diff --git a/specs/merge/fork-choice.md b/specs/merge/fork-choice.md index bf67d2f4f..7a8db7dd9 100644 --- a/specs/merge/fork-choice.md +++ b/specs/merge/fork-choice.md @@ -176,10 +176,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None: store.block_states[hash_tree_root(block)] = state # Add proposer score boost if the block is timely - is_before_attestation_broadcast = ( - store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // ATTESTATION_OFFSET_QUOTIENT - ) - if get_current_slot(store) == block.slot and is_before_attestation_broadcast: + is_before_attesting_interval = store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // INTERVALS_PER_SLOT + if get_current_slot(store) == block.slot and is_before_attesting_interval: store.proposer_score_boost = LatestMessage( root=hash_tree_root(block), epoch=compute_epoch_at_slot(block.slot) diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index e2e235acf..5216027cd 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -169,7 +169,6 @@ We define the following Python custom types for type hinting and readability: | `BLSPubkey` | `Bytes48` | a BLS12-381 public key | | `BLSSignature` | `Bytes96` | a BLS12-381 signature | - ## Constants The following values are (non-configurable) constants used throughout the specification. diff --git a/specs/phase0/fork-choice.md b/specs/phase0/fork-choice.md index f302887ec..7a87d0070 100644 --- a/specs/phase0/fork-choice.md +++ b/specs/phase0/fork-choice.md @@ -57,12 +57,18 @@ Any of the above handlers that trigger an unhandled exception (e.g. a failed ass 4) **Manual forks**: Manual forks may arbitrarily change the fork choice rule but are expected to be enacted at epoch transitions, with the fork details reflected in `state.fork`. 5) **Implementation**: The implementation found in this specification is constructed for ease of understanding rather than for optimization in computation, space, or any other resource. A number of optimized alternatives can be found [here](https://github.com/protolambda/lmd-ghost). + +### Constant + +| Name | Value | +| - | - | +| `INTERVALS_PER_SLOT` | `uint64(3)` | + ### Preset | Name | Value | Unit | Duration | | - | - | :-: | :-: | | `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` | `2**3` (= 8) | slots | 96 seconds | -| `ATTESTATION_OFFSET_QUOTIENT` | `uint64(3)` | - | - | ### Configuration @@ -406,10 +412,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None: store.block_states[hash_tree_root(block)] = state # Add proposer score boost if the block is timely - is_before_attestation_broadcast = ( - store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // ATTESTATION_OFFSET_QUOTIENT - ) - if get_current_slot(store) == block.slot and is_before_attestation_broadcast: + is_before_attesting_interval = store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // INTERVALS_PER_SLOT + if get_current_slot(store) == block.slot and is_before_attesting_interval: store.proposer_score_boost = LatestMessage( root=hash_tree_root(block), epoch=compute_epoch_at_slot(block.slot) diff --git a/specs/phase0/validator.md b/specs/phase0/validator.md index 209cc7e5d..e21ff980a 100644 --- a/specs/phase0/validator.md +++ b/specs/phase0/validator.md @@ -446,7 +446,7 @@ def get_block_signature(state: BeaconState, block: BeaconBlock, privkey: int) -> A validator is expected to create, sign, and broadcast an attestation during each epoch. The `committee`, assigned `index`, and assigned `slot` for which the validator performs this role during an epoch are defined by `get_committee_assignment(state, epoch, validator_index)`. -A validator should create and broadcast the `attestation` to the associated attestation subnet when either (a) the validator has received a valid block from the expected block proposer for the assigned `slot` or (b) `1 / ATTESTATION_OFFSET_QUOTIENT` of the `slot` has transpired (`SECONDS_PER_SLOT / ATTESTATION_OFFSET_QUOTIENT` seconds after the start of `slot`) -- whichever comes _first_. +A validator should create and broadcast the `attestation` to the associated attestation subnet when either (a) the validator has received a valid block from the expected block proposer for the assigned `slot` or (b) `1 / INTERVALS_PER_SLOT` of the `slot` has transpired (`SECONDS_PER_SLOT / INTERVALS_PER_SLOT` seconds after the start of `slot`) -- whichever comes _first_. *Note*: Although attestations during `GENESIS_EPOCH` do not count toward FFG finality, these initial attestations do give weight to the fork choice, are rewarded, and should be made. @@ -569,7 +569,7 @@ def get_aggregate_signature(attestations: Sequence[Attestation]) -> BLSSignature #### Broadcast aggregate -If the validator is selected to aggregate (`is_aggregator`), then they broadcast their best aggregate as a `SignedAggregateAndProof` to the global aggregate channel (`beacon_aggregate_and_proof`) `2 / ATTESTATION_OFFSET_QUOTIENT` of the way through the `slot`-that is, `SECONDS_PER_SLOT * 2 / ATTESTATION_OFFSET_QUOTIENT` seconds after the start of `slot`. +If the validator is selected to aggregate (`is_aggregator`), then they broadcast their best aggregate as a `SignedAggregateAndProof` to the global aggregate channel (`beacon_aggregate_and_proof`) `2 / INTERVALS_PER_SLOT` of the way through the `slot`-that is, `SECONDS_PER_SLOT * 2 / INTERVALS_PER_SLOT` seconds after the start of `slot`. Selection proofs are provided in `AggregateAndProof` to prove to the gossip channel that the validator has been selected as an aggregator.