Merge pull request #2308 from ralexstokes/fix-altair-val-fns

Clean up unnecessary function arguments in Altair validator guide
This commit is contained in:
Alex Stokes 2021-04-05 17:15:51 -07:00 committed by GitHub
commit ed3c8d2755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -220,8 +220,7 @@ Given a collection of the best seen `contributions` (with no repeating `subcommi
the proposer processes them as follows: the proposer processes them as follows:
```python ```python
def process_sync_committee_contributions(state: BeaconState, def process_sync_committee_contributions(block: BeaconBlock,
block: BeaconBlock,
contributions: Set[SyncCommitteeContribution]) -> None: contributions: Set[SyncCommitteeContribution]) -> None:
sync_aggregate = SyncAggregate() sync_aggregate = SyncAggregate()
signatures = [] signatures = []
@ -310,7 +309,7 @@ Each slot some sync committee members in each subcommittee are selected to aggre
##### Aggregation selection ##### Aggregation selection
A validator is selected to aggregate based on the computation in `is_sync_committee_aggregator` where `state` is a `BeaconState` as supplied to `get_sync_committee_selection_proof` and `signature` is the BLS signature returned by `get_sync_committee_selection_proof`. A validator is selected to aggregate based on the computation in `is_sync_committee_aggregator` where `signature` is the BLS signature returned by `get_sync_committee_selection_proof`.
The signature function takes a `BeaconState` with the relevant sync committees for the queried `slot` (i.e. `state.slot` is within the span covered by the current or next sync committee period), the `subcommittee_index` equal to the `subnet_id`, and the `privkey` is the BLS private key associated with the validator. The signature function takes a `BeaconState` with the relevant sync committees for the queried `slot` (i.e. `state.slot` is within the span covered by the current or next sync committee period), the `subcommittee_index` equal to the `subnet_id`, and the `privkey` is the BLS private key associated with the validator.
```python ```python
@ -326,7 +325,7 @@ def get_sync_committee_selection_proof(state: BeaconState, slot: Slot,
``` ```
```python ```python
def is_sync_committee_aggregator(state: BeaconState, signature: BLSSignature) -> bool: def is_sync_committee_aggregator(signature: BLSSignature) -> bool:
modulo = max(1, SYNC_COMMITTEE_SIZE // SYNC_COMMITTEE_SUBNET_COUNT // TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE) modulo = max(1, SYNC_COMMITTEE_SIZE // SYNC_COMMITTEE_SUBNET_COUNT // TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE)
return bytes_to_uint64(hash(signature)[0:8]) % modulo == 0 return bytes_to_uint64(hash(signature)[0:8]) % modulo == 0
``` ```