mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-13 04:04:19 +00:00
Skips tests properly
This commit is contained in:
parent
c06a60c95a
commit
9d00a76493
@ -1,3 +1,5 @@
|
||||
import pytest
|
||||
|
||||
from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal
|
||||
from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error
|
||||
|
||||
@ -51,12 +53,14 @@ def test_reveal_from_current_epoch(spec, state):
|
||||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
|
||||
|
||||
# @with_phase1
|
||||
# @spec_state_test
|
||||
# def test_reveal_from_past_epoch(state):
|
||||
# randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state) - 1)
|
||||
#
|
||||
# yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
@with_phase1
|
||||
@spec_state_test
|
||||
def test_reveal_from_past_epoch(spec, state):
|
||||
if spec.get_current_epoch(state) < 1:
|
||||
pytest.skip('testing of previous epoch requires epoch of at least 1')
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state) - 1)
|
||||
|
||||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
|
||||
|
||||
@with_phase1
|
||||
|
@ -72,24 +72,25 @@ def test_empty_epoch_transition(spec, state):
|
||||
assert spec.get_block_root_at_slot(state, slot) == block.parent_root
|
||||
|
||||
|
||||
# @spec_state_test
|
||||
# def test_empty_epoch_transition_not_finalizing(spec, state):
|
||||
# # copy for later balance lookups.
|
||||
# pre_state = deepcopy(state)
|
||||
# yield 'pre', state
|
||||
#
|
||||
# block = build_empty_block_for_next_slot(spec, state)
|
||||
# block.slot += spec.SLOTS_PER_EPOCH * 5
|
||||
# sign_block(spec, state, block, proposer_index=0)
|
||||
# yield 'blocks', [block], [spec.BeaconBlock]
|
||||
#
|
||||
# spec.state_transition(state, block)
|
||||
# yield 'post', state
|
||||
#
|
||||
# assert state.slot == block.slot
|
||||
# assert state.finalized_epoch < spec.get_current_epoch(state) - 4
|
||||
# for index in range(len(state.validator_registry)):
|
||||
# assert get_balance(state, index) < get_balance(pre_state, index)
|
||||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_empty_epoch_transition_not_finalizing(spec, state):
|
||||
# copy for later balance lookups.
|
||||
pre_state = deepcopy(state)
|
||||
yield 'pre', state
|
||||
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
block.slot += spec.SLOTS_PER_EPOCH * 5
|
||||
sign_block(spec, state, block, proposer_index=0)
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
|
||||
spec.state_transition(state, block)
|
||||
yield 'post', state
|
||||
|
||||
assert state.slot == block.slot
|
||||
assert state.finalized_epoch < spec.get_current_epoch(state) - 4
|
||||
for index in range(len(state.validator_registry)):
|
||||
assert get_balance(state, index) < get_balance(pre_state, index)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@ -378,28 +379,29 @@ def test_historical_batch(spec, state):
|
||||
assert len(state.historical_roots) == pre_historical_roots_len + 1
|
||||
|
||||
|
||||
# @spec_state_test
|
||||
# def test_eth1_data_votes(spec, state):
|
||||
# yield 'pre', state
|
||||
#
|
||||
# expected_votes = 0
|
||||
# assert len(state.eth1_data_votes) == expected_votes
|
||||
#
|
||||
# blocks = []
|
||||
# for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1):
|
||||
# block = build_empty_block_for_next_slot(spec, state)
|
||||
# spec.state_transition(state, block)
|
||||
# expected_votes += 1
|
||||
# assert len(state.eth1_data_votes) == expected_votes
|
||||
# blocks.append(block)
|
||||
#
|
||||
# block = build_empty_block_for_next_slot(spec, state)
|
||||
# blocks.append(block)
|
||||
#
|
||||
# spec.state_transition(state, block)
|
||||
#
|
||||
# yield 'blocks', [block], [spec.BeaconBlock]
|
||||
# yield 'post', state
|
||||
#
|
||||
# assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0
|
||||
# assert len(state.eth1_data_votes) == 1
|
||||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_eth1_data_votes(spec, state):
|
||||
yield 'pre', state
|
||||
|
||||
expected_votes = 0
|
||||
assert len(state.eth1_data_votes) == expected_votes
|
||||
|
||||
blocks = []
|
||||
for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1):
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
spec.state_transition(state, block)
|
||||
expected_votes += 1
|
||||
assert len(state.eth1_data_votes) == expected_votes
|
||||
blocks.append(block)
|
||||
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
blocks.append(block)
|
||||
|
||||
spec.state_transition(state, block)
|
||||
|
||||
yield 'blocks', [block], [spec.BeaconBlock]
|
||||
yield 'post', state
|
||||
|
||||
assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0
|
||||
assert len(state.eth1_data_votes) == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user