From 27889860f098f92a60b7e543d61c5c156aeecb44 Mon Sep 17 00:00:00 2001 From: ericsson Date: Wed, 16 Jun 2021 12:03:20 +0300 Subject: [PATCH 1/3] fix typo: sometimes `change()` invoked on `ShardWork` itself, should be invoked on its `status` field --- specs/sharding/beacon-chain.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 98feba22b..d57e97752 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -576,12 +576,12 @@ def update_pending_shard_work(state: BeaconState, attestation: Attestation) -> N # TODO In Altair: set participation bit flag for voters of this early winning header if pending_header.commitment == DataCommitment(): # The committee voted to not confirm anything - state.shard_buffer[buffer_index][attestation_shard].change( + state.shard_buffer[buffer_index][attestation_shard].status.change( selector=SHARD_WORK_UNCONFIRMED, value=None, ) else: - state.shard_buffer[buffer_index][attestation_shard].change( + state.shard_buffer[buffer_index][attestation_shard].status.change( selector=SHARD_WORK_CONFIRMED, value=pending_header.commitment, ) @@ -785,7 +785,7 @@ def reset_pending_shard_work(state: BeaconState) -> None: shard = (start_shard + committee_index) % active_shards # a committee is available, initialize a pending shard-header list committee_length = len(get_beacon_committee(state, slot, committee_index)) - state.shard_buffer[buffer_index][shard].change( + state.shard_buffer[buffer_index][shard].status.change( selector=SHARD_WORK_PENDING, value=List[PendingShardHeader, MAX_SHARD_HEADERS_PER_SHARD]( PendingShardHeader( From d83ca352d5b89a1b11aedeb290f3c3730766d331 Mon Sep 17 00:00:00 2001 From: ericsson Date: Wed, 16 Jun 2021 13:33:56 +0300 Subject: [PATCH 2/3] Fix typing problem: `append` is invoked on a `ShardWork` instance --- specs/sharding/beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 98feba22b..e6137748c 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -608,7 +608,7 @@ def process_shard_header(state: BeaconState, signed_header: SignedShardBlobHeade assert committee_work.status.selector == SHARD_WORK_PENDING # Check that this header is not yet in the pending list - current_headers: Sequence[PendingShardHeader] = committee_work.status.value + current_headers: MutableSequence[PendingShardHeader] = committee_work.status.value header_root = hash_tree_root(header) assert header_root not in [pending_header.root for pending_header in current_headers] @@ -640,7 +640,7 @@ def process_shard_header(state: BeaconState, signed_header: SignedShardBlobHeade ) # Include it in the pending list - state.shard_buffer[header.slot % SHARD_STATE_MEMORY_SLOTS][header.shard].append(pending_header) + current_headers.append(pending_header) ``` The degree proof works as follows. For a block `B` with length `l` (so `l` values in `[0...l - 1]`, seen as a polynomial `B(X)` which takes these values), From 5b4f89875c26d4a15b3a83bc8eb5d255a328179e Mon Sep 17 00:00:00 2001 From: ericsson Date: Wed, 16 Jun 2021 14:06:17 +0300 Subject: [PATCH 3/3] use `List[PendingShardHeader,...]` instead of `MutableSequence`, since `remerkleable.List` does not implement the latter --- 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 e6137748c..6a6772690 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -608,7 +608,7 @@ def process_shard_header(state: BeaconState, signed_header: SignedShardBlobHeade assert committee_work.status.selector == SHARD_WORK_PENDING # Check that this header is not yet in the pending list - current_headers: MutableSequence[PendingShardHeader] = committee_work.status.value + current_headers: List[PendingShardHeader, MAX_SHARD_HEADERS_PER_SHARD] = committee_work.status.value header_root = hash_tree_root(header) assert header_root not in [pending_header.root for pending_header in current_headers]