Skip to content

fix(evm): set tx_origin from sender address in CLI and state loader - #455

Merged
zoowii merged 4 commits into
DTVMStack:mainfrom
cmgCr:cmgCr/fix_issue448
Apr 10, 2026
Merged

fix(evm): set tx_origin from sender address in CLI and state loader#455
zoowii merged 4 commits into
DTVMStack:mainfrom
cmgCr:cmgCr/fix_issue448

Conversation

@cmgCr

@cmgCr cmgCr commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains CI/CD configuration changes
  • Contains documentation changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

None

cmgCr added 3 commits April 8, 2026 23:43
ORIGIN opcode returned zero address because tx_origin was never set.
loadState() now parses tx_origin from state.json, and the CLI falls
back to --sender when tx_origin is still unset. This aligns DTVM
behavior with Geth for contracts that read tx.origin.
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

⚡ Performance Regression Check Results

✅ Performance Check Passed (interpreter)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.52 1.52 -0.1% PASS
total/main/blake2b_huff/empty 0.02 0.02 -0.5% PASS
total/main/blake2b_shifts/8415nulls 11.52 11.77 +2.1% PASS
total/main/sha1_divs/5311 5.08 5.16 +1.5% PASS
total/main/sha1_divs/empty 0.06 0.06 +0.6% PASS
total/main/sha1_shifts/5311 2.80 2.97 +5.9% PASS
total/main/sha1_shifts/empty 0.03 0.04 +4.7% PASS
total/main/snailtracer/benchmark 52.27 52.56 +0.6% PASS
total/main/structarray_alloc/nfts_rank 0.96 0.96 -0.4% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 +1.8% PASS
total/main/swap_math/received 0.00 0.00 +1.3% PASS
total/main/swap_math/spent 0.00 0.00 +3.2% PASS
total/main/weierstrudel/1 0.29 0.28 -1.4% PASS
total/main/weierstrudel/15 3.15 3.12 -1.0% PASS
total/micro/JUMPDEST_n0/empty 2.12 1.31 -38.2% PASS
total/micro/jump_around/empty 0.09 0.09 -3.4% PASS
total/micro/loop_with_many_jumpdests/empty 33.93 20.25 -40.3% PASS
total/micro/memory_grow_mload/by1 0.09 0.09 -0.4% PASS
total/micro/memory_grow_mload/by16 0.10 0.10 +0.7% PASS
total/micro/memory_grow_mload/by32 0.11 0.11 +1.2% PASS
total/micro/memory_grow_mload/nogrow 0.08 0.09 +9.4% PASS
total/micro/memory_grow_mstore/by1 0.09 0.10 +7.9% PASS
total/micro/memory_grow_mstore/by16 0.10 0.10 +3.6% PASS
total/micro/memory_grow_mstore/by32 0.11 0.11 +1.0% PASS
total/micro/memory_grow_mstore/nogrow 0.09 0.09 +0.4% PASS
total/micro/signextend/one 0.23 0.23 -1.2% PASS
total/micro/signextend/zero 0.23 0.23 +0.3% PASS
total/synth/ADD/b0 1.98 2.00 +0.9% PASS
total/synth/ADD/b1 1.97 2.00 +1.5% PASS
total/synth/ADDRESS/a0 4.73 4.76 +0.7% PASS
total/synth/ADDRESS/a1 5.22 5.31 +1.6% PASS
total/synth/AND/b0 1.71 1.71 +0.0% PASS
total/synth/AND/b1 1.71 1.72 +0.2% PASS
total/synth/BYTE/b0 6.13 6.12 -0.1% PASS
total/synth/BYTE/b1 4.76 4.75 -0.2% PASS
total/synth/CALLDATASIZE/a0 3.26 3.35 +2.8% PASS
total/synth/CALLDATASIZE/a1 3.51 3.59 +2.3% PASS
total/synth/CALLER/a0 4.75 4.74 -0.3% PASS
total/synth/CALLER/a1 5.22 5.30 +1.5% PASS
total/synth/CALLVALUE/a0 3.50 3.76 +7.3% PASS
total/synth/CALLVALUE/a1 3.52 3.76 +6.9% PASS
total/synth/CODESIZE/a0 3.83 3.99 +4.2% PASS
total/synth/CODESIZE/a1 3.84 4.00 +4.3% PASS
total/synth/DUP1/d0 1.14 1.31 +14.2% PASS
total/synth/DUP1/d1 1.31 1.39 +6.5% PASS
total/synth/DUP10/d0 0.98 1.15 +16.6% PASS
total/synth/DUP10/d1 1.23 1.16 -6.0% PASS
total/synth/DUP11/d0 0.91 1.15 +26.8% PASS
total/synth/DUP11/d1 1.23 1.16 -6.2% PASS
total/synth/DUP12/d0 0.98 1.15 +16.6% PASS
total/synth/DUP12/d1 1.23 1.40 +13.2% PASS
total/synth/DUP13/d0 0.91 1.31 +44.4% PASS
total/synth/DUP13/d1 1.23 1.16 -6.1% PASS
total/synth/DUP14/d0 0.98 1.30 +32.5% PASS
total/synth/DUP14/d1 1.23 1.16 -6.1% PASS
total/synth/DUP15/d0 0.99 1.31 +32.7% PASS
total/synth/DUP15/d1 1.23 1.16 -6.1% PASS
total/synth/DUP16/d0 0.99 1.31 +33.0% PASS
total/synth/DUP16/d1 1.14 1.16 +1.7% PASS
total/synth/DUP2/d0 0.90 1.39 +54.6% PASS
total/synth/DUP2/d1 1.23 1.16 -6.3% PASS
total/synth/DUP3/d0 0.90 1.31 +45.1% PASS
total/synth/DUP3/d1 1.23 1.16 -6.3% PASS
total/synth/DUP4/d0 0.98 1.31 +32.9% PASS
total/synth/DUP4/d1 1.16 1.40 +20.4% PASS
total/synth/DUP5/d0 0.90 1.31 +45.0% PASS
total/synth/DUP5/d1 1.23 1.16 -6.4% PASS
total/synth/DUP6/d0 0.90 1.07 +18.5% PASS
total/synth/DUP6/d1 1.23 1.16 -6.1% PASS
total/synth/DUP7/d0 0.98 1.31 +33.3% PASS
total/synth/DUP7/d1 1.23 1.19 -3.9% PASS
total/synth/DUP8/d0 0.90 1.07 +18.0% PASS
total/synth/DUP8/d1 1.23 1.16 -6.3% PASS
total/synth/DUP9/d0 0.98 1.31 +32.9% PASS
total/synth/DUP9/d1 1.23 1.40 +13.2% PASS
total/synth/EQ/b0 2.76 2.76 -0.0% PASS
total/synth/EQ/b1 1.34 1.34 +0.5% PASS
total/synth/GAS/a0 3.88 3.83 -1.4% PASS
total/synth/GAS/a1 3.92 3.85 -1.9% PASS
total/synth/GT/b0 2.59 2.61 +0.6% PASS
total/synth/GT/b1 1.64 1.56 -4.6% PASS
total/synth/ISZERO/u0 1.15 1.15 -0.1% PASS
total/synth/JUMPDEST/n0 2.12 1.31 -38.4% PASS
total/synth/LT/b0 2.62 2.62 -0.2% PASS
total/synth/LT/b1 1.64 1.56 -4.5% PASS
total/synth/MSIZE/a0 4.24 4.24 -0.1% PASS
total/synth/MSIZE/a1 4.75 4.81 +1.3% PASS
total/synth/MUL/b0 5.31 5.30 -0.2% PASS
total/synth/MUL/b1 5.29 5.38 +1.6% PASS
total/synth/NOT/u0 1.69 1.80 +6.7% PASS
total/synth/OR/b0 1.64 1.64 +0.1% PASS
total/synth/OR/b1 1.72 1.72 +0.2% PASS
total/synth/PC/a0 3.26 3.58 +10.0% PASS
total/synth/PC/a1 3.89 3.59 -7.7% PASS
total/synth/PUSH1/p0 0.91 0.91 -0.0% PASS
total/synth/PUSH1/p1 1.23 1.40 +13.1% PASS
total/synth/PUSH10/p0 0.91 1.15 +26.2% PASS
total/synth/PUSH10/p1 1.30 1.41 +8.7% PASS
total/synth/PUSH11/p0 1.15 1.07 -7.0% PASS
total/synth/PUSH11/p1 1.29 1.41 +9.6% PASS
total/synth/PUSH12/p0 1.15 0.99 -13.9% PASS
total/synth/PUSH12/p1 1.30 1.42 +9.3% PASS
total/synth/PUSH13/p0 0.91 1.07 +17.3% PASS
total/synth/PUSH13/p1 1.29 1.42 +10.1% PASS
total/synth/PUSH14/p0 1.15 1.16 +0.2% PASS
total/synth/PUSH14/p1 1.30 1.44 +10.9% PASS
total/synth/PUSH15/p0 1.15 1.07 -6.9% PASS
total/synth/PUSH15/p1 1.40 1.50 +7.0% PASS
total/synth/PUSH16/p0 1.07 0.99 -7.4% PASS
total/synth/PUSH16/p1 1.29 1.43 +11.0% PASS
total/synth/PUSH17/p0 1.15 1.15 -0.1% PASS
total/synth/PUSH17/p1 1.29 1.41 +9.6% PASS
total/synth/PUSH18/p0 1.14 0.99 -13.7% PASS
total/synth/PUSH18/p1 1.29 1.42 +9.6% PASS
total/synth/PUSH19/p0 0.91 1.06 +17.0% PASS
total/synth/PUSH19/p1 1.29 1.42 +9.8% PASS
total/synth/PUSH2/p0 0.91 0.91 +0.2% PASS
total/synth/PUSH2/p1 1.24 1.40 +13.0% PASS
total/synth/PUSH20/p0 0.91 0.99 +8.5% PASS
total/synth/PUSH20/p1 1.30 1.43 +10.4% PASS
total/synth/PUSH21/p0 1.07 1.15 +7.6% PASS
total/synth/PUSH21/p1 1.30 1.42 +9.1% PASS
total/synth/PUSH22/p0 1.15 1.15 -0.0% PASS
total/synth/PUSH22/p1 1.29 1.42 +9.6% PASS
total/synth/PUSH23/p0 1.07 1.15 +7.6% PASS
total/synth/PUSH23/p1 1.31 1.42 +8.4% PASS
total/synth/PUSH24/p0 1.07 1.15 +7.6% PASS
total/synth/PUSH24/p1 1.30 1.44 +10.6% PASS
total/synth/PUSH25/p0 0.91 1.15 +27.0% PASS
total/synth/PUSH25/p1 1.30 1.44 +10.7% PASS
total/synth/PUSH26/p0 1.15 1.15 +0.2% PASS
total/synth/PUSH26/p1 1.30 1.42 +9.3% PASS
total/synth/PUSH27/p0 1.07 0.99 -7.4% PASS
total/synth/PUSH27/p1 1.31 1.43 +9.1% PASS
total/synth/PUSH28/p0 0.91 1.07 +17.2% PASS
total/synth/PUSH28/p1 1.30 1.43 +10.1% PASS
total/synth/PUSH29/p0 0.91 1.15 +26.3% PASS
total/synth/PUSH29/p1 1.32 1.45 +9.5% PASS
total/synth/PUSH3/p0 0.91 1.15 +26.6% PASS
total/synth/PUSH3/p1 1.28 1.42 +10.5% PASS
total/synth/PUSH30/p0 1.07 1.16 +8.1% PASS
total/synth/PUSH30/p1 1.33 1.45 +9.0% PASS
total/synth/PUSH31/p0 0.91 1.15 +26.4% PASS
total/synth/PUSH31/p1 1.41 1.53 +9.1% PASS
total/synth/PUSH32/p0 1.15 1.15 +0.2% PASS
total/synth/PUSH32/p1 1.31 1.42 +9.2% PASS
total/synth/PUSH4/p0 0.91 1.15 +26.4% PASS
total/synth/PUSH4/p1 1.28 1.42 +10.7% PASS
total/synth/PUSH5/p0 1.07 0.91 -15.0% PASS
total/synth/PUSH5/p1 1.28 1.42 +10.3% PASS
total/synth/PUSH6/p0 0.91 0.99 +8.5% PASS
total/synth/PUSH6/p1 1.29 1.41 +9.1% PASS
total/synth/PUSH7/p0 1.15 1.15 +0.1% PASS
total/synth/PUSH7/p1 1.30 1.42 +9.7% PASS
total/synth/PUSH8/p0 0.91 1.07 +17.3% PASS
total/synth/PUSH8/p1 1.29 1.44 +11.8% PASS
total/synth/PUSH9/p0 1.07 1.23 +15.2% PASS
total/synth/PUSH9/p1 1.30 1.42 +8.7% PASS
total/synth/RETURNDATASIZE/a0 3.58 3.99 +11.3% PASS
total/synth/RETURNDATASIZE/a1 3.84 4.00 +4.3% PASS
total/synth/SAR/b0 3.77 3.80 +0.7% PASS
total/synth/SAR/b1 4.27 4.31 +1.1% PASS
total/synth/SGT/b0 2.60 2.61 +0.1% PASS
total/synth/SGT/b1 1.72 1.56 -9.1% PASS
total/synth/SHL/b0 3.05 3.04 -0.5% PASS
total/synth/SHL/b1 1.72 1.61 -6.1% PASS
total/synth/SHR/b0 2.93 2.94 +0.1% PASS
total/synth/SHR/b1 1.64 1.63 -0.6% PASS
total/synth/SIGNEXTEND/b0 3.14 3.58 +14.1% PASS
total/synth/SIGNEXTEND/b1 3.52 3.49 -0.9% PASS
total/synth/SLT/b0 2.60 2.61 +0.5% PASS
total/synth/SLT/b1 1.72 1.56 -9.0% PASS
total/synth/SUB/b0 1.98 2.00 +0.9% PASS
total/synth/SUB/b1 1.97 1.97 +0.1% PASS
total/synth/SWAP1/s0 1.49 1.49 -0.1% PASS
total/synth/SWAP10/s0 1.64 1.50 -8.7% PASS
total/synth/SWAP11/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP12/s0 1.50 1.51 +0.1% PASS
total/synth/SWAP13/s0 1.65 1.51 -8.5% PASS
total/synth/SWAP14/s0 1.65 1.51 -8.5% PASS
total/synth/SWAP15/s0 1.65 1.51 -8.4% PASS
total/synth/SWAP16/s0 1.65 1.51 -8.7% PASS
total/synth/SWAP2/s0 1.64 1.49 -8.8% PASS
total/synth/SWAP3/s0 1.64 1.49 -8.8% PASS
total/synth/SWAP4/s0 1.64 1.50 -8.7% PASS
total/synth/SWAP5/s0 1.64 1.50 -8.7% PASS
total/synth/SWAP6/s0 1.64 1.50 -8.7% PASS
total/synth/SWAP7/s0 1.56 1.50 -4.1% PASS
total/synth/SWAP8/s0 1.64 1.50 -8.8% PASS
total/synth/SWAP9/s0 1.64 1.50 -8.6% PASS
total/synth/XOR/b0 1.55 1.55 +0.0% PASS
total/synth/XOR/b1 1.55 1.56 +0.3% PASS
total/synth/loop_v1 4.44 4.43 -0.3% PASS
total/synth/loop_v2 4.46 4.32 -3.1% PASS

Summary: 194 benchmarks, 0 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.73 1.48 -14.4% PASS
total/main/blake2b_huff/empty 0.07 0.06 -8.4% PASS
total/main/blake2b_shifts/8415nulls 3.39 3.32 -2.1% PASS
total/main/sha1_divs/5311 0.61 0.53 -12.8% PASS
total/main/sha1_divs/empty 0.01 0.01 -9.8% PASS
total/main/sha1_shifts/5311 0.51 0.47 -9.2% PASS
total/main/sha1_shifts/empty 0.01 0.01 -7.2% PASS
total/main/snailtracer/benchmark 54.91 49.77 -9.4% PASS
total/main/structarray_alloc/nfts_rank 0.32 0.34 +6.5% PASS
total/main/swap_math/insufficient_liquidity 0.02 0.02 -10.0% PASS
total/main/swap_math/received 0.02 0.02 -9.5% PASS
total/main/swap_math/spent 0.02 0.02 -9.3% PASS
total/main/weierstrudel/1 0.35 0.29 -17.8% PASS
total/main/weierstrudel/15 3.38 2.55 -24.4% PASS
total/micro/JUMPDEST_n0/empty 0.13 0.13 -4.2% PASS
total/micro/jump_around/empty 0.58 0.54 -6.3% PASS
total/micro/loop_with_many_jumpdests/empty 1.98 1.98 -0.2% PASS
total/micro/memory_grow_mload/by1 0.18 0.18 +0.5% PASS
total/micro/memory_grow_mload/by16 0.19 0.19 -3.6% PASS
total/micro/memory_grow_mload/by32 0.21 0.19 -7.2% PASS
total/micro/memory_grow_mload/nogrow 0.18 0.18 +1.5% PASS
total/micro/memory_grow_mstore/by1 0.19 0.18 -6.2% PASS
total/micro/memory_grow_mstore/by16 0.21 0.18 -12.2% PASS
total/micro/memory_grow_mstore/by32 0.23 0.19 -16.2% PASS
total/micro/memory_grow_mstore/nogrow 0.19 0.17 -6.7% PASS
total/micro/signextend/one 0.37 0.33 -9.8% PASS
total/micro/signextend/zero 0.36 0.33 -8.7% PASS
total/synth/ADD/b0 0.01 0.01 -5.8% PASS
total/synth/ADD/b1 0.01 0.01 -4.9% PASS
total/synth/ADDRESS/a0 0.16 0.16 +0.2% PASS
total/synth/ADDRESS/a1 0.16 0.16 +0.1% PASS
total/synth/AND/b0 0.01 0.01 -5.6% PASS
total/synth/AND/b1 0.01 0.01 -5.0% PASS
total/synth/BYTE/b0 0.01 0.01 -5.9% PASS
total/synth/BYTE/b1 0.01 0.01 -5.0% PASS
total/synth/CALLDATASIZE/a0 0.08 0.09 +6.2% PASS
total/synth/CALLDATASIZE/a1 0.08 0.09 +6.0% PASS
total/synth/CALLER/a0 0.16 0.16 +0.3% PASS
total/synth/CALLER/a1 0.16 0.16 +0.3% PASS
total/synth/CALLVALUE/a0 0.31 0.26 -16.7% PASS
total/synth/CALLVALUE/a1 0.32 0.31 -1.1% PASS
total/synth/CODESIZE/a0 0.08 0.09 +6.2% PASS
total/synth/CODESIZE/a1 0.08 0.09 +6.0% PASS
total/synth/DUP1/d0 0.01 0.01 -5.6% PASS
total/synth/DUP1/d1 0.01 0.01 -5.0% PASS
total/synth/DUP10/d0 0.01 0.01 -5.6% PASS
total/synth/DUP10/d1 0.01 0.01 -5.0% PASS
total/synth/DUP11/d0 0.01 0.01 -5.6% PASS
total/synth/DUP11/d1 0.01 0.01 -4.9% PASS
total/synth/DUP12/d0 0.01 0.01 -5.6% PASS
total/synth/DUP12/d1 0.01 0.01 -5.0% PASS
total/synth/DUP13/d0 0.01 0.01 -5.7% PASS
total/synth/DUP13/d1 0.01 0.01 -5.0% PASS
total/synth/DUP14/d0 0.01 0.01 -5.7% PASS
total/synth/DUP14/d1 0.01 0.01 -5.0% PASS
total/synth/DUP15/d0 0.01 0.01 -10.8% PASS
total/synth/DUP15/d1 0.01 0.01 -4.8% PASS
total/synth/DUP16/d0 0.01 0.01 -5.6% PASS
total/synth/DUP16/d1 0.01 0.01 -4.9% PASS
total/synth/DUP2/d0 0.01 0.01 -5.8% PASS
total/synth/DUP2/d1 0.01 0.01 -4.9% PASS
total/synth/DUP3/d0 0.01 0.01 -5.6% PASS
total/synth/DUP3/d1 0.01 0.01 -5.0% PASS
total/synth/DUP4/d0 0.01 0.01 -5.7% PASS
total/synth/DUP4/d1 0.01 0.01 -5.1% PASS
total/synth/DUP5/d0 0.01 0.01 -5.2% PASS
total/synth/DUP5/d1 0.01 0.01 -4.8% PASS
total/synth/DUP6/d0 0.01 0.01 -5.6% PASS
total/synth/DUP6/d1 0.01 0.01 -4.9% PASS
total/synth/DUP7/d0 0.01 0.01 -5.7% PASS
total/synth/DUP7/d1 0.01 0.01 -4.9% PASS
total/synth/DUP8/d0 0.01 0.01 -5.6% PASS
total/synth/DUP8/d1 0.01 0.01 -5.0% PASS
total/synth/DUP9/d0 0.01 0.01 -6.4% PASS
total/synth/DUP9/d1 0.01 0.01 -5.0% PASS
total/synth/EQ/b0 0.01 0.01 -5.7% PASS
total/synth/EQ/b1 0.01 0.01 -5.0% PASS
total/synth/GAS/a0 0.87 0.53 -39.6% PASS
total/synth/GAS/a1 0.87 0.53 -39.6% PASS
total/synth/GT/b0 0.01 0.01 -5.8% PASS
total/synth/GT/b1 0.01 0.01 -4.9% PASS
total/synth/ISZERO/u0 0.01 0.01 -6.3% PASS
total/synth/JUMPDEST/n0 0.13 0.13 -3.6% PASS
total/synth/LT/b0 0.01 0.01 -5.9% PASS
total/synth/LT/b1 0.01 0.01 -5.0% PASS
total/synth/MSIZE/a0 0.01 0.01 -6.4% PASS
total/synth/MSIZE/a1 0.01 0.01 -6.4% PASS
total/synth/MUL/b0 0.01 0.01 -5.7% PASS
total/synth/MUL/b1 0.01 0.01 -5.1% PASS
total/synth/NOT/u0 0.01 0.01 -6.4% PASS
total/synth/OR/b0 0.01 0.01 -5.7% PASS
total/synth/OR/b1 0.01 0.01 -5.0% PASS
total/synth/PC/a0 0.01 0.01 -6.3% PASS
total/synth/PC/a1 0.01 0.01 -6.4% PASS
total/synth/PUSH1/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH1/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH10/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH10/p1 0.01 0.01 -10.6% PASS
total/synth/PUSH11/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH11/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH12/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH12/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH13/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH13/p1 0.01 0.01 -10.6% PASS
total/synth/PUSH14/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH14/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH15/p0 0.01 0.01 -12.2% PASS
total/synth/PUSH15/p1 0.01 0.01 -10.9% PASS
total/synth/PUSH16/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH16/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH17/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH17/p1 0.01 0.01 -10.6% PASS
total/synth/PUSH18/p0 0.01 0.01 -11.4% PASS
total/synth/PUSH18/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH19/p0 0.01 0.01 -11.4% PASS
total/synth/PUSH19/p1 0.01 0.01 -11.0% PASS
total/synth/PUSH2/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH2/p1 0.01 0.01 -11.1% PASS
total/synth/PUSH20/p0 0.01 0.01 -11.3% PASS
total/synth/PUSH20/p1 0.01 0.01 -10.8% PASS
total/synth/PUSH21/p0 0.01 0.01 -11.4% PASS
total/synth/PUSH21/p1 0.01 0.01 -11.0% PASS
total/synth/PUSH22/p0 0.89 0.91 +2.2% PASS
total/synth/PUSH22/p1 1.15 1.02 -11.5% PASS
total/synth/PUSH23/p0 0.94 0.91 -3.1% PASS
total/synth/PUSH23/p1 1.13 1.05 -6.9% PASS
total/synth/PUSH24/p0 0.90 0.92 +1.9% PASS
total/synth/PUSH24/p1 1.14 1.02 -10.7% PASS
total/synth/PUSH25/p0 0.94 0.91 -2.9% PASS
total/synth/PUSH25/p1 1.17 1.06 -9.6% PASS
total/synth/PUSH26/p0 0.89 0.92 +2.7% PASS
total/synth/PUSH26/p1 1.14 1.03 -10.0% PASS
total/synth/PUSH27/p0 0.91 0.92 +1.3% PASS
total/synth/PUSH27/p1 1.14 1.07 -6.3% PASS
total/synth/PUSH28/p0 0.90 0.92 +2.4% PASS
total/synth/PUSH28/p1 1.15 1.03 -9.9% PASS
total/synth/PUSH29/p0 0.90 0.92 +1.9% PASS
total/synth/PUSH29/p1 1.14 1.06 -6.4% PASS
total/synth/PUSH3/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH3/p1 0.01 0.01 -10.9% PASS
total/synth/PUSH30/p0 0.95 0.89 -6.5% PASS
total/synth/PUSH30/p1 1.20 1.03 -13.6% PASS
total/synth/PUSH31/p0 0.91 0.92 +1.9% PASS
total/synth/PUSH31/p1 1.18 1.02 -13.4% PASS
total/synth/PUSH32/p0 0.90 0.93 +2.9% PASS
total/synth/PUSH32/p1 1.18 1.04 -11.7% PASS
total/synth/PUSH4/p0 0.01 0.01 -12.2% PASS
total/synth/PUSH4/p1 0.01 0.01 -10.7% PASS
total/synth/PUSH5/p0 0.01 0.01 -11.1% PASS
total/synth/PUSH5/p1 0.01 0.01 -11.3% PASS
total/synth/PUSH6/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH6/p1 0.01 0.01 -10.4% PASS
total/synth/PUSH7/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH7/p1 0.01 0.01 -10.7% PASS
total/synth/PUSH8/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH8/p1 0.01 0.01 -10.5% PASS
total/synth/PUSH9/p0 0.01 0.01 -11.2% PASS
total/synth/PUSH9/p1 0.01 0.01 -11.0% PASS
total/synth/RETURNDATASIZE/a0 0.04 0.05 +14.9% PASS
total/synth/RETURNDATASIZE/a1 0.04 0.05 +14.7% PASS
total/synth/SAR/b0 4.36 3.72 -14.8% PASS
total/synth/SAR/b1 4.81 3.98 -17.3% PASS
total/synth/SGT/b0 0.01 0.01 -5.7% PASS
total/synth/SGT/b1 0.01 0.01 -5.0% PASS
total/synth/SHL/b0 3.51 2.82 -19.6% PASS
total/synth/SHL/b1 1.67 1.31 -21.7% PASS
total/synth/SHR/b0 3.52 2.83 -19.7% PASS
total/synth/SHR/b1 1.63 1.26 -22.2% PASS
total/synth/SIGNEXTEND/b0 3.51 3.15 -10.3% PASS
total/synth/SIGNEXTEND/b1 3.42 3.13 -8.3% PASS
total/synth/SLT/b0 0.01 0.01 -5.6% PASS
total/synth/SLT/b1 0.01 0.01 -5.1% PASS
total/synth/SUB/b0 0.01 0.01 -5.7% PASS
total/synth/SUB/b1 0.01 0.01 -5.0% PASS
total/synth/SWAP1/s0 0.01 0.01 -4.7% PASS
total/synth/SWAP10/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP11/s0 0.01 0.01 -4.7% PASS
total/synth/SWAP12/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP13/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP14/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP15/s0 0.01 0.01 -4.7% PASS
total/synth/SWAP16/s0 0.01 0.01 -4.7% PASS
total/synth/SWAP2/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP3/s0 0.01 0.01 -4.9% PASS
total/synth/SWAP4/s0 0.01 0.01 -4.8% PASS
total/synth/SWAP5/s0 0.01 0.01 -6.6% PASS
total/synth/SWAP6/s0 0.01 0.01 -4.7% PASS
total/synth/SWAP7/s0 0.01 0.01 -4.6% PASS
total/synth/SWAP8/s0 0.01 0.01 -4.9% PASS
total/synth/SWAP9/s0 0.01 0.01 -4.7% PASS
total/synth/XOR/b0 0.01 0.01 -5.6% PASS
total/synth/XOR/b1 0.01 0.01 -4.9% PASS
total/synth/loop_v1 1.45 1.31 -9.4% PASS
total/synth/loop_v2 1.28 1.27 -0.7% PASS

Summary: 194 benchmarks, 0 regressions


Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes EVM ORIGIN behavior in the CLI/state-loading path by ensuring tx_origin is populated from either loaded state or the sender address, aligning execution results with expected EVM semantics and updating affected tests.

Changes:

  • Load tx_origin from tx_context in state.json when present.
  • In the CLI, default tx_origin to the sender address when it’s otherwise unset.
  • Update EVM interpreter tests and the origin expected output to reflect non-zero ORIGIN.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/utils/evm.cpp Extends state loading to parse tx_origin from JSON tx_context.
src/cli/dtvm.cpp Adds CLI fallback to set tx_origin from --sender.
src/tests/evm_interp_tests.cpp Sets a non-zero default tx_origin for interpreter tests.
tests/evm_asm/origin.expected Updates expected memory/return for ORIGIN-based test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/evm.cpp
Comment thread src/cli/dtvm.cpp Outdated
Comment on lines +383 to +387
// Set tx_origin from sender address (fallback if not loaded from state)
evmc::address SenderAddr = zen::utils::parseAddress(SenderAddress);
if (MockedHost.tx_context.tx_origin == evmc::address{}) {
MockedHost.tx_context.tx_origin = SenderAddr;
}

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

The fallback logic treats tx_origin == evmc::address{} as “not set”, but that can’t distinguish between “missing in loaded state” vs “explicitly set to zero address in state”. A safer approach is to set tx_origin from --sender before calling loadState(), and let loadState() override it only when the JSON contains tx_origin (including an explicit zero). This also avoids re-parsing the sender address multiple times.

Copilot uses AI. Check for mistakes.
- Move tx_origin initialization from a post-loadState fallback to
  pre-loadState default. This sets tx_origin from --sender before
  calling loadState(), allowing loadState() to override it when
  tx_origin is present in state.json. Avoids the ambiguity of
  treating zero address as 'not set' vs 'explicitly set to zero'.
- Add tx_origin serialization in saveState() to keep save/load
  symmetric, preventing tx_origin from being lost during state
  round-tripping via --save-state/--load-state.
@zoowii
zoowii merged commit fc17b56 into DTVMStack:main Apr 10, 2026
16 checks passed
@cmgCr
cmgCr deleted the cmgCr/fix_issue448 branch April 10, 2026 09:48
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.

A possible bug in EVM

3 participants