-
Notifications
You must be signed in to change notification settings - Fork 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
Change proposer cache overwrite logic #11191
Conversation
beacon-chain/cache/payload_id.go
Outdated
// Ok to overwrite if the slot is already set but the payload ID is not set. | ||
ids, ok := f.slotToProposerAndPayloadIDs[slot] | ||
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | ||
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | ||
// This combats the re-org case where payload assignment could change the epoch of. |
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 combats the re-org case where payload assignment could change the epoch of
There is something missing at the end of the sentence @terencechain. What should it say?
beacon-chain/cache/payload_id.go
Outdated
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | ||
// Ok to overwrite if the slot is already set but the cached payload ID is not set. |
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.
Duplicate lines?
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | |
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | |
// Ok to overwrite if the slot is already set but the cached payload ID is not set. |
if !ok || (ok && pId != [pIdLength]byte{}) { | ||
f.slotToProposerAndPayloadIDs[slot] = bytes | ||
byte8 := [8]byte{} | ||
if !ok || (ok && bytes.Equal(ids[vIdLength:], byte8[:])) { |
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.
Could you add a unit test for condition bytes.Equal(ids[vIdLength:], byte8[:])
if it's not already covered? Thanks!
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 was already covered. I improved a comment in dc553ac
Co-authored-by: terencechain <[email protected]>
beacon-chain/cache/payload_id.go
Outdated
ids, ok := f.slotToProposerAndPayloadIDs[slot] | ||
// Ok to overwrite if the slot is already set but the cached payload ID is not set. | ||
// This combats the re-org case where payload assignment could change at the start of the epoch. | ||
byte8 := [8]byte{} |
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.
Why do we hardcode 8 here but use vpIdsLength
on line 54?
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.
fixed
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Comment in
ProposerPayloadIDsCache.SetProposerAndPayloadIDs
says:The mentioned payload ID refers to the cached ID, not the new one. The current comparison verifies the new ID.