Unified syntax - id implementation, txId in mandos trace#2284
Merged
andrei-marinica merged 4 commits intorc/v0.65from Feb 12, 2026
Merged
Unified syntax - id implementation, txId in mandos trace#2284andrei-marinica merged 4 commits intorc/v0.65from
andrei-marinica merged 4 commits intorc/v0.65from
Conversation
|
Contract comparison - from cb67383 to 50f016d
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies scenario step transaction identification by consolidating legacy id and newer txId/tx_id handling into a single tx_id flow, and propagates tx_id through tx environments so it shows up consistently in Mandos/scenario traces (including for queries).
Changes:
- Updated scenario JSON serde and model interpretation to treat legacy
idas a fallback fortxId, while writing onlytxId. - Added
TxIdsupport toTxEnvWithTxHashand plumbed it through scenario + interactor envs and tx-to-step conversions. - Updated/added blackbox trace outputs and tests to validate the new trace format.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/scenario-format/src/serde_raw/step_raw.rs | Makes legacy id optional on raw step serde structs to support unified txId flow. |
| framework/snippets/src/interactor/interactor_tx/interactor_query_env.rs | Implements TxEnvWithTxHash for query env, including tx id propagation. |
| framework/snippets/src/interactor/interactor_tx/interactor_prepare_async.rs | Initializes ScenarioTxEnvData with tx_id: None. |
| framework/snippets/src/interactor/interactor_tx/interactor_exec_env.rs | Adds tx id plumbing into exec env’s TxEnvWithTxHash impl. |
| framework/scenario/tests/scenarios-io/example_raw.scen.json | Updates examples to prefer txId and demonstrate legacy id handling. |
| framework/scenario/tests/scenarios-io/example_normalized.scen.json | Normalizes examples to unified txId output format. |
| framework/scenario/src/whitebox_legacy/mandos_generator.rs | Emits tx_id and clears legacy id when generating steps. |
| framework/scenario/src/scenario/tx_to_step/tx_to_step_query.rs | Pulls tx_id/tx_hash from env into query steps. |
| framework/scenario/src/scenario/tx_to_step/tx_to_step_deploy.rs | Pulls tx_id from env into deploy steps. |
| framework/scenario/src/scenario/tx_to_step/tx_to_step_call.rs | Pulls tx_id from env into call steps. |
| framework/scenario/src/scenario/run_vm/sc_query.rs | Uses unified tx id accessor when checking outputs / generating tx hash. |
| framework/scenario/src/scenario/run_vm/sc_deploy.rs | Uses unified tx id accessor when checking outputs / generating tx hash. |
| framework/scenario/src/scenario/run_vm/sc_call.rs | Uses unified tx id accessor when checking outputs / generating tx hash. |
| framework/scenario/src/scenario/model/step/transfer_step.rs | Removes legacy id field in transfer/reward step models. |
| framework/scenario/src/scenario/model/step/step_enum.rs | Adds legacy→new tx_id interpretation and writes legacy id as absent. |
| framework/scenario/src/scenario/model/step/sc_query_step.rs | Removes legacy id, adds get_tx_id(), updates builder id() to set tx_id. |
| framework/scenario/src/scenario/model/step/sc_deploy_step.rs | Removes legacy id, adds get_tx_id(). |
| framework/scenario/src/scenario/model/step/sc_call_step.rs | Removes legacy id, adds get_tx_id(), aligns defaults. |
| framework/scenario/src/facade/world_tx/scenario_tx_env.rs | Extends env data with tx_id and implements set/take on TxEnvWithTxHash. |
| framework/scenario/src/facade/world_tx/scenario_query_call.rs | Implements TxEnvWithTxHash for query env, including tx id support. |
| framework/scenario/src/facade/world_tx/scenario_exec_call.rs | Implements TxEnvWithTxHash tx id support for exec env. |
| framework/base/src/types/interaction/tx_env.rs | Introduces TxId alias and adds set/take tx id to TxEnvWithTxHash. |
| framework/base/src/types/interaction/tx.rs | Implements .id() builder to set the env tx id. |
| contracts/feature-tests/scenario-tester/trace/expected_trace1.scen.json | Adds expected trace JSON using txId. |
| contracts/feature-tests/scenario-tester/tests/st_blackbox_test.rs | Sets tx ids in steps and adds generated-vs-expected trace comparison. |
| contracts/feature-tests/scenario-tester/tests/st_blackbox_legacy_proxy_test.rs | Removes trace write call (legacy proxy test). |
| contracts/feature-tests/scenario-tester/tests/st_blackbox_chained_test.rs | Updates trace output path. |
| contracts/feature-tests/scenario-tester/.gitignore | Ignores new trace output location/pattern. |
| contracts/examples/multisig/interact/src/multisig_interact.rs | Renames trace output file and sets tx id on deploy. |
| contracts/examples/multisig/interact/.gitignore | Broadens ignore rules for trace outputs and set_state.json. |
| contracts/examples/adder/tests/adder_blackbox_test.rs | Sets tx ids and updates trace output filename. |
| contracts/examples/adder/interactor/src/basic_interactor.rs | Sets tx ids for interactor deploy/add. |
| contracts/examples/adder/.gitignore | Ignores new adder trace filename pattern. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unified Transaction ID in Scenario Steps
Summary
This PR unifies the transaction ID handling across all scenario step types by consolidating the previously separate
idandtx_idfields into a singletx_idfield.Changes
Core Changes
tx_idfield: Removed the redundantidfield from all transaction step structures (ScCallStep,ScDeployStep,ScQueryStep,TransferStep,ValidatorRewardStep)interpret_tx_id()helper function that gracefully handles legacy scenarios by interpreting the oldidfield astx_idwhen loading scenariosidfield is always set toNone, with all transaction identification going throughtx_idAffected Step Types
ScCallStepScDeployStepScQueryStepTransferStepValidatorRewardStepTesting
trace/expected_trace1.scen.jsonas a reference for trace validationMigration Notes
idfield will automatically be interpreted astx_idwhen loadedtx_idformatid()builder method now setstx_idinstead of the deprecatedidfield