mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
implement spev v0.12.1 in initialize_beacon_state_from_eth1 (#1236)
This commit is contained in:
parent
8288b568d2
commit
578ea2013a
@ -192,7 +192,7 @@ proc slash_validator*(state: var BeaconState, slashed_index: ValidatorIndex,
|
||||
increase_balance(
|
||||
state, whistleblower_index, whistleblowing_reward - proposer_reward)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/beacon-chain.md#genesis
|
||||
# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/beacon-chain.md#genesis
|
||||
proc initialize_beacon_state_from_eth1*(
|
||||
eth1_block_hash: Eth2Digest,
|
||||
eth1_timestamp: uint64,
|
||||
@ -221,6 +221,10 @@ proc initialize_beacon_state_from_eth1*(
|
||||
current_version: Version(GENESIS_FORK_VERSION),
|
||||
epoch: GENESIS_EPOCH),
|
||||
genesis_time:
|
||||
# TODO: remove once we switch completely to v0.12.1
|
||||
when SPEC_VERSION == "0.12.1":
|
||||
eth1_timestamp + GENESIS_DELAY
|
||||
else:
|
||||
eth1_timestamp + 2'u64 * SECONDS_PER_DAY -
|
||||
(eth1_timestamp mod SECONDS_PER_DAY),
|
||||
eth1_data:
|
||||
@ -228,6 +232,9 @@ proc initialize_beacon_state_from_eth1*(
|
||||
latest_block_header:
|
||||
BeaconBlockHeader(
|
||||
body_root: hash_tree_root(BeaconBlockBody(
|
||||
# This differs from the spec intentionally.
|
||||
# We must specify the default value for `ValidatorSig`
|
||||
# in order to get a correct `hash_tree_root`.
|
||||
randao_reveal: ValidatorSig(kind: OpaqueBlob)
|
||||
))
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user