minor formatting cleanups

This commit is contained in:
Danny Ryan 2021-11-22 11:29:12 -07:00
parent 88c76abd7f
commit cebe6ba7e7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
4 changed files with 13 additions and 12 deletions

View File

@ -176,10 +176,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
store.block_states[hash_tree_root(block)] = state store.block_states[hash_tree_root(block)] = state
# Add proposer score boost if the block is timely # Add proposer score boost if the block is timely
is_before_attestation_broadcast = ( is_before_attesting_interval = store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // ATTESTATION_OFFSET_QUOTIENT if get_current_slot(store) == block.slot and is_before_attesting_interval:
)
if get_current_slot(store) == block.slot and is_before_attestation_broadcast:
store.proposer_score_boost = LatestMessage( store.proposer_score_boost = LatestMessage(
root=hash_tree_root(block), root=hash_tree_root(block),
epoch=compute_epoch_at_slot(block.slot) epoch=compute_epoch_at_slot(block.slot)

View File

@ -169,7 +169,6 @@ We define the following Python custom types for type hinting and readability:
| `BLSPubkey` | `Bytes48` | a BLS12-381 public key | | `BLSPubkey` | `Bytes48` | a BLS12-381 public key |
| `BLSSignature` | `Bytes96` | a BLS12-381 signature | | `BLSSignature` | `Bytes96` | a BLS12-381 signature |
## Constants ## Constants
The following values are (non-configurable) constants used throughout the specification. The following values are (non-configurable) constants used throughout the specification.

View File

@ -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`. 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). 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 ### Preset
| Name | Value | Unit | Duration | | Name | Value | Unit | Duration |
| - | - | :-: | :-: | | - | - | :-: | :-: |
| `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` | `2**3` (= 8) | slots | 96 seconds | | `SAFE_SLOTS_TO_UPDATE_JUSTIFIED` | `2**3` (= 8) | slots | 96 seconds |
| `ATTESTATION_OFFSET_QUOTIENT` | `uint64(3)` | - | - |
### Configuration ### Configuration
@ -406,10 +412,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
store.block_states[hash_tree_root(block)] = state store.block_states[hash_tree_root(block)] = state
# Add proposer score boost if the block is timely # Add proposer score boost if the block is timely
is_before_attestation_broadcast = ( is_before_attesting_interval = store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
store.time % SECONDS_PER_SLOT < SECONDS_PER_SLOT // ATTESTATION_OFFSET_QUOTIENT if get_current_slot(store) == block.slot and is_before_attesting_interval:
)
if get_current_slot(store) == block.slot and is_before_attestation_broadcast:
store.proposer_score_boost = LatestMessage( store.proposer_score_boost = LatestMessage(
root=hash_tree_root(block), root=hash_tree_root(block),
epoch=compute_epoch_at_slot(block.slot) epoch=compute_epoch_at_slot(block.slot)

View File

@ -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 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. *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 #### 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. Selection proofs are provided in `AggregateAndProof` to prove to the gossip channel that the validator has been selected as an aggregator.