-
Notifications
You must be signed in to change notification settings - Fork 89
feat: enable TX debugging #1883
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
base: next
Are you sure you want to change the base?
Changes from 3 commits
76068c1
b904257
ec3fa67
a7339f5
f33d10b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,14 +44,17 @@ miden-tx = { default-features = false, version = "=0.14.0-alpha.1" } | |
| miden-node-block-producer = { version = "=0.14.0-alpha.4" } | ||
| miden-node-ntx-builder = { version = "=0.14.0-alpha.4" } | ||
| miden-node-proto = { version = "=0.14.0-alpha.4" } | ||
| miden-node-proto-build = { default-features = false, version = "=0.14.0-alpha.4" } | ||
| miden-node-proto-build = { default-features = false, path = "../node/proto", version = "=0.14.0-alpha.1" } | ||
| miden-node-rpc = { version = "=0.14.0-alpha.4" } | ||
| miden-node-store = { version = "=0.14.0-alpha.4" } | ||
| miden-node-utils = { version = "=0.14.0-alpha.4" } | ||
| miden-node-validator = { version = "=0.14.0-alpha.4" } | ||
| miden-note-transport-proto-build = { default-features = false, version = "0.2" } | ||
| miden-remote-prover-client = { default-features = false, features = ["tx-prover"], version = "=0.14.0-alpha.4" } | ||
|
|
||
| # Miden debug dependency | ||
| miden-debug = { default-features = false, features = ["dap", "std"], path = "../miden-debug" } | ||
|
|
||
| # External dependencies | ||
| anyhow = { default-features = false, version = "1.0" } | ||
| async-trait = { version = "0.1" } | ||
|
|
@@ -76,3 +79,9 @@ module_name_repetitions = "allow" # Many triggers, and is a stylistic choice | |
| must_use_candidate = "allow" # This marks many fn's which isn't helpful. | ||
| should_panic_without_expect = "allow" # We don't care about the specific panic message. | ||
| # End of pedantic lints. | ||
|
|
||
| [patch.crates-io] | ||
| miden-protocol = { path = "../protocol/crates/miden-protocol" } | ||
| miden-standards = { path = "../protocol/crates/miden-standards" } | ||
| miden-testing = { path = "../protocol/crates/miden-testing" } | ||
| miden-tx = { path = "../protocol/crates/miden-tx" } | ||
|
Comment on lines
+83
to
+87
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be removed |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,14 @@ version.workspace = true | |
| name = "miden-client" | ||
| path = "src/main.rs" | ||
|
|
||
| [features] | ||
| dap = ["miden-client/dap", "dep:miden-debug"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we gate behind a feature? Or have connection depend on an |
||
|
|
||
| [dependencies] | ||
| # Workspace dependencies | ||
| miden-client = { features = ["tonic"], workspace = true } | ||
| miden-client-sqlite-store = { workspace = true } | ||
| miden-debug = { optional = true, workspace = true } | ||
|
|
||
| # External dependencies | ||
| clap = { features = ["derive"], version = "4.5" } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,12 @@ pub struct ExecCmd { | |
| /// Print the output stack grouped into words | ||
| #[arg(long, default_value_t = false)] | ||
| hex_words: bool, | ||
|
|
||
| /// Start a DAP debug adapter server on the given address (e.g. "127.0.0.1:4711") | ||
| /// and wait for a DAP client to connect before executing. | ||
| #[cfg(feature = "dap")] | ||
| #[arg(long = "start-debug-adapter")] | ||
| start_debug_adapter: Option<String>, | ||
| } | ||
|
|
||
| impl ExecCmd { | ||
|
|
@@ -87,6 +93,21 @@ impl ExecCmd { | |
|
|
||
| let tx_script = client.code_builder().compile_tx_script(&program)?; | ||
|
|
||
| #[cfg(feature = "dap")] | ||
| let result = if let Some(ref addr) = self.start_debug_adapter { | ||
| miden_debug::DapConfig::set_global(miden_debug::DapConfig { | ||
| listen_addr: addr.clone(), | ||
| }); | ||
| client | ||
| .execute_program_with_dap(account_id, tx_script, advice_inputs, BTreeSet::new()) | ||
| .await | ||
| } else { | ||
| client | ||
| .execute_program(account_id, tx_script, advice_inputs, BTreeSet::new()) | ||
| .await | ||
| }; | ||
|
|
||
| #[cfg(not(feature = "dap"))] | ||
| let result = client | ||
| .execute_program(account_id, tx_script, advice_inputs, BTreeSet::new()) | ||
| .await; | ||
|
Comment on lines
+105
to
113
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is duplicated code. Maybe the best approach is not to split between |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure. I should have marked this as a draft.