Skip to content

Commit

Permalink
Merge pull request #3459 from marioevz/deneb-test-cases-comments
Browse files Browse the repository at this point in the history
Deneb: Add test cases to execution payload processing
  • Loading branch information
djrtwo committed Jul 19, 2023
2 parents 79bfdad + 419cbdc commit ff2840e
Showing 1 changed file with 60 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def verify_and_notify_new_payload(self, new_payload_request) -> bool:
assert state.latest_execution_payload_header == get_execution_payload_header(spec, body.execution_payload)


"""
Tests with incorrect blob transactions in the execution payload, but the execution client returns
VALID, and the purpose of these tests is that the beacon client must not reject the block by
attempting to do a validation of its own.
"""


@with_deneb_and_later
@spec_state_test
def test_incorrect_blob_tx_type(spec, state):
Expand All @@ -78,14 +85,14 @@ def test_incorrect_blob_tx_type(spec, state):

@with_deneb_and_later
@spec_state_test
def test_incorrect_transaction_length_1_byte(spec, state):
def test_incorrect_transaction_length_1_extra_byte(spec, state):
"""
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
"""
execution_payload = build_empty_execution_payload(spec, state)

opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
opaque_tx = opaque_tx + b'\x12' # incorrect tx length
opaque_tx = opaque_tx + b'\x12' # incorrect tx length, longer

execution_payload.transactions = [opaque_tx]
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload)
Expand All @@ -95,7 +102,41 @@ def test_incorrect_transaction_length_1_byte(spec, state):

@with_deneb_and_later
@spec_state_test
def test_incorrect_transaction_length_32_bytes(spec, state):
def test_incorrect_transaction_length_1_byte_short(spec, state):
"""
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
"""
execution_payload = build_empty_execution_payload(spec, state)

opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
opaque_tx = opaque_tx[:-1] # incorrect tx length, shorter

execution_payload.transactions = [opaque_tx]
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload)

yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


@with_deneb_and_later
@spec_state_test
def test_incorrect_transaction_length_empty(spec, state):
"""
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
"""
execution_payload = build_empty_execution_payload(spec, state)

opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)
opaque_tx = opaque_tx[0:0] # incorrect tx length, empty

execution_payload.transactions = [opaque_tx]
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload)

yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


@with_deneb_and_later
@spec_state_test
def test_incorrect_transaction_length_32_extra_bytes(spec, state):
"""
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
"""
Expand All @@ -110,6 +151,22 @@ def test_incorrect_transaction_length_32_bytes(spec, state):
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


@with_deneb_and_later
@spec_state_test
def test_no_transactions_with_commitments(spec, state):
"""
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
"""
execution_payload = build_empty_execution_payload(spec, state)

_, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec)

execution_payload.transactions = []
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload)

yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


@with_deneb_and_later
@spec_state_test
def test_incorrect_commitment(spec, state):
Expand Down

0 comments on commit ff2840e

Please sign in to comment.