-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 EIP-6122: Forkid checks based on timestamps #6122
Conversation
A critical exception has occurred: |
99ec35c
to
48248bf
Compare
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!
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.
A handful of nits. Agreed with @axic that we should call out explicitly that
- timestamps are strictly much larger than block numbers and thus it's an easy transition to utilize the same uint64 type and previous logic
- that once you go to timestamps, this standard does not support going back to block number
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu> Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
} | ||
``` | ||
|
||
Here's a suite of tests of the different states a Mainnet node might be in and the different remote fork identifiers it might be required to validate and decide to accept or reject: |
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.
A summary of rejection cases are as follows
Hash
of remote must be one of the hashes that the local node is aware of (past fork or future fork)- if
Hash
of remote is older than currentHash
of local, remoteNext
must be equal to next fork (that exists in local) - if remote
Next
is smaller than local current (BlockNumber
orTimestamp
), local must have forked at thatNext
or reject remote.
Please correct me if i am wrong
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
The commit 2189707 (as a parent of c7f49e0) contains errors. |
The following additional rules are applied: | ||
|
||
- Forks by timestamp MUST be scheduled at or after the forks by block (on mainnet as well as on private networks). | ||
- An implementation of forkid verification of remote peer needs to filter the incoming forkids first by block then by timestamp. |
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.
Does this mean that a client need to try comparing a block number of local head in the first place and then if it doesn't work fallback to the timestamp?
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.
Yes, we compare by block first and if the last block we have is past the remote block we fallback to the timestamp
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.
Got it! We might want to add details on how exactly forkid validation rules are changed by this EIP to make this statement clearer
* EIPS: add forkid by timestamp draft * EIPS: add forkid by timestamp * eip-6122: rename * eip-6122: add martins comments, linter fixes * Fix typo * Fix typo introduced by me * Apply suggestions from code review Co-authored-by: Alex Beregszaszi <alex@rtfs.hu> Co-authored-by: Danny Ryan <dannyjryan@gmail.com> * Fix typos highlighted in code review Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com> * eip-6122: fix comments * eip-6122: fix comments * eip-6122: fix comments --------- Co-authored-by: Pandapip1 <45835846+Pandapip1@users.noreply.github.com> Co-authored-by: Alex Beregszaszi <alex@rtfs.hu> Co-authored-by: Danny Ryan <dannyjryan@gmail.com> Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-template.md
We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met: