Conversation
…ations - Add Self::require_not_paused(&env) checks to set_transfer_restriction, add_to_whitelist, remove_from_whitelist, snapshot, record_balance_snapshot, grant_role, revoke_role, add_admin, remove_admin, and increase_allowance - Add dedicated unit tests verifying all 10 operations panic when paused and resume upon unpause - Clean up test sequence numbers and assertions in token_tests.rs Closes ChainLearnOfficial#500
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Enforces emergency pause checks across all 10 administrative and configuration functions in
LearnTokenas specified in #500:set_transfer_restrictionadd_to_whitelistremove_from_whitelistsnapshotrecord_balance_snapshotgrant_rolerevoke_roleadd_adminremove_adminincrease_allowanceEach function now calls
Self::require_not_paused(&env)immediately following authentication, ensuring that an emergency pause halts all state mutations.Verification & Testing
#[should_panic(expected = "contract is paused")]unit tests intests/unit/token_tests.rsverifying that each operation reverts when paused:test_set_transfer_restriction_fails_while_pausedtest_add_to_whitelist_fails_while_pausedtest_remove_from_whitelist_fails_while_pausedtest_snapshot_fails_while_pausedtest_record_balance_snapshot_fails_while_pausedtest_grant_role_fails_while_pausedtest_revoke_role_fails_while_pausedtest_add_admin_fails_while_pausedtest_remove_admin_fails_while_pausedtest_increase_allowance_fails_while_pausedtest_unpause_restores_admin_and_config_operationsasserting that operations succeed afterunpause.cargo test --test token_tests.tests/integration/emergency_pause_flow.rspass.cargo clippy --test token_tests.Closes #500