fix(chainlink): report error when response_slot < min_context_slot#1317
fix(chainlink): report error when response_slot < min_context_slot#13170xzrf wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughIn Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
4ce0a58 to
0745dfe
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@magicblock-chainlink/src/remote_account_provider/mod.rs`:
- Around line 2130-2137: The post-fetch check that logs "Response slot
{response_slot} < {min_context_slot}..." (using response_slot, min_context_slot,
pubkeys_str and notify_error) is unreachable because the fetch loop already
retries on slot < min_context_slot via the retry! path; move this explicit
min-context-slot failure reporting into the retry-exhaustion branch that handles
the retry! failure for the slot < min_context_slot case so callers receive a
deterministic "Minimum context slot ... not reached" error; remove the redundant
post-fetch branch or make it a no-op, and ensure the error text matches the
existing downstream "Minimum context slot ... not reached" wording so callers
get the same contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 01b39403-dd10-441f-ac48-f522377531fb
📒 Files selected for processing (1)
magicblock-chainlink/src/remote_account_provider/mod.rs
| if response_slot < min_context_slot { | ||
| let err_msg = format!( | ||
| "Response slot {response_slot} < {min_context_slot} fetching accounts {}", | ||
| pubkeys_str(&pubkeys) | ||
| ); | ||
| notify_error(&err_msg); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Min-context-slot failure reason is effectively bypassed by current control flow
At Line 2130, this check runs after the fetch loop that already handles slot < min_context_slot (Line 2027) via retry!, so this branch is effectively unreachable in normal execution. On retry exhaustion, callers get a generic max-retries error instead of a deterministic min-context-slot-not-reached reason, which weakens the cross-layer error contract.
Please move the explicit min-context-slot failure reporting into the retry-exhaustion path for the slot < min_context_slot case (and keep the error text aligned with existing “Minimum context slot … not reached” handling used downstream).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@magicblock-chainlink/src/remote_account_provider/mod.rs` around lines 2130 -
2137, The post-fetch check that logs "Response slot {response_slot} <
{min_context_slot}..." (using response_slot, min_context_slot, pubkeys_str and
notify_error) is unreachable because the fetch loop already retries on slot <
min_context_slot via the retry! path; move this explicit min-context-slot
failure reporting into the retry-exhaustion branch that handles the retry!
failure for the slot < min_context_slot case so callers receive a deterministic
"Minimum context slot ... not reached" error; remove the redundant post-fetch
branch or make it a no-op, and ensure the error text matches the existing
downstream "Minimum context slot ... not reached" wording so callers get the
same contract.
Summary
Report error inside
RemoteAccountProvider::fetch()whenresponse_slot < min_context_slotinstead of panicking onassert!Summary by CodeRabbit