Merge branch 'fork-choice-epoch' into checkpoints

This commit is contained in:
Danny Ryan 2019-06-25 10:37:04 -06:00
commit ac06362716
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
3 changed files with 4 additions and 23 deletions

View File

@ -1,5 +1,3 @@
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
from eth2spec.test.context import with_all_phases, with_state, bls_switch
from eth2spec.test.helpers.block import build_empty_block_for_next_slot
@ -31,8 +29,6 @@ def run_on_attestation(spec, state, store, attestation, valid=True):
@with_state
@bls_switch
def test_on_attestation(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
store = spec.get_genesis_store(state)
time = 100
spec.on_tick(store, time)
@ -52,8 +48,6 @@ def test_on_attestation(spec, state):
@with_state
@bls_switch
def test_on_attestation_target_not_in_store(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
store = spec.get_genesis_store(state)
time = 100
spec.on_tick(store, time)
@ -74,8 +68,6 @@ def test_on_attestation_target_not_in_store(spec, state):
@with_state
@bls_switch
def test_on_attestation_future_epoch(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
store = spec.get_genesis_store(state)
time = 3 * spec.SECONDS_PER_SLOT
spec.on_tick(store, time)
@ -98,8 +90,6 @@ def test_on_attestation_future_epoch(spec, state):
@with_state
@bls_switch
def test_on_attestation_same_slot(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
store = spec.get_genesis_store(state)
time = 1 * spec.SECONDS_PER_SLOT
spec.on_tick(store, time)
@ -117,8 +107,6 @@ def test_on_attestation_same_slot(spec, state):
@with_state
@bls_switch
def test_on_attestation_invalid_attestation(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
store = spec.get_genesis_store(state)
time = 3 * spec.SECONDS_PER_SLOT
spec.on_tick(store, time)

View File

@ -1,7 +1,6 @@
from eth2spec.utils.ssz.ssz_impl import signing_root, hash_tree_root
from eth2spec.utils.ssz.ssz_impl import signing_root
from eth2spec.test.context import with_all_phases, with_state, bls_switch
from eth2spec.test.helpers.block import build_empty_block_for_next_slot
@ -22,8 +21,6 @@ def run_on_block(spec, state, store, block, valid=True):
@with_state
@bls_switch
def test_basic(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
# Initialization
store = spec.get_genesis_store(state)
time = 100
@ -48,8 +45,6 @@ def test_basic(spec, state):
@with_state
@bls_switch
def test_on_block_future_block(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
# Initialization
store = spec.get_genesis_store(state)
@ -64,8 +59,6 @@ def test_on_block_future_block(spec, state):
@with_state
@bls_switch
def test_on_block_bad_parent_root(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
# Initialization
store = spec.get_genesis_store(state)
time = 100
@ -81,8 +74,6 @@ def test_on_block_bad_parent_root(spec, state):
@with_state
@bls_switch
def test_on_block_before_finalized(spec, state):
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
# Initialization
store = spec.get_genesis_store(state)
time = 100

View File

@ -27,7 +27,9 @@ def create_genesis_state(spec, num_validators):
deposit_root=deposit_root,
deposit_count=num_validators,
block_hash=spec.ZERO_HASH,
))
),
latest_block_header=spec.BeaconBlockHeader(body_root=spec.hash_tree_root(spec.BeaconBlockBody())),
)
# We "hack" in the initial validators,
# as it is much faster than creating and processing genesis deposits for every single test case.