Repository navigation
Set vault, oracle and token parameters from the console - #231
luchobonatti wants to merge 10 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 feature spanning ~24 files that expands admin authorization surfaces and adds on-chain financial-parameter setters, so final human review is warranted despite no concrete defects being found.
0 open findings
What changed in this PR
This PR adds a Configuration admin surface (/admin/configuration) that lets the relevant authorities change vault, oracle, and share-token parameters. Vault governance sets the deposit cap, custodian, notice and wind-down delay; the oracle admin sets the oracle limits; the share-token admin sets the compliance contract and identity verifier. Each field is prefilled with the current value, shows current-vs-new side by side, and mirrors the contract's bounds client-side before a signature is requested, with refusals mapped to named contract errors. It fits into the existing admin panel alongside the Cycle and Emergency surfaces, reusing the CycleActionRail and TransactionModal infrastructure.
Changes:
- New Configuration surface: state hook (
useConfigurationState), write hooks (useConfigurationTransactions), page logic (configuration.ts), and UI (ConfigurationSection), wired intoAdminPanelanduseAdminAuthority(oracle/token admins now reachconfiguration). - Shared extraction/refactors:
toAction/Spec/ROLESmoved intoactions.ts;adminTransactionfactory extracted intouseAdminTransaction;parseDuration+ parameterizedformatDurationand several formatters exported fromcycle.ts. CycleActionRailgains keyed multi-field support with current/new value display;TransactionModalgains configuration copy and admin error-code mappings;usePendingTransactionnow retriesnull-valued args correctly.
| File | Description |
|---|---|
| app/src/pages/configuration.ts | New: parses inputs, mirrors contract bounds, builds setter specs/actions and parameter groups |
| app/src/pages/configuration.test.ts | New: thorough coverage of actions, bounds, prefills and groups |
| app/src/hooks/useConfigurationState.ts | New: reads current vault/oracle/token parameters for the surface |
| app/src/hooks/useConfigurationTransactions.ts | New: setter write hooks with query-key invalidation |
| app/src/hooks/useConfigurationState.test.ts | New: covers gathering/checking/unreadable/polling |
| app/src/hooks/useAdminTransaction.ts | New: shared admin transaction factory extracted from emergency |
| app/src/hooks/useAdminTransaction.test.ts | Adds configuration setter cases to the shared factory tests |
| app/src/components/admin/ConfigurationSection.tsx | New: surface component wiring state, actions, inputs and modal |
| app/src/components/admin/ConfigurationSection.test.tsx | New: renders, submits, resets inputs, modal/polling-by-active |
| app/src/components/admin/CycleActionRail.tsx | Keyed multi-field support, current/new display, text inputMode |
| app/src/components/admin/CycleActionRail.module.css | Styles for keyed field head/labels/values |
| app/src/components/admin/CycleActionRail.test.tsx | Tests keyed fields and "No change" summary |
| app/src/pages/actions.ts | Moves ROLES/Spec/toAction here; adds unchanged readiness and field metadata |
| app/src/pages/actions.test.ts | Tests toAction and unchanged readiness |
| app/src/pages/emergency.ts | Imports shared ROLES/Spec/toAction instead of local copies |
| app/src/pages/cycle.ts | Adds parseDuration, parameterizes formatDuration, exports formatters/oracleLimitRows |
| app/src/pages/cycle.test.ts | Tests parseDuration and exact formatDuration |
| app/src/pages/AdminPanel.tsx | Routes the configuration surface to ConfigurationSection |
| app/src/pages/AdminPanel.test.tsx | Tests configuration surface rendering/active state |
| app/src/components/vault/TransactionModal.tsx | Adds configuration action copy and admin error-code reasons |
| app/src/components/vault/TransactionModal.test.tsx | Tests configuration modal states and refusal messages |
| app/src/hooks/useAdminAuthority.ts | Grants configuration to oracle/share-token admins; exports adminAuthorityKey |
| app/src/hooks/useAdminAuthority.test.ts | Updates expected surfaces/grantedBy |
| app/src/hooks/useCycleState.ts | Exports useCycleReads/CycleReads for reuse |
| app/src/hooks/useVaultAuthorities.ts | Exports vaultAuthoritiesKey |
| app/src/hooks/useIsAllowed.ts | Exports isAllowedKey |
| app/src/hooks/useEmergencyTransactions.ts | Switches to shared adminTransaction factory |
| app/src/hooks/usePendingTransaction.ts | Boxes the pending arg so null args retry correctly |
| app/src/hooks/usePendingTransaction.test.ts | Tests retry of a null arg |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
612010c to
7d4055c
Compare
Summary
Closes #196
The Configuration tab sets the vault, oracle and share-token parameters, showing the current and new value and checking the contract's bounds before signing.
Changes
parseDurationreads seconds ord/h/m/sAcceptance criteria
Test plan
Automated tests
npm run test— 1229 passing.Manual verification
/admin/configurationas governance: seven setters, each reading "No change".10dwith a 7-day upgrade delay: "Notice ≤ upgrade delay 7d" is unmet and the button is disabled.Breaking changes
None.
Checklist
Screenshots
None.