From 8471bc9c12330f2e99c59b5bacf1763db08bf77f Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Mon, 24 Nov 2025 18:51:54 +0000 Subject: [PATCH 1/2] Add test for unexpected withdrawal in ePBS Add test for exception when the builder includes one unexpected withdrawal in the execution payload (ePBS). Cherry-picked from https://github.com/etan-status/consensus-specs/pull/2 --- .../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 ccb4ab3c79dfaf66837c7a1f9399315977d4bdee Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 30 Dec 2025 15:03:47 +0100 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