Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more tests for execution payload processing with incorrect blob commitments #4087

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

debjit-bw
Copy link
Contributor

This PR expands the coverage of deneb's execution payload processing by adding the following two scenarios:

  • test_no_commitments_for_transactions: while we test for incorrect commitments, this test adds a scenario where there are NO commitments even when blob txs are present. naturally the EL returns VALID, by definition. this test asserts that the CL doesn't reject it by running any validation.
  • test_incorrect_commitments_for_no_blob: this test adds a scenario where none of the txs contain any blobs, but there are kzg commitments for them. it does so by combining the opaque txs of one sample tx with the commitments received from another. as earlier, the CL should not reject it.

Comment on lines +230 to +231
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))
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 😄

@debjit-bw debjit-bw requested a review from jtraglia January 20, 2025 16:42
@debjit-bw debjit-bw marked this pull request as ready for review January 20, 2025 17:08
Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jtraglia jtraglia requested a review from mkalinin January 20, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants