Skip to content

test: Move the state diff revert test to state_transition - #1717

Merged
chfast merged 1 commit into
masterfrom
test/state-diff-transition
Sep 15, 2026
Merged

chfast merged 1 commit into
masterfrom
test/state-diff-transition

Conversation

@chfast

@chfast chfast commented Sep 15, 2026

Copy link
Copy Markdown
Member

Follow-up to #1709, which added the regression test as a standalone TEST() building its own state, block and transaction instead of using the state_transition fixture the rest of the state tests use.

Moves it to state_transition_touch_test.cpp, next to the other touch-and-revert cases.

The post state alone cannot express what the test checks: applying a diff entry for an account which does not exist is a no-op, so a spurious entry leaves the post state correct. The fixture gets an std::optional<bool> in_diff expectation for that, used in three places:

test account in_diff why
touch_revert_cold_access_nonexistent 0x4e false never existed, the revert must leave no trace — the case #1709 fixed
touch_empty_sd 0xee true pre-existing empty account swept by EIP-161, a real deleted_accounts entry
call_value_to_empty 0xbe true received value, a real modified_accounts entry

The first two make a matched pair: both end non-existent in the post state, and only the diff tells them apart.

in_diff is an optional<bool> rather than a plain flag so the same shape can later cover storage entries.

Verified by reverting the host.cpp change from #1709: the migrated test fails with 0x4e: unexpectedly in the state diff while every other touch test and call_value_to_empty still pass. Each of the three expectations was also flipped to the wrong value to confirm it asserts something.

Note: the account-level diff is not consistent beyond this case — see #1718.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DV45qzgCspEBfY2es9c7SL

@codspeed

codspeed Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 129 untouched benchmarks


Comparing test/state-diff-transition (5a2c928) with master (8350f81)

Open in CodSpeed

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.02%. Comparing base (8350f81) to head (5a2c928).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
test/unittests/state_transition.cpp 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1717      +/-   ##
==========================================
- Coverage   98.02%   98.02%   -0.01%     
==========================================
  Files         180      179       -1     
  Lines       16379    16382       +3     
  Branches     3769     3769              
==========================================
+ Hits        16056    16058       +2     
- Misses        243      244       +1     
  Partials       80       80              
Flag Coverage Δ
eest-develop 82.81% <ø> (ø)
eest-develop-gmp 26.18% <0.00%> (-0.01%) ⬇️
eest-legacy 17.22% <0.00%> (-0.01%) ⬇️
eest-libsecp256k1 28.44% <0.00%> (-0.01%) ⬇️
eest-stable 82.77% <ø> (ø)
evmone-unittests 94.32% <95.65%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 96.20% <ø> (ø)
tooling 94.06% <ø> (ø)
tests 99.80% <95.65%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
test/unittests/state_transition_call_test.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition_touch_test.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition.cpp 97.91% <90.90%> (-0.91%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The test added with the fix builds its own state, block and transaction
instead of using the state_transition fixture the rest of the state
tests use. Move it to state_transition_touch_test.cpp, next to the other
touch-and-revert cases.

The post state alone cannot express what the test checks: applying a
diff entry for an account which does not exist is a no-op, so a spurious
entry leaves the post state correct. The fixture gets an `in_diff`
expectation for that, used in three places: the reverted cold access
(false), an EIP-161 sweep of a pre-existing account (true, a deletion)
and a value transfer (true, a modification).
@chfast
chfast force-pushed the test/state-diff-transition branch from be32086 to 5a2c928 Compare September 15, 2026 08:53
@chfast
chfast requested a balanced review from Copilot September 15, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Add the direct <algorithm> include required by std::ranges::find.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Moves the state-diff regression test into the shared state_transition fixture and adds account-level diff expectations.

Changes:

  • Adds optional in_diff validation.
  • Migrates touch/revert and value-transfer coverage.
  • Removes the superseded standalone test and build entry.
File summaries
File Summary
test/unittests/state_transition.hpp Adds diff expectation metadata.
test/unittests/state_transition.cpp Validates expected diff membership; requires a direct <algorithm> include.
test/unittests/state_transition_touch_test.cpp Adds migrated regression and deletion coverage.
test/unittests/state_transition_call_test.cpp Adds value-transfer diff coverage.
test/unittests/state_diff_test.cpp Removes the superseded standalone test.
test/unittests/CMakeLists.txt Removes the deleted test source.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/unittests/state_transition.cpp
@chfast
chfast merged commit e0ba5d0 into master Sep 15, 2026
21 of 24 checks passed
@chfast
chfast deleted the test/state-diff-transition branch September 15, 2026 09:03
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.

2 participants