Skip to content

Conversation

@spencer-tb
Copy link
Collaborator

@spencer-tb spencer-tb commented Feb 8, 2024

🗒️ Description

This PR aims to start creating a structure within src/ethereum_test_tools/ for usage within consume.

Its predominant aim is to define a types file specifically for the engine api spec, that can be used within the tests_consume/test_via_engine_api.py EEST simulator (and potentially many more). This allows us to:

  1. Separate from the existing FixtureEngineNewPayload etc types, apprehending a future deprecation of the hive blockchain fixture format. We can delete these with ease.
  2. Internally start a python specification for the engine api, that can be built upon for future EEST simulators.
  3. Opens the option to directly create the engine new payload json (and dataclasses) during filling procedures. This may be of use at somepoint, where we don't need to read in the fixture json directly -> convert it to dataclasses -> and then serialize it back to json for engine new payloads.

Key Changes

  • Updates various field names to be more concretely related to the engine api spec. This helps cleanly extract fields from a FixtureBlock type. Changes incl:
    • base_fee -> base_fee_per_gas,
    • reciept_root -> reciepts_root,
    • bloom -> logs_bloom,
    • mix_digest -> prev_randao,
    • hash -> block_hash,
    • Only in FixtureBlock: txs -> transactions
  • Moves src/ethereum_test_tools/rpc/* into src/ethereum_test_tools/consume/.
  • Adds src/ethereum_test_tools/consume/types.py, containing engine new payload and execution payload types, specific to the engine api fork version - aligning cleanly with the spec.
  • Adds tests to check that we can:
    • Extract a FixtureBlock into their respective Engine<fork>.NewPayloadV<version> dataclasses.
    • Convert the Engine<fork>.NewPayloadV<version> dataclasses to the correct json representation, expected within engine_rpc.py.

Remaining Todos

  • Add more complex tests for valid Cancun and Shanghai blockchain test fixtures, properly testing the conversion from a FixtureBlock to a correct engine new payload json representation:
    • Withdrawals extractions
    • ExpectedBlobVersionedHashes & ParentBeaconBlockRoot extractions
  • Integrate the new types within test_consume_via_engine.py and engine_rpc.py, cleaning up more code.
  • Rebase back onto Dan's branch, after his is rebased to main.
  • Clean up tox.

Other Considerations

  • Change the name of coinbase to feeRecipent to align more with the PoS terminology (also makes the engine spec cleaner).
  • Like the above, change the name of number to block_number.
  • Use Base and Meta classes within the engine spec types to reduce duplication of functions.

If blocktest is unavailable exit pytest before the test session starts. If --single-test is supported test individual fixtures using that, otherwise test per fixture file, not per single fixture.
…ate-pytest-command

To get changes from feat(pytest): use node id as fixture name ethereum#342.
@danceratopz danceratopz changed the base branch from feat/pytest/add-a-verify-fixtures-as-a-separate-pytest-command to main May 8, 2024 09:29
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