-
Notifications
You must be signed in to change notification settings - Fork 390
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
Cancun fixes + EIP 4788 #6009
Cancun fixes + EIP 4788 #6009
Conversation
- Added Eip4788 wiring to ChainSpecs
- Added Eip4788 stateful precompile
- make Instance field in Precompile static generic to match class type
src/Nethermind/Nethermind.Specs/ChainSpecStyle/ChainSpecLoader.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Merge.Plugin/Data/IExecutionPayloadParams.cs
Outdated
Show resolved
Hide resolved
|
||
state.RecalculateStateRoot(); | ||
blockRequestV3.StateRoot = state.StateRoot; | ||
TryCalculateHash(blockRequestV3, out Keccak? hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recalculate it below CreateBlockRequestInternal<T>
btw. What is interesting is that we do not execute transactions that may affect the state. Maybe state hash root was already calculated before( _beaconBlockRootHandler can be placed there if so)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure tbh, I'll have to take a look into it
- removed commented precompile line from VirtualMachine
- removed deprectated tests
/// Parent Beacon Block precompile | ||
/// </summary> | ||
bool IsEip4788Enabled { get; } | ||
Address Eip4788ContractAddress { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need test that this address is being loaded correctly from chainspec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Demuirgos :) please do it in next PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small comments
This reverts commit 872bce8.
public static int GetVersion(this PayloadAttributes executionPayload) => | ||
executionPayload.Withdrawals is null ? 1 : 2; | ||
executionPayload switch | ||
{ | ||
{ ParentBeaconBlockRoot: not null, Withdrawals: not null } => EngineApiVersions.Cancun, | ||
{ Withdrawals: not null } => EngineApiVersions.Shanghai, | ||
_ => EngineApiVersions.Paris | ||
}; | ||
|
||
public static int ExpectedEngineSpecVersion(this IReleaseSpec spec) => | ||
spec switch | ||
{ | ||
{ WithdrawalsEnabled: true, IsEip4844Enabled: true } => EngineApiVersions.Cancun, | ||
{ WithdrawalsEnabled: true } => EngineApiVersions.Shanghai, | ||
_ => EngineApiVersions.Paris | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execution payload is treated based on a specific fork instead of what EIPs are enabled. This could result in conflicts with supporting other chains where, for example, gnosis would want to adopt 4788 but not 4844 (just an example). Ill post the same thing on the PR. but i dont want to block it. so ill probably post it as an issue to be looked at in a later PR.
designing a solution to this problem is not easy so i completely understand if it is not considered before cancun.
@@ -17,6 +18,8 @@ protected Cancun() | |||
IsEip5656Enabled = true; | |||
IsEip4844Enabled = true; | |||
IsEip6780Enabled = true; | |||
IsEip4788Enabled = true; | |||
Eip4788ContractAddress = Address.FromNumber(0x0b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might differ from one network to another (hopefully not)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will
Changes
PR for current Cancun branch and last minute fixes + EIP 4788
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?