-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
p2p/enode: use unix timestamp as base ENR sequence number #19903
Conversation
e1615fb
to
5e64cc0
Compare
The general issue with timestamp as sequence number is that we cannot sign new records faster than once per second. Otherwise the sequence number may advance too fast and the original problem is not solved at all. One idea we had in the triage today was to increase the granularity to millisecond. Another approach would be keeping the sequence number in two parts, with a timestamp part + update counter. |
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
This changes the local ENR update mechanism to block for up to 1ms in LocalNode.Node when the previous update was less than 1ms ago. To make this work, the granularity of sequence numbers is increased to millisecond.
e252e2a
to
018c8af
Compare
We did it! Merged after > 2 years. 😁 |
…9903) This PR ensures that wiping all data associated with a node (apart from its nodekey) will not generate already used sequence number for the ENRs, since all remote nodes would reject them until they out-number the previously published largest one. The big complication with this scheme is that every local update to the ENR can potentially bump the sequence number by one. In order to ensure that local updates do not outrun the clock, the sequence number is a millisecond-precision timestamp, and updates are throttled to occur at most once per millisecond. Co-authored-by: Felix Lange <[email protected]>
…9903) This PR ensures that wiping all data associated with a node (apart from its nodekey) will not generate already used sequence number for the ENRs, since all remote nodes would reject them until they out-number the previously published largest one. The big complication with this scheme is that every local update to the ENR can potentially bump the sequence number by one. In order to ensure that local updates do not outrun the clock, the sequence number is a millisecond-precision timestamp, and updates are throttled to occur at most once per millisecond. Co-authored-by: Felix Lange <[email protected]>
This PR ensures that wiping all data associated with a node (apart from its key) will not generate already used sequence number for the ENRs, since all remote nodes would reject them until they out-number the previously published largest one.