Skip to content

Commit bd791d8

Browse files
authored
Add check that block is known in on_payload_attestation_message (#5022)
Currently, [on_payload_attestation_message](https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/fork-choice.md#new-on_payload_attestation_message) raises `KeyError` if `data.beacon_block_root` refers to unknown block. One consequence is that [expect_assertion_error](https://github.com/ethereum/consensus-specs/blob/1baa05e71148b0975e28918ac6022d2256b56f4a/tests/core/pyspec/eth_consensus_specs/test/context.py#L385) won't catch the error. Historically, block roots are validated with an explicit `assert`. The PR adds such a check.
1 parent 5276545 commit bd791d8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

specs/gloas/fork-choice.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ def on_payload_attestation_message(
853853
# The beacon block root must be known
854854
data = ptc_message.data
855855
# PTC attestation must be for a known block. If block is unknown, delay consideration until the block is found
856+
assert data.beacon_block_root in store.block_states
856857
state = store.block_states[data.beacon_block_root]
857858
ptc = get_ptc(state, data.slot)
858859
# PTC votes can only change the vote for their assigned beacon block, return early otherwise

0 commit comments

Comments
 (0)