Introduce separate payload availability deadline + make naturalSet/Map only write ordered - #10749
Conversation
…p only write ordered
|
i wont claim this as my feedback, as i just asked codex but worth considering |
|
@rolfyone what do you think without Codex on my changes to alternative of LRU map, which is called "natural" which is a part of this PR? Also, addressed feedback. A lot of structures to hold everything but I didn't come to something simpler fast. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 56239dc. Configure here.
| private PendingExecutionPayloads(final Map<Bytes32, PendingExecutionPayload> payloads) { | ||
| final Map<Bytes32, PendingExecutionPayload> limitedPayloads = | ||
| LimitedMap.createSynchronizedNatural(UNVALIDATED_EXECUTION_PAYLOADS_CACHE_SIZE); | ||
| limitedPayloads.putAll(payloads); |
There was a problem hiding this comment.
probably worth a size sanity check here, just to ensure that the new limitedPayloads won't exceed the cache size - would be a good place to throw if that happens... this was basically what codex was concerned about, but it makes sense to sanity check given the 'map' coming in.
There was a problem hiding this comment.
I've added protection on putAll, I think it's better to prune rather than throw
|
did a scan, looked ok to me.... codex had one concern which seems like its worth investigating [P2] ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/execution/DefaultExecutionPayloadManager.java:348 can still drop the only timely valid pending payload. PendingExecutionPayloads is bounded with write-order pruning, so once more than 64 candidates arrive for the same block root/builder index, the earliest candidate is evicted. Because these candidates are stored before block-dependent validation runs, a valid envelope seen before get_payload_due_ms() can be pushed out by later invalid envelopes; when the block imports, only the remaining invalid candidates are retried, and Teku may vote payload_present=false despite having seen a valid payload before the deadline. I’d preserve pre-deadline candidates until block validation rejects them, or use an eviction policy that does not replace earlier unvalidated candidates with later ones for this deadline-sensitive path. |
|
@rolfyone |
rolfyone
left a comment
There was a problem hiding this comment.
LGTM thanks for looking into the codex comment, sounds like we can live with it.

PR Description
Implementation of ethereum/consensus-specs#5212
Part of alpha.8 spec
Fixed Issue(s)
Documentation
doc-change-requiredlabel to this PR if updates are required.Changelog
Note
High Risk
Changes Gloas payload attestation semantics and execution-payload import timing, which affect validator votes and fork-choice-related behavior at the payload deadline.
Overview
Implements Gloas alpha.8 timing for when an execution payload counts as present for payload attestation (
payload_present), instead of treating any recently gossiped payload as present.Spec & config: Adds
PAYLOAD_DUE_BPS(7500) andget_payload_due_ms/Spec.getPayloadDueMillis(), alongside shared slot-time helpersisTimeReachedandisBeforeTimeInSlot(also used by slot processing). Spec reference metadata is updated to drop temporary exceptions for these items.Execution payload handling:
ExecutionPayloadManagersplits “recently seen” (dedup) fromisExecutionPayloadAvailableForPayloadAttestation, which is true only if a validated payload was recorded strictly before the payload-due offset in the slot (earliest arrival wins; late duplicates do not flip the vote;IGNOREafter an earlierACCEPTcan still mark availability). Pending payloads per block/builder keep multiple candidates with timestamps and bounded caches.Validator API:
createPayloadAttestationDatauses the new availability check forpayload_present.Infrastructure:
LimitedMap.createSynchronizedNatural/LimitedSet.createSynchronizedNaturalevict on insert/update order, not LRU on read—used for the new execution-payload caches.Reviewed by Cursor Bugbot for commit 4e120df. Bugbot is set up for automated code reviews on this repo. Configure here.