Skip to content

fix: unify pause naming, add RBAC, typed errors in learn-token and credential-nft (#550-#553) - #677

Merged
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
TheHalalHunter:fix/issues-550-551-552-553
Oct 21, 2026
Merged

DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
TheHalalHunter:fix/issues-550-551-552-553

Conversation

@TheHalalHunter

@TheHalalHunter TheHalalHunter commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves four related issues in a single PR to keep the contract API changes atomic and reviewable together.


#550 — Unify pause function naming

  • Renamed \emergency_pause/\emergency_unpause\ → \pause/\unpause\ in \credential-nft\ and \progress-tracker\ to match \learn-token\
  • Updated all tests, integration tests, scripts, examples, and README API tables

#551 — Add RBAC to credential-nft and progress-tracker

  • Ported \AdminRole\ enum (Admin, Minter, Pauser) from \learn-token\ to both contracts
  • Added \grant_role,
    evoke_role, \has_role\ public functions
  • Gated \mint_credential\ on Minter/Admin, \pause/\unpause\ on Pauser/Admin, \upgrade\ on Admin
  • Admin role granted to initial admin on \initialize\
  • Added comprehensive RBAC tests to both contracts

#552 — Typed ContractError returns in learn-token

  • All 15 \ContractError\ variants are now used (previously 11 were dead code)
  • Newly wired variants: \ZeroAddress, \RewardCapped\
  • Converted all public state-mutating functions from \panic!\ to \Result<_, ContractError>\
  • Removed
    equire_not_paused\ (replaced by \ensure_not_paused\ returning \Result)
  • Updated all string-message \should_panic\ tests to typed error assertions

#553 — Typed ContractError returns in credential-nft

  • Added 5 new variants: \ContractPaused, \NotFound, \DuplicateCredential, \InvalidScore, \InvalidMetadataUri\
  • Converted all public functions in \lib.rs, \mint.rs, and \�erify.rs\ to return \Result\
  • Updated all string-message \should_panic\ tests across \credential_tests.rs, \error_message_tests.rs, and \security_double_spending_tests.rs\

Testing

All string-message #[should_panic]\ tests have been converted to typed error assertions. Cargo is not installed in the development environment — please run \cargo test --workspace\ as part of CI review.

Commits

Closes #550, Closes #551, Closes #552, Closes #553

@TheHalalHunter
TheHalalHunter force-pushed the fix/issues-550-551-552-553 branch from 4338f02 to d956036 Compare October 21, 2026 02:43
@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@TheHalalHunter 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

2 participants