yield for `is_genesis_trigger`
This commit is contained in:
parent
24ad42663f
commit
5f09212777
|
@ -1178,11 +1178,7 @@ def get_genesis_beacon_state(deposits: List[Deposit], genesis_time: int, genesis
|
||||||
|
|
||||||
# Process genesis deposits
|
# Process genesis deposits
|
||||||
for deposit_index, deposit in enumerate(deposits):
|
for deposit_index, deposit in enumerate(deposits):
|
||||||
process_deposit(
|
process_deposit(state, deposit, deposit_index=deposit_index)
|
||||||
state,
|
|
||||||
deposit,
|
|
||||||
deposit_index=deposit_index,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Process genesis activations
|
# Process genesis activations
|
||||||
for validator in state.validators:
|
for validator in state.validators:
|
||||||
|
|
|
@ -9,7 +9,11 @@ from eth2spec.test.helpers.deposits import (
|
||||||
def test_is_genesis_trigger_false(spec):
|
def test_is_genesis_trigger_false(spec):
|
||||||
deposit_count = 2
|
deposit_count = 2
|
||||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||||
genesis_time = 1234
|
genesis_time = 1546300800
|
||||||
|
|
||||||
|
yield genesis_deposits
|
||||||
|
yield genesis_time
|
||||||
|
yield deposit_root
|
||||||
|
|
||||||
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
||||||
assert is_triggered is False
|
assert is_triggered is False
|
||||||
|
@ -22,7 +26,11 @@ def test_is_genesis_trigger_false(spec):
|
||||||
def test_is_genesis_trigger_true(spec):
|
def test_is_genesis_trigger_true(spec):
|
||||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||||
genesis_time = 1234
|
genesis_time = 1546300800
|
||||||
|
|
||||||
|
yield genesis_deposits
|
||||||
|
yield genesis_time
|
||||||
|
yield deposit_root
|
||||||
|
|
||||||
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
||||||
assert is_triggered is True
|
assert is_triggered is True
|
||||||
|
@ -35,9 +43,10 @@ def test_is_genesis_trigger_true(spec):
|
||||||
def test_is_genesis_trigger_not_enough_balance(spec):
|
def test_is_genesis_trigger_not_enough_balance(spec):
|
||||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE - 1)
|
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE - 1)
|
||||||
genesis_time = 1234
|
genesis_time = 1546300800
|
||||||
yield genesis_deposits
|
yield genesis_deposits
|
||||||
yield genesis_time
|
yield genesis_time
|
||||||
|
yield deposit_root
|
||||||
|
|
||||||
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root)
|
||||||
assert is_triggered is False
|
assert is_triggered is False
|
||||||
|
@ -50,7 +59,7 @@ def test_is_genesis_trigger_not_enough_balance(spec):
|
||||||
def test_genesis(spec):
|
def test_genesis(spec):
|
||||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||||
genesis_time = 1234
|
genesis_time = 1546300800
|
||||||
|
|
||||||
yield genesis_deposits
|
yield genesis_deposits
|
||||||
yield genesis_time
|
yield genesis_time
|
||||||
|
|
Loading…
Reference in New Issue