Repository navigation
Govern roles, admin, upgrades and wind-downs from the console - #233
luchobonatti wants to merge 41 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🔵 Needs a closer look
It is a large, security-sensitive surface controlling role grants, admin handover, code upgrades, and wind-downs, with error-code mappings against the OZ access-control crate that cannot be verified in this environment, so final human review is warranted.
0 open findings
What changed in this PR
This PR adds a Governance admin surface to the vault console, implementing issue #197. It lets each contract's admin enumerate role holders, grant/revoke roles, run the two-step admin handover (offer with expiry, cancel, accept), and propose/apply/cancel vault upgrades and wind-downs. Actions that are safe-but-dangerous (revoking the vault's share-token manager, merging vault roles, handing over admin, applying a code upgrade, proposing a wind-down) require an explicit confirmation before signing, and renounce_admin is intentionally not offered. The work spans a new on-chain read (readPendingAdmins), new state/transaction hooks, a new page module with action specs, and a shared refactor of the action-rail field model (adding select/confirm field kinds and replacing the "N unmet" readiness with a "Blocked" status rendered as per-condition pass/fail/pending).
Changes:
- New governance surface end-to-end:
readPendingAdmins+pendingAdmins/useGovernanceState/useGovernanceTransactionshooks, thegovernance.tsspec/metrics module, and theGovernanceSectioncomponent wired intoAdminPanel. useAdminAuthoritynow enumerates full role-member lists (not just the first holder), tracks share-token manager and per-contract pending admins, and grants thegovernancesurface to the relevant admins and pending admins.- Shared action-rail refactor:
RailFieldunion (ActionField | SelectField | ConfirmField), new condition rendering with accessible pass/fail/pending status, andTransactionModalgovernance copy + error-code reasons.
| File | Description |
|---|---|
app-lib/readContract.ts / .test.ts |
Adds readPendingAdmins reading temporary PendingAdmin keys + archival settings; parameterizes durability. |
app/src/hooks/pendingAdmins.ts |
Shared pendingAdminsQuery, governanceReadsKey, and GovernedContract definitions. |
app/src/hooks/useGovernanceState.ts / .test.ts |
Assembles handovers and upgrade/wind-down/pause state for the surface. |
app/src/hooks/useGovernanceTransactions.ts |
Role/handover/upgrade/wind-down write hooks via the adminTransaction factory with query-invalidation keys. |
app/src/hooks/useAdminAuthority.ts / .test.ts |
Full role-member enumeration, pending-admin surfacing, governance-surface grants. |
app/src/pages/governance.ts / .test.ts |
Action specs, conditions, confirmations, expiry math, and metrics groups. |
app/src/pages/actions.ts / .test.ts |
RailField union, generic Spec/toAction, blocked readiness. |
app/src/components/admin/GovernanceSection.tsx / .test.tsx |
New surface component: flows, submit dispatch, modal wiring. |
app/src/components/admin/CycleActionRail.tsx / .module.css / .test.tsx |
Select/confirm inputs, accessible condition status rendering. |
app/src/components/vault/TransactionModal.tsx / .test.tsx / .module.css |
Governance copy and contract-error reasons (codes 2002–2203, 6046–6060). |
app/src/components/vault/MetricsStrip.tsx / .test.tsx |
Optional title for exposing full text behind a shortened value. |
app/src/pages/cycle.ts, configuration.ts |
Hoist shared DAY constant to cycle.ts. |
app/src/pages/AdminPanel.tsx / .test.tsx, App.test.tsx, CycleSection.test.tsx, useAdminTransaction.test.ts |
Wire holders/governance through the panel and update affected tests. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7d4055c to
286e1d6
Compare
Summary
Closes #197
The Governance tab lists every role holder and lets each contract's admin grant and revoke roles, hand over admin in two steps, and propose, apply or cancel upgrades and wind-downs.
Changes
renounce_adminis not offeredAcceptance criteria
renounce_adminnot offeredTest plan
Automated tests
npm run test— 1433 passing.Manual verification
/admin/governanceas governance: every role holder per contract, and the grant, revoke, handover, upgrade and wind-down actions.Breaking changes
None.
Checklist
Screenshots
None.