Merge branch 'fork-choice-epoch' into checkpoints
This commit is contained in:
commit
ac06362716
|
@ -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.context import with_all_phases, with_state, bls_switch
|
||||||
|
|
||||||
from eth2spec.test.helpers.block import build_empty_block_for_next_slot
|
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
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_attestation(spec, state):
|
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)
|
store = spec.get_genesis_store(state)
|
||||||
time = 100
|
time = 100
|
||||||
spec.on_tick(store, time)
|
spec.on_tick(store, time)
|
||||||
|
@ -52,8 +48,6 @@ def test_on_attestation(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_attestation_target_not_in_store(spec, state):
|
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)
|
store = spec.get_genesis_store(state)
|
||||||
time = 100
|
time = 100
|
||||||
spec.on_tick(store, time)
|
spec.on_tick(store, time)
|
||||||
|
@ -74,8 +68,6 @@ def test_on_attestation_target_not_in_store(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_attestation_future_epoch(spec, state):
|
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)
|
store = spec.get_genesis_store(state)
|
||||||
time = 3 * spec.SECONDS_PER_SLOT
|
time = 3 * spec.SECONDS_PER_SLOT
|
||||||
spec.on_tick(store, time)
|
spec.on_tick(store, time)
|
||||||
|
@ -98,8 +90,6 @@ def test_on_attestation_future_epoch(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_attestation_same_slot(spec, state):
|
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)
|
store = spec.get_genesis_store(state)
|
||||||
time = 1 * spec.SECONDS_PER_SLOT
|
time = 1 * spec.SECONDS_PER_SLOT
|
||||||
spec.on_tick(store, time)
|
spec.on_tick(store, time)
|
||||||
|
@ -117,8 +107,6 @@ def test_on_attestation_same_slot(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_attestation_invalid_attestation(spec, state):
|
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)
|
store = spec.get_genesis_store(state)
|
||||||
time = 3 * spec.SECONDS_PER_SLOT
|
time = 3 * spec.SECONDS_PER_SLOT
|
||||||
spec.on_tick(store, time)
|
spec.on_tick(store, time)
|
||||||
|
|
|
@ -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.context import with_all_phases, with_state, bls_switch
|
||||||
|
|
||||||
from eth2spec.test.helpers.block import build_empty_block_for_next_slot
|
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
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_basic(spec, state):
|
def test_basic(spec, state):
|
||||||
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
store = spec.get_genesis_store(state)
|
store = spec.get_genesis_store(state)
|
||||||
time = 100
|
time = 100
|
||||||
|
@ -48,8 +45,6 @@ def test_basic(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_block_future_block(spec, state):
|
def test_on_block_future_block(spec, state):
|
||||||
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
store = spec.get_genesis_store(state)
|
store = spec.get_genesis_store(state)
|
||||||
|
|
||||||
|
@ -64,8 +59,6 @@ def test_on_block_future_block(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_block_bad_parent_root(spec, state):
|
def test_on_block_bad_parent_root(spec, state):
|
||||||
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
store = spec.get_genesis_store(state)
|
store = spec.get_genesis_store(state)
|
||||||
time = 100
|
time = 100
|
||||||
|
@ -81,8 +74,6 @@ def test_on_block_bad_parent_root(spec, state):
|
||||||
@with_state
|
@with_state
|
||||||
@bls_switch
|
@bls_switch
|
||||||
def test_on_block_before_finalized(spec, state):
|
def test_on_block_before_finalized(spec, state):
|
||||||
state.latest_block_header = spec.BeaconBlockHeader(body_root=hash_tree_root(spec.BeaconBlockBody()))
|
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
store = spec.get_genesis_store(state)
|
store = spec.get_genesis_store(state)
|
||||||
time = 100
|
time = 100
|
||||||
|
|
|
@ -27,7 +27,9 @@ def create_genesis_state(spec, num_validators):
|
||||||
deposit_root=deposit_root,
|
deposit_root=deposit_root,
|
||||||
deposit_count=num_validators,
|
deposit_count=num_validators,
|
||||||
block_hash=spec.ZERO_HASH,
|
block_hash=spec.ZERO_HASH,
|
||||||
))
|
),
|
||||||
|
latest_block_header=spec.BeaconBlockHeader(body_root=spec.hash_tree_root(spec.BeaconBlockBody())),
|
||||||
|
)
|
||||||
|
|
||||||
# We "hack" in the initial validators,
|
# We "hack" in the initial validators,
|
||||||
# as it is much faster than creating and processing genesis deposits for every single test case.
|
# as it is much faster than creating and processing genesis deposits for every single test case.
|
||||||
|
|
Loading…
Reference in New Issue