Skip to content

SMTChecker: Do not assume gasleft() is monotonic for Amsterdam - #17197

Closed
riba2534 wants to merge 1 commit into
argotorg:developfrom
riba2534:fix/smt-gasleft-amsterdam-17193
Closed

riba2534 wants to merge 1 commit into
argotorg:developfrom
riba2534:fix/smt-gasleft-amsterdam-17193

Conversation

@riba2534

@riba2534 riba2534 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #17193.

SMTEncoder::visitGasLeft assumed every later gasleft() was <= the previous one in the same transaction. That holds through Osaka, but EIP-8037 lets Amsterdam refill state gas inside a frame, so gasleft() can grow. CHC then treated those paths as unreachable and proved failing assertions safe.

The target EVM version is now passed through to the SMTChecker, and the monotonicity constraint is only added when hasMonotonicGasLeft() still holds (< amsterdam).

SMTCheckerTest used to compile every SMT test for the default EVM version, ignoring --evm-version and // EVMVersion:. It now uses the version from the command line, like the other isoltest suites. Tests that need features newer than the oldest tested version got the matching EVMVersion setting.

Checklist

AI Disclosure

A Cursor cloud agent helped implement the compiler change, the SMTCheckerTest harness update, and the extra tests, and ran the isoltest suite below. I reviewed the diff and the results.

Tests

Release build with g++ 13 / Ninja and z3 4.13.3, using the SMT-LIB2 callback the same way CI does.

Example 1 from #17193: before the fix, --evm-version amsterdam --experimental reported the assertion safe; afterwards CHC reports the violation.

build/test/tools/isoltest --no-semantic-tests -t "smtCheckerTests/*" at homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, istanbul, paris, cancun, prague, amsterdam, osaka and @future: 0 FAIL.

Each EVM-version-gated SMT test at all 16 versions (832 combinations): 0 FAIL.

build/test/soltest -t '!smtCheckerTests' -- --testpath test --no-semantic-tests --evm-version osaka: no errors.

scripts/check_style.sh: exit 0.

EIP-8037 refills state gas inside a frame, so gasleft() can grow during a
transaction and CHC was wrongly proving assertions safe on paths that need
more gas than before. Pass the target EVM version to the SMTChecker and add
the monotonicity constraint only for EVM versions where it still holds.

SMTChecker tests now compile for the EVM version given on the command line,
like the other isoltest suites do, so that a test can be restricted to the
versions it applies to. Tests using features newer than the oldest tested
EVM version got the matching EVMVersion setting.
@blishko

blishko commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This is premature as the faith of EIP-8037 is not decided yet. Please monitor the discussion at the linked issue #17193.

@blishko blishko closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SMTChecker: gasleft() monotonicity assumption is unsound for the Amsterdam target and proves failing assertions safe

2 participants