-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
core/forkid: correctly compute forkid when timestamp fork is activated in genesis #27895
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lightclient
requested review from
zsfelfoldi,
rjl493456442,
karalabe and
holiman
as code owners
August 10, 2023 14:47
lightclient
force-pushed
the
fix-forkid-time-genesis
branch
2 times, most recently
from
August 10, 2023 15:10
74ee5b4
to
33560cb
Compare
lightclient
force-pushed
the
fix-forkid-time-genesis
branch
from
August 11, 2023 11:33
33560cb
to
1f7bf7e
Compare
MariusVanDerWijden
approved these changes
Aug 15, 2023
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.
LGTM
fjl
changed the title
all: correctly compute forkid when timestamp fork is activated in genesis
core/forkid: correctly compute forkid when timestamp fork is activated in genesis
Aug 16, 2023
yperbasis
added a commit
to erigontech/erigon
that referenced
this pull request
Aug 21, 2023
AskAlexSharov
pushed a commit
to erigontech/erigon
that referenced
this pull request
Sep 6, 2023
devopsbo3
pushed a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…d in genesis (ethereum#27895) This changes the forkID calculation to ignore time-based forks that occurred before the genesis block. It's supposed to be done this way because the spec says: > If a chain is configured to start with a non-Frontier ruleset already in its genesis, that is NOT considered a fork.
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…activated in genesis (ethereum#27895)" This reverts commit db56844.
devopsbo3
added a commit
to HorizenOfficial/go-ethereum
that referenced
this pull request
Nov 10, 2023
…activated in genesis (ethereum#27895)" This reverts commit db56844.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an issue with how we compute forkid values for networks where a time-based fork is activated in genesis. Currently, we have no in
forkid.NewID
to determine the genesis' timestamp and per EIP-6122:However, since the
NewID
function cannot know the timestamp of the genesis block, it is unable to differentiate the case where a time-base fork activation is equal to the time of genesis and correctly skip the block.Here is an example
genesis.json
:genesis.json
Before this change, it would output a forkid of
0xa614adaf 1690476041
. Now it outputs0x06278388 1690476041
. The forkid calculation to get these values is:Therefore this PR correctly skips applying time-based forks to the forkid hash when the fork is already active in genesis.