0xMiden / 0xMiden/protocol

Add Per Procedure Pause to `Authority`

Offen
#3,853 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
132
Forks
167
Ø Merge
1 T. 22 Std.
Gemergte PRs (30 T.)
116

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
backend
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
65/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.