This commit is contained in:
Hsiao-Wei Wang 2019-06-21 22:26:15 -06:00
parent b51011568a
commit 6aef6c5634
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
2 changed files with 11 additions and 3 deletions

View File

@ -1139,11 +1139,11 @@ When `is_genesis_trigger(deposits, timestamp, deposit_root) is True` for the fir
* `genesis_deposits = deposits`
* `genesis_time = timestamp - timestamp % SECONDS_PER_DAY + 2 * SECONDS_PER_DAY` where `SECONDS_PER_DAY = 86400`
* `deposit_root` is the tree root of the given `deposits`
* `deposit_root` is the Merkle tree root of the data of the given `deposits`
* `genesis_eth1_data` be the object of type `Eth1Data` where:
* `genesis_eth1_data.block_hash` is the Ethereum 1.0 block hash that emitted the log for the last deposit in `deposits`
* `genesis_eth1_data.deposit_root` is the deposit root for the last deposit in `deposits`
* `genesis_eth1_data.deposit_count = len(genesis_deposits)`
* `genesis_eth1_data.block_hash` is the Ethereum 1.0 block hash that emitted the log for the last deposit in `deposits`
*Note*: The function `is_genesis_trigger` has yet to be agreed by the community, and can be updated as necessary. We define the following testing placeholder:

View File

@ -60,6 +60,7 @@ def test_genesis(spec):
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
genesis_time = 1546300800
block_hash = b'\x12' * 32
yield genesis_deposits
yield genesis_time
@ -67,7 +68,7 @@ def test_genesis(spec):
genesis_eth1_data = spec.Eth1Data(
deposit_root=deposit_root,
deposit_count=deposit_count,
block_hash=b'\x12' * 32,
block_hash=block_hash,
)
yield genesis_eth1_data
@ -76,4 +77,11 @@ def test_genesis(spec):
genesis_time,
genesis_eth1_data,
)
assert genesis_state.genesis_time == genesis_time
assert len(genesis_state.validators) == deposit_count
assert genesis_state.eth1_data.deposit_root == deposit_root
assert genesis_state.eth1_data.deposit_count == deposit_count
assert genesis_state.eth1_data.block_hash == block_hash
yield genesis_state