add helper in p2p document to executable spec

This commit is contained in:
Alex Stokes 2021-04-15 11:46:44 -07:00
parent 3c07303c5c
commit ebd16e1b79
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69
1 changed files with 3 additions and 4 deletions

View File

@ -86,11 +86,10 @@ This topic is used to propagate partially aggregated sync committee signatures t
The following validations MUST pass before forwarding the `signed_contribution_and_proof` on the network; define `contribution_and_proof = signed_contribution_and_proof.message`, `contribution = contribution_and_proof.contribution`, and the following function `get_sync_subcommittee_pubkeys` for convenience:
```python
SYNC_SUBCOMMITTEE_SIZE = SYNC_COMMITTEE_SIZE // SYNC_COMMITTEE_SUBNET_COUNT
def get_sync_subcommittee_pubkeys(state: BeaconState, subcommittee_index: uint64) -> Sequence[BLSPubkey]:
i = subcommittee_index * SYNC_SUBCOMMITTEE_SIZE
return state.current_sync_committee.pubkeys[i:i+SYNC_SUBCOMMITTEE_SIZE]
sync_subcommittee_size = SYNC_COMMITTEE_SIZE // SYNC_COMMITTEE_SUBNET_COUNT
i = subcommittee_index * sync_subcommittee_size
return state.current_sync_committee.pubkeys[i:i + sync_subcommittee_size]
```
- _[IGNORE]_ The contribution's slot is for the current slot, i.e. `contribution.slot == current_slot`.