Skip to content

Commit 756f49c

Browse files
authored
Test PTC data-unavailable parent fallback (#5595)
Adds a Gloas validator test for a locally verified parent whose PTC majority reports the payload present but its blob data unavailable. It verifies proposal preparation treats that parent as empty and builds on `parent_bid.parent_block_hash`, covering the data-availability decision independently of payload timeliness.
1 parent 5166cd3 commit 756f49c

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/core/pyspec/eth_consensus_specs/test/gloas/unittests/validator/test_prepare_execution_payload.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,45 @@ def test_prepare_execution_payload__no_payload_verified(spec, state):
211211
assert engine.payload_attributes.withdrawals == carried_withdrawals
212212

213213

214+
@with_phases([GLOAS])
215+
@spec_state_test
216+
def test_prepare_execution_payload__ptc_votes_data_unavailable(spec, state):
217+
store, block_root, _ = _setup_full_parent(spec, state)
218+
219+
# Model a PTC majority that observed the payload but not its blob data.
220+
# The locally verified payload remains in the store.
221+
store.payload_timeliness_vote[block_root] = [True] * spec.PTC_SIZE
222+
unavailable_votes = spec.DATA_AVAILABILITY_TIMELY_THRESHOLD + 1
223+
store.payload_data_availability_vote[block_root] = [False] * unavailable_votes + [None] * (
224+
spec.PTC_SIZE - unavailable_votes
225+
)
226+
227+
proposal_state = _advance_to_proposal_slot(spec, state, store)
228+
head = spec.get_head(store)
229+
assert head.root == block_root
230+
assert head.payload_status == spec.PAYLOAD_STATUS_FULL
231+
assert spec.payload_data_availability(store, block_root, available=False)
232+
assert not spec.should_build_on_full(store, head, proposal_state.slot)
233+
234+
engine = CaptureEngine()
235+
parent_bid = proposal_state.latest_execution_payload_bid
236+
assert parent_bid.block_hash != parent_bid.parent_block_hash
237+
238+
payload_id = spec.prepare_execution_payload(
239+
store=store,
240+
head=head,
241+
state=proposal_state,
242+
safe_block_hash=spec.Hash32(),
243+
finalized_block_hash=spec.Hash32(),
244+
suggested_fee_recipient=spec.ExecutionAddress(),
245+
target_gas_limit=spec.Uint64(60_000_000),
246+
execution_engine=engine,
247+
)
248+
249+
assert payload_id == SAMPLE_PAYLOAD_ID
250+
assert engine.head_block_hash == parent_bid.parent_block_hash
251+
252+
214253
@with_phases([GLOAS])
215254
@spec_state_test
216255
def test_prepare_execution_payload__extend_payload_does_not_mutate_state(spec, state):

0 commit comments

Comments
 (0)