This repository was archived by the owner on Sep 8, 2026. It is now read-only.
Commit 8004775
authored
contributor-rewards: fail the tick instead of saving a snapshot with no leader schedule (#413)
## Summary of Changes
* The scheduler no longer writes a snapshot it cannot use: a failed leader-schedule fetch propagates instead of becoming `leader_schedule: null`, and `create_epoch_snapshot` validates before saving.
* A failed fetch was one `warn!`, then an unusable snapshot uploaded over the epoch's canonical S3 key; the tick then failed reading it back with `Missing leader schedule`, a symptom whose cause survived only in the log. #411 fixed this for the `snapshot` CLI command but not for the scheduler, which is the path that runs in production.
* Scheduler failures now log the full cause chain (`{:#}`). Plain `{}` prints only the outermost context, so the newly propagated reason would still have been dropped.
* **Security:** `EpochFinder`'s retry logs printed `reqwest`'s error verbatim, which includes the request URL. That URL carries the read endpoint's API key on mainnet-beta and journald ships to Loki, so those logs now strip it. This matters because the companion PR points mainnet-beta's reads at the keyed endpoint.
* **Behavior change:** a `--dry-run` tick that previously marked the epoch processed with an unusable snapshot now fails and retries — nothing validated on that path, since `calculate_rewards` never ran. Both deployed environments run with dry-run off.
## Testing Verification
* New `tests/test_snapshot_validate.rs` builds a `CompleteSnapshot` from the existing `testnet_snapshot.json` and `leader-schedule-epoch-89.json` fixtures: `validate()` is `Ok` on a complete snapshot, and names the right issue when the leader schedule is missing or empty.1 parent 0c84bde commit 8004775
5 files changed
Lines changed: 191 additions & 60 deletions
File tree
- crates/contributor-rewards
- src
- cli
- ingestor
- scheduler
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 261 | + | |
271 | 262 | | |
272 | 263 | | |
273 | 264 | | |
| |||
283 | 274 | | |
284 | 275 | | |
285 | 276 | | |
286 | | - | |
| 277 | + | |
287 | 278 | | |
288 | | - | |
| 279 | + | |
289 | 280 | | |
290 | 281 | | |
291 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
145 | 169 | | |
146 | 170 | | |
147 | 171 | | |
| |||
264 | 288 | | |
265 | 289 | | |
266 | 290 | | |
267 | | - | |
268 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
269 | 294 | | |
270 | 295 | | |
271 | | - | |
| 296 | + | |
| 297 | + | |
272 | 298 | | |
273 | 299 | | |
274 | 300 | | |
| |||
285 | 311 | | |
286 | 312 | | |
287 | 313 | | |
288 | | - | |
289 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
290 | 317 | | |
291 | 318 | | |
292 | | - | |
| 319 | + | |
| 320 | + | |
293 | 321 | | |
294 | 322 | | |
295 | 323 | | |
| |||
311 | 339 | | |
312 | 340 | | |
313 | 341 | | |
314 | | - | |
315 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
316 | 345 | | |
317 | 346 | | |
318 | 347 | | |
319 | 348 | | |
320 | 349 | | |
321 | 350 | | |
322 | 351 | | |
323 | | - | |
324 | | - | |
325 | | - | |
| 352 | + | |
| 353 | + | |
326 | 354 | | |
327 | 355 | | |
328 | 356 | | |
| |||
368 | 396 | | |
369 | 397 | | |
370 | 398 | | |
371 | | - | |
372 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
373 | 402 | | |
374 | 403 | | |
375 | 404 | | |
| 405 | + | |
376 | 406 | | |
377 | 407 | | |
378 | 408 | | |
| |||
458 | 488 | | |
459 | 489 | | |
460 | 490 | | |
461 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
462 | 496 | | |
463 | | - | |
| 497 | + | |
| 498 | + | |
464 | 499 | | |
465 | 500 | | |
466 | 501 | | |
| |||
576 | 611 | | |
577 | 612 | | |
578 | 613 | | |
579 | | - | |
580 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
581 | 617 | | |
582 | 618 | | |
583 | | - | |
| 619 | + | |
| 620 | + | |
584 | 621 | | |
585 | 622 | | |
586 | 623 | | |
| |||
607 | 644 | | |
608 | 645 | | |
609 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
610 | 673 | | |
611 | 674 | | |
612 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
425 | 424 | | |
426 | 425 | | |
427 | 426 | | |
| |||
769 | 768 | | |
770 | 769 | | |
771 | 770 | | |
772 | | - | |
| 771 | + | |
773 | 772 | | |
774 | | - | |
| 773 | + | |
775 | 774 | | |
776 | 775 | | |
777 | 776 | | |
778 | 777 | | |
779 | 778 | | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
794 | 784 | | |
795 | 785 | | |
796 | 786 | | |
| |||
806 | 796 | | |
807 | 797 | | |
808 | 798 | | |
809 | | - | |
| 799 | + | |
810 | 800 | | |
811 | | - | |
| 801 | + | |
812 | 802 | | |
813 | 803 | | |
814 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
815 | 810 | | |
816 | 811 | | |
817 | 812 | | |
| |||
0 commit comments