feat(security): C-2 remaining — emergency rate reset + spot divergence alerter + operator trip #27
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#27
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Finish the remaining C-2 recommendations from
audits/INTERNAL_KIMIK3_1786162831.mdthat were explicitly out of scope for #22 / MR !40 (circuit-breaker pause only):exchangeRateStoreddivergence alerter.Audit ref: C-2 recommendations #2–#4 (pause/#1 shipped in #22)
Depends on: #22 pause fail-closed (merged !40)
Related: #23 liveness confirm; #24 poll/silence; H-2 governance key risk
Current codebase
ust1-oracleState.paused+ windowensure_oracle_usableOraclePausedimmediatelyust1-commonoracle_policy.rsMonotonicViolation) — no emergency bypassUpdateRatecontracts/ust1-oracleoracle-service/src/main.rsSetPausedexchangeRateStoredvia BSC consensusdocs/DEPLOYMENT.md,skills/oracle-circuit-breakerGap: Pause stops the bleed once a human trips it, but (a) there is still no way to mark the rate down after a real vFDUSD collapse without a new governance path, (b) ops get no automated secondary-market divergence signal, and (c) the oracle bot that first sees a decrease cannot trip the on-chain breaker.
Why this is needed
exchangeRateStoredis no longer an economic price; pause alone is reactive and human-gated.Constraints / guardrails
Relevant files
contracts/ust1-oracle/src/{msg,contract,state,error,multitest}.rs— emergency reset / trip msgs + ACLsmartcontracts-terraclassic/packages/ust1-common/src/oracle_policy.rs— gated bypass helper if sharedcontracts/ust1-window/src/contract.rs— ensure still fail-closed while paused; no special casing for reset beyond reading new rate when unpausedoracle-service/src/{main,bsc,config,liveness}.rs— decrease → trip; spot feed + divergence alertdocs/DEPLOYMENT.md— emergency reset runbook + alerter envskills/oracle-circuit-breaker/SKILL.md— extend or add sibling skillRecommended direction
ExecuteMsg::EmergencySetRate { rate }(name flexible) — governance-only; requirepaused == true; setrate+last_update_sec; emit rich attributes; enforce cooldown / one-shot latch as designed.TripCircuitBreaker {}callable by operator or governance to setpaused=true; unpause stays governanceSetPaused { false }.MonotonicViolation/ configured decrease: optionally broadcast trip (if ACL exists); always emit structured alert event.|spot - venus_implied| > threshold, logORACLE_SPOT_DIVERGENCEand optionally trip pause; never treat spot asUpdateRateinput.Acceptance criteria
UpdateRatepath still rejects decreases when not in emergency path.Test plan (all paths)
Test plan (attack / hack / abuse vectors)
Verification criteria
marked as related to #22
mentioned in issue #28
Rejected - in the case of a vFDUSD exploit, the system needs to be paused, evaluated, and upgraded, so the existing pause system is sufficent.
mentioned in merge request !45