Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,23 @@ def test_incorrect_commitment(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_commitments_for_transactions(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_blob_tx(spec, blob_count=2, rng=Random(1111))
blob_kzg_commitments = [] # incorrect count

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

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


@with_deneb_and_later
@spec_state_test
def test_incorrect_commitments_order(spec, state):
Expand All @@ -202,6 +219,26 @@ def test_incorrect_commitments_order(spec, state):
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


@with_deneb_and_later
@spec_state_test
def test_incorrect_transaction_no_blobs_but_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)

# the blob transaction is invalid, because the EL verifies that the tx contains at least one blob
# therefore the EL should reject it, but the CL should not reject the block regardless
opaque_tx, _, _, _ = get_sample_blob_tx(spec, blob_count=0, rng=Random(1111))
_, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=2, rng=Random(1112))
Comment on lines +232 to +233
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this would be an invalid blob transaction though 😅

if get_tx_type(tx) == BLOB_TX_TYPE:
    # there must be at least one blob
    assert len(tx.blob_versioned_hashes) > 0

See: https://eips.ethereum.org/EIPS/eip-4844#execution-layer-validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no, this skipped my mind sorry, i removed this test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries at all. After looking at other tests in that file, it seems that some also have invalid transactions. So it might have been okay to keep but I think removing it is for the best. Thank you.

For example, an invalid transaction:

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_blob_tx(spec)
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, state)
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)

Copy link
Contributor Author

@debjit-bw debjit-bw Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, hawk eyes 👀! btw, i just updated the base branch right after you approved the CI, would you mind approving the CI run once again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can add it back but with a new name. Something like this, feel free to alter:

- test_incorrect_commitments_for_no_blob
+ test_incorrect_transaction_no_blobs_but_with_commitments

Also I would add a comment (above the get_sample_blob_tx call) about blob transactions with zero blobs being invalid. This might not be immediately obvious to CL folks 😄


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

# the transaction doesn't contain any blob, but commitments are provided
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)


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