Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types,specs,tests): Verify resulting transaction receipt #1068

Merged
merged 9 commits into from
Jan 15, 2025

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Jan 9, 2025

🗒️ Description

Transaction.expected_receipt

Adds expected_receiptto the Transaction class in order to signal the test specs that the resulting receipt returned by the transition tool must be verified against the expected values.

At the moment only gas_used is compared, since this is the only value returned by execution-specs, but this is also the value most used by tests.

Updated tests:

Following gas-related tests have been updated in this PR to incorporate a transaction gas usage test:

  • EIP-4844: Precompile gas usage tests
  • EIP-5656: Memory expansion tests
  • EIP-3680: Contract creating transaction gas usage tests
  • EIP-7702: Gas cost tests (instead of calculating start-end balance of transaction sender account)
  • EIP-7623*: Gas execution costs tests

🔗 Related Issues

#402

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: A PR with removal of converted JSON/YML tests from ethereum/tests have been opened.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@marioevz marioevz added scope:tools Scope: ethereum_test_tools package scope:tests Scope: Test cases type:refactor Type: Refactor type:feat type: Feature scope:fw Scope: Framework (evm|tools|forks|pytest) labels Jan 9, 2025
@marioevz marioevz requested a review from winsvega January 9, 2025 23:40
@marioevz marioevz force-pushed the verify-transaction-output branch from 912d281 to bad166b Compare January 9, 2025 23:44
Copy link
Contributor

@winsvega winsvega left a comment

Choose a reason for hiding this comment

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

lots of comments.
I think I found a bug because the transaction exception was verified in all cases and now it is inside If

src/ethereum_test_specs/helpers.py Outdated Show resolved Hide resolved
src/ethereum_test_specs/helpers.py Outdated Show resolved Hide resolved
src/ethereum_test_specs/state.py Outdated Show resolved Hide resolved
src/ethereum_test_types/helpers.py Show resolved Hide resolved
@marioevz marioevz force-pushed the verify-transaction-output branch 2 times, most recently from af61efc to 6493b33 Compare January 13, 2025 04:14
@marioevz marioevz force-pushed the verify-transaction-output branch from 6493b33 to 472b064 Compare January 13, 2025 22:20
Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

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

LGTM.

@marioevz marioevz force-pushed the verify-transaction-output branch from 472b064 to df7dfc9 Compare January 14, 2025 19:48
@marioevz marioevz requested a review from winsvega January 14, 2025 19:50
Copy link
Contributor

@winsvega winsvega left a comment

Choose a reason for hiding this comment

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

add a unit test for transaction exception verification
4 cases (well if none vs none is already covered)

src/ethereum_test_specs/helpers.py Show resolved Hide resolved
@marioevz marioevz force-pushed the verify-transaction-output branch from df7dfc9 to 09b3688 Compare January 15, 2025 16:30
@marioevz marioevz merged commit 64fbb50 into main Jan 15, 2025
22 checks passed
@marioevz marioevz deleted the verify-transaction-output branch January 15, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fw Scope: Framework (evm|tools|forks|pytest) scope:tests Scope: Test cases scope:tools Scope: ethereum_test_tools package type:feat type: Feature type:refactor Type: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants