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

EIP-2935: Save historical block hashes in state #6925

Merged
merged 45 commits into from
May 7, 2024
Merged

EIP-2935: Save historical block hashes in state #6925

merged 45 commits into from
May 7, 2024

Conversation

tanishqjasoria
Copy link
Contributor

@tanishqjasoria tanishqjasoria commented Apr 16, 2024

Closes #6689

Changes

  • add BlockHashInStateHandler

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

@tanishqjasoria tanishqjasoria marked this pull request as ready for review April 18, 2024 03:29
@tanishqjasoria tanishqjasoria marked this pull request as draft April 18, 2024 04:04
@tanishqjasoria tanishqjasoria marked this pull request as ready for review April 18, 2024 04:16
@tanishqjasoria tanishqjasoria mentioned this pull request Apr 19, 2024
16 tasks
BlockHeader header = currentBlock;
for (var i = 0; i < Math.Min(Eip2935Constants.RingBufferSize, current); i++)
{
// an extra check - don't think it is needed
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is needed when you start devnet from genesis or from early blocks with 2935

Copy link
Member

Choose a reason for hiding this comment

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

I think it shouldn't be needed if for loop header would take it into account and I think it does - this could use a test and removing this.

Just to be sure - genesis block hash should be added to state or not? If it should then it currently isn't and it is consensus issue.

If genesis shouldn't be added then we either need this or have a conditional -1 on Math.Min(Eip2935Constants.RingBufferSize, current) if we go up to genesis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so it is handled by the loop - I will remove this check.

genesis is added to the state in current implementation also, we have a test for this. for adding genesis we dont need to iterate to block 0, we need to iterate to block 1, because we add the parent hash to the state.

@MarekM25 MarekM25 merged commit f679833 into master May 7, 2024
67 checks passed
@MarekM25 MarekM25 deleted the eip-2935 branch May 7, 2024 10: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.

implement eip-2935 - save historical block hashes in state
3 participants