This repository was archived by the owner on Sep 8, 2026. It is now read-only.
contributor-rewards: fail the tick instead of saving a snapshot with no leader schedule - #413
Merged
Conversation
…no leader schedule The scheduler logged a failed leader-schedule fetch as a warning, threw the error away, and uploaded the snapshot under the canonical key with a null leader schedule. It then failed reading that same file back with "Missing leader schedule", a symptom whose cause survived only in a log line. Both snapshot producers now propagate the fetch error with the epoch in its context, and the scheduler validates before saving, which also covers the --dry-run path where no consumer validates at all. Refs malbeclabs/infra#2372
… API key out of it
The propagated leader-schedule error was formatted with {}, which prints only the
outermost context, so the reason the fetch failed never reached the journal.
Both scheduler failure sites now use {:#}.
EpochFinder's retry hooks logged SolanaClientError with {:?}, and reqwest's Debug
prints the request URL. The mainnet-beta read endpoint carries an API key in that
URL and journald ships to Loki, so every timeout and 429 would have published it.
Replaces the validate() unit tests with an integration test over the existing
snapshot and leader-schedule fixtures, so the accepting case asserts is_ok()
on a genuinely complete snapshot rather than a substring of an error.
Refs malbeclabs/infra#2372
…is branch Comments and prose only, no behavior change.
…rror too
Redacting only the retry logs left the leak open: when the retry gives up, the
client error travels up the chain, and the scheduler prints that chain with
{:#}, so the mainnet-beta read endpoint's API key still reached journald and
Loki. Every RPC call in EpochFinder now converts its error through redacted_error,
which drops the original as a source rather than wrapping it.
Test points a client at a closed local port and asserts the key is absent from
the propagated error while present in the raw one.
Refs malbeclabs/infra#2372
nikw9944
force-pushed
the
nikw9944/infra-2372
branch
from
August 26, 2026 22:13
f04cf47 to
a5e562a
Compare
Contributor
Author
|
Addressed the review in a5e562a: the URL redaction now covers the propagated error, not only the retry logs. The catch was correct and the leak was worse than the comment suggested — this PR also changed the scheduler to print the failure chain with Nothing else changed. Rebased onto |
martinsander00
approved these changes
Aug 26, 2026
bgm-malbeclabs
pushed a commit
to malbeclabs/doublezero
that referenced
this pull request
Aug 28, 2026
…no leader schedule (malbeclabs/doublezero-offchain#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. malbeclabs/doublezero-offchain#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
leader_schedule: null, andcreate_epoch_snapshotvalidates before saving.warn!, then an unusable snapshot uploaded over the epoch's canonical S3 key; the tick then failed reading it back withMissing leader schedule, a symptom whose cause survived only in the log. contributor-rewards, solana-cli, validator-debt: fix the hardcoded 400ms slot times #411 fixed this for thesnapshotCLI command but not for the scheduler, which is the path that runs in production.{:#}). Plain{}prints only the outermost context, so the newly propagated reason would still have been dropped.EpochFinderprintedreqwest's error verbatim, which includes the request URL, both in its retry logs and in the error it propagates. It reads the DZ ledger through a vaulted URL on mainnet-beta, and journald ships to Loki, so those credentials would reach Loki on any timeout or 429 — and the{:#}change above would have printed them on the failure path too. Every RPC error in the module is now stripped of its URL, with a test pinning it.--dry-runtick that previously marked the epoch processed with an unusable snapshot now fails and retries — nothing validated on that path, sincecalculate_rewardsnever ran. Both deployed environments run with dry-run off.Fixes malbeclabs/infra#2372
Testing Verification
tests/test_snapshot_validate.rsbuilds aCompleteSnapshotfrom the existingtestnet_snapshot.jsonandleader-schedule-epoch-89.jsonfixtures:validate()isOkon a complete snapshot, and names the right issue when the leader schedule is missing or empty.cargo test --workspace: 483 pass, 0 fail.just clippy(-Dclippy::all) andjust fmt-checkclean.getLeaderSchedule, since this session has no network route to a DZ ledger or Solana RPC. Traced instead:validate()precedesstorage.saveon both storage backends, andprocess_rewardsreturns the error without callingmark_success, so the epoch retries on the next tick.