simplify sync committee pubkey aggregation in altair

This commit is contained in:
Alex Stokes 2021-05-01 16:08:36 -07:00
parent 0438f2f27c
commit 7b33c1119a
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69
3 changed files with 3 additions and 9 deletions

View File

@ -14,8 +14,6 @@ PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2
# ---------------------------------------------------------------
# 2**10 (= 1,024)
SYNC_COMMITTEE_SIZE: 1024
# 2**6 (= 64)
SYNC_PUBKEYS_PER_AGGREGATE: 64
# 2**2 (= 4)
INACTIVITY_SCORE_BIAS: 4

View File

@ -14,8 +14,6 @@ PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2
# ---------------------------------------------------------------
# [customized]
SYNC_COMMITTEE_SIZE: 32
# [customized]
SYNC_PUBKEYS_PER_AGGREGATE: 16
# 2**2 (= 4)
INACTIVITY_SCORE_BIAS: 4

View File

@ -119,7 +119,6 @@ This patch updates a few configuration values to move penalty parameters toward
| Name | Value |
| - | - |
| `SYNC_COMMITTEE_SIZE` | `uint64(2**10)` (= 1,024) |
| `SYNC_PUBKEYS_PER_AGGREGATE` | `uint64(2**6)` (= 64) |
| `INACTIVITY_SCORE_BIAS` | `uint64(4)` |
### Time parameters
@ -212,7 +211,7 @@ class SyncAggregate(Container):
```python
class SyncCommittee(Container):
pubkeys: Vector[BLSPubkey, SYNC_COMMITTEE_SIZE]
pubkey_aggregates: Vector[BLSPubkey, SYNC_COMMITTEE_SIZE // SYNC_PUBKEYS_PER_AGGREGATE]
aggregate_pubkey: BLSPubkey
```
## Helper functions
@ -306,9 +305,8 @@ def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee:
"""
indices = get_sync_committee_indices(state, epoch)
pubkeys = [state.validators[index].pubkey for index in indices]
partition = [pubkeys[i:i + SYNC_PUBKEYS_PER_AGGREGATE] for i in range(0, len(pubkeys), SYNC_PUBKEYS_PER_AGGREGATE)]
pubkey_aggregates = [bls.AggregatePKs(preaggregate) for preaggregate in partition]
return SyncCommittee(pubkeys=pubkeys, pubkey_aggregates=pubkey_aggregates)
aggregate_pubkey = bls.AggregatePKs(pubkeys)
return SyncCommittee(pubkeys=pubkeys, aggregate_pubkey=aggregate_pubkey)
```
#### `get_base_reward_per_increment`