Skip to content

Commit

Permalink
Allow second sync committee message to propagate if first one is stale
Browse files Browse the repository at this point in the history
The sync committee message signature does not sign over the slot, making
it possible for stale messages to be adjusted and replayed, possibly
preventing new sync committee messages to propagate. If such a message
for an older head is received, allow a second message to propagate that
refers to the current head as selected by fork choice, overriding the
previous one.

Also add a couple sanity checks, as in, disallowing messages referring
to unknown or invalid blocks to spread, in line with existing rules for
blob sidecars, parent block roots and attestations.
  • Loading branch information
etan-status committed Nov 20, 2024
1 parent a09d0c3 commit c54a6be
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion specs/altair/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def get_sync_subcommittee_pubkeys(state: BeaconState, subcommittee_index: uint64
- _[REJECT]_ `contribution_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_sync_committee_aggregator(contribution_and_proof.selection_proof)` returns `True`.
- _[REJECT]_ The aggregator's validator index is in the declared subcommittee of the current sync committee --
i.e. `state.validators[contribution_and_proof.aggregator_index].pubkey in get_sync_subcommittee_pubkeys(state, contribution.subcommittee_index)`.
- _[IGNORE]_ The block being signed (`contribution_and_proof.contribution.beacon_block_root`) has been seen (via both gossip and non-gossip sources) (a client MAY queue sync committee contributions for processing once block is received)
- _[REJECT]_ The block being signed (`contribution_and_proof.contribution.beacon_block_root`) passes validation.
- _[IGNORE]_ A valid sync committee contribution with equal `slot`, `beacon_block_root` and `subcommittee_index` whose `aggregation_bits` is non-strict superset has _not_ already been seen.
- _[IGNORE]_ The sync committee contribution is the first valid contribution received for the aggregator with index `contribution_and_proof.aggregator_index`
for the slot `contribution.slot` and subcommittee index `contribution.subcommittee_index`
Expand All @@ -161,7 +163,9 @@ The following validations MUST pass before forwarding the `sync_committee_messag
- _[IGNORE]_ The message's slot is for the current slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance), i.e. `sync_committee_message.slot == current_slot`.
- _[REJECT]_ The `subnet_id` is valid for the given validator, i.e. `subnet_id in compute_subnets_for_sync_committee(state, sync_committee_message.validator_index)`.
Note this validation implies the validator is part of the broader current sync committee along with the correct subcommittee.
- _[IGNORE]_ There has been no other valid sync committee message for the declared `slot` for the validator referenced by `sync_committee_message.validator_index`
- _[IGNORE]_ The block being signed (`sync_committee_message.beacon_block_root`) has been seen (via both gossip and non-gossip sources) (a client MAY queue sync committee messages for processing once block is retrieved).
- _[REJECT]_ The block being signed (`sync_committee_message.beacon_block_root`) passes validation.
- _[IGNORE]_ There has been no other valid sync committee message for the declared `slot` for the validator referenced by `sync_committee_message.validator_index`, unless the block being signed (`beacon_block_root`) matches the local head as selected by fork choice, and the earlier valid sync committee message does not match
(this requires maintaining a cache of size `SYNC_COMMITTEE_SIZE // SYNC_COMMITTEE_SUBNET_COUNT` for each subnet that can be flushed after each slot).
Note this validation is _per topic_ so that for a given `slot`, multiple messages could be forwarded with the same `validator_index` as long as the `subnet_id`s are distinct.
- _[REJECT]_ The `signature` is valid for the message `beacon_block_root` for the validator referenced by `validator_index`.
Expand Down

0 comments on commit c54a6be

Please sign in to comment.