From 346454627d50a2b1537fab1e1149c762510a866f Mon Sep 17 00:00:00 2001 From: Meredith Baxter Date: Mon, 29 Mar 2021 13:45:41 -0400 Subject: [PATCH 1/6] Set altair fork slot to max value --- configs/mainnet/altair.yaml | 2 +- configs/minimal/altair.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/mainnet/altair.yaml b/configs/mainnet/altair.yaml index f30e9fcdc..8b470814f 100644 --- a/configs/mainnet/altair.yaml +++ b/configs/mainnet/altair.yaml @@ -37,7 +37,7 @@ DOMAIN_SYNC_COMMITTEE: 0x07000000 # --------------------------------------------------------------- ALTAIR_FORK_VERSION: 0x01000000 # TBD -ALTAIR_FORK_SLOT: 0 +ALTAIR_FORK_SLOT: 18446744073709551615 # Sync protocol diff --git a/configs/minimal/altair.yaml b/configs/minimal/altair.yaml index afdaf9eb5..ceda44a48 100644 --- a/configs/minimal/altair.yaml +++ b/configs/minimal/altair.yaml @@ -37,7 +37,7 @@ DOMAIN_SYNC_COMMITTEE: 0x07000000 # --------------------------------------------------------------- ALTAIR_FORK_VERSION: 0x01000000 # [customized] -ALTAIR_FORK_SLOT: 0 +ALTAIR_FORK_SLOT: 18446744073709551615 # Sync protocol From 4b81cc21f4eddbd869eedc726165373cf374be42 Mon Sep 17 00:00:00 2001 From: Meredith Baxter Date: Mon, 29 Mar 2021 15:15:53 -0400 Subject: [PATCH 2/6] Update altair/fork.md --- specs/altair/fork.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/altair/fork.md b/specs/altair/fork.md index 1fb87d554..5ffbb2ab5 100644 --- a/specs/altair/fork.md +++ b/specs/altair/fork.md @@ -26,7 +26,7 @@ Warning: this configuration is not definitive. | Name | Value | | - | - | | `ALTAIR_FORK_VERSION` | `Version('0x01000000')` | -| `ALTAIR_FORK_SLOT` | `Slot(0)` **TBD** | +| `ALTAIR_FORK_SLOT` | `Slot(18446744073709551615)` **TBD** | ## Fork to Altair From b151adbd4e68609e6f757e6df4b904b10fa0fe8f Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 30 Mar 2021 16:18:14 -0700 Subject: [PATCH 3/6] Reorder Altair gossip validation conditions Validate the `selection_proof` selects the incoming validator as an aggregator before doing other checks like committee inclusion and (relatively) expensive signature checks. --- specs/altair/p2p-interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/altair/p2p-interface.md b/specs/altair/p2p-interface.md index 0d5af0a71..c4c755733 100644 --- a/specs/altair/p2p-interface.md +++ b/specs/altair/p2p-interface.md @@ -89,10 +89,10 @@ The following validations MUST pass before forwarding the `signed_contribution_a - _[IGNORE]_ The block being signed over (`contribution.beacon_block_root`) has been seen (via both gossip and non-gossip sources). - _[REJECT]_ The subcommittee index is in the allowed range, i.e. `contribution.subcommittee_index < SYNC_COMMITTEE_SUBNET_COUNT`. - _[IGNORE]_ The sync committee contribution is the first valid contribution received for the aggregator with index `contribution_and_proof.aggregator_index` for the slot `contribution.slot`. +- _[REJECT]_ `contribution_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_sync_committee_aggregator(state, contribution.slot, contribution_and_proof.selection_proof)` returns `True`. - _[REJECT]_ The aggregator's validator index is within the current sync committee -- i.e. `state.validators[aggregate_and_proof.aggregator_index].pubkey in state.current_sync_committee.pubkeys`. - _[REJECT]_ The `contribution_and_proof.selection_proof` is a valid signature of the `contribution.slot` by the validator with index `contribution_and_proof.aggregator_index`. -- _[REJECT]_ `contribution_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_sync_committee_aggregator(state, contribution.slot, contribution_and_proof.selection_proof)` returns `True`. - _[REJECT]_ The aggregator signature, `signed_contribution_and_proof.signature`, is valid. - _[REJECT]_ The aggregate signature is valid for the message `beacon_block_root` and aggregate pubkey derived from the participation info in `aggregation_bits` for the subcommittee specified by the `subcommittee_index`. From e8b758f9a60b741b77335bf0b79ee5d8751f4d34 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 31 Mar 2021 17:20:19 +1100 Subject: [PATCH 4/6] Simplify balance calc in `process_sync_committee` --- specs/altair/beacon-chain.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 998958643..207c100d5 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -545,8 +545,7 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None max_slot_rewards = Gwei(max_epoch_rewards * len(included_indices) // len(committee_indices) // SLOTS_PER_EPOCH) # Compute the participant and proposer sync rewards - committee_effective_balance = sum([state.validators[index].effective_balance for index in included_indices]) - committee_effective_balance = max(EFFECTIVE_BALANCE_INCREMENT, committee_effective_balance) + committee_effective_balance = get_total_balance(state, included_indices) for included_index in included_indices: effective_balance = state.validators[included_index].effective_balance inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) From 28216cbcda9062ee7dcc1a263de7db31780e2626 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 31 Mar 2021 13:22:45 -0600 Subject: [PATCH 5/6] fix lint Co-authored-by: Alex Stokes --- 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 207c100d5..5b51be17a 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -545,7 +545,7 @@ def process_sync_committee(state: BeaconState, aggregate: SyncAggregate) -> None max_slot_rewards = Gwei(max_epoch_rewards * len(included_indices) // len(committee_indices) // SLOTS_PER_EPOCH) # Compute the participant and proposer sync rewards - committee_effective_balance = get_total_balance(state, included_indices) + committee_effective_balance = get_total_balance(state, set(included_indices)) for included_index in included_indices: effective_balance = state.validators[included_index].effective_balance inclusion_reward = Gwei(max_slot_rewards * effective_balance // committee_effective_balance) From 45c764618a56c1cb94da8aec2f51c899591d6fc1 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Thu, 1 Apr 2021 15:18:31 +1000 Subject: [PATCH 6/6] Fix missed rename from aggregate_and_proof to contribution_and_proof --- specs/altair/p2p-interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/altair/p2p-interface.md b/specs/altair/p2p-interface.md index 0d5af0a71..6dc431a52 100644 --- a/specs/altair/p2p-interface.md +++ b/specs/altair/p2p-interface.md @@ -90,7 +90,7 @@ The following validations MUST pass before forwarding the `signed_contribution_a - _[REJECT]_ The subcommittee index is in the allowed range, i.e. `contribution.subcommittee_index < SYNC_COMMITTEE_SUBNET_COUNT`. - _[IGNORE]_ The sync committee contribution is the first valid contribution received for the aggregator with index `contribution_and_proof.aggregator_index` for the slot `contribution.slot`. - _[REJECT]_ The aggregator's validator index is within the current sync committee -- - i.e. `state.validators[aggregate_and_proof.aggregator_index].pubkey in state.current_sync_committee.pubkeys`. + i.e. `state.validators[contribution_and_proof.aggregator_index].pubkey in state.current_sync_committee.pubkeys`. - _[REJECT]_ The `contribution_and_proof.selection_proof` is a valid signature of the `contribution.slot` by the validator with index `contribution_and_proof.aggregator_index`. - _[REJECT]_ `contribution_and_proof.selection_proof` selects the validator as an aggregator for the slot -- i.e. `is_sync_committee_aggregator(state, contribution.slot, contribution_and_proof.selection_proof)` returns `True`. - _[REJECT]_ The aggregator signature, `signed_contribution_and_proof.signature`, is valid.