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

refactor(ethereum_clis): move TransitionTool.verify_fixture() to StateTest and BlockTest #935

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

danceratopz
Copy link
Member

@danceratopz danceratopz commented Nov 4, 2024

🗒️ Description

This PR refactors ethereum_clis and the consume direct interface so that it can be extended to other clients.

Previously, the GethTransitionTool class implemented fixture consumption and referred to it as "fixture verification". The reason is historical: the first "consumer" was implemented in fill.

This PR:

  • Adds GethStatetest and GethBlocktest interface consumer classes to the evm statetest, respectively evm_blocktest commands.
  • Adds a GethFixtureConsumer class which applies the appropriate consumer class for the fixture to run against the client.

Note, that as we now instantiate the GethStatetest and GethBlocktest classes from within GethFixtureConsumer we don't currently use any of the binary detection/automatic subclass instantiation provided by EthereumCLI that is used for the TransitionTool.

🔗 Related Issues

None.

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.

@danceratopz danceratopz added type:refactor Type: Refactor scope:consume Scope: Consume command suite labels Nov 4, 2024
@danceratopz danceratopz self-assigned this Nov 18, 2024
shutil.copyfile(fixture_path, debug_fixture_path)


class GethTransitionTool(GethEvm, TransitionTool):
Copy link
Contributor

@winsvega winsvega Dec 18, 2024

Choose a reason for hiding this comment

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

I feel It is not necessarily GethEvm, it just happened to be inside gethEvm
for evmone it will be a standalone (nested from ethereum cli) class? it is a bit confusing

Copy link
Member

Choose a reason for hiding this comment

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

Addressed this in the latest commit:

  • GethEvm is a construct only valid for geth, since this same evm command contains both functions, and is inherited by both GethTransitionTool and GethFixtureConsumerTool.
  • In other tools, there would be a class that inherits EthereumCLI with a binary for TransitionTool and another class that also inherits EthereumCLI for a different binary for FixtureConsumerTool.

@marioevz marioevz force-pushed the feat/ethereum-clis/add-statetest-blocktest branch from bf0f91b to 1ee0336 Compare January 8, 2025 17:17
@marioevz
Copy link
Member

marioevz commented Jan 8, 2025

Summary of the latest commit:

  • Rebased on top of main to get ruff
  • Deleted src/ethereum_clis/blocktest.py and src/ethereum_clis/statetest.py in favor of a making a generic FixtureConsumerTool that can be specified to consume many different types of Fixtures, without having to create a new base class for every new fixture type.
  • FixtureConsumer (in ethereum_test_fixtures) is now an abstract class and FixtureConsumerTool (in ethereum_clis) is an implementation that can automatically detect different fixture consumers binaries.

I'm thinking we can go all the way in this PR and accept multiple --evm-bin values in consume direct and let FixtureConsumerTool detect each, and then consume all fixtures with each different consumer automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:consume Scope: Consume command suite type:refactor Type: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants