fix tests and minor copy edit
This commit is contained in:
parent
1310105174
commit
5dd29b6659
|
@ -292,10 +292,10 @@ The validator broadcasts the assembled signature to the assigned subnet, the `sy
|
||||||
The `subnet_id` is derived from the position in the sync committee such that the sync committee is divided into "subcommittees".
|
The `subnet_id` is derived from the position in the sync committee such that the sync committee is divided into "subcommittees".
|
||||||
`subnet_id` can be computed via `compute_subnets_for_sync_committee(state, validator_index)` where `state` is a `BeaconState` during the matching sync committee period.
|
`subnet_id` can be computed via `compute_subnets_for_sync_committee(state, validator_index)` where `state` is a `BeaconState` during the matching sync committee period.
|
||||||
|
|
||||||
*Note*: This function returns multiple non-duplicated subnets if a given validator index is included multiple times in a given sync committee across multiple subcommittees.
|
*Note*: This function returns multiple deduplicated subnets if a given validator index is included multiple times in a given sync committee across multiple subcommittees.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def compute_subnets_for_sync_committee(state: BeaconState, validator_index: ValidatorIndex) -> Sequence[uint64]:
|
def compute_subnets_for_sync_committee(state: BeaconState, validator_index: ValidatorIndex) -> Set[uint64]:
|
||||||
next_slot_epoch = compute_epoch_at_slot(Slot(state.slot + 1))
|
next_slot_epoch = compute_epoch_at_slot(Slot(state.slot + 1))
|
||||||
if compute_sync_committee_period(get_current_epoch(state)) == compute_sync_committee_period(next_slot_epoch):
|
if compute_sync_committee_period(get_current_epoch(state)) == compute_sync_committee_period(next_slot_epoch):
|
||||||
sync_committee = state.current_sync_committee
|
sync_committee = state.current_sync_committee
|
||||||
|
|
|
@ -149,9 +149,10 @@ def _subnet_for_sync_committee_index(spec, i):
|
||||||
|
|
||||||
|
|
||||||
def _get_expected_subnets_by_pubkey(sync_committee_members):
|
def _get_expected_subnets_by_pubkey(sync_committee_members):
|
||||||
expected_subnets_by_pubkey = defaultdict(list)
|
# Build deduplicated set for each pubkey
|
||||||
|
expected_subnets_by_pubkey = defaultdict(set)
|
||||||
for (subnet, pubkey) in sync_committee_members:
|
for (subnet, pubkey) in sync_committee_members:
|
||||||
expected_subnets_by_pubkey[pubkey].append(subnet)
|
expected_subnets_by_pubkey[pubkey].add(subnet)
|
||||||
return expected_subnets_by_pubkey
|
return expected_subnets_by_pubkey
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue