Skip to content

Comments

Unified syntax - id implementation, txId in mandos trace#2284

Merged
andrei-marinica merged 4 commits intorc/v0.65from
unified-tx-id
Feb 12, 2026
Merged

Unified syntax - id implementation, txId in mandos trace#2284
andrei-marinica merged 4 commits intorc/v0.65from
unified-tx-id

Conversation

@andrei-marinica
Copy link
Contributor

@andrei-marinica andrei-marinica commented Feb 12, 2026

Unified Transaction ID in Scenario Steps

Summary

This PR unifies the transaction ID handling across all scenario step types by consolidating the previously separate id and tx_id fields into a single tx_id field.

Changes

Core Changes

  • Unified tx_id field: Removed the redundant id field from all transaction step structures (ScCallStep, ScDeployStep, ScQueryStep, TransferStep, ValidatorRewardStep)
  • Backward compatibility: Added interpret_tx_id() helper function that gracefully handles legacy scenarios by interpreting the old id field as tx_id when loading scenarios
  • Serialization update: When writing scenarios, the legacy id field is always set to None, with all transaction identification going through tx_id

Affected Step Types

  • ScCallStep
  • ScDeployStep
  • ScQueryStep
  • TransferStep
  • ValidatorRewardStep

Testing

  • Added blackbox trace test comparing generated traces with expected output
  • Created trace/expected_trace1.scen.json as a reference for trace validation
  • Updated existing blackbox tests to validate trace generation
  • Fixed SC query ID handling in trace generation

Migration Notes

  • Existing scenarios with the legacy id field will automatically be interpreted as tx_id when loaded
  • When scenarios are regenerated/written, they will use the new unified tx_id format
  • The id() builder method now sets tx_id instead of the deprecated id field

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Contract comparison - from cb67383 to 50f016d

Path                                                                                             size                  has-allocator                     has-format
fractional-nfts.wasm 8302 false without message
multisig-view.wasm 5590 false None
multisig-full.wasm 15111 false without message
multisig.wasm 13606 false without message
nft-minter.wasm 9726 false without message
ping-pong-egld.wasm 6397 false None
factorial.wasm 579 false None
nft-subscription.wasm 8725 false without message
kitty-auction.wasm 9394 false without message
kitty-genetic-alg.wasm 3494 false without message
kitty-ownership.wasm 12953 false without message
nft-storage-prepay.wasm 2609 false None
crypto-bubbles.wasm 2561 false None
esdt-transfer-with-fee.wasm 7505 false without message
seed-nft-minter.wasm 14189 false without message
adder.wasm 699 false None
bonding-curve-contract.wasm 14011 false None
proxy-pause.wasm 4165 false None
empty.wasm 244 false None
crowdfunding.wasm 3574 false None
digital-cash.wasm 9730 false None
token-release.wasm 6948 false without message
lottery-esdt.wasm 10580 false without message
rewards-distribution.wasm 9449 false without message
check-pause.wasm 1240 false None
order-book-factory.wasm 3401 false None
order-book-pair.wasm 14098 false None
crypto-zombies.wasm 9276 false without message
set-repeat.wasm 6511 false None
single-value-repeat.wasm 4253 false None
map-repeat.wasm 7363 false without message
queue-repeat.wasm 5536 false None
linked-list-repeat.wasm 6838 false without message
vec-repeat.wasm 4872 false None
str-repeat-mb-builder-cached.wasm 1109 false without message
str-repeat-mb-builder-basic.wasm 757 false None
str-repeat.wasm 2733 false without message
large-storage.wasm 1656 false None
send-tx-repeat.wasm 1292 false None
abi-tester.wasm 8607 true without message
abi-tester-ev.wasm 760 false None
exchange-features.wasm 1514 false None
use-module.wasm 32360 false without message
use-module-view.wasm 736 false None
panic-message-features.wasm 12838 false with message
panic-message-std.wasm 15886 false with message
big-float-features.wasm 6373 false without message
scenario-tester.wasm 1374 false None
forbidden-opcodes.wasm 842 false None
basic-features.wasm 85769 false without message
basic-features-storage-bytes.wasm 541 false None
payable-features.wasm 6046 false None
std-contract.wasm 3469 true without message
forwarder-queue.wasm 12712 false without message
forwarder-queue-promises.wasm 13336 false without message
forwarder-raw.wasm 13081 false None
forwarder-raw-init-sync-call.wasm 2958 false None
forwarder-raw-init-async-call.wasm 2374 false None
forwarder-legacy.wasm 33533 false without message
recursive-caller.wasm 5163 false without message
second-contract.wasm 1158 false None
first-contract.wasm 3450 false None
proxy-test-first.wasm 5711 false without message
transfer-role-features.wasm 8605 false without message
vault.wasm 8950 false None
vault-upgrade.wasm 708 false None
forwarder.wasm 49169 false without message
proxy-test-second.wasm 2327 false without message
local-esdt-and-nft.wasm 12568 false without message
parent.wasm 1999 false None
child.wasm 3982 false without message
builtin-func-features.wasm 3828 false None
rust-snippets-generator-test.wasm 4708 false None
rust-testing-framework-tester.wasm 8584 false None
multi-contract-features-view.wasm 1113 false None
multi-contract-features.wasm 681 false None
multi-contract-alt-impl.wasm 353 false None
multi-contract-example-feature.wasm 680 false None
alloc-mem-leaking.wasm 23325 false without message
alloc-features.wasm 23168 false without message
alloc-mem-fail.wasm 17720 true without message
erc1155-user-mock.wasm 1229 false None
erc721.wasm 2232 false None
crowdfunding-erc20.wasm 4909 false without message
lottery-erc20.wasm 12886 false without message
erc1155.wasm 11969 false without message
erc1155-marketplace.wasm 10603 false without message
erc20.wasm 1887 false None
esdt-system-sc-mock.wasm 4556 false None
formatted-message-features.wasm 3613 false without message
multiversx-price-aggregator-sc.wasm 17896 false without message
multiversx-wegld-swap-sc.wasm 4304 false None

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 id as a fallback for txId, while writing only txId.
  • Added TxId support to TxEnvWithTxHash and 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.

@andrei-marinica andrei-marinica merged commit dcb4aed into rc/v0.65 Feb 12, 2026
29 checks passed
@andrei-marinica andrei-marinica deleted the unified-tx-id branch February 12, 2026 14:33
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.

1 participant