Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDB Connect: Add db query tool #1963

Merged
merged 10 commits into from
Jun 23, 2024
Merged

EDB Connect: Add db query tool #1963

merged 10 commits into from
Jun 23, 2024

Conversation

BedrockSquirrel
Copy link
Collaborator

@BedrockSquirrel BedrockSquirrel commented Jun 18, 2024

Why this change is needed

EDB is a black box, for testnet debugging we want to be able to peek at data, do maintenance tasks, identify expensive queries etc.

EDB Connect is a REPL-like command line tool that lets you execute arbitrary queries against the secure EDB on a node.

This PR adds a script ./edb-connect.sh to the obscurouser home dir, which when executed pulls the latest edb-connect image and starts the CLI tool. It tries to clean up after itself and should support simultaneous running on the same box.

This PR also adds a github action that can be run from main or any branch to publish a new 'latest' edb-connect image. This allows us to tweak the tool when debugging without having to do a network upgrade or manual fiddling to get the changes.

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

(minor comment)

"exe": "main",
"key": "testnet.pem",
"debug": true,
"heapSize": 4096,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be 1024.

Copy link
Contributor

@StefanIliev545 StefanIliev545 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

"exe": "main",
"key": "testnet.pem",
"debug": true,
"heapSize": 4096,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me, does the enclave allocate the memory preemptively? If so this might be a bit huge

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good shout I think it might allocate greedily. I'll cut it in half and check it still works

}

// Starts a loop that reads user input and runs queries against the Edgeless DB until user types "exit"
func startREPL(db *sql.DB) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we tested how special characters behave here, considering its coming from stdio? I imagine since its in app the terminal won't be doing any ad hoc bs, but ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you press like keys like up and ctrl on the keyboard it does create some garbage characters I think, let me have a look see if I can improve that. Didn't see any weird rendering with the query responses though (although it's not very pretty, nicer formatting and option to dump response to CSV would be useful upgrades).

@BedrockSquirrel BedrockSquirrel merged commit 291a698 into main Jun 23, 2024
3 checks passed
@BedrockSquirrel BedrockSquirrel deleted the matt/edb-query-tool branch June 23, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants