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

Add Labels to ChainParameters to Enable Hardforks via Single Timestamp #7764

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LuisDi98
Copy link

This PR introduces functionality to allow grouped EIP timestamps (e.g., dencun, cancun) in ChainParameters. This simplifies the process of activating multiple EIPs simultaneously through a single label, while preserving the ability to handle individual EIP timestamps.

Fixes #7738

Changes

  • Added DencunTransitionTimestamp and CancunTransitionTimestamp to ChainParameters class.
  • Implemented ValidateNoTimestampConflicts to detect and validate timestamp conflicts between labels and individual EIPs.
  • Updated ChainSpecParamsJson to support grouped label serialization/deserialization.
  • Added tests in ChainParametersTests to verify label functionality and conflict detection.

Types of Changes

What types of changes does your code introduce?

  • New feature (a non-breaking change that adds functionality)

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes

Notes on testing

Added unit tests in ChainParametersTests to verify:

  • Setting and getting label timestamps.
  • Conflict detection for mismatched individual EIP timestamps.
  • Valid behavior when all timestamps match.

Documentation

Requires documentation update

  • No

Requires explanation in Release Notes

  • Yes

Release Notes:

  • Added support for grouped EIP timestamps (dencun, cancun) in ChainParameters for simplifying hardfork activation.

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

We need to support all hardforks

Comment on lines +20 to +23
if (Eip4844TransitionTimestamp == Eip4788TransitionTimestamp &&
Eip4788TransitionTimestamp == Eip1153TransitionTimestamp &&
Eip1153TransitionTimestamp == Eip5656TransitionTimestamp &&
Eip5656TransitionTimestamp == Eip6780TransitionTimestamp)
Copy link
Member

Choose a reason for hiding this comment

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

We should have a helper method to have such comparisions as we will do it for every hardfork.

}
set
{
_dencunTransitionTimestamp = value;
Copy link
Member

Choose a reason for hiding this comment

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

Potentially we could have _dencunTransitionTimestamp and individual EIP's out of sync, so maybe always calculate it and don't have a separate field?

}
set
{
_dencunTransitionTimestamp = value;
Copy link
Member

Choose a reason for hiding this comment

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

Potentially we could have _dencunTransitionTimestamp and individual EIP's out of sync, so maybe always calculate it and don't have a separate field? Then you also don't need Validate methods

Comment on lines +20 to +23
if (Eip4844TransitionTimestamp == Eip4788TransitionTimestamp &&
Eip4788TransitionTimestamp == Eip1153TransitionTimestamp &&
Eip1153TransitionTimestamp == Eip5656TransitionTimestamp &&
Eip5656TransitionTimestamp == Eip6780TransitionTimestamp)
Copy link
Member

Choose a reason for hiding this comment

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

You could potentially use more declarative style of Expression Api to map individual properties to Hardfork property, that might be useful outside of this class too?

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.

Add Labels to chainspec to activate hardforks at once.
2 participants