mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-22 00:20:28 +00:00
Add test_invalid_data_unavailable
This commit is contained in:
parent
2210cea734
commit
d2d351f7c9
@ -89,7 +89,7 @@ def test_invalid_incorrect_proof(spec, state):
|
|||||||
assert store.time == current_time
|
assert store.time == current_time
|
||||||
|
|
||||||
# On receiving a block of `GENESIS_SLOT + 1` slot
|
# On receiving a block of `GENESIS_SLOT + 1` slot
|
||||||
block, blobs, blob_kzg_proofs = get_block_with_blob(spec, state, rng=rng)
|
block, blobs, _ = get_block_with_blob(spec, state, rng=rng)
|
||||||
signed_block = state_transition_and_sign_block(spec, state, block)
|
signed_block = state_transition_and_sign_block(spec, state, block)
|
||||||
# Insert incorrect proof
|
# Insert incorrect proof
|
||||||
blob_kzg_proofs = [b'\xc0' + b'\x00' * 47]
|
blob_kzg_proofs = [b'\xc0' + b'\x00' * 47]
|
||||||
@ -103,3 +103,34 @@ def test_invalid_incorrect_proof(spec, state):
|
|||||||
assert spec.get_head(store) != signed_block.message.hash_tree_root()
|
assert spec.get_head(store) != signed_block.message.hash_tree_root()
|
||||||
|
|
||||||
yield 'steps', test_steps
|
yield 'steps', test_steps
|
||||||
|
|
||||||
|
|
||||||
|
@with_deneb_and_later
|
||||||
|
@spec_state_test
|
||||||
|
def test_invalid_data_unavailable(spec, state):
|
||||||
|
rng = Random(1234)
|
||||||
|
|
||||||
|
test_steps = []
|
||||||
|
# Initialization
|
||||||
|
store, anchor_block = get_genesis_forkchoice_store_and_block(spec, state)
|
||||||
|
yield 'anchor_state', state
|
||||||
|
yield 'anchor_block', anchor_block
|
||||||
|
current_time = state.slot * spec.config.SECONDS_PER_SLOT + store.genesis_time
|
||||||
|
on_tick_and_append_step(spec, store, current_time, test_steps)
|
||||||
|
assert store.time == current_time
|
||||||
|
|
||||||
|
# On receiving a block of `GENESIS_SLOT + 1` slot
|
||||||
|
block, _, _ = get_block_with_blob(spec, state, rng=rng)
|
||||||
|
signed_block = state_transition_and_sign_block(spec, state, block)
|
||||||
|
|
||||||
|
# data unavailable
|
||||||
|
blob_data = BlobData([], [])
|
||||||
|
|
||||||
|
def run_func_1():
|
||||||
|
yield from tick_and_add_block(spec, store, signed_block, test_steps, blob_data=blob_data, valid=False)
|
||||||
|
|
||||||
|
yield from with_blob_data(spec, blob_data, run_func_1)
|
||||||
|
|
||||||
|
assert spec.get_head(store) != signed_block.message.hash_tree_root()
|
||||||
|
|
||||||
|
yield 'steps', test_steps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user