0xMiden / 0xMiden/protocol

Add Per Procedure Pause to `Authority`

Aperta
#3,853 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
132
Fork
167
Merge medio
1g 22h
PR unite (30g)
116

Descrizione

`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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Esaminate la funzione `assert_authorized` del componente Authority per comprendere il controllo attuale dello stato congelato. È necessario aggiungere il nuovo map slot `AUTHORITY_PAUSED_PROCEDURES_SLOT`. Implementate l’helper `assert_caller_not_paused` e i mutatori `pause_procedure` e `unpause_procedure`, assicurandovi che siano soggetti a `assert_sender_is_emergency_authority`. Verificate che la modifica funzioni in tutte e tre le modalità di Authority.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
backend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.