Skip to content

fix(progress-tracker): allow revoke_delegation during emergency pause (#492) - #518

Open
lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/revoke-delegation-pause-492
Open

lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/revoke-delegation-pause-492

Conversation

@lmduy2612

Copy link
Copy Markdown

Summary of Changes

Closes #492.

This PR enables learners to revoke progress delegations during an emergency pause in contracts/progress-tracker:

  • Safety rationale: The emergency pause is designed to freeze state-mutating actions that add risk (e.g. submitting progress, completing modules, or creating delegations). Revoking a delegation is a safety-critical action that eliminates risk by immediately cutting off compromised or malicious delegates.
  • Implementation:
    • Removed Self::require_not_paused(&env); from revoke_delegation in contracts/progress-tracker/src/lib.rs.
    • Preserved Self::require_not_paused(&env); on delegate_progress, ensuring new delegations remain strictly blocked during pause.
  • Tests:
    • Added unit test test_revoke_delegation_succeeds_while_paused in tests/unit/progress_tests.rs.
    • Added integration test assertions to test_progress_tracker_emergency_pause in tests/integration/emergency_pause_flow.rs covering pause -> delegate attempt failure -> revoke delegation success -> state verification.

Verification

  • cargo test --test progress_tests: All 107 tests passing.
  • cargo test --test emergency_pause_flow: All 4 tests passing.
  • Clippy: 0 warnings on modified files.

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.

revoke_delegation is blocked during pause, preventing learners from revoking malicious delegates

2 participants