Skip to content

feat: enable TX debugging#1883

Draft
djolertrk wants to merge 5 commits into0xMiden:nextfrom
walnuthq:pr/enable-tx-debugging-clean
Draft

feat: enable TX debugging#1883
djolertrk wants to merge 5 commits into0xMiden:nextfrom
walnuthq:pr/enable-tx-debugging-clean

Conversation

@djolertrk
Copy link

This was rebased on top of Fumuran's branch for migrating to miden-vm v0.21.

cc @bitwalker

Use miden-debug's DapExecutorFactory and DapConfig to let
miden-client execute transaction scripts under a debug adapter
via --start-debug-adapter.
@djolertrk djolertrk force-pushed the pr/enable-tx-debugging-clean branch from e502fbb to ec3fa67 Compare March 10, 2026 17:08
@djolertrk
Copy link
Author

Rebased on top of next now, since the PR for migration to new VM is merged.

Comment on lines +83 to +87
[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" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be removed

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" }
Copy link
Collaborator

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.

Copy link
Author

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.

@juan518munoz
Copy link
Collaborator

Could you provide a more detailed description like screenshots and a sample debug flow?

@djolertrk
Copy link
Author

Could you provide a more detailed description like screenshots and a sample debug flow?

Hi @juan518munoz, thanks for taking a look.

The main idea is to enhance debugger with support to debug programs executed under the transaction kernel, instead of only debugging standalone VM programs.

Please check:

0xMiden/miden-debug#29

0xMiden/miden-debug#41
0xMiden/protocol#2574

Within 0xMiden/miden-debug#29, I have described one of possible use cases, but I was able to add even an "offline" mode to this dap execution, so you just do:

run

# terminal 1

$  miden-client init --local --network localhost
$ miden-client new-wallet --offline
$ miden-client exec \
    --script-path /tmp/miden-no-node-client/nop.masm \
    --start-debug-adapter localhost:4711

and run debugger as:

# terminal 2
miden-debug --dap-connect localhost:4711

so, it starts the debugger in TUI mode, and you can step through the execution, and whenever you execute a command via DAP, it will be logged with the client -- see picture attached.

Screenshot 2026-03-11 at 20 58 43

@djolertrk djolertrk marked this pull request as draft March 13, 2026 10:47
Copy link
Collaborator

@juan518munoz juan518munoz left a comment

Choose a reason for hiding this comment

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

Let's update the branch so we can run the CI

Comment on lines +105 to 113
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 feature = "dap" or not.

path = "src/main.rs"

[features]
dap = ["miden-client/dap", "dep:miden-debug"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we gate behind a feature? Or have connection depend on an Optional argument?

use crate::store::{BlockRelevance, StoreError};
use crate::{Client, ClientError};

const OFFLINE_NATIVE_ASSET_FAUCET_ID: u128 = 0xab00_0000_0000_cd20_0000_ac00_0000_de00;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's doc this

Copy link
Collaborator

Choose a reason for hiding this comment

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

The whole diff of this part seems to be caused due to not being on track with next. As we should already have solved them here.

@juan518munoz juan518munoz changed the title Enable TX debugging feat: enable TX debugging Mar 16, 2026
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.

2 participants