Skip to content

fix: reward callback failure unlock - #211

Merged
linguists merged 1 commit into
mainfrom
fix/reward-callback-failure-unlock
Jun 8, 2026
Merged

linguists merged 1 commit into
mainfrom
fix/reward-callback-failure-unlock

Conversation

@dongcool

@dongcool dongcool commented May 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR prevents a validator from remaining locked if the reward balance refresh callback receives a failed external promise.

Problem

epoch_update_rewards() sets the validator into executing state before calling the external staking pool. The callback previously used #[callback], which panics
before entering the function body if the external call fails.

In that failure case, the validator never reaches the normal post_execution() path, so it can remain stuck in executing = true and block future operations for that
validator.

Fix

Change validator_get_balance_callback to use #[callback_result].

On success, the existing reward update logic is unchanged. On failure, the callback clears the validator execution flag and returns without updating rewards.

Testing

CI passed:

  • test
  • clippy and fmt

@linguists linguists changed the title fix reward callback failure unlock fix: reward callback failure unlock May 11, 2026
@linguists

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@linguists has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 7 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a34d50d0-7b34-4964-b9cd-605a23c3c2d2

📥 Commits

Reviewing files that changed from the base of the PR and between 7620e4e and a759814.

📒 Files selected for processing (3)
  • contracts/linear/src/epoch_actions.rs
  • contracts/linear/src/validator_pool.rs
  • tests/__tests__/linear/epoch-action-failure.ava.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/reward-callback-failure-unlock

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread contracts/linear/src/epoch_actions.rs Resolved
@linguists
linguists merged commit 0b05d05 into main Jun 8, 2026
3 checks passed
@linguists
linguists deleted the fix/reward-callback-failure-unlock branch June 8, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants