Skip to content

contributor-rewards: retry the merkle root posting - #4468

Merged
martinsander00 merged 2 commits into
mainfrom
ms/3302-4
Oct 28, 2026
Merged

martinsander00 merged 2 commits into
mainfrom
ms/3302-4

Conversation

@martinsander00

Copy link
Copy Markdown
Contributor

Summary of Changes

  • This PR makes the worker retry a failed merkle root posting 3 more times, one minute apart, before it reports the failure.
  • The scheduler and calculate-rewards both post the root through the same call, so both now retry.
  • Before, one transient RPC error ended the run. The worker no longer fails the run at the first error.

Testing Verification

  • The backfill of DZ epoch 241 failed once with RPC response error -32004: Block not available for slot 462537200. This retry covers that error.
  • No test was added, because the change wraps one existing call in the retry helper that the crate already uses.

@martinsander00
martinsander00 requested review from a team and a balanced review from Copilot October 28, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the merkle root posting retry change.

No open issues 🎉

What changed in this PR

This PR adds retries for merkle root posting in the contributor rewards worker, reducing failures from transient RPC errors.

Changes:

  • The worker retries a failed posting three more times, with a one-minute delay and a warning before each retry.
  • The scheduler and calculate-rewards both use the updated posting path.
  • The changelog records the retry behavior.
File Description
offchain/​crates/​contributor-rewards/​src/​calculator/​orchestrator.rs Adds bounded retries and warning logs around merkle root posting.
offchain/​crates/​contributor-rewards/​CHANGELOG.md Documents the three additional posting attempts and one-minute delays.

Review effort: Balanced

Comment thread offchain/crates/contributor-rewards/CHANGELOG.md Outdated
nikw9944
nikw9944 previously approved these changes Oct 28, 2026

@nikw9944 nikw9944 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry covers the Block not available for slot error from epoch 241. That error comes from the get_block_time call inside wait_for_grace_period, and the new retry wraps that call. One non-blocking note: the retry also covers the grace-period wait, so a timeout can now stretch to about four times grace_period_max_wait_seconds.

Comment thread offchain/crates/contributor-rewards/src/calculator/orchestrator.rs

@nikw9944 nikw9944 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier note about retries stretching the grace-period wait is fixed. orchestrator.rs now computes grace_period_deadline once, before the retry loop, and wait_for_grace_period checks against that deadline. A retry after a timeout now fails within one poll, and grace_period_max_wait_seconds again limits the total wait. The retry still covers the get_block_time error from epoch 241.

@martinsander00
martinsander00 merged commit 5eb12dc into main Oct 28, 2026
33 checks passed
@martinsander00
martinsander00 deleted the ms/3302-4 branch October 28, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants