Skip to content

fix(learn-token): enforce require_not_paused in batch_claim_reward (#497) - #516

Open
lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/batch-claim-pause-check-497
Open

lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:fix/batch-claim-pause-check-497

Conversation

@lmduy2612

Copy link
Copy Markdown

Summary of Changes

Enforces the emergency pause check in batch_claim_reward within LearnToken as specified in #497.

Previously, claim_reward checked Self::require_not_paused(&env), but batch_claim_reward omitted this check, which allowed users to batch-claim rewards and mint tokens while the contract was emergency-paused.

Verification & Testing

  • Added test_batch_claim_reward_fails_while_paused in tests/unit/token_tests.rs asserting that batch_claim_reward reverts with "contract is paused" when paused.
  • Added test_batch_claim_reward_allowed_after_unpause verifying that batch claiming succeeds after unpause.
  • All 80 unit tests pass in cargo test --test token_tests.
  • All 4 tests in tests/integration/emergency_pause_flow.rs pass.

Closes #497

- Add Self::require_not_paused(&env) check to batch_claim_reward before learner authorization
- Add unit tests verifying batch_claim_reward panics when paused and succeeds upon unpause
- Clean up test sequence numbers and assertions in token_tests.rs

Closes ChainLearnOfficial#497
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.

batch_claim_reward bypasses pause check while claim_reward checks it

2 participants