From 260c642e3f52b1795f476d15e650af8767982509 Mon Sep 17 00:00:00 2001 From: vbuterin Date: Tue, 29 Jan 2019 19:00:39 -0600 Subject: [PATCH] One more new_deposit_root, and chainStarted as public bool --- specs/core/0_beacon-chain.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 6d3a9574a..370b2c2bd 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -660,6 +660,7 @@ zerohashes: bytes32[32] branch: bytes32[32] deposit_count: uint256 full_deposit_count: uint256 +chainStarted: public(bool) @public def __init__(): @@ -716,7 +717,8 @@ def deposit(deposit_input: bytes[512]): if self.full_deposit_count == CHAIN_START_FULL_DEPOSIT_THRESHOLD: timestamp_day_boundary: uint256 = as_unitless_number(block.timestamp) - as_unitless_number(block.timestamp) % SECONDS_PER_DAY + SECONDS_PER_DAY chainstart_time: bytes[8] = slice(concat("", convert(timestamp_day_boundary, bytes32)), start=24, len=8) - log.ChainStart(self.get_deposit_root(), chainstart_time) + log.ChainStart(new_deposit_root, chainstart_time) + self.chainStarted = True ``` Note: to save ~10x on gas this contract uses a somewhat unintuitive progressive Merkle root calculation algo that requires only O(log(n)) storage. See https://github.com/ethereum/research/blob/master/beacon_chain_impl/progressive_merkle_tree.py for an implementation of the same algo in python tested for correctness.