From ee360df689af6bf4ec3edad4a45d0bb2c2dd07d2 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 00:12:28 +0300 Subject: [PATCH 1/6] missed `body_summary` attribute when accessing`ShardBlobBodySummary.beacon_block_root` --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 3cd262ed6..c1fee19bd 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -559,7 +559,7 @@ def process_shard_header(state: BeaconState, assert header.shard < get_active_shard_count(state, header_epoch) # Verify that the block root matches, # to ensure the header will only be included in this specific Beacon Chain sub-tree. - assert header.beacon_block_root == get_block_root_at_slot(state, header.slot - 1) + assert header.body_summary.beacon_block_root == get_block_root_at_slot(state, header.slot - 1) # Verify proposer assert header.proposer_index == get_shard_proposer_index(state, header.slot, header.shard) # Verify signature From 47e52a636122b707399c81f3b0241462e9bb6073 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 17:32:05 +0300 Subject: [PATCH 2/6] fix typo: `get_shard_proposer_index` vs `get_shard_proposer` --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index c1fee19bd..8ae66b5e6 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -728,7 +728,7 @@ def charge_confirmed_header_fees(state: BeaconState) -> None: candidate = confirmed_candidates[0] # Charge EIP 1559 fee - proposer = get_shard_proposer(state, slot, shard) + proposer = get_shard_proposer_index(state, slot, shard) fee = ( (state.shard_gasprice * candidate.commitment.length) // TARGET_SAMPLES_PER_BLOCK From 6814efac2e8934f15409bbf976aec671d1356c62 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 17:32:59 +0300 Subject: [PATCH 3/6] fix typo: `state` missed in `get_committee_count_per_slot` call --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 8ae66b5e6..f577ab1df 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -752,7 +752,7 @@ def reset_pending_headers(state: BeaconState) -> None: next_epoch = get_current_epoch(state) + 1 next_epoch_start_slot = compute_start_slot_at_epoch(next_epoch) for slot in range(next_epoch_start_slot, next_epoch_start_slot + SLOTS_IN_EPOCH): - for index in range(get_committee_count_per_slot(next_epoch)): + for index in range(get_committee_count_per_slot(state, next_epoch)): shard = compute_shard_from_committee_index(state, slot, index) committee_length = len(get_beacon_committee(state, slot, shard)) state.current_epoch_pending_shard_headers.append(PendingShardHeader( From 77bceeae690f8d41cbe0b08812ae8f073a216554 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 17:33:53 +0300 Subject: [PATCH 4/6] fix typo: `SLOTS_IN_EPOCH` used instead of `SLOTS_PER_EPOCH` --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index f577ab1df..41dcca410 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -751,7 +751,7 @@ 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) - for slot in range(next_epoch_start_slot, next_epoch_start_slot + SLOTS_IN_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)): shard = compute_shard_from_committee_index(state, slot, index) committee_length = len(get_beacon_committee(state, slot, shard)) From e05356893f9e769739ba3e61435027daffaa88d0 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 17:38:09 +0300 Subject: [PATCH 5/6] fix typo: `c` var name used instad of `header` in `process_pending_headers` --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 41dcca410..28491731e 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -706,7 +706,7 @@ def process_pending_headers(state: BeaconState) -> None: state.grandparent_epoch_confirmed_commitments[shard][slot_index] = DataCommitment() confirmed_headers = [candidate for candidate in state.previous_epoch_pending_shard_headers if candidate.confirmed] for header in confirmed_headers: - state.grandparent_epoch_confirmed_commitments[c.shard][c.slot % SLOTS_PER_EPOCH] = c.commitment + state.grandparent_epoch_confirmed_commitments[header.shard][header.slot % SLOTS_PER_EPOCH] = header.commitment ``` ```python From 6288252d44445ce5cbdb685da3fcd0f6d119c785 Mon Sep 17 00:00:00 2001 From: ericsson Date: Sat, 24 Apr 2021 17:46:55 +0300 Subject: [PATCH 6/6] fix typo: `process_confirmed_header_fees` called instead of `charge_confirmed_header_fees` --- specs/sharding/beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 28491731e..04a469a60 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -644,7 +644,7 @@ def process_epoch(state: BeaconState) -> None: # Sharding process_pending_headers(state) - process_confirmed_header_fees(state) + charge_confirmed_header_fees(state) reset_pending_headers(state) # Final updates