Commit 269e6d0
authored
fix(test): reliably find target proposer in sentinel_status_slash (A-1217) (#24143)
## Problem
The e2e helper `warpToSlotBeforeTargetProposer` (in
`sentinel_status_slash.parallel.test.ts`) intermittently threw `Target
proposer ... not found with sufficient buffer within 20 epochs`,
surfacing as an `e2e_p2p` flake. It's a deterministic helper bug, not
network flakiness.
The search window was derived as `searchStart = currentSlot +
minBufferSlots`, `searchEnd = (currentEpoch + 2) * AZTEC_EPOCH_DURATION
- 1`. With `AZTEC_EPOCH_DURATION = 2` and `minBufferSlots = 2`, the
buffer offset consumes a full epoch, so whenever `currentSlot` is odd
the window collapses to a single, always-odd slot. Because the proposer
for each slot is a different RANDAO-shuffled committee member, probing
only odd slots never examines the even slot of any epoch — where the
1-of-6 target can be the proposer — so the loop exhausts all attempts
and throws.
## Log verification
Confirmed against CI run
[`cc8c935bb167ed37`](http://ci.aztec-labs.com/cc8c935bb167ed37):
- All 20 attempts probed a 1-slot window, every probed slot odd: `13,
15, 17, … 51`. Zero hit lines.
- The target `0x90f79b…` was on the committee every epoch
(RANDAO-shuffled into different positions) and attested at slots 11–12 —
reachable, just never at a probed (odd) slot.
- Zero `EpochNotStable` reverts during the scan — the search ran clean,
just structurally blind to even slots.
## Fix
Extract the proposer search into a shared `findUpcomingProposerSlot` in
`e2e_p2p/shared.ts`, parameterized by `minLeadSlots`, and have the
sentinel test use it:
- Scans forward **one slot at a time** from `currentSlot +
minLeadSlots`, so it examines **both epoch parities** (fixing the
odd-only blindness) and finds the RANDAO-shuffled target wherever it
proposes.
- Guarantees the returned slot is **at least `minLeadSlots` ahead**, so
the sentinel can warp to `targetSlot - minLeadSlots` for its settle
buffer with no risk of a backwards warp — the lead comes from the scan
start, not from a per-epoch position constraint.
- Handles `EpochNotStable` by warping one epoch forward and continuing,
keeping the lead.
The sentinel helper becomes a thin wrapper: `findUpcomingProposerSlot({
minLeadSlots: 2 })` then `advanceToSlot(targetSlot - 2)`.
Kept **separate** from the existing `advanceToEpochBeforeProposer`,
which serves a genuinely different pattern: its four callers stay one
epoch before the target to start sequencers, then warp to the epoch
boundary, and rely on `warmupSlots` for their warm-up margin
(load-bearing — without it their proposals serialize past the slot
boundary and are rejected as late). That helper is unchanged, so its
callers are unaffected.
## Testing
- Build, format, and lint clean; only `shared.ts` and the sentinel test
changed.
- The proposer search now examines both parities and guarantees the lead
by construction.
- **Not yet run:** the full e2e
(`sentinel_status_slash.parallel.test.ts`, ~20 min,
real-time-dependent). The real validation is running it repeatedly to
confirm the proposer is found and the suite's other two tests (which
share the helper) still pass.
Closes A-1217.1 parent fbfddf4 commit 269e6d0
2 files changed
Lines changed: 84 additions & 55 deletions
Lines changed: 25 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
246 | 250 | | |
247 | | - | |
248 | | - | |
249 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
250 | 254 | | |
251 | | - | |
252 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
253 | 259 | | |
254 | | - | |
| 260 | + | |
255 | 261 | | |
256 | 262 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
301 | 275 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 276 | | |
307 | 277 | | |
308 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
150 | 209 | | |
151 | 210 | | |
152 | 211 | | |
| |||
0 commit comments