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

forks: Add fork-specific, non-inherited class variables #366

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Dec 20, 2023

🗒️ Description

Introduces fork-specific variables that are not inherited by subclass forks, containing the following variables:

  • transition_tool_name: The name that the transition tool (evm t8n) expects for this fork.
  • blockchain_test_network_name: The network value that must be included in the BlockchainTest fixture format for this fork.
  • solc_name: The name that the solidity compiler (solc) expects for this fork.

This is very useful to name forks differently than the transition tool actually expects (e.g. when we rename Merge to Paris, the transition tool will still expect Merge as the fork to execute the tests).

This was achieved by using the __init_subclass__ special method in the BaseFork class, with the class variables as parameters, and then, when defining the fork subclass, the parameters are passed when sub-classing the parent fork:

class Merge(
    London,
    solc_name="Paris",
):

Can be converted to:

class Paris(
    London,
    transition_tool_name="Merge",
    blockchain_test_network_name="Merge",
):

And will still behave exactly the same to the transition tool (and to the output of the BlockchainTest format).

🔗 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.
  • All: Considered updating the online docs in the ./docs/ directory.
  • 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:forks Scope: ethereum_test_forks package scope:fw Scope: Framework (evm|tools|forks|pytest) labels Dec 20, 2023
Copy link
Collaborator

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

LGTM :)

Very useful, I don't know why we didn't do this before.

I think in the future we can extend the naming to be specific to the t8n that is being used, i.e if Nethermind choose a different network name than geth. But only if we need to cross that bridge.

@marioevz marioevz merged commit 5ce00e7 into ethereum:main Dec 21, 2023
5 checks passed
@marioevz marioevz deleted the fork-name-network branch December 21, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:forks Scope: ethereum_test_forks package scope:fw Scope: Framework (evm|tools|forks|pytest)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants