mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-17 21:16:52 +00:00
Add test_zero_blob
test case
This commit is contained in:
parent
1a38b83e5d
commit
655094ee4a
@ -16,13 +16,11 @@ from eth2spec.test.helpers.sharding import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@with_deneb_and_later
|
def run_block_with_blobs(spec, state, blob_count):
|
||||||
@spec_state_test
|
|
||||||
def test_one_blob(spec, state):
|
|
||||||
yield 'pre', state
|
yield 'pre', state
|
||||||
|
|
||||||
block = build_empty_block_for_next_slot(spec, state)
|
block = build_empty_block_for_next_slot(spec, state)
|
||||||
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
|
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=blob_count)
|
||||||
block.body.blob_kzg_commitments = blob_kzg_commitments
|
block.body.blob_kzg_commitments = blob_kzg_commitments
|
||||||
block.body.execution_payload.transactions = [opaque_tx]
|
block.body.execution_payload.transactions = [opaque_tx]
|
||||||
block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload)
|
block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload)
|
||||||
@ -32,17 +30,19 @@ def test_one_blob(spec, state):
|
|||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
|
|
||||||
|
@with_deneb_and_later
|
||||||
|
@spec_state_test
|
||||||
|
def test_zero_blob(spec, state):
|
||||||
|
yield from run_block_with_blobs(spec, state, blob_count=0)
|
||||||
|
|
||||||
|
|
||||||
|
@with_deneb_and_later
|
||||||
|
@spec_state_test
|
||||||
|
def test_one_blob(spec, state):
|
||||||
|
yield from run_block_with_blobs(spec, state, blob_count=1)
|
||||||
|
|
||||||
|
|
||||||
@with_deneb_and_later
|
@with_deneb_and_later
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_max_blobs(spec, state):
|
def test_max_blobs(spec, state):
|
||||||
yield 'pre', state
|
yield from run_block_with_blobs(spec, state, blob_count=spec.MAX_BLOBS_PER_BLOCK)
|
||||||
|
|
||||||
block = build_empty_block_for_next_slot(spec, state)
|
|
||||||
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=spec.MAX_BLOBS_PER_BLOCK)
|
|
||||||
block.body.blob_kzg_commitments = blob_kzg_commitments
|
|
||||||
block.body.execution_payload.transactions = [opaque_tx]
|
|
||||||
block.body.execution_payload.block_hash = compute_el_block_hash(spec, block.body.execution_payload)
|
|
||||||
signed_block = state_transition_and_sign_block(spec, state, block)
|
|
||||||
|
|
||||||
yield 'blocks', [signed_block]
|
|
||||||
yield 'post', state
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user