From 0438f2f27c5c3eb1b43c940962fec702361ee1b2 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Sat, 1 May 2021 16:07:43 -0700 Subject: [PATCH 1/3] whitespace --- specs/altair/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 726747c59..25b8bae54 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -409,7 +409,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S #### Modified `slash_validator` -*Note*: The function `slash_validator` is modified to use `MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR` +*Note*: The function `slash_validator` is modified to use `MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR` and use `PROPOSER_WEIGHT` when calculating the proposer reward. ```python From 7b33c1119a383ea693ada3793699e0bb1d43c8de Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Sat, 1 May 2021 16:08:36 -0700 Subject: [PATCH 2/3] simplify sync committee pubkey aggregation in altair --- configs/mainnet/altair.yaml | 2 -- configs/minimal/altair.yaml | 2 -- specs/altair/beacon-chain.md | 8 +++----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/configs/mainnet/altair.yaml b/configs/mainnet/altair.yaml index 3cd4b8419..46b74b3aa 100644 --- a/configs/mainnet/altair.yaml +++ b/configs/mainnet/altair.yaml @@ -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 diff --git a/configs/minimal/altair.yaml b/configs/minimal/altair.yaml index f9b30eea2..42e464ab4 100644 --- a/configs/minimal/altair.yaml +++ b/configs/minimal/altair.yaml @@ -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 diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 25b8bae54..96a14fe21 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -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` From 9c3d5982cfbe9a52b02e2bd028a873c9226a34c9 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 4 May 2021 12:16:39 -0700 Subject: [PATCH 3/3] add documentation about duplicate pubkeys --- specs/altair/beacon-chain.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 96a14fe21..b75835d55 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -302,6 +302,14 @@ def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[Val def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee: """ Return the sync committee for a given ``state`` and ``epoch``. + + ``SyncCommittee`` contains an aggregate pubkey that enables + resource-constrained clients to save some computation when verifying + the sync committee's signature. + + ``SyncCommittee`` can also contain duplicate pubkeys, when ``get_sync_committee_indices`` + returns duplicate indices. Implementations must take care when handling + optimizations relating to aggregation and verification in the presence of duplicates. """ indices = get_sync_committee_indices(state, epoch) pubkeys = [state.validators[index].pubkey for index in indices]