Commit d0f852e
fix(portal): close silent-gap paths in backfill floor + stream realtime
Five correctness fixes, each a path where the fork could mark a block range
"synced" while serving no (or wrong-fork) data. Every fix ships a regression
test verified to fail without it.
Historical backfill:
- backfillStartBlock: an undefined fromBlock is genesis (the runtime reads
`filter.fromBlock ?? 0`), so if ANY source omits it the floor is 0. The old
Math.min-over-defined-fromBlocks let a bounded source (e.g. 15M) clamp every
chunk fetch past the [0, 15M) history of an unbounded source, marking that
prefix synced over a silent gap. (finding 3)
Portal-native stream realtime (PORTAL_REALTIME=stream, experimental):
- Refuse to start when a chain has non-log sources (trace/transfer/transaction/
block) or receipt-requiring log sources: stream mode emits only log-bearing
block events, so those events were silently skipped while their intervals were
finalized as cached. Fail loud instead. (finding 5)
- A failed /finalized-head probe is now fatal at both seams (clampFinalized-
ToPortalHead retries then throws; the historical seam throws on an unknown
head) instead of passing the RPC finalized block through / returning [] —
which left (portalHead, rpcFinalized] permanently skipped. (finding 6)
- Force a /stream reconnect the moment a factory child is discovered (a bumped
logsRevision streamHotBlocks watches), so the widened server-side filter takes
effect on the next block instead of only after an unrelated reconnect. Same-
block child logs remain a documented limitation. (finding 4)
- An unknown-parent gap (a reorg deeper than the unfinalized window) is now
fatal instead of silently clearing the window and continuing — which left the
pre-fork blocks indexed on the wrong fork with no rollback event. (finding 7)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 802ceed commit d0f852e
6 files changed
Lines changed: 486 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
93 | 119 | | |
94 | 120 | | |
95 | 121 | | |
| |||
289 | 315 | | |
290 | 316 | | |
291 | 317 | | |
292 | | - | |
| 318 | + | |
293 | 319 | | |
294 | 320 | | |
295 | 321 | | |
| |||
300 | 326 | | |
301 | 327 | | |
302 | 328 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
310 | 339 | | |
311 | 340 | | |
312 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
58 | 89 | | |
59 | 90 | | |
60 | 91 | | |
| |||
65 | 96 | | |
66 | 97 | | |
67 | 98 | | |
| 99 | + | |
| 100 | + | |
68 | 101 | | |
69 | 102 | | |
70 | 103 | | |
| |||
102 | 135 | | |
103 | 136 | | |
104 | 137 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
114 | 162 | | |
115 | 163 | | |
116 | 164 | | |
| |||
309 | 357 | | |
310 | 358 | | |
311 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
312 | 363 | | |
313 | 364 | | |
314 | 365 | | |
| |||
345 | 396 | | |
346 | 397 | | |
347 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
348 | 402 | | |
349 | 403 | | |
350 | 404 | | |
| |||
355 | 409 | | |
356 | 410 | | |
357 | 411 | | |
358 | | - | |
359 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
360 | 415 | | |
| 416 | + | |
361 | 417 | | |
362 | 418 | | |
363 | 419 | | |
| |||
380 | 436 | | |
381 | 437 | | |
382 | 438 | | |
| 439 | + | |
383 | 440 | | |
384 | 441 | | |
385 | 442 | | |
| |||
407 | 464 | | |
408 | 465 | | |
409 | 466 | | |
410 | | - | |
| 467 | + | |
| 468 | + | |
411 | 469 | | |
412 | 470 | | |
413 | 471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
162 | 163 | | |
163 | 164 | | |
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 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
0 commit comments