From e2a045210827a80e57e1cc2815bb183c48d3950b Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 5 Mar 2019 06:07:00 -0700 Subject: [PATCH] fix previous root (#716) --- specs/core/0_beacon-chain.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 81a757db2..ff1ec1ea1 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1693,10 +1693,10 @@ At every `slot > GENESIS_SLOT` run the following function: ```python def advance_slot(state: BeaconState) -> None: state.latest_state_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = hash_tree_root(state) - state.latest_block_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = get_block_root(state, state.slot - 1) - state.slot += 1 if state.latest_block_header.state_root == ZERO_HASH: - state.latest_block_header.state_root = get_state_root(state, state.slot - 1) + state.latest_block_header.state_root = get_state_root(state, state.slot) + state.latest_block_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = hash_tree_root(state.latest_block_header) + state.slot += 1 ``` ### Per-block processing @@ -1711,8 +1711,6 @@ def process_block_header(state: BeaconState, block: BeaconBlock) -> None: assert block.slot == state.slot # Verify that the parent matches assert block.previous_block_root == hash_tree_root(state.latest_block_header) - # Save previous block root - state.latest_block_roots[(state.slot - 1) % SLOTS_PER_HISTORICAL_ROOT] = block.previous_block_root # Save current block as the new latest block state.latest_block_header = get_temporary_block_header(block) # Verify proposer signature