You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contracts/vault/ACCESS_CONTROL.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,3 +75,29 @@ The `transfer_ownership` function allows the current owner to hand over full con
75
75
### Admin Transition
76
76
77
77
The `set_admin` function allows the current admin (typically the owner initially) to delegate operational control (like settlement and distribution) to a dedicated service account.
In the initial deployment model, only the vault owner could invoke `deduct` and `batch_deduct`. This required the owner's key to be present in the metering path, which is impractical for automated, high-frequency backend services.
86
+
87
+
### Current Model
88
+
89
+
The `set_authorized_caller` function allows the owner to designate a single backend address (e.g., a matching engine or metering service) that may call deduct flows alongside the owner. Both the owner and the authorized caller are permitted; all other addresses are rejected.
90
+
91
+
### Migration Steps
92
+
93
+
1. Deploy or upgrade the vault contract containing `set_authorized_caller`.
94
+
2. The owner calls `set_authorized_caller(owner, backend_address)` to register the backend signing key.
95
+
3. The backend service signs and submits `deduct` / `batch_deduct` transactions using its own key.
96
+
4. The owner's key is no longer required in the hot metering path.
97
+
98
+
### Operational Notes
99
+
100
+
- Only the owner may call `set_authorized_caller`; the backend cannot self-register.
101
+
- Rotating the backend key requires calling `set_authorized_caller` again with the new address. The previous address is replaced atomically.
102
+
- Every change emits a `set_auth_caller` event (topics: `("set_auth_caller", owner)`, data: `new_caller`) for audit purposes.
103
+
- Passing the vault contract's own address or the currently stored address as `new_caller` is rejected.
0 commit comments