Skip to content

Conversation

@bshastry
Copy link
Contributor

@bshastry bshastry commented Dec 1, 2025

This PR makes the revme statetest runner spec-compliant for handling expected exceptions, matching the behavior of geth and other clients.

Problem

Previously, revme silently skipped tests when:

  • tx_type() returned None for invalid tx combinations (e.g., blob+create)
  • AND expect_exception was set

This meant tests with expected exceptions were not actually validated, they just returned "All tests passed" without executing anything.

Solution

1. Remove early transaction type rejection

  • tx_type() now always returns a TransactionType (not Option)
  • Invalid combinations (blob+create, 7702+create) are validated during EVM execution, not during parsing
  • This matches geth's toMessage() behavior

2. Add missing validations in handler

  • Added BlobCreateTransaction validation for EIP-4844
  • Added Eip7702CreateTransaction validation for EIP-7702
  • Both check tx.kind().is_create() and return appropriate errors

3. Proper exception matching

  • New exception_map module maps EEST exception strings to REVM errors
  • Supports pipe-separated multiple exceptions (exc1|exc2)
  • Comprehensive mapping for 30+ exception types

4. Always execute and validate

  • Removed silent continue in runner.rs
  • Tests with expected exceptions now execute and validate the error matches
  • State roots are computed and output (matching geth behavior)

Results

  • 2297/2303 corpus tests passing (99.7%)
  • State roots match geth exactly for expected exception tests
  • Remaining 6 failures are pre-existing skip list issues

🤖 Generated with Claude Code

bshastry and others added 2 commits November 28, 2025 12:27
This PR makes the revme statetest runner spec-compliant for handling
expected exceptions, matching the behavior of geth and other clients.

## Problem

Previously, revme silently skipped tests when:
- `tx_type()` returned `None` for invalid tx combinations (e.g., blob+create)
- AND `expect_exception` was set

This meant tests with expected exceptions were not actually validated,
they just returned "All tests passed" without executing anything.

## Solution

### 1. Remove early transaction type rejection
- `tx_type()` now always returns a `TransactionType` (not `Option`)
- Invalid combinations (blob+create, 7702+create) are validated during
  EVM execution, not during parsing
- This matches geth's `toMessage()` behavior

### 2. Add missing validations in handler
- Added `BlobCreateTransaction` validation for EIP-4844
- Added `Eip7702CreateTransaction` validation for EIP-7702
- Both check `tx.kind().is_create()` and return appropriate errors

### 3. Proper exception matching
- New `exception_map` module maps EEST exception strings to REVM errors
- Supports pipe-separated multiple exceptions (`exc1|exc2`)
- Comprehensive mapping for 30+ exception types

### 4. Always execute and validate
- Removed silent `continue` in runner.rs
- Tests with expected exceptions now execute and validate the error matches
- State roots are computed and output (matching geth behavior)

## Results
- 2297/2303 corpus tests passing (99.7%)
- State roots match geth exactly for expected exception tests
- Remaining 6 failures are pre-existing skip list issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Use U256::from() instead of .into() for test values (compilation fix)
- Add unprefixed "SenderNotEOA" variant to exception mapping
- Apply rustfmt formatting fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 1, 2025

CodSpeed Performance Report

Merging #3198 will not alter performance

Comparing bshastry:feat/spec-compliant-expected-exceptions (7b68eda) with main (6cf44ef)

Summary

✅ 173 untouched

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

Supportive, need to flush the mapping.

bshastry and others added 3 commits December 2, 2025 13:02
- Wrap URL in angle brackets to fix rustdoc bare-urls warning
- Add TR_TypeNotSupported as alias for TYPE_NOT_SUPPORTED exception

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add support for legacy TR_* exception names used in ethereum/legacytests:
- TR_FeeCapLessThanBlocks -> GasPriceLessThanBasefee
- TR_GasLimitReached -> CallerGasLimitMoreThanBlock
- TR_NoFunds -> LackOfFundForMaxFee
- TR_IntrinsicGas, TR_NoFundsOrGas, IntrinsicGas -> CallGasCostMoreThanGasLimit
- TR_TipGtFeeCap -> PriorityFeeGreaterThanMaxFee
- TR_NoFundsX -> OverflowPaymentInTransaction
- TR_InitCodeLimitExceeded -> CreateInitCodeSizeLimit
- TR_BLOBCREATE -> BlobCreateTransaction
- TR_EMPTYBLOB -> EmptyBlobs
- TR_BLOBLIST_OVERSIZE -> TooManyBlobs
- TR_BLOBVERSION_INVALID -> BlobVersionNotSupported

These mappings enable the state test runner to correctly match expected
exceptions from the legacy test suite.
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.

3 participants