Skip to content

fix: convert GuardError in staking_rewards rotate_admin - #413

Open
kaizercodes wants to merge 1 commit into
OdyxeeeLabs:mainfrom
kaizercodes:feat/issue-314-ct-027-staking-rewards-rotate-admin-returns
Open

fix: convert GuardError in staking_rewards rotate_admin#413
kaizercodes wants to merge 1 commit into
OdyxeeeLabs:mainfrom
kaizercodes:feat/issue-314-ct-027-staking-rewards-rotate-admin-returns

Conversation

@kaizercodes

Copy link
Copy Markdown

Overview

This PR fixes a compile-blocking type mismatch in contracts/staking_rewards/src/lib.rs. The rotate_admin function declares a return type of Result<(), ContractError>, but DefaultEmergencyGuard::rotate_admin returns Result<(), GuardError>. The guard call is now wrapped with .map_err(|_| ContractError::Paused) so the error type aligns without requiring a broad From<GuardError> for ContractError implementation.

Related Issue

Closes CT-027

Changes

🐛 Staking Rewards Error Conversion

  • [MODIFY] contracts/staking_rewards/src/lib.rs
    • Converts the GuardError from DefaultEmergencyGuard::rotate_admin into ContractError::Paused.
    • Keeps the change minimal and consistent with existing contract error conventions.
    • Updated call:
DefaultEmergencyGuard::rotate_admin(...).map_err(|_| ContractError::Paused)?;

Verification Results

cargo check --manifest-path contracts/staking_rewards/Cargo.toml
✅ Compilation succeeds

cargo test --manifest-path contracts/staking_rewards/Cargo.toml
✅ Tests pass
Acceptance Criteria Status
Add `.map_err( _
Or implement From<GuardError> for ContractError ✅ Not needed — the focused error conversion satisfies the function signature

Closes #314

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@kaizercodes Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant