From 9dabdacbe39a660a72d17e318f26baf9d8cf0309 Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Mon, 8 Dec 2025 01:22:48 +0000 Subject: [PATCH 1/2] Add a test when EL payload contains unexpected withdrawal --- .../test_process_execution_payload.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py b/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py index afb8d34827..7edc8a0d9f 100644 --- a/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py @@ -990,3 +990,39 @@ def test_process_execution_payload_execution_engine_invalid(spec, state): yield from run_execution_payload_processing( spec, state, signed_envelope, valid=False, execution_valid=False ) + +@with_gloas_and_later +@spec_state_test +@always_bls +def test_process_execution_payload_unexpected_builder_withdrawal(spec, state): + """ + Test exception when the builder includes one unexpected withdrawal in the execution payload + """ + proposer_index = spec.get_beacon_proposer_index(state) + # Use a different validator as builder (not the proposer) + builder_index = (proposer_index + 1) % len(state.validators) + make_validator_builder(spec, state, builder_index) + + setup_state_with_payload_bid(spec, state, builder_index, spec.Gwei(50000000)) + + # Create execution payload that matches the committed bid + execution_payload = build_empty_execution_payload(spec, state) + execution_payload.block_hash = state.latest_execution_payload_bid.block_hash + execution_payload.gas_limit = state.latest_execution_payload_bid.gas_limit + execution_payload.parent_hash = state.latest_block_hash + + unexpected_withdrawal = spec.Withdrawal( + index=0, + validator_index=0, + address=b"\x30" * 20, + amount=420, + ) + execution_payload.withdrawals.append(unexpected_withdrawal) + + assert len(execution_payload.withdrawals) == 1 + + signed_envelope = prepare_execution_payload_envelope( + spec, state, builder_index=builder_index, execution_payload=execution_payload + ) + + yield from run_execution_payload_processing(spec, state, signed_envelope, valid=False) From 11f6f476f9670c593023e12bde6a0d555f6355cd Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Mon, 22 Dec 2025 15:54:38 +0000 Subject: [PATCH 2/2] lint --- .../gloas/block_processing/test_process_execution_payload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py b/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py index 7edc8a0d9f..b1cf7cf666 100644 --- a/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py +++ b/tests/core/pyspec/eth2spec/test/gloas/block_processing/test_process_execution_payload.py @@ -991,6 +991,7 @@ def test_process_execution_payload_execution_engine_invalid(spec, state): spec, state, signed_envelope, valid=False, execution_valid=False ) + @with_gloas_and_later @spec_state_test @always_bls