Skip to content

Commit 526d550

Browse files
authored
Merge pull request #4087 from debjit-bw/ef-assignment
Add more execution payload processing tests
2 parents b87fbac + 02f6719 commit 526d550

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/core/pyspec/eth2spec/test/deneb/block_processing/test_process_execution_payload.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ def test_incorrect_commitment(spec, state):
185185
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)
186186

187187

188+
@with_deneb_and_later
189+
@spec_state_test
190+
def test_no_commitments_for_transactions(spec, state):
191+
"""
192+
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
193+
"""
194+
execution_payload = build_empty_execution_payload(spec, state)
195+
196+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=2, rng=Random(1111))
197+
blob_kzg_commitments = [] # incorrect count
198+
199+
execution_payload.transactions = [opaque_tx]
200+
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)
201+
202+
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)
203+
204+
188205
@with_deneb_and_later
189206
@spec_state_test
190207
def test_incorrect_commitments_order(spec, state):
@@ -202,6 +219,26 @@ def test_incorrect_commitments_order(spec, state):
202219
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)
203220

204221

222+
@with_deneb_and_later
223+
@spec_state_test
224+
def test_incorrect_transaction_no_blobs_but_with_commitments(spec, state):
225+
"""
226+
The versioned hashes are wrong, but the testing ExecutionEngine returns VALID by default.
227+
"""
228+
execution_payload = build_empty_execution_payload(spec, state)
229+
230+
# the blob transaction is invalid, because the EL verifies that the tx contains at least one blob
231+
# therefore the EL should reject it, but the CL should not reject the block regardless
232+
opaque_tx, _, _, _ = get_sample_blob_tx(spec, blob_count=0, rng=Random(1111))
233+
_, _, blob_kzg_commitments, _ = get_sample_blob_tx(spec, blob_count=2, rng=Random(1112))
234+
235+
execution_payload.transactions = [opaque_tx]
236+
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)
237+
238+
# the transaction doesn't contain any blob, but commitments are provided
239+
yield from run_execution_payload_processing(spec, state, execution_payload, blob_kzg_commitments)
240+
241+
205242
@with_deneb_and_later
206243
@spec_state_test
207244
def test_incorrect_block_hash(spec, state):

0 commit comments

Comments
 (0)