Conversation
…e flags (ceejaylaboratory#1163) Introduce a PauseState struct (deposits_paused, withdrawals_paused, swaps_paused) stored alongside the existing global pause. The super admin sets it with set_pause_flags, and integrators query the effective state via is_deposit_paused, is_withdraw_paused and is_swap_paused, which also honour the global kill switch. get_pause_flags exposes the raw configuration. Includes unit tests for partial pause states.
|
@AdaBliss 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! 🚀 |
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.
closes #1163
Summary
Adds granular pause levels to
src/security_registry/lib.rs, so the security team can halt risky operations (for example deposits) while users can still withdraw.Changes
PauseState { deposits_paused, withdrawals_paused, swaps_paused }struct (contracttype,Default), stored underDataKey::PauseFlags.set_pause_flags(admin, flags): super-admin only (same auth and admin check aspause). It extends instance TTL like the other admin setters.is_deposit_paused(),is_withdraw_paused(),is_swap_paused(): effective state for each operation.get_pause_flags(): raw configured flags (defaults to allfalse).Design notes
pause/unpause/is_pausedkill switch is unchanged, so current integrators (for exampleescrow_timelock, which callsis_paused) keep working. The granular queries returntruewhen either the global pause or the specific flag is set. The global switch always wins, and granular flags never engage the global pause.is_swap_pausedis included alongside the two helpers named in the issue because the struct has aswaps_pausedflag.Verification
cargo test --lib -p anchorpoint-security-registry: 11 passed (3 existing + 8 new), covering defaults, deposit-only, withdraw-only and swap-only states, clearing flags, the global pause overriding flags, admin auth plus TTL extension, and rejection of non-admin callers.cargo clippy -p anchorpoint-security-registry --all-targets --all-features -- -D warnings(the CI command): clean.cargo build -p anchorpoint-security-registry --target wasm32v1-none --release: OK.