From 416bbf9ceab00cdcecc955e5b712e0b32adcc8ea Mon Sep 17 00:00:00 2001 From: vbuterin Date: Mon, 17 Dec 2018 04:40:27 -0500 Subject: [PATCH] Edit latest_block_roots in place instead of as a queue Faster editing that way; otherwise every block will require completely reconstructing a 8192-sized Merkle tree. --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index d999b27e4..7718a906e 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1337,7 +1337,7 @@ Below are the processing steps that happen at every slot. ### Block roots * Let `previous_block_root` be the `tree_hash_root` of the previous beacon block processed in the chain. -* Set `state.latest_block_roots = state.latest_block_roots[1:] + [previous_block_root]`. +* Set `state.latest_block_roots[(state.slot - 1) % LATEST_BLOCK_ROOTS_LENGTH] = previous_block_root`. * If `state.slot % LATEST_BLOCK_ROOTS_LENGTH == 0` append `merkle_root(state.latest_block_roots)` to `state.batched_block_roots`. ## Per-block processing