feat(pipeline): minimize deadzone w cross slot attesting#21435
feat(pipeline): minimize deadzone w cross slot attesting#21435Maddiaa0 merged 1 commit intomerge-train/spartanfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
730df54 to
67be055
Compare
26acaf0 to
f18cc20
Compare
f18cc20 to
b7b0c11
Compare
67be055 to
72312e1
Compare
72312e1 to
9f24073
Compare
0944eb7 to
de53468
Compare
9f24073 to
c2d1bb4
Compare
c2d1bb4 to
ef383be
Compare
de53468 to
82f2dbd
Compare
a399cd5 to
c1e72e3
Compare
82f2dbd to
4f49f4a
Compare
|
fix here |
| initialValidators: validators, | ||
| enableProposerPipelining: true, // <- yehaw | ||
| mockGossipSubNetwork: true, | ||
| mockGossipSubNetworkLatency: 500, // 200 ms delay in message prop - adverse network conditions |
There was a problem hiding this comment.
It's amazing how fast comments become outdated
| disableAnvilTestWatcher: true, | ||
| startProverNode: true, | ||
| perBlockAllocationMultiplier: 1, | ||
| perBlockAllocationMultiplier: 8, |
There was a problem hiding this comment.
This will lead to very big blocks at the beginning of the checkpoint, we sure about it?
There was a problem hiding this comment.
i had the value so high as it essentially disables it. ceil(remainingBudget / remainingBlocks * multiplier)
| ethereumSlotDuration: 12, | ||
| aztecSlotDuration: 72, | ||
| blockDurationMs: 8000, | ||
| l1PublishingTime: 2, | ||
| attestationPropagationTime: 0.5, | ||
| // maxDABlockGas: 786432, // Set max DA block gas to be the same as the checkpoint | ||
| // l1PublishingTime: 2, | ||
| // attestationPropagationTime: 1, |
There was a problem hiding this comment.
legacy and ill have to make sure if still true - l1PublishingTime + attestationPropagationTime removal was to use the network defaults in this test.
maxDaBlockGas was due dividing the defaults across blocks at one point in time was not enough to get a tx into a block
| // Check if message is for previous slot and within clock tolerance | ||
| if (!isWithinClockTolerance(slotNumber, targetSlot, this.epochCache)) { | ||
| // When pipelining, accept attestations for the current slot (built in the previous slot) | ||
| // if we're within the first ethereumSlotDuration/2 seconds of the slot. |
There was a problem hiding this comment.
Comment is wrong? The implementation accepts up until the p2p propagation time.
| * @param epochCache - EpochCache to get timing and pipelining state | ||
| * @returns true if pipelining is enabled, the message is for the current slot, and we're within the grace period | ||
| */ | ||
| export function isWithinPipeliningGracePeriod(messageSlot: SlotNumber, epochCache: EpochCacheInterface): boolean { |
There was a problem hiding this comment.
Shouldn't this function also consider the clock disparity time?
There was a problem hiding this comment.
Actually, can't we just merge this function with the one above? They are all used in all the same places after all.
There was a problem hiding this comment.
ive done a little refactor here
| if (this.pipelining) { | ||
| // L1 submission happens in target slot, after attestations | ||
| return this.aztecSlotDuration + this.pipeliningAttestationGracePeriod; | ||
| } |
There was a problem hiding this comment.
This limit feels too tight. We're saying here that we're only willing to collect attestations until this time, after that, we just give up. I'd update this to this.aztecSlotDuration * 2 - this.l1PublishingTime.
| stateDiff: [ | ||
| { slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true), value: toPaddedHex(0n, true) }, | ||
| ...forcePendingArchiveStateDiff, | ||
| ...forcePendingCheckpointNumberStateDiff, |
There was a problem hiding this comment.
I'm surprised we need the archive override tbh, given the checkpoint number override works for simulating. Maybe we can merge them and keep a single override for "current state of the network"?
There was a problem hiding this comment.
I dont think we do either, theres got to be a good reason i didnt migrate it in to the earlier PR. This appears to just be stale
There was a problem hiding this comment.
Right, its required if supporting a pipeline depth > 1. When building ontop of a proposed checkpoint that is not confirmed, then this is required else the value of the archive for the checkpoint being built on is 0
There was a problem hiding this comment.
merging them is a good idea
|
|
||
| if (checkpoint) { | ||
| this.metrics.recordCheckpointProposalSuccess(); | ||
| if (!broadcast) { |
There was a problem hiding this comment.
Maybe it's in a later PR, but if we failed to broadcast (or if there was any error broadcasting) we should clean up our proposed blocks from our archiver, so we can attest in the next slot.
There was a problem hiding this comment.
This is true, right now the wider rollback covers this - but we will need to tighten it up
| // Background the attestation → signing → L1 pipeline so the work loop is unblocked | ||
| this.pendingL1Submission = this.waitForAttestationsAndEnqueueSubmissionAsync(broadcast, votesPromises); |
There was a problem hiding this comment.
I'm trying to figure out if there's an issue with this getting overwritten before completion if we are the proposer for two slots in a row. But I don't think so - this is just used for awaiting completion, right?
c1e72e3 to
bfadfa1
Compare
59aca30 to
8fd3bbe
Compare
7c93544 to
0f459dd
Compare
0f459dd to
95557a0
Compare
8fd3bbe to
0c09382
Compare
| const elapsedMs = Number(nowMs - slotStartMs); | ||
| const windowMs = windowSeconds * 1000; | ||
|
|
||
| return elapsedMs < windowMs; |
There was a problem hiding this comment.
We should still account for clock disparity here
| }; | ||
|
|
||
| /** | ||
| * Shared checkpoint timing model used by the sequencer timetable and P2P validators. |
There was a problem hiding this comment.
WDYT about having different impls for pipelining and not pipelining, to avoid all the conditionals in the getters? No need to implement now, for sure.
| } | ||
|
|
||
| const timeAvailableForBlocks = this.aztecSlotDuration - this.checkpointInitializationTime - this.timeReservedAtEnd; | ||
| return Math.max(1, Math.floor(timeAvailableForBlocks / this.blockDuration)); |
There was a problem hiding this comment.
Can this mask errors where we have an invalid config altogether? Should we instead throw if the resulting blocks per slot is below 1?
| public get pipeliningAttestationGracePeriod(): number { | ||
| return (this.blockDuration ?? 0) + this.p2pPropagationTime; | ||
| } |
There was a problem hiding this comment.
Can you remind me why this value?
There was a problem hiding this comment.
Aside from that, it'd be good to keep comments on what each value represents, and the rationale for it.
2c391ba to
de83910
Compare
de83910 to
da950b2
Compare
BEGIN_COMMIT_OVERRIDE fix(stdlib): use bigint arithmetic in GasFees.mul() for non-integer scalars (#22383) fix(node-lib): reuse existing fileStore in snapshot sync instead of recreating (#22375) fix: gate req/resp data protocols for unauthenticated peers (#22406) fix(p2p): use per-batch ops array in AztecDatastore.batch() (#22357) chore(pipeline): spartan config (#21285) chore: add claude skill to send txs (#22439) feat(pipeline): minimize deadzone w cross slot attesting (#21435) fix(p2p): avoid 32-bit overflow in attestation pool block position key (#22412) fix(prover-client): increment retry count on timeout re-enqueue to prevent infinite loop (#22355) fix: remove redundant p2pClient.start() call (#22438) chore: add kubectl binary to spartan .gitignore (#22454) END_COMMIT_OVERRIDE
## Overview Allow validators to attest to old proposals slightly into the next slot, this allows validators from the slot before to send their checkpoint proposals later in their own slot. ## Key points - Allows timetable to extend past the current slot - Decouples attestation gathering from the hot path for sequencers - it can move async - Refactor of the timetable model into stdlib so it can be consumed elsewhere

Overview
Allow validators to attest to old proposals slightly into the next slot, this allows validators from the slot before to send their checkpoint proposals
later in their own slot.
Key points