Skip to content

Commit fbee1fd

Browse files
committed
Pass only signed bid to process_execution_payload_bid
Most operation processors take the minimum amount of information that's needed for validation, e.g., process_sync_aggregate solely takes the sync aggregate. For process_execution_payload_bid, the full block is passed instead, while at the same time requiring in validator.md that the verification checks in process_execution_payload_bid have to be run in order to construct a bid. Clean that up by only taking the SignedExecutionPayloadBid, so that the verification checks no longer depend on the existence of a BeaconBlock.
1 parent 8e19f82 commit fbee1fd

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

specs/gloas/beacon-chain.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
11111111
# [Modified in Gloas:EIP7732]
11121112
# Removed `process_execution_payload`
11131113
# [New in Gloas:EIP7732]
1114-
process_execution_payload_bid(state, block)
1114+
process_execution_payload_bid(state, block.body.signed_execution_payload_bid)
11151115
process_randao(state, block.body)
11161116
process_eth1_data(state, block.body)
11171117
# [Modified in Gloas:EIP7732]
@@ -1440,8 +1440,9 @@ def verify_execution_payload_bid_signature(
14401440
##### New `process_execution_payload_bid`
14411441

14421442
```python
1443-
def process_execution_payload_bid(state: BeaconState, block: BeaconBlock) -> None:
1444-
signed_bid = block.body.signed_execution_payload_bid
1443+
def process_execution_payload_bid(
1444+
state: BeaconState, signed_bid: SignedExecutionPayloadBid
1445+
) -> None:
14451446
bid = signed_bid.message
14461447
builder_index = bid.builder_index
14471448
amount = bid.value
@@ -1465,10 +1466,11 @@ def process_execution_payload_bid(state: BeaconState, block: BeaconBlock) -> Non
14651466
)
14661467

14671468
# Verify that the bid is for the current slot
1468-
assert bid.slot == block.slot
1469+
assert bid.slot == state.slot
1470+
assert state.slot > GENESIS_SLOT
14691471
# Verify that the bid is for the right parent block
14701472
assert bid.parent_block_hash == state.latest_block_hash
1471-
assert bid.parent_block_root == block.parent_root
1473+
assert bid.parent_block_root == get_block_root_at_slot(state, Slot(state.slot - 1))
14721474
assert bid.prev_randao == get_randao_mix(state, get_current_epoch(state))
14731475

14741476
# Record the pending payment if there is some payment

tests/core/pyspec/eth_consensus_specs/test/gloas/block_processing/test_process_execution_payload_bid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,10 @@ def test_process_execution_payload_bid_wrong_slot(spec, state):
602602
spec,
603603
state,
604604
builder_index=spec.BUILDER_INDEX_SELF_BUILD,
605-
slot=block.slot + 1, # Wrong slot
605+
slot=block.slot,
606606
parent_block_root=block.parent_root,
607607
)
608+
signed_bid.message.slot = signed_bid.message.slot + 1 # Wrong slot
608609

609610
block.body.signed_execution_payload_bid = signed_bid
610611

tests/core/pyspec/eth_consensus_specs/test/helpers/execution_payload_bid.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ def run_execution_payload_bid_processing(spec, state, block, valid=True):
77
"""
88
Run ``process_execution_payload_bid``, yielding:
99
- pre-state ('pre')
10-
- block ('block')
10+
- execution payload bid ('execution_payload_bid')
1111
- post-state ('post').
1212
If ``valid == False``, run expecting ``AssertionError``
1313
"""
14+
signed_bid = block.body.signed_execution_payload_bid
1415
yield "pre", state
15-
yield "block", block
16+
yield "execution_payload_bid", signed_bid
1617

1718
if not valid:
18-
expect_assertion_error(lambda: spec.process_execution_payload_bid(state, block))
19+
expect_assertion_error(lambda: spec.process_execution_payload_bid(state, signed_bid))
1920
yield "post", None
2021
return
2122

22-
spec.process_execution_payload_bid(state, block)
23+
spec.process_execution_payload_bid(state, signed_bid)
2324
yield "post", state
2425

2526

tests/formats/operations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Operations:
4949
| `deposit_request` | `DepositRequest` | `deposit_request` | `process_deposit_request(state, deposit_request)` (new in Electra) |
5050
| `withdrawal_request` | `WithdrawalRequest` | `withdrawal_request` | `process_withdrawal_request(state, withdrawal_request)` (new in Electra) |
5151
| `consolidation_request` | `ConsolidationRequest` | `consolidation_request` | `process_consolidation_request(state, consolidation_request)` (new in Electra) |
52-
| `execution_payload_bid` | `BeaconBlock` | **`block`** | `process_execution_payload_bid(state, block)` (new in Gloas) |
52+
| `execution_payload_bid` | `SignedExecutionPayloadBid` | `execution_payload_bid` | `process_execution_payload_bid(state, execution_payload_bid)` (new in Gloas) |
5353
| `parent_execution_payload` | `BeaconBlock` | **`block`** | `process_parent_execution_payload(state, block)` (new in Gloas) |
5454
| `payload_attestation` | `PayloadAttestation` | `payload_attestation` | `process_payload_attestation(state, payload_attestation)` (new in Gloas) |
5555

0 commit comments

Comments
 (0)