Skip to content

Add hooks to enable TX debugging#2574

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

Add hooks to enable TX debugging#2574
djolertrk wants to merge 4 commits into0xMiden:nextfrom
walnuthq:pr/enable-tx-debugging-clean

Conversation

@djolertrk
Copy link

@djolertrk djolertrk commented Mar 10, 2026

This PR adds a small hook to the transaction execution path so that the program runner used by midentx::TransactionExecutor can be swapped out while preserving the existing transaction preparation/execution pipeline.

The motivation is debugger support and better developer tooling. We want to be able to debug programs executed under the transaction kernel, instead of only debugging standalone VM programs. In practice, this lets downstream tooling swap in a custom executor that:

  • starts a DAP server
  • enables tracing/debugging
  • or wraps execution with richer diagnostics

while still reusing the existing TransactionExecutor logic for transaction preparation, host setup, note handling, foreign account loading, etc.

The default behavior is unchanged: TransactionExecutor still uses FastProcessor by default.

@djolertrk
Copy link
Author

cc @bitwalker

@PhilippGackstatter
Copy link
Contributor

Could you add a description or link an issue where we can find information about what the goal of the PR is? It is hard to review the changes or judge alternatives without this information.

@bitwalker
Copy link
Collaborator

@PhilippGackstatter @bobbinth This PR makes it possible for us to debug programs executed by the transaction kernel, which is a big improvement in DX. I'd like to try and get this released as part of the v0.22 release cycle/upcoming testnet - just let me know if you need anything on our end to make that go smoothly.

@bitwalker
Copy link
Collaborator

@djolertrk Looks like a couple lint checks failed

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Not a review yet - but a couple of high-level comments:

  • It seems like this PR includes a lot of extraneous changes (e.g., from the AggLayer crate). Could we remove them? (these changes will land soon as a part of #2546)
  • It would be great to provide a bit more detail about the goal here. After a brief look, my understanding is that we are trying to control how FastProcessor is instantiated, but I don't yet have full understanding of how this will be used in the compiler. I'm mostly trying to understand if the TransactionProgramFactory pattern is really needed here or if we can do something simpler (e.g., maybe adding a generic type to the TransactionExecutor would suffice).

Also, I wonder if there may be some overlap with #2293 (though, maybe not).

@djolertrk
Copy link
Author

Thank you! Not a review yet - but a couple of high-level comments:

  • It seems like this PR includes a lot of extraneous changes (e.g., from the AggLayer crate). Could we remove them? (these changes will land soon as a part of feat: migrate miden-agglayer to VM 0.21 and crypto 0.22 #2546)
  • It would be great to provide a bit more detail about the goal here. After a brief look, my understanding is that we are trying to control how FastProcessor is instantiated, but I don't yet have full understanding of how this will be used in the compiler. I'm mostly trying to understand if the TransactionProgramFactory pattern is really needed here or if we can do something simpler (e.g., maybe adding a generic type to the TransactionExecutor would suffice).

Also, I wonder if there may be some overlap with #2293 (though, maybe not).

@bobbinth Thanks for the comments! Yes, it does overlap with the #2546 (the AggLayer changes for example), but I needed those so I can test the feature end to end. But yes, if the PR will land soon, I can just rebase on top of it -- so I am doing it.

The immediate consumer here is the debugger, not the compiler. The goal is to let miden-tx::TransactionExecutor reuse its existing transaction preparation / host setup logic, but swap out the program runner used underneath it. The default remains FastProcessor; the debugger plugs in an alternative executor that enables tracing / DAP-driven execution instead of always running straight to completion.

@PhilippGackstatter I've updated PR description as well.

@djolertrk djolertrk force-pushed the pr/enable-tx-debugging-clean branch from 917ffe3 to 6a5bc19 Compare March 11, 2026 06:50
@djolertrk
Copy link
Author

note: Rebased on top of #2546.

@djolertrk djolertrk force-pushed the pr/enable-tx-debugging-clean branch from 6a5bc19 to 27c1fea Compare March 11, 2026 14:27
@djolertrk
Copy link
Author

note: now rebased on top of next since the #2546 is merged.

@bitwalker
Copy link
Collaborator

@djolertrk I think we've landed on our plan for how to proceed with this. If you can rebase on the latest changes in next, and make the switch to a single trait vs factory + executor traits, I believe this should be basically ready to merge.

@djolertrk
Copy link
Author

djolertrk commented Mar 13, 2026

@djolertrk I think we've landed on our plan for how to proceed with this. If you can rebase on the latest changes in next, and make the switch to a single trait vs factory + executor traits, I believe this should be basically ready to merge.

Yes. I agree. Let's do it that way (I was already on it -- doing some final testing).
Thanks a lot!

@djolertrk djolertrk force-pushed the pr/enable-tx-debugging-clean branch from 27c1fea to d1e99cf Compare March 13, 2026 21:04
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you. I left some comments inline.

@djolertrk
Copy link
Author

@bobbinth Thank you for the comments!

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

.map_err(TransactionCheckerError::TransactionPreparation)?;

let processor = FastProcessor::new(stack_inputs).with_advice(advice_inputs);
let processor = EXEC::new(stack_inputs, advice_inputs, ExecutionOptions::default());
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, but I wonder if the options should be configured somehow (i.e., we shouldn't be using just the default options). cc @PhilippGackstatter.

let (mut host, stack_inputs, advice_inputs) = self.prepare_transaction(&tx_inputs).await?;

let processor = FastProcessor::new(stack_inputs).with_advice(advice_inputs);
let processor = EXEC::new(stack_inputs, advice_inputs, ExecutionOptions::default());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

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.

4 participants