From abda2dd5fa0d591efab511ce923793cb8ff79b58 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Fri, 14 May 2021 12:02:46 -0700 Subject: [PATCH 1/6] Sharding: move `get_committee_count_per_slot` to the outside --- specs/sharding/beacon-chain.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index b555e962f..775e1f551 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -760,8 +760,9 @@ def reset_pending_headers(state: BeaconState) -> None: # Add dummy "empty" PendingShardHeader (default vote for if no shard header available) next_epoch = get_current_epoch(state) + 1 next_epoch_start_slot = compute_start_slot_at_epoch(next_epoch) + committees_per_slot = get_committee_count_per_slot(state, next_epoch) for slot in range(next_epoch_start_slot, next_epoch_start_slot + SLOTS_PER_EPOCH): - for index in range(get_committee_count_per_slot(state, next_epoch)): + for index in range(committees_per_slot): committee_index = CommitteeIndex(index) shard = compute_shard_from_committee_index(state, slot, committee_index) committee_length = len(get_beacon_committee(state, slot, committee_index)) From fcf37895ba959a7dd9d6bff8ca56eab06a1c0e78 Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 18 May 2021 00:48:59 +0200 Subject: [PATCH 2/6] remove duplicate sharding config var, fix minimal-sharding-config fork epoch name --- configs/mainnet/sharding.yaml | 5 ----- configs/minimal/sharding.yaml | 7 +------ specs/sharding/beacon-chain.md | 7 ------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/configs/mainnet/sharding.yaml b/configs/mainnet/sharding.yaml index b3c22c354..af7e94f00 100644 --- a/configs/mainnet/sharding.yaml +++ b/configs/mainnet/sharding.yaml @@ -34,11 +34,6 @@ MAX_GASPRICE: 8589934592 # 2**3 (= 8) Gwei MIN_GASPRICE: 8 -# Time parameters -# --------------------------------------------------------------- -# 2**8 (= 256) | epochs -SHARD_COMMITTEE_PERIOD: 256 - # Signature domains # --------------------------------------------------------------- DOMAIN_SHARD_PROPOSER: 0x80000000 diff --git a/configs/minimal/sharding.yaml b/configs/minimal/sharding.yaml index c6ca8b560..2db2acffa 100644 --- a/configs/minimal/sharding.yaml +++ b/configs/minimal/sharding.yaml @@ -4,7 +4,7 @@ # --------------------------------------------------------------- SHARDING_FORK_VERSION: 0x03000001 # TBD, temporarily max uint64 value: 2**64 - 1 -MERGE_FORK_EPOCH: 18446744073709551615 +SHARDING_FORK_EPOCH: 18446744073709551615 # Beacon-chain @@ -34,11 +34,6 @@ MAX_GASPRICE: 8589934592 # 2**3 (= 8) Gwei MIN_GASPRICE: 8 -# Time parameters -# --------------------------------------------------------------- -# 2**8 (= 256) | epochs -SHARD_COMMITTEE_PERIOD: 256 - # Signature domains # --------------------------------------------------------------- DOMAIN_SHARD_PROPOSER: 0x80000000 diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 775e1f551..d7fd42f22 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -16,7 +16,6 @@ - [Shard block configs](#shard-block-configs) - [Precomputed size verification points](#precomputed-size-verification-points) - [Gwei values](#gwei-values) - - [Time parameters](#time-parameters) - [Domain types](#domain-types) - [Updated containers](#updated-containers) - [`AttestationData`](#attestationdata) @@ -123,12 +122,6 @@ The following values are (non-configurable) constants used throughout the specif | `MAX_GASPRICE` | `Gwei(2**33)` (= 8,589,934,592) | Gwei | Max gasprice charged for a TARGET-sized shard block | | `MIN_GASPRICE` | `Gwei(2**3)` (= 8) | Gwei | Min gasprice charged for a TARGET-sized shard block | -### Time parameters - -| Name | Value | Unit | Duration | -| - | - | :-: | :-: | -| `SHARD_COMMITTEE_PERIOD` | `Epoch(2**8)` (= 256) | epochs | ~27 hours | - ### Domain types | Name | Value | From a7344b3ee1b5287362631540727bf5bbb000a278 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 17 May 2021 21:35:43 -0700 Subject: [PATCH 3/6] Fix `PARTICIPATION_FLAG_WEIGHTS` to use correct head weight --- 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 bb2d9554e..17d1efc51 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -99,7 +99,7 @@ Altair is the first beacon chain hard fork. Its main features are: | Name | Value | | - | - | | `G2_POINT_AT_INFINITY` | `BLSSignature(b'\xc0' + b'\x00' * 95)` | -| `PARTICIPATION_FLAG_WEIGHTS` | `[TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_FLAG_INDEX]` | +| `PARTICIPATION_FLAG_WEIGHTS` | `[TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT]` | ## Configuration From 441992c77919fb9a84504db23182ced718cb3175 Mon Sep 17 00:00:00 2001 From: ericsson Date: Tue, 18 May 2021 14:14:43 +0300 Subject: [PATCH 4/6] Fix typing problem in `sharding.process_block` --- specs/sharding/beacon-chain.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index d7fd42f22..8512e15d9 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -459,7 +459,9 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None: process_randao(state, block.body) process_eth1_data(state, block.body) process_operations(state, block.body) # [Modified in Sharding] - process_execution_payload(state, block.body) # [New in Merge] + # Pre-merge, skip execution payload processing + if is_execution_enabled(state, block): + process_execution_payload(state, block.body.execution_payload, EXECUTION_ENGINE) # [New in Merge] ``` #### Operations From c03c72a543b04423c36a825d50d4eb840e3c193f Mon Sep 17 00:00:00 2001 From: terence tsao Date: Tue, 18 May 2021 13:50:46 -0700 Subject: [PATCH 5/6] Altair fork: add a link --- specs/altair/fork.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/altair/fork.md b/specs/altair/fork.md index b4c4e3a31..f7aa89c42 100644 --- a/specs/altair/fork.md +++ b/specs/altair/fork.md @@ -41,8 +41,8 @@ Note that for the pure Altair networks, we don't apply `upgrade_to_altair` since If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == ALTAIR_FORK_EPOCH`, an irregular state change is made to upgrade to Altair. The upgrade occurs after the completion of the inner loop of `process_slots` that sets `state.slot` equal to `ALTAIR_FORK_EPOCH * SLOTS_PER_EPOCH`. -Care must be taken when transitioning through the fork boundary as implementations will need a modified state transition function that deviates from the Phase 0 spec. -In particular, the outer `state_transition` function defined in the Phase 0 spec will not expose the precise fork slot to execute the upgrade in the presence of skipped slots at the fork boundary. Instead the logic must be within `process_slots`. +Care must be taken when transitioning through the fork boundary as implementations will need a modified [state transition function](../phase0/beacon-chain.md#beacon-chain-state-transition-function) that deviates from the Phase 0 document. +In particular, the outer `state_transition` function defined in the Phase 0 document will not expose the precise fork slot to execute the upgrade in the presence of skipped slots at the fork boundary. Instead the logic must be within `process_slots`. ```python def translate_participation(state: BeaconState, pending_attestations: Sequence[phase0.PendingAttestation]) -> None: From 19a8076b8953cf1d5680fd7edec4a7ee74c6a46c Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 18 May 2021 15:57:44 -0600 Subject: [PATCH 6/6] bump VERSION.txt to alpha.5 --- tests/core/pyspec/eth2spec/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/VERSION.txt b/tests/core/pyspec/eth2spec/VERSION.txt index 4b68ba4fa..d87416ff1 100644 --- a/tests/core/pyspec/eth2spec/VERSION.txt +++ b/tests/core/pyspec/eth2spec/VERSION.txt @@ -1 +1 @@ -1.1.0-alpha.4 \ No newline at end of file +1.1.0-alpha.5 \ No newline at end of file