Skip to content

fix(evm): apply capped gas refund and intrinsic gas once in CLI settlement - #608

Merged
zoowii merged 3 commits into
DTVMStack:mainfrom
ys8888john:fix/588-gas-refund-settlement
Sep 10, 2026
Merged

zoowii merged 3 commits into
DTVMStack:mainfrom
ys8888john:fix/588-gas-refund-settlement

Conversation

@ys8888john

Copy link
Copy Markdown
Contributor

…ement

The CLI transaction settlement only refunded unused gas computed from gas_left; it never consumed the refund counter produced during execution, so refunds earned by SSTORE clearing (EIP-2200/EIP-3529) were discarded and the sender was overcharged.

Additionally, intrinsic gas was deducted from Msg.gas before execution and added again to GasUsed at settlement, double counting 21000 gas.

Settlement now caps the accumulated refund counter at gas_used / 5, subtracts it from gas_used before charging the sender, and no longer re-adds the already-deducted intrinsic gas, mirroring the settlement in tests/evm_test_host.hpp which passes the upstream EVM state tests.

For the issue #588 repro (SSTORE set 5 then clear, Cancun), the sender now pays 34570 gas (21000 + 22212 - 8642) instead of 64212, matching evmone/geth/besu/ethrex/revm/py-evm.

Closes #588

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

@github-actions

github-actions Bot commented Sep 8, 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 2.45 2.41 -1.7% PASS
total/main/blake2b_huff/empty 0.04 0.04 -5.2% PASS
total/main/blake2b_shifts/8415nulls 13.61 13.64 +0.2% PASS
total/main/sha1_divs/5311 7.99 8.04 +0.6% PASS
total/main/sha1_divs/empty 0.10 0.10 -2.7% PASS
total/main/sha1_shifts/5311 5.44 5.46 +0.3% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.1% PASS
total/main/snailtracer/benchmark 93.99 89.22 -5.1% PASS
total/main/structarray_alloc/nfts_rank 1.11 1.13 +1.4% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 +0.9% PASS
total/main/swap_math/received 0.01 0.01 +10.4% PASS
total/main/swap_math/spent 0.01 0.01 +1.2% PASS
total/main/weierstrudel/1 0.32 0.33 +3.8% PASS
total/main/weierstrudel/15 3.36 3.37 +0.2% PASS
total/micro/JUMPDEST_n0/empty 2.82 2.81 -0.2% PASS
total/micro/jump_around/empty 0.12 0.11 -4.1% PASS
total/micro/loop_with_many_jumpdests/empty 69.96 69.93 -0.0% PASS
total/micro/memory_grow_mload/by1 0.17 0.17 -1.1% PASS
total/micro/memory_grow_mload/by16 0.19 0.19 -0.1% PASS
total/micro/memory_grow_mload/by32 0.12 0.12 +0.0% PASS
total/micro/memory_grow_mload/nogrow 0.09 0.09 +0.4% PASS
total/micro/memory_grow_mstore/by1 0.19 0.18 -5.0% PASS
total/micro/memory_grow_mstore/by16 0.11 0.11 -0.2% PASS
total/micro/memory_grow_mstore/by32 0.23 0.24 +2.4% PASS
total/micro/memory_grow_mstore/nogrow 0.19 0.18 -6.3% PASS
total/micro/signextend/one 0.26 0.26 -1.0% PASS
total/micro/signextend/zero 0.49 0.49 -1.1% PASS
total/synth/ADD/b0 2.02 2.03 +0.2% PASS
total/synth/ADD/b1 2.87 2.68 -6.3% PASS
total/synth/ADDRESS/a0 6.06 6.04 -0.4% PASS
total/synth/ADDRESS/a1 5.15 5.10 -0.9% PASS
total/synth/AND/b0 2.11 2.11 -0.3% PASS
total/synth/AND/b1 2.40 2.39 -0.3% PASS
total/synth/BYTE/b0 6.23 6.23 +0.0% PASS
total/synth/BYTE/b1 8.16 8.30 +1.7% PASS
total/synth/CALLDATASIZE/a0 5.20 5.17 -0.5% PASS
total/synth/CALLDATASIZE/a1 3.39 3.33 -2.0% PASS
total/synth/CALLER/a0 5.85 6.34 +8.5% PASS
total/synth/CALLER/a1 6.06 6.76 +11.5% PASS
total/synth/CALLVALUE/a0 3.52 3.50 -0.4% PASS
total/synth/CALLVALUE/a1 5.86 5.96 +1.8% PASS
total/synth/CODESIZE/a0 5.83 5.96 +2.3% PASS
total/synth/CODESIZE/a1 6.29 6.11 -2.8% PASS
total/synth/DUP1/d0 1.56 1.61 +3.0% PASS
total/synth/DUP1/d1 1.77 1.80 +1.6% PASS
total/synth/DUP10/d0 1.62 1.54 -4.8% PASS
total/synth/DUP10/d1 1.84 1.75 -4.5% PASS
total/synth/DUP11/d0 0.93 0.93 -0.1% PASS
total/synth/DUP11/d1 1.77 1.75 -0.8% PASS
total/synth/DUP12/d0 1.68 1.53 -8.7% PASS
total/synth/DUP12/d1 1.17 1.09 -7.2% PASS
total/synth/DUP13/d0 1.58 1.67 +5.6% PASS
total/synth/DUP13/d1 1.73 1.80 +3.8% PASS
total/synth/DUP14/d0 1.17 1.17 -0.1% PASS
total/synth/DUP14/d1 1.77 1.73 -2.3% PASS
total/synth/DUP15/d0 1.58 1.57 -0.5% PASS
total/synth/DUP15/d1 1.18 1.09 -7.5% PASS
total/synth/DUP16/d0 1.61 1.76 +9.0% PASS
total/synth/DUP16/d1 1.78 1.77 -0.2% PASS
total/synth/DUP2/d0 1.15 1.15 -0.1% PASS
total/synth/DUP2/d1 1.76 1.72 -2.0% PASS
total/synth/DUP3/d0 1.56 1.65 +6.2% PASS
total/synth/DUP3/d1 1.17 1.15 -1.4% PASS
total/synth/DUP4/d0 1.55 1.69 +9.5% PASS
total/synth/DUP4/d1 1.95 1.84 -5.5% PASS
total/synth/DUP5/d0 1.15 1.15 +0.5% PASS
total/synth/DUP5/d1 1.83 1.77 -3.5% PASS
total/synth/DUP6/d0 1.60 1.65 +2.8% PASS
total/synth/DUP6/d1 1.10 1.16 +5.4% PASS
total/synth/DUP7/d0 1.63 1.77 +8.7% PASS
total/synth/DUP7/d1 1.73 1.78 +2.7% PASS
total/synth/DUP8/d0 0.95 1.16 +21.5% PASS
total/synth/DUP8/d1 1.74 1.82 +5.0% PASS
total/synth/DUP9/d0 1.55 1.64 +5.5% PASS
total/synth/DUP9/d1 1.17 1.08 -7.4% PASS
total/synth/EQ/b0 4.54 4.53 -0.1% PASS
total/synth/EQ/b1 4.96 4.96 -0.2% PASS
total/synth/GAS/a0 3.77 3.76 -0.1% PASS
total/synth/GAS/a1 6.79 6.88 +1.3% PASS
total/synth/GT/b0 4.82 4.94 +2.5% PASS
total/synth/GT/b1 5.01 4.96 -0.9% PASS
total/synth/ISZERO/u0 7.08 7.10 +0.3% PASS
total/synth/JUMPDEST/n0 2.81 2.81 +0.2% PASS
total/synth/LT/b0 4.85 4.85 -0.0% PASS
total/synth/LT/b1 4.32 4.26 -1.3% PASS
total/synth/MSIZE/a0 5.27 5.35 +1.5% PASS
total/synth/MSIZE/a1 5.56 5.63 +1.2% PASS
total/synth/MUL/b0 5.48 5.52 +0.8% PASS
total/synth/MUL/b1 5.32 5.26 -1.1% PASS
total/synth/NOT/u0 2.10 2.05 -2.0% PASS
total/synth/OR/b0 2.30 2.28 -0.8% PASS
total/synth/OR/b1 1.70 1.67 -1.6% PASS
total/synth/PC/a0 5.29 5.50 +4.0% PASS
total/synth/PC/a1 3.39 3.37 -0.7% PASS
total/synth/PUSH1/p0 1.78 1.81 +1.5% PASS
total/synth/PUSH1/p1 1.64 1.63 -0.7% PASS
total/synth/PUSH10/p0 1.93 1.84 -4.7% PASS
total/synth/PUSH10/p1 1.65 1.63 -0.9% PASS
total/synth/PUSH11/p0 2.04 1.86 -9.2% PASS
total/synth/PUSH11/p1 1.95 1.97 +1.3% PASS
total/synth/PUSH12/p0 1.20 1.20 +0.0% PASS
total/synth/PUSH12/p1 2.03 2.07 +2.0% PASS
total/synth/PUSH13/p0 1.83 1.85 +1.5% PASS
total/synth/PUSH13/p1 1.64 1.63 -0.5% PASS
total/synth/PUSH14/p0 1.97 2.09 +6.2% PASS
total/synth/PUSH14/p1 1.97 2.11 +6.8% PASS
total/synth/PUSH15/p0 1.20 1.20 +0.3% PASS
total/synth/PUSH15/p1 2.33 2.15 -7.9% PASS
total/synth/PUSH16/p0 1.82 1.80 -0.8% PASS
total/synth/PUSH16/p1 1.64 1.64 -0.2% PASS
total/synth/PUSH17/p0 1.78 1.96 +9.9% PASS
total/synth/PUSH17/p1 2.04 1.98 -2.9% PASS
total/synth/PUSH18/p0 1.20 1.20 +0.1% PASS
total/synth/PUSH18/p1 2.00 1.98 -1.2% PASS
total/synth/PUSH19/p0 2.02 1.93 -4.6% PASS
total/synth/PUSH19/p1 1.67 1.64 -1.8% PASS
total/synth/PUSH2/p0 1.88 1.83 -2.4% PASS
total/synth/PUSH2/p1 1.96 2.28 +16.2% PASS
total/synth/PUSH20/p0 1.87 1.97 +5.2% PASS
total/synth/PUSH20/p1 2.02 2.07 +2.7% PASS
total/synth/PUSH21/p0 1.20 1.21 +0.1% PASS
total/synth/PUSH21/p1 2.13 2.07 -3.2% PASS
total/synth/PUSH22/p0 1.96 1.93 -1.4% PASS
total/synth/PUSH22/p1 1.66 1.63 -1.8% PASS
total/synth/PUSH23/p0 1.79 1.97 +9.6% PASS
total/synth/PUSH23/p1 2.09 2.19 +4.6% PASS
total/synth/PUSH24/p0 1.20 1.20 -0.0% PASS
total/synth/PUSH24/p1 2.22 2.11 -4.9% PASS
total/synth/PUSH25/p0 1.89 1.77 -6.4% PASS
total/synth/PUSH25/p1 1.65 1.64 -0.6% PASS
total/synth/PUSH26/p0 1.81 1.76 -2.6% PASS
total/synth/PUSH26/p1 2.04 2.00 -2.1% PASS
total/synth/PUSH27/p0 1.20 1.20 -0.4% PASS
total/synth/PUSH27/p1 2.13 1.97 -7.5% PASS
total/synth/PUSH28/p0 1.88 1.81 -3.8% PASS
total/synth/PUSH28/p1 1.67 1.64 -1.7% PASS
total/synth/PUSH29/p0 1.81 1.83 +1.6% PASS
total/synth/PUSH29/p1 2.13 2.19 +2.6% PASS
total/synth/PUSH3/p0 1.19 1.20 +0.4% PASS
total/synth/PUSH3/p1 2.02 2.12 +4.9% PASS
total/synth/PUSH30/p0 1.27 1.29 +1.6% PASS
total/synth/PUSH30/p1 2.04 1.95 -4.0% PASS
total/synth/PUSH31/p0 1.81 1.87 +3.4% PASS
total/synth/PUSH31/p1 1.75 1.68 -3.7% PASS
total/synth/PUSH32/p0 1.90 1.95 +2.7% PASS
total/synth/PUSH32/p1 2.13 2.16 +1.7% PASS
total/synth/PUSH4/p0 1.81 1.88 +3.8% PASS
total/synth/PUSH4/p1 1.64 1.64 -0.3% PASS
total/synth/PUSH5/p0 1.78 1.78 -0.3% PASS
total/synth/PUSH5/p1 1.98 2.08 +5.2% PASS
total/synth/PUSH6/p0 1.20 1.19 -0.3% PASS
total/synth/PUSH6/p1 2.05 1.94 -5.2% PASS
total/synth/PUSH7/p0 1.79 1.83 +1.8% PASS
total/synth/PUSH7/p1 1.67 1.63 -2.1% PASS
total/synth/PUSH8/p0 1.79 1.81 +1.0% PASS
total/synth/PUSH8/p1 1.94 2.24 +15.8% PASS
total/synth/PUSH9/p0 1.19 1.19 +0.1% PASS
total/synth/PUSH9/p1 2.12 2.02 -4.6% PASS
total/synth/RETURNDATASIZE/a0 3.31 3.43 +3.6% PASS
total/synth/RETURNDATASIZE/a1 5.95 5.90 -0.8% PASS
total/synth/SAR/b0 4.90 3.95 -19.5% PASS
total/synth/SAR/b1 7.64 7.23 -5.3% PASS
total/synth/SGT/b0 3.60 3.66 +1.6% PASS
total/synth/SGT/b1 3.33 3.29 -1.3% PASS
total/synth/SHL/b0 3.62 3.68 +1.7% PASS
total/synth/SHL/b1 1.83 1.81 -1.0% PASS
total/synth/SHR/b0 3.75 3.88 +3.4% PASS
total/synth/SHR/b1 3.17 3.14 -0.8% PASS
total/synth/SIGNEXTEND/b0 3.31 3.44 +3.7% PASS
total/synth/SIGNEXTEND/b1 6.64 6.40 -3.6% PASS
total/synth/SLT/b0 3.42 3.42 -0.0% PASS
total/synth/SLT/b1 3.80 3.84 +1.0% PASS
total/synth/SUB/b0 2.59 3.06 +17.9% PASS
total/synth/SUB/b1 2.63 2.72 +3.2% PASS
total/synth/SWAP1/s0 1.81 1.52 -15.9% PASS
total/synth/SWAP10/s0 1.81 1.53 -15.4% PASS
total/synth/SWAP11/s0 3.14 3.05 -2.7% PASS
total/synth/SWAP12/s0 3.10 3.10 +0.0% PASS
total/synth/SWAP13/s0 1.54 1.82 +17.7% PASS
total/synth/SWAP14/s0 3.16 3.08 -2.2% PASS
total/synth/SWAP15/s0 3.22 4.12 +28.1% PASS
total/synth/SWAP16/s0 1.54 1.86 +20.6% PASS
total/synth/SWAP2/s0 3.14 3.93 +25.2% PASS
total/synth/SWAP3/s0 3.08 3.07 -0.3% PASS
total/synth/SWAP4/s0 1.53 1.51 -0.9% PASS
total/synth/SWAP5/s0 3.08 3.27 +6.3% PASS
total/synth/SWAP6/s0 3.12 3.11 -0.5% PASS
total/synth/SWAP7/s0 1.53 1.53 +0.2% PASS
total/synth/SWAP8/s0 3.04 3.08 +1.3% PASS
total/synth/SWAP9/s0 3.17 3.08 -2.8% PASS
total/synth/XOR/b0 2.09 2.50 +19.4% PASS
total/synth/XOR/b1 2.19 2.10 -4.3% PASS
total/synth/loop_v1 8.68 8.55 -1.6% PASS
total/synth/loop_v2 8.89 8.66 -2.6% 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.55 1.53 -1.1% PASS
total/main/blake2b_huff/empty 0.02 0.02 +4.5% PASS
total/main/blake2b_shifts/8415nulls 4.36 4.38 +0.5% PASS
total/main/sha1_divs/5311 0.86 0.86 +0.2% PASS
total/main/sha1_divs/empty 0.01 0.01 -0.8% PASS
total/main/sha1_shifts/5311 0.77 0.77 -0.8% PASS
total/main/sha1_shifts/empty 0.01 0.01 -0.2% PASS
total/main/snailtracer/benchmark 48.76 47.88 -1.8% PASS
total/main/structarray_alloc/nfts_rank 0.27 0.27 -0.1% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -0.3% PASS
total/main/swap_math/received 0.01 0.01 -0.9% PASS
total/main/swap_math/spent 0.01 0.01 +0.1% PASS
total/main/weierstrudel/1 0.33 0.33 -1.2% PASS
total/main/weierstrudel/15 3.74 3.78 +1.2% PASS
total/micro/JUMPDEST_n0/empty 0.00 0.00 -1.1% PASS
total/micro/jump_around/empty 0.07 0.07 -6.1% PASS
total/micro/loop_with_many_jumpdests/empty 0.01 0.01 +0.2% PASS
total/micro/memory_grow_mload/by1 0.02 0.02 -6.1% PASS
total/micro/memory_grow_mload/by16 0.02 0.02 +1.1% PASS
total/micro/memory_grow_mload/by32 0.01 0.01 -5.0% PASS
total/micro/memory_grow_mload/nogrow 0.01 0.01 -2.3% PASS
total/micro/memory_grow_mstore/by1 0.02 0.02 -3.9% PASS
total/micro/memory_grow_mstore/by16 0.01 0.01 -1.7% PASS
total/micro/memory_grow_mstore/by32 0.03 0.02 -3.3% PASS
total/micro/memory_grow_mstore/nogrow 0.02 0.02 -1.9% PASS
total/micro/signextend/one 0.08 0.08 -0.1% PASS
total/micro/signextend/zero 0.18 0.19 +3.1% PASS
total/synth/ADD/b0 0.00 0.00 -1.2% PASS
total/synth/ADD/b1 0.00 0.00 -0.0% PASS
total/synth/ADDRESS/a0 0.22 0.22 -0.4% PASS
total/synth/ADDRESS/a1 0.15 0.15 +0.0% PASS
total/synth/AND/b0 0.00 0.00 -1.3% PASS
total/synth/AND/b1 0.00 0.00 +0.3% PASS
total/synth/BYTE/b0 0.00 0.00 -1.0% PASS
total/synth/BYTE/b1 0.00 0.00 +0.3% PASS
total/synth/CALLDATASIZE/a0 0.12 0.12 +2.7% PASS
total/synth/CALLDATASIZE/a1 0.07 0.07 -0.1% PASS
total/synth/CALLER/a0 0.23 0.22 -2.4% PASS
total/synth/CALLER/a1 0.22 0.22 -0.2% PASS
total/synth/CALLVALUE/a0 0.19 0.19 -0.1% PASS
total/synth/CALLVALUE/a1 0.28 0.29 +2.3% PASS
total/synth/CODESIZE/a0 0.12 0.12 -0.1% PASS
total/synth/CODESIZE/a1 0.13 0.12 -6.5% PASS
total/synth/DUP1/d0 0.00 0.00 -0.3% PASS
total/synth/DUP1/d1 0.00 0.00 +0.3% PASS
total/synth/DUP10/d0 0.00 0.00 -0.4% PASS
total/synth/DUP10/d1 0.00 0.00 -0.9% PASS
total/synth/DUP11/d0 0.00 0.00 -1.3% PASS
total/synth/DUP11/d1 0.00 0.00 -0.8% PASS
total/synth/DUP12/d0 0.00 0.00 +0.0% PASS
total/synth/DUP12/d1 0.00 0.00 -1.3% PASS
total/synth/DUP13/d0 0.00 0.00 +1.0% PASS
total/synth/DUP13/d1 0.00 0.00 -2.4% PASS
total/synth/DUP14/d0 0.00 0.00 -1.0% PASS
total/synth/DUP14/d1 0.00 0.00 +0.6% PASS
total/synth/DUP15/d0 0.00 0.00 +0.0% PASS
total/synth/DUP15/d1 0.00 0.00 -1.3% PASS
total/synth/DUP16/d0 0.00 0.00 +1.1% PASS
total/synth/DUP16/d1 0.00 0.00 -0.5% PASS
total/synth/DUP2/d0 0.00 0.00 -0.0% PASS
total/synth/DUP2/d1 0.00 0.00 +0.7% PASS
total/synth/DUP3/d0 0.00 0.00 -0.1% PASS
total/synth/DUP3/d1 0.00 0.00 -1.2% PASS
total/synth/DUP4/d0 0.00 0.00 -0.1% PASS
total/synth/DUP4/d1 0.00 0.00 +0.4% PASS
total/synth/DUP5/d0 0.00 0.00 -0.6% PASS
total/synth/DUP5/d1 0.00 0.00 -0.9% PASS
total/synth/DUP6/d0 0.00 0.00 -0.2% PASS
total/synth/DUP6/d1 0.00 0.00 -1.3% PASS
total/synth/DUP7/d0 0.00 0.00 +3.2% PASS
total/synth/DUP7/d1 0.00 0.00 -0.4% PASS
total/synth/DUP8/d0 0.00 0.00 -1.1% PASS
total/synth/DUP8/d1 0.00 0.00 +0.1% PASS
total/synth/DUP9/d0 0.00 0.00 -1.0% PASS
total/synth/DUP9/d1 0.00 0.00 -1.6% PASS
total/synth/EQ/b0 0.00 0.00 +1.4% PASS
total/synth/EQ/b1 0.00 0.00 -1.2% PASS
total/synth/GAS/a0 0.76 0.76 +0.0% PASS
total/synth/GAS/a1 0.94 1.02 +9.4% PASS
total/synth/GT/b0 0.00 0.00 +0.2% PASS
total/synth/GT/b1 0.00 0.00 -0.1% PASS
total/synth/ISZERO/u0 0.00 0.00 +0.4% PASS
total/synth/JUMPDEST/n0 0.00 0.00 -1.0% PASS
total/synth/LT/b0 0.00 0.00 +0.3% PASS
total/synth/LT/b1 0.00 0.00 -1.0% PASS
total/synth/MSIZE/a0 0.00 0.00 +0.5% PASS
total/synth/MSIZE/a1 0.00 0.00 +1.0% PASS
total/synth/MUL/b0 0.00 0.00 +0.3% PASS
total/synth/MUL/b1 0.00 0.00 -1.1% PASS
total/synth/NOT/u0 0.00 0.00 -1.4% PASS
total/synth/OR/b0 0.00 0.00 +0.3% PASS
total/synth/OR/b1 0.00 0.00 -1.4% PASS
total/synth/PC/a0 0.00 0.00 +0.5% PASS
total/synth/PC/a1 0.00 0.00 -0.8% PASS
total/synth/PUSH1/p0 0.00 0.00 +0.4% PASS
total/synth/PUSH1/p1 0.00 0.00 -1.2% PASS
total/synth/PUSH10/p0 0.00 0.00 -1.5% PASS
total/synth/PUSH10/p1 0.00 0.00 -0.8% PASS
total/synth/PUSH11/p0 0.00 0.00 +4.1% PASS
total/synth/PUSH11/p1 0.00 0.00 +2.4% PASS
total/synth/PUSH12/p0 0.00 0.00 -1.3% PASS
total/synth/PUSH12/p1 0.00 0.00 +5.7% PASS
total/synth/PUSH13/p0 0.00 0.00 -6.3% PASS
total/synth/PUSH13/p1 0.00 0.00 -1.9% PASS
total/synth/PUSH14/p0 0.00 0.00 +0.0% PASS
total/synth/PUSH14/p1 0.00 0.00 -1.1% PASS
total/synth/PUSH15/p0 0.00 0.00 -1.0% PASS
total/synth/PUSH15/p1 0.00 0.00 +6.6% PASS
total/synth/PUSH16/p0 0.00 0.00 +4.2% PASS
total/synth/PUSH16/p1 0.00 0.00 -1.3% PASS
total/synth/PUSH17/p0 0.00 0.00 -3.8% PASS
total/synth/PUSH17/p1 0.00 0.00 -1.0% PASS
total/synth/PUSH18/p0 0.00 0.00 -1.2% PASS
total/synth/PUSH18/p1 0.00 0.00 -3.5% PASS
total/synth/PUSH19/p0 0.00 0.00 -2.0% PASS
total/synth/PUSH19/p1 0.00 0.00 -1.1% PASS
total/synth/PUSH2/p0 0.00 0.00 +0.7% PASS
total/synth/PUSH2/p1 0.00 0.00 -3.7% PASS
total/synth/PUSH20/p0 0.00 0.00 +1.1% PASS
total/synth/PUSH20/p1 0.00 0.00 +6.3% PASS
total/synth/PUSH21/p0 0.00 0.00 -1.4% PASS
total/synth/PUSH21/p1 0.00 0.00 +2.5% PASS
total/synth/PUSH22/p0 1.77 1.68 -5.0% PASS
total/synth/PUSH22/p1 1.64 1.64 +0.1% PASS
total/synth/PUSH23/p0 1.66 1.68 +1.2% PASS
total/synth/PUSH23/p1 2.05 1.94 -5.3% PASS
total/synth/PUSH24/p0 1.20 1.20 +0.4% PASS
total/synth/PUSH24/p1 1.89 1.86 -1.5% PASS
total/synth/PUSH25/p0 1.74 1.65 -5.1% PASS
total/synth/PUSH25/p1 1.63 1.64 +0.3% PASS
total/synth/PUSH26/p0 1.71 1.72 +0.8% PASS
total/synth/PUSH26/p1 2.06 1.91 -7.0% PASS
total/synth/PUSH27/p0 1.20 1.20 -0.1% PASS
total/synth/PUSH27/p1 1.92 1.89 -1.7% PASS
total/synth/PUSH28/p0 1.75 1.69 -3.3% PASS
total/synth/PUSH28/p1 1.65 1.64 -0.2% PASS
total/synth/PUSH29/p0 1.86 1.64 -11.8% PASS
total/synth/PUSH29/p1 1.99 1.95 -2.0% PASS
total/synth/PUSH3/p0 0.00 0.00 -1.2% PASS
total/synth/PUSH3/p1 0.00 0.00 -0.1% PASS
total/synth/PUSH30/p0 1.28 1.24 -2.8% PASS
total/synth/PUSH30/p1 1.88 1.86 -0.9% PASS
total/synth/PUSH31/p0 1.78 1.67 -6.1% PASS
total/synth/PUSH31/p1 1.74 1.66 -4.5% PASS
total/synth/PUSH32/p0 1.67 1.69 +1.4% PASS
total/synth/PUSH32/p1 2.03 1.96 -3.5% PASS
total/synth/PUSH4/p0 0.00 0.00 +3.7% PASS
total/synth/PUSH4/p1 0.00 0.00 -0.7% PASS
total/synth/PUSH5/p0 0.00 0.00 -0.9% PASS
total/synth/PUSH5/p1 0.00 0.00 +1.9% PASS
total/synth/PUSH6/p0 0.00 0.00 -1.5% PASS
total/synth/PUSH6/p1 0.00 0.00 -2.2% PASS
total/synth/PUSH7/p0 0.00 0.00 -2.9% PASS
total/synth/PUSH7/p1 0.00 0.00 -2.8% PASS
total/synth/PUSH8/p0 0.00 0.00 +2.1% PASS
total/synth/PUSH8/p1 0.00 0.00 +2.3% PASS
total/synth/PUSH9/p0 0.00 0.00 -2.5% PASS
total/synth/PUSH9/p1 0.00 0.00 +5.2% PASS
total/synth/RETURNDATASIZE/a0 0.03 0.03 -0.2% PASS
total/synth/RETURNDATASIZE/a1 0.06 0.06 +4.2% PASS
total/synth/SAR/b0 0.00 0.00 -0.3% PASS
total/synth/SAR/b1 0.00 0.00 +0.1% PASS
total/synth/SGT/b0 0.00 0.00 +0.5% PASS
total/synth/SGT/b1 0.00 0.00 -1.0% PASS
total/synth/SHL/b0 0.00 0.00 +0.3% PASS
total/synth/SHL/b1 0.00 0.00 -0.7% PASS
total/synth/SHR/b0 0.00 0.00 +0.3% PASS
total/synth/SHR/b1 0.00 0.00 +0.7% PASS
total/synth/SIGNEXTEND/b0 0.00 0.00 -0.8% PASS
total/synth/SIGNEXTEND/b1 0.00 0.00 -0.5% PASS
total/synth/SLT/b0 0.00 0.00 -0.9% PASS
total/synth/SLT/b1 0.00 0.00 -1.6% PASS
total/synth/SUB/b0 0.00 0.00 +0.0% PASS
total/synth/SUB/b1 0.00 0.00 -0.2% PASS
total/synth/SWAP1/s0 0.00 0.00 -1.2% PASS
total/synth/SWAP10/s0 0.00 0.00 -1.1% PASS
total/synth/SWAP11/s0 0.00 0.00 +0.1% PASS
total/synth/SWAP12/s0 0.00 0.00 +1.3% PASS
total/synth/SWAP13/s0 0.00 0.00 -0.3% PASS
total/synth/SWAP14/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP15/s0 0.00 0.00 +1.9% PASS
total/synth/SWAP16/s0 0.00 0.00 -0.7% PASS
total/synth/SWAP2/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP3/s0 0.00 0.00 +0.0% PASS
total/synth/SWAP4/s0 0.00 0.00 -0.8% PASS
total/synth/SWAP5/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP6/s0 0.00 0.00 -0.1% PASS
total/synth/SWAP7/s0 0.00 0.00 -0.7% PASS
total/synth/SWAP8/s0 0.00 0.00 -0.3% PASS
total/synth/SWAP9/s0 0.00 0.00 -0.9% PASS
total/synth/XOR/b0 0.00 0.00 -0.2% PASS
total/synth/XOR/b1 0.00 0.00 -1.0% PASS
total/synth/loop_v1 8.46 8.21 -3.0% PASS
total/synth/loop_v2 8.32 8.39 +0.9% PASS

Summary: 194 benchmarks, 0 regressions


@ys8888john
ys8888john force-pushed the fix/588-gas-refund-settlement branch 2 times, most recently from 2f806e7 to d52f88f Compare September 9, 2026 12:14
…ement

Settle the execution refund counter with the EIP-3529 revision-specific cap and count intrinsic gas exactly once when charging the sender. This aligns CLI gas settlement with EVM spec behavior and adds regression tests for refund limits across revisions.

Closes DTVMStack#588
Create the EVM instance after upfront gas deduction so interpreter and JIT start from the same Msg.gas value. Rename the fee helper for transaction generality, share settlement test setup, and document the utility contracts.

Verified the issue DTVMStack#588 CLI repro and EVM interpreter regression tests.
Previously, loaded storage set current but left original as zero. A non-zero prestate slot cleared to zero was classified as a dirty clear, charging the wrong SSTORE gas and accruing an incorrect refund. Initialize original from the persisted current value unless an explicit original is provided, so loading state starts a new transaction from that boundary.

Closes DTVMStack#589
@ys8888john
ys8888john force-pushed the fix/588-gas-refund-settlement branch from ae81c54 to acdf8e7 Compare September 10, 2026 13:12
@zoowii
zoowii merged commit cd56d31 into DTVMStack:main Sep 10, 2026
17 checks passed
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.

DTVM EVM Bug: SSTORE refund is never credited to the sender at transaction settlement

2 participants