-
Notifications
You must be signed in to change notification settings - Fork 996
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
Use fork choice to determine finalized_checkpoint
in gossip validation
#3543
Conversation
Update gossip validation rules to use the highest `finalized_checkpoint` across _all_ branches (`store.finalized_checkpoint`), instead of the one on the currently selected branch (`state.finalized_checkpoint`) when deciding whether to ignore a block / blob because they are already finalized.
- `finalized_root`: `state.finalized_checkpoint.root` for the state corresponding to the head block | ||
- `finalized_root`: `store.finalized_checkpoint.root` according to [fork choice](./fork-choice.md). | ||
(Note this defaults to `Root(b'\x00' * 32)` for the genesis finalized checkpoint). | ||
- `finalized_epoch`: `state.finalized_checkpoint.epoch` for the state corresponding to the head block. | ||
- `finalized_epoch`: `store.finalized_checkpoint.epoch` according to [fork choice](./fork-choice.md). |
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.
These are for the libp2p Status
message
i.e. validate that `signed_beacon_block.message.slot > compute_start_slot_at_epoch(state.finalized_checkpoint.epoch)` | ||
i.e. validate that `signed_beacon_block.message.slot > compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)` |
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.
blocks gossip
- _[IGNORE]_ The sidecar is from a slot greater than the latest finalized slot -- i.e. validate that `block_header.slot > compute_start_slot_at_epoch(state.finalized_checkpoint.epoch)` | ||
- _[IGNORE]_ The sidecar is from a slot greater than the latest finalized slot -- i.e. validate that `block_header.slot > compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)` |
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.
blobs gossip
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.
Lodestar determines finality for gossip validation from the fork-choice store since genesis
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'm not an expert on this, but using the fork-choice store looks cleaner (even though it may not be different assuming that 2/3 of validators are honest). So this LGTM.
notably, it doesn't move backwards when you reorg |
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.
Makes sense to me 👍
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 is certainly the intention of the spec since genesis. With state
being poorly defined, definitely see how this was incorrect as is
@@ -691,9 +691,9 @@ The fields are, as seen by the client at the time of sending the message: | |||
- `current_fork_version` is the fork version at the node's current epoch defined by the wall-clock time | |||
(not necessarily the epoch to which the node is sync) | |||
- `genesis_validators_root` is the static `Root` found in `state.genesis_validators_root` | |||
- `finalized_root`: `state.finalized_checkpoint.root` for the state corresponding to the head block | |||
- `finalized_root`: `store.finalized_checkpoint.root` according to [fork choice](./fork-choice.md). |
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 is a no-op, right? The state
here is implicitly your head which is going to share the store's finalized checkpoint by definition
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.
no, there may be a reorg that unrealizes finality in state
that was already realized on a different branch - store.finalized_checkpoint
tracks the highest finality across all branches, while state
just tracks the one from the branch currently selected by fork choice (which may be lower).
Update gossip validation rules to use the highest
finalized_checkpoint
across all branches (store.finalized_checkpoint
), instead of the one on the currently selected branch (state.finalized_checkpoint
) when deciding whether to ignore a block / blob because they are already finalized.