From 5f0921277739d5a137ba86cefa5bf91d0df852dd Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 21 Jun 2019 22:09:09 -0600 Subject: [PATCH] yield for `is_genesis_trigger` --- specs/core/0_beacon-chain.md | 6 +----- .../pyspec/eth2spec/test/sanity/test_genesis.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 1d2dead41..c94c4fcc9 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1178,11 +1178,7 @@ def get_genesis_beacon_state(deposits: List[Deposit], genesis_time: int, genesis # Process genesis deposits for deposit_index, deposit in enumerate(deposits): - process_deposit( - state, - deposit, - deposit_index=deposit_index, - ) + process_deposit(state, deposit, deposit_index=deposit_index) # Process genesis activations for validator in state.validators: diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_genesis.py b/test_libs/pyspec/eth2spec/test/sanity/test_genesis.py index 3c76654e6..37d8a2b17 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_genesis.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_genesis.py @@ -9,7 +9,11 @@ from eth2spec.test.helpers.deposits import ( def test_is_genesis_trigger_false(spec): deposit_count = 2 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) assert is_triggered is False @@ -22,7 +26,11 @@ def test_is_genesis_trigger_false(spec): def test_is_genesis_trigger_true(spec): deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT 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) 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): deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT 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_time + yield deposit_root is_triggered = spec.is_genesis_trigger(genesis_deposits, genesis_time, deposit_root) assert is_triggered is False @@ -50,7 +59,7 @@ def test_is_genesis_trigger_not_enough_balance(spec): 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 = 1234 + genesis_time = 1546300800 yield genesis_deposits yield genesis_time