change note about genesis delay in p2p spec to match new GENESIS_DELAY config value; fix tests
This commit is contained in:
parent
d5ed78e974
commit
671fae6efe
|
@ -1052,7 +1052,7 @@ discv5 uses ENRs and we will presumably need to:
|
||||||
|
|
||||||
Although client software might very well be running locally prior to the solidification of the eth2 genesis state and block, clients cannot form valid ENRs prior to this point. ENRs contain `fork_digest` which utilizes the `genesis_validators_root` for a cleaner separation between chains so prior to knowing genesis, we cannot use `fork_digest` to cleanly find peers on our intended chain. Once genesis data is known, we can then form ENRs and safely find peers.
|
Although client software might very well be running locally prior to the solidification of the eth2 genesis state and block, clients cannot form valid ENRs prior to this point. ENRs contain `fork_digest` which utilizes the `genesis_validators_root` for a cleaner separation between chains so prior to knowing genesis, we cannot use `fork_digest` to cleanly find peers on our intended chain. Once genesis data is known, we can then form ENRs and safely find peers.
|
||||||
|
|
||||||
When using an eth1 deposit contract for deposits, `fork_digest` will be known at least `MIN_GENESIS_DELAY` (24 hours in mainnet configuration) before `genesis_time`, providing ample time to find peers and form initial connections and gossip subnets prior to genesis.
|
When using an eth1 deposit contract for deposits, `fork_digest` will be known `GENESIS_DELAY` (48hours in mainnet configuration) before `genesis_time`, providing ample time to find peers and form initial connections and gossip subnets prior to genesis.
|
||||||
|
|
||||||
## Compression/Encoding
|
## Compression/Encoding
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ def test_initialize_beacon_state_from_eth1(spec):
|
||||||
# initialize beacon_state
|
# initialize beacon_state
|
||||||
state = spec.initialize_beacon_state_from_eth1(eth1_block_hash, eth1_timestamp, deposits)
|
state = spec.initialize_beacon_state_from_eth1(eth1_block_hash, eth1_timestamp, deposits)
|
||||||
|
|
||||||
assert state.genesis_time == eth1_timestamp - eth1_timestamp % spec.MIN_GENESIS_DELAY + 2 * spec.MIN_GENESIS_DELAY
|
assert state.genesis_time == eth1_timestamp + spec.GENESIS_DELAY
|
||||||
assert len(state.validators) == deposit_count
|
assert len(state.validators) == deposit_count
|
||||||
assert state.eth1_data.deposit_root == deposit_root
|
assert state.eth1_data.deposit_root == deposit_root
|
||||||
assert state.eth1_data.deposit_count == deposit_count
|
assert state.eth1_data.deposit_count == deposit_count
|
||||||
|
@ -57,7 +57,7 @@ def test_initialize_beacon_state_some_small_balances(spec):
|
||||||
# initialize beacon_state
|
# initialize beacon_state
|
||||||
state = spec.initialize_beacon_state_from_eth1(eth1_block_hash, eth1_timestamp, deposits)
|
state = spec.initialize_beacon_state_from_eth1(eth1_block_hash, eth1_timestamp, deposits)
|
||||||
|
|
||||||
assert state.genesis_time == eth1_timestamp - eth1_timestamp % spec.MIN_GENESIS_DELAY + 2 * spec.MIN_GENESIS_DELAY
|
assert state.genesis_time == eth1_timestamp + spec.GENESIS_DELAY
|
||||||
assert len(state.validators) == small_deposit_count
|
assert len(state.validators) == small_deposit_count
|
||||||
assert state.eth1_data.deposit_root == deposit_root
|
assert state.eth1_data.deposit_root == deposit_root
|
||||||
assert state.eth1_data.deposit_count == len(deposits)
|
assert state.eth1_data.deposit_count == len(deposits)
|
||||||
|
|
Loading…
Reference in New Issue