diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index d9454fff1..732cec31e 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1036,6 +1036,7 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash, genesis_time=eth1_timestamp - eth1_timestamp % SECONDS_PER_DAY + 2 * SECONDS_PER_DAY, eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=len(deposits)), latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())), + randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy ) # Process deposits diff --git a/test_libs/pyspec/eth2spec/test/helpers/genesis.py b/test_libs/pyspec/eth2spec/test/helpers/genesis.py index 9e3c77b7b..7e747e34e 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/genesis.py +++ b/test_libs/pyspec/eth2spec/test/helpers/genesis.py @@ -19,15 +19,17 @@ def build_mock_validator(spec, i: int, balance: int): def create_genesis_state(spec, num_validators): deposit_root = b'\x42' * 32 + eth1_block_hash = b'\xda' * 32 state = spec.BeaconState( genesis_time=0, eth1_deposit_index=num_validators, eth1_data=spec.Eth1Data( deposit_root=deposit_root, deposit_count=num_validators, - block_hash=spec.Hash(), + block_hash=eth1_block_hash, ), latest_block_header=spec.BeaconBlockHeader(body_root=spec.hash_tree_root(spec.BeaconBlockBody())), + randao_mixes=[eth1_block_hash] * spec.EPOCHS_PER_HISTORICAL_VECTOR, ) # We "hack" in the initial validators, diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py index 5e919120d..bffb1c1fc 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py @@ -475,6 +475,8 @@ def test_eth1_data_votes_no_consensus(spec, state): if spec.SLOTS_PER_ETH1_VOTING_PERIOD > 16: return + pre_eth1_hash = state.eth1_data.block_hash + offset_block = build_empty_block(spec, state, slot=spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1) sign_block(spec, state, offset_block) state_transition_and_sign_block(spec, state, offset_block) @@ -494,7 +496,7 @@ def test_eth1_data_votes_no_consensus(spec, state): blocks.append(block) assert len(state.eth1_data_votes) == spec.SLOTS_PER_ETH1_VOTING_PERIOD - assert state.eth1_data.block_hash == b'\x00' * 32 + assert state.eth1_data.block_hash == pre_eth1_hash yield 'blocks', blocks yield 'post', state