Skip to content

Add Upstream Spec State Test Support to SAE#70

Draft
ceyonur wants to merge 11 commits intoceyonur/eth-testsfrom
ceyonur/eth-state-tests
Draft

Add Upstream Spec State Test Support to SAE#70
ceyonur wants to merge 11 commits intoceyonur/eth-testsfrom
ceyonur/eth-state-tests

Conversation

@ceyonur
Copy link
Contributor

@ceyonur ceyonur commented Jan 6, 2026

This PR enables execution of the upstream spec state tests from libevm (see tests/state_test.go).

Execution Model Differences

Compared to upstream, SAE executes these tests through the full block production pipeline instead of calling directly into message application:

State Initialization:

  • Upstream creates a new StateDB for each test and applies the fixture preState before executing messages.
  • In SAE, genesis allocations are used to initialize preState, and execution proceeds through real blocks using saexec.Executor.

Message Execution:

  • Upstream uses a single genesis block and directly applies messages via ApplyMessage (here).
  • SAE constructs blocks containing the given transactions and executes them end-to-end through the executor. Upstream converts transactions in test fixtures into core.Message objects, whereas SAE uses the raw transactions in the block.

Base Fee Handling:

Similar to blockchain tests, base fee values are adjusted to follow SAE rules.

Semantics and Ownership of State Logic

  • In upstream, the state tests drive most of the state logic directly.
  • In SAE, the actual executor encapsulates most of the state transition components, and the tests verify only the final world state.

Skipped Tests

Following the same convention as blockchain tests (see PR #27), invalid tests that expect specific errors/exceptions are skipped. These cases rely on worst-case insertion rules and validations that SAE does not currently model.

@ceyonur ceyonur force-pushed the ceyonur/eth-state-tests branch from 460db10 to 2b591dd Compare January 7, 2026 15:06
@ceyonur ceyonur changed the title Ceyonur/eth state tests Add Upstream Spec State Test Support to SAE Jan 8, 2026
Comment on lines +136 to +144
// Context(cey): Path scheme is not supported yet
// if err := bt.checkFailure(t, test.Run(t, false, rawdb.PathScheme, nil, nil)); err != nil {
// t.Errorf("test in path mode without snapshotter failed: %v", err)
// return
// }
// if err := bt.checkFailure(t, test.Run(t, true, rawdb.PathScheme, nil, nil)); err != nil {
// t.Errorf("test in path mode with snapshotter failed: %v", err)
// return
// }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO we don't need to really waste time with running these.

)

root, err := stateDB.Commit(b.NumberU64(), true)
root, err := stateDB.Commit(b.NumberU64(), rules.IsEIP158)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was required to pass frontier tests (where the isEIP158=false

@ceyonur ceyonur linked an issue Jan 8, 2026 that may be closed by this pull request
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.

Run official EVM tests against SAE

1 participant