Repository navigation
feat(platform)!: an emergency switch for the shielded pools - #6410
Conversation
Adds `EmergencySwitch::ShieldedPools` (id 7) to the switches of protocol version 16. While it is paused or off, every state transition that carries a shielded bundle is refused without a fee: the twelve shielded state transitions, a batch with a token action on a token's pool, and a batch with a document whose token cost is paid from one. It is one switch for the credit pool and every token's pool, and it refuses deposits as well as spends. The existing check in check tx and in block processing reads the new switch through `StateTransition::gating_emergency_switches`; in a block it runs before the bundle's proof is verified. Nothing a block does by itself is gated: pruning already keeps each pool's latest anchor while a pool is idle. The list of switches is edited in place: only protocol version 16 selects it, and that version is not released. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-11-30T14:49:10.370Z |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit 9d675be) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Adds the protocol-16 ShieldedPools emergency switch and routes all currently defined shielded credit, token-pool, and shielded token-payment transitions through the existing emergency-switch validation path. The transition and token classifiers are exhaustive and reuse established helpers; no in-scope defect was found. CI checks are still in progress, with completed checks successful and no failed code checks reported.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The change is a substantial consensus-critical modification to state-transition gating and protocol-version emergency-switch dispatch that directly controls shielded-pool value movement, including theStateTransition::gating_emergency_switcheslogic andPlatformVersionv16 tables. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
|
Bots are done — your move: post |
…dsa-65-keys v5.2-dev gained the emergency switch for the shielded pools (#6410), EmergencySwitch::ShieldedPools, which holds id 7. The ML_DSA_65 switch this branch added held the same id, so it moves to id 8, after it: EmergencySwitch::KeyTypeMlDsa65 = 8. Neither id has shipped. Conflicts: the switch enum, its list and its names in voting/emergency_switch/mod.rs, the EmergencySwitchName type of wasm-dpp2, and the table of the book chapter. Both switches are kept in each, in id order. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Basic explanation
What this does: Adds one more emergency switch,
ShieldedPools. Emergency switches (#6395) let the evonodes pause a Platform feature by vote, and turn it off at three quarters. This one covers everything that moves value into, inside or out of a shielded pool: the main credit pool and the shielded pool of every token. While it is paused or off, every such transaction is refused without a fee.Value: The shielded pools rest on zero-knowledge proofs. If a flaw is ever found in the proof system or in how Platform checks it, the damage (value created from nothing, or taken from the pool) cannot be seen from outside, and a fix needs a release and an upgrade vote. With this switch a quarter of the evonodes can stop all shielded activity for an hour within one block, and larger shares for longer, while the fix is prepared. Nothing inside a pool is touched, and everything else on Platform keeps working.
Risks: Low to medium. The rule itself is small: one new entry in a list, and one function that says which transactions carry a shielded bundle. The risk is in using it. Three quarters of the evonodes turning it off locks every shielded note, credits and tokens, until a later protocol version turns the pools back on or gives a way out; no such code exists yet. A quarter of the evonodes can stop shielded activity for one hour, once in the life of the switch. Protocol version 16 is not released, so no running network changes.
Issue being fixed or feature implemented
Follow-up to #6395. The first set of switches covers transfers to Core, platform address spends and the identity key types. Nothing covered the shielded pools, where a broken proof check is both the most damaging failure and the hardest to notice.
What was done?
The switch.
EmergencySwitch::ShieldedPools, id 7, appended to the enum and to the list of switches of protocol version 16. It is voted on, counted, stored and queried like every other switch; no storage, vote, query or error code is new.What it gates.
StateTransition::gating_emergency_switchesinrs-dppstays the one place that decides. A state transition is gated when it carries a shielded bundle:Shield,ShieldFromAssetLock,ShieldFromIdentityShieldedTransferUnshield,ShieldedWithdrawalShieldedWithdrawalis also gated byStopTransfersToCore)IdentityCreateFromShieldedPool,IdentityTopUpFromShieldedPoolTokenShieldedTransferWithShieldedFee,TokenUnshieldWithShieldedFee,TokenPurchaseFromShieldedPoolPrivateDocumentCreateFromShieldedPoolThe top-level list is an exhaustive match, so a new state transition does not compile until it is put on one side. Inside a batch the answer comes from the existing
TokenTransition::shielded_pool_actionsandTokenPaymentInfo::shielded_payment, which already say which kinds touch a pool.Decisions worth a look:
Where the refusal happens. No change: the existing check in check tx and in block processing reads the new switch through the gating function. In a block it runs before the bundle's proof is verified and before an asset lock is used, so a refused shielded transition costs nothing and a lock that was to be shielded stays unspent.
Before and after, for a
ShieldedTransfersent while a quarter of the evonodes have the switch flipped:StateTransitionRefusedByEmergencySwitchError(41400), namingShieldedPoolsand the block time the pause ends at. Not charged; the nullifiers are not spent.Around it:
wasm-dpp2:"shieldedPools"added to the hand-writtenEmergencySwitchNameTypeScript type, and a test that every switch rs-dpp has is named in it.architecture/emergency-switches.md: the new row and what to know before flipping it.rs-platform-version.Public interface changes
dpp::voting::emergency_switch::EmergencySwitch::ShieldedPools. Code that matches the enum exhaustively needs an arm.7, storage key0x0007.getEmergencySwitchesreturns one more status at protocol version 16."shieldedPools". These layers pass switch names through to Rust, so the reads and the vote accept it with no other change:sdk.voting.emergencySwitchVote({ emergencySwitch: 'shieldedPools', flipped: true, ... }).EmergencySwitchNamegains"shieldedPools".How Has This Been Tested?
rs-dpp(27 emergency switch tests, 4 new): every one of the 12 shielded state transitions is gated; a shielded transfer by this switch alone and a shielded withdrawal by this one andStopTransfersToCore; each of the 7 token actions on a pool gates its batch and a transparent burn or transfer does not; a document paid from a pool gates its batch, one paid from a balance or not paid in tokens does not.rs-drive-abci(18 emergency switch tests, 1 new): a well-formed shielded transfer with a proof that proves nothing reaches the pool's own checks before the flip; with one of four evonodes flipped it is refused by the switch in check tx at both levels and in a block, with the pause end in the error; after the pause it reaches the pool's checks again.wasm-dpp2: the TypeScript name list covers every switch.drive,dash-sdkandrs-sdk-ffipass unchanged.cargo clippy --all-targets --all-features --locked -- --no-deps -D warningsondpp,drive-abci,wasm-dpp2andplatform-version.Not done: no run on a live network, and no test that flips the switch with real proofs in flight.
Breaking Changes
Consensus changes at protocol version 16 only: a new switch exists there, and once enough evonodes flip it shielded transitions are refused. Earlier protocol versions are untouched.
The list of switches (
EmergencySwitch::existinggeneration 0) is edited in place. It is selected only by protocol version 16, which has not been released as stable or activated on testnet or mainnet, so no shipped generation changes.#6354 (ML-DSA-65 identity keys) also appends a switch with id 7,
KeyTypeMlDsa65. Whichever of the two merges second takes id 8; the enum conflicts textually, so it cannot merge unnoticed.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
9d675be/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.