Add Per Procedure Pause to `Authority`
- Langage dominant
- Rust
- Étoiles
- 132
- Forks
- 167
- Merge moyen
- 1 j 22 h
- PR mergées (30 j)
- 116
Description
`Authority` component currently have an account-wide emergency switch is via `is frozen`. It is read at the top of `assert authorized` and cuts off everything before any role or owner dispatch. Consequently, stopping one procedure means stopping all of them.
Additionally, pausing the target procedure alone is the only way to neutralize a pending note without freezing the whole account.
### Proposed Design
A new map slot to Authority:
```
AUTHORITY_PAUSED_PROCEDURES_SLOT -> map: [PROCEDURE_ROOT] -> [is_paused, 0, 0, 0]
```
One line in `assert_authorized`, right after the existing frozen check.
```masm
# block this procedure alone when it is individually paused.
exec.assert_caller_not_paused
# => [authority, is_frozen, 0, 0]
```
The helper uses the same `caller` pattern as `assert_authorized_rbac`:
```masm
proc assert_caller_not_paused
end
```
The mutators follow the `freeze` / `unfreeze` shape, taking the procedure root as an argument:
```masm
@account_procedure
pub proc pause_procedure(procedure_root: Word)
end
```
```masm
@account_procedure
pub proc unpause_procedure(procedure_root: Word)
end
```
`freeze` and `unfreeze` stay exactly as they are. The two mechanisms are independent. A procedure runs only if the account is not frozen and the procedure is not paused.
### Notes
- `pause_procedure` and `unpause_procedure` must gate on `assert_sender_is_emergency_authority` rather than `assert_authorized`, so they bypass both the frozen flag and the pause check. Otherwise `unpause_procedure` itself could be paused.
- The new slot must be installed under all three authority modes.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Look at the Authority component's `assert_authorized` function to understand the current frozen check. The new map slot `AUTHORITY_PAUSED_PROCEDURES_SLOT` needs to be added. Implement the helper `assert_caller_not_paused` and the mutators `pause_procedure` and `unpause_procedure`, ensuring they gate on `assert_sender_is_emergency_authority`. Verify the change works under all three authority modes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- backend
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Active
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 65/100