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

remove backfill from eip 2935 and serve hashes from state when eip 7709 enabled #7140

Merged
merged 18 commits into from
Jun 24, 2024

Conversation

yerke26
Copy link
Contributor

@yerke26 yerke26 commented Jun 6, 2024

Eip2935 is going to collect block hashes in the state, when Eip7709 gets enabled it will start serving collected block hashes from the state.

Before: if eip2935IsEnabled we stored the last 8192 hashes in the state and served last 256 block hashes from state on request
In this PR: if eip2935IsEnabled we store parent block hash in the state and if eip7709IsEnabled serve last 256 block hashes from state

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

There is no tests for Eip7709, tests that confirm blockhashes being served from the state
Eip2935 tests cannot test that blockhashes stored in the state

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.

Remarks

Optional. Remove if not applicable.

@yerke26 yerke26 requested a review from tanishqjasoria June 6, 2024 09:34
@@ -47,28 +39,12 @@ public void ApplyHistoryBlockHashes(BlockHeader blockHeader)
return null;
}
var blockIndex = new UInt256((ulong)(requiredBlockNumber % Eip2935Constants.RingBufferSize));
Address? eip2935Account = spec.Eip2935ContractAddress ?? Eip2935Constants.BlockHashHistoryAddress;
Address eip2935Account = spec.Eip2935ContractAddress;
Copy link
Contributor

Choose a reason for hiding this comment

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

this should not be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

@tanishqjasoria
Copy link
Contributor

NOTE: though 7709 is included here but the implementation is not complete yet - we dont charge the appropiate gas as its dependent on verkle.
Should we keep it or just remove it entirely?
cc: @MarekM25 @LukaszRozmej

@tanishqjasoria tanishqjasoria changed the title Fetch blockHashes from state in Eip-7709, remove backfill from eip 2935 and serve hashes from state when eip 7709 enabled Jun 6, 2024
@@ -28,7 +28,7 @@ public override void Setup()


[TestCase(MainnetSpecProvider.CancunBlockTimestamp, false)]
[TestCase(MainnetSpecProvider.PragueBlockTimestamp, true)]
[TestCase(MainnetSpecProvider.PragueBlockTimestamp, false)]
public void CorrectBlockhashBeingUsed(ulong timestamp, bool eipEnabled)
Copy link
Contributor

Choose a reason for hiding this comment

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

here eipEnabled=false does not make sense
eip2935 is enabled - just the expectation changed
i think this test can be removed or modify it for using 7709

{
Hash256? result = provider.GetBlockhash(currentHeader, 0);
if (currentHeader.Number > Eip2935Constants.RingBufferSize)
if (currentHeader.Number > Eip2935Constants.RingBufferSize || spec.IsEip7709Enabled || currentHeader.Number > 256)
Copy link
Contributor

Choose a reason for hiding this comment

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

this condition does not make sense - i think this should be
(spec.IsEip7709Enabled && currentHeader.Number > Eip2935Constants.RingBufferSize) || currentHeader.Number > 256

@yerke26 yerke26 requested a review from tanishqjasoria June 12, 2024 13:35
yerke26 added 4 commits June 18, 2024 17:10
# Conflicts:
#	src/Nethermind/Nethermind.Consensus.Clique/CliquePlugin.cs
#	src/Nethermind/Nethermind.Consensus.Ethash/NethDevPlugin.cs
#	src/Nethermind/Nethermind.Consensus/Processing/ReadOnlyChainProcessingEnv.cs
#	src/Nethermind/Nethermind.Consensus/Producers/BlockProducerEnvFactory.cs
#	src/Nethermind/Nethermind.Optimism/OptimismBlockProducerEnvFactory.cs
#	src/Nethermind/Nethermind.Optimism/ReadOnlyChainProcessingEnv.cs
@MarekM25 MarekM25 merged commit 2f2eb01 into master Jun 24, 2024
68 checks passed
@MarekM25 MarekM25 deleted the feature/eip7709-changes branch June 24, 2024 11:38
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.

5 participants