From 3d108e7fe2cde0055a64af8aa4c9a5bb704563d3 Mon Sep 17 00:00:00 2001 From: vbuterin Date: Thu, 10 Dec 2020 14:37:00 +0800 Subject: [PATCH] Made confirmed headers a separate object --- specs/phase1/beacon-chain.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index 92ac59162..36ae05fca 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -108,7 +108,7 @@ class BeaconBlock(phase0.BeaconBlock): class BeaconState(phase0.BeaconState): current_epoch_pending_headers: List[PendingHeader, MAX_PENDING_HEADERS * SLOTS_PER_EPOCH] previous_epoch_pending_headers: List[PendingHeader, MAX_PENDING_HEADERS * SLOTS_PER_EPOCH] - confirmed_header_root: Root + two_epochs_ago_confirmed_headers: Vector[Vector[PendingShardHeader, SLOTS_PER_EPOCH], MAX_SHARDS] shard_gasprice: uint64 current_epoch_start_shard: Shard ``` @@ -497,13 +497,12 @@ def process_pending_headers(state: BeaconState): # If no votes, zero wins winning_index = [c.root for c in candidates].index(Root()) candidates[winning_index].confirmed = True - confirmed_headers = Vector[ - Vector[PendingShardHeader, SLOTS_PER_EPOCH], MAX_SHARDS - ]() + for slot in range(SLOTS_PER_EPOCH): + for shard in range(SHARD_COUNT): + state.two_epochs_ago_confirmed_headers[shard][slot] = PendingHeader() for c in state.previous_epoch_pending_headers: if c.confirmed: - confirmed_headers[c.shard][c.slot % SLOTS_PER_EPOCH] = c - state.confirmed_header_root = hash_tree_root(confirmed_headers) + state.two_epochs_ago_confirmed_headers[c.shard][c.slot % SLOTS_PER_EPOCH] = c ``` ```python