Skip to content

feat(platform)!: an emergency switch for funding from asset locks - #6416

Merged
QuantumExplorer merged 4 commits into
v5.2-devfrom
feat/asset-lock-funding-emergency-switch
Dec 1, 2026
Merged

QuantumExplorer merged 4 commits into
v5.2-devfrom
feat/asset-lock-funding-emergency-switch

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: Adds one more emergency switch, AssetLockFunding. Emergency switches (#6395) let the evonodes pause a Platform feature by vote, and turn it off at three quarters. This one covers the way in from Dash Core: every transaction that turns Dash locked on Core into Platform credits. While it is paused or off, each of them is refused without a fee, and the locked Dash is not used up.

Value: Credits are created on Platform when a transaction shows a proof that Dash was locked on Core. If a flaw is ever found in how that proof is checked, credits could be made that no Dash stands behind, and they could then leave through withdrawals. A fix needs a release and an upgrade vote. With this switch a quarter of the evonodes can stop new credits from entering for an hour within one block, and larger shares for longer, while the fix is prepared. StopTransfersToCore already closes the way out; this closes the way in. Credits already on Platform keep moving.

Risks: Low to medium. The rule itself is small: one new entry in a list, and one function that says which transactions are funded by an asset lock. The risk is in using it. While the switch refuses, nobody can create an identity from Core or bring new Dash to Platform; Dash already locked on Core waits. If three quarters of the evonodes turn it off, that lasts until a later protocol version turns funding back on, and no such code exists yet. A quarter of the evonodes can stop funding 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 and #6410. The switches so far cover transfers to Core, platform address spends, the identity key types and the shielded pools. Nothing covered the creation of credits from asset locks, the one place where value enters Platform from outside.

What was done?

The switch. EmergencySwitch::AssetLockFunding, id 8, 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_switches in rs-dpp stays the one place that decides. A state transition is gated when it carries an asset lock proof:

Kind Gated
IdentityCreate yes (also by the switch of each key type it adds)
IdentityTopUp yes
AddressFundingFromAssetLock yes (also by PlatformAddressSpends when it names an address as an input)
ShieldFromAssetLock yes (also by ShieldedPools)
IdentityCreateFromAddresses, IdentityTopUpFromAddresses, IdentityCreateFromShieldedPool, IdentityTopUpFromShieldedPool, ShieldFromIdentity, Shield no: they spend credits that are already on Platform
Every other transition no

The list is an exhaustive match, so a new state transition does not compile until it is put on one side.

Decisions worth a look:

  • One switch for every use of an asset lock. The four kinds share the proof check (instant lock or chain lock, the lock transaction, the one-time key's signature), so a flaw in it is a flaw in all of them.
  • Identities can still be created and topped up from platform addresses and from the shielded pool. Those move credits that already exist.
  • Nothing a block does by itself is gated. What Core pays Platform in a block is consensus, like everything else a block does without a transaction.
  • A refused lock is not used. See below.

Where the refusal happens. No change: the existing check in check tx and in block processing reads the new switch through the gating function. It runs before the asset lock is verified against Core and before the lock is recorded as used, so a refused transition costs nothing and the same lock funds a transition once the pause ends. On first admission check tx reads the switches after structure, nonces, address inputs and the signature of an identity key, so a gated transition that fails one of those gets that error and not 41400. The asset lock's proof and the signature of its one-time key are verified after the switches, so a transition that would fail there gets 41400 during a pause. No refusal is charged.

Before and after, for an IdentityTopUp sent while a quarter of the evonodes have the switch flipped:

  • Before: no switch exists for it. The top up is checked and executed as usual.
  • After: refused with StateTransitionRefusedByEmergencySwitchError (41400), naming AssetLockFunding and the block time the pause ends at. Not charged; the identity's balance is unchanged; the asset lock is unused, and the same transition is accepted after the pause.

Around it:

  • wasm-dpp2: "assetLockFunding" added to the hand-written EmergencySwitchName TypeScript type. The test from feat(platform)!: an emergency switch for the shielded pools #6410 checks every switch is named in it.
  • Book chapter architecture/emergency-switches.md: the new row and what to know before flipping it.
  • The protocol version 16 note in rs-platform-version.

Public interface changes

  • Rust: new variant dpp::voting::emergency_switch::EmergencySwitch::AssetLockFunding. Code that matches the enum exhaustively needs an arm.
  • Wire and storage: switch id 8, storage key 0x0008. getEmergencySwitches returns one more status at protocol version 16.
  • JS, WASM, Swift, Kotlin, FFI: the switch is named "assetLockFunding". These layers pass switch names through to Rust, so the reads and the vote accept it with no other change: sdk.voting.emergencySwitchVote({ emergencySwitch: 'assetLockFunding', flipped: true, ... }).
  • TypeScript: EmergencySwitchName gains "assetLockFunding".
  • Clients that fund from Core (identity registration, top up, address funding, shielding from an asset lock) can now get error 41400 from these calls. The asset lock stays usable, so the same transition can be sent again after the pause.

How Has This Been Tested?

  • rs-dpp (29 emergency switch tests, 2 new, 1 changed): an identity create, an identity top up and an address funding from an asset lock are each gated by this switch alone; an address funding that also names an address input by this one and PlatformAddressSpends; shielding an asset lock by this one and ShieldedPools; the same transitions funded from platform addresses, from an identity or by a batch are not gated by it; of the 12 shielded transitions only ShieldFromAssetLock is; and the gate agrees with required_asset_lock_balance_for_processing_start, which already names the asset lock transitions.
  • rs-drive-abci (19 emergency switch tests, 1 new): a top up from an asset lock is accepted before the flip and the balance grows; with one of four evonodes flipped a top up from another lock is refused by the switch in check tx at both levels and in a block, with the pause end in the error and the balance unchanged; after the pause the same serialized top up is accepted, which shows the refusal left its lock unused.
  • wasm-dpp2: the TypeScript name list covers every switch.
  • Existing emergency switch tests of drive (5), dash-sdk (3) and rs-sdk-ffi (7) pass unchanged.
  • cargo clippy --all-targets --all-features --locked -- --no-deps -D warnings on dpp, drive-abci, wasm-dpp2 and platform-version.

Not done: no run on a live network.

Breaking Changes

Consensus changes at protocol version 16 only: a new switch exists there, and once enough evonodes flip it transitions funded by an asset lock are refused. Earlier protocol versions are untouched.

The list of switches (EmergencySwitch::existing generation 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 8, KeyTypeMlDsa65. Whichever of the two merges second takes id 9; the enum conflicts textually, so it cannot merge unnoticed.

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 6101e19

  • Bots — thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Build running
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Adds `EmergencySwitch::AssetLockFunding` (id 8) to the switches of protocol
version 16. While it is paused or off, every state transition funded by an
asset lock is refused without a fee: creating an identity, topping one up,
funding platform addresses and shielding. It is the way in from Dash Core, as
`StopTransfersToCore` is the way out.

The existing check in check tx and in block processing reads the new switch
through `StateTransition::gating_emergency_switches`; it runs before the asset
lock proof is checked, so a refused lock is not used and funds the same
transition once the pause ends.

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]>
@QuantumExplorer QuantumExplorer added this to the v5.2.0 milestone Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You'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 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2ba9760 and 6101e19.

Files selected for processing: 1

  • book/src/architecture/emergency-switches.md

No actionable comments were generated in the recent review.

Walkthrough

The change adds the AssetLockFunding emergency switch to protocol version 16 and the TypeScript switch-name union. Asset-lock-funded transitions are gated by the switch. Tests verify refusal during a pause and success with the same proof after the pause ends.

Changes: Asset-lock funding gate

Layer / File(s) Summary
Register the switch in protocol version 16
packages/rs-dpp/src/voting/emergency_switch/mod.rs, packages/wasm-dpp2/src/voting/vote.rs, packages/rs-platform-version/src/version/v16.rs, book/src/architecture/emergency-switches.md
Adds AssetLockFunding as switch ID 8, includes it in the version 16 switch list and TypeScript name union, and documents its scope.
Classify asset-lock-funded transitions
packages/rs-dpp/src/state_transition/emergency_switches.rs
Adds the gate for identity creation, identity top-up, address funding from an asset lock, and shielding from an asset lock. Tests cover gate membership and combinations with other switches.
Verify refusal and retry behavior
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/emergency_switch_tests.rs, book/src/architecture/emergency-switches.md
Tests that check tx and block processing refuse a top-up during the pause without changing the balance, and that the same proof succeeds after the pause. Documentation describes validation order and refusal effects.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • dashpay/platform#6354: This PR also adds an emergency switch in protocol version 16 and uses ID 8, which is the ID assigned to AssetLockFunding here.

Suggested reviewers: shumkov

Merge Risk: Minimal · previous review 2ba97

This adds a new emergency switch that pauses asset-lock-funded credit creation in protocol version 16, leaving existing Platform credits usable. No merge-blocking risk was found, and tests cover refusal during the pause and retry afterward.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a new emergency switch that gates funding from asset locks, which matches the switch addition in the emergency switch enum, the gating logic, and the v16 switch list. …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: a new emergency switch that gates funding from asset locks, which matches the switch addition in the emergency switch enum, the gating logic, and the v16 switch list. The "feat(platform)!" prefix marks a breaking change, which fits the protocol-version-16 consensus change described in the objectives. The title is short, specific, and free of file lists or vague wording.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d86d80f and 2ba9760.

Files selected for processing: 6

  • book/src/architecture/emergency-switches.md
  • packages/rs-dpp/src/state_transition/emergency_switches.rs
  • packages/rs-dpp/src/voting/emergency_switch/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/emergency_switch_tests.rs
  • packages/rs-platform-version/src/version/v16.rs
  • packages/wasm-dpp2/src/voting/vote.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📖 Book Preview built successfully.

Download the preview from the workflow artifacts.
To view locally: download the artifact, unzip, and open index.html.

Updated at 2026-12-01T01:10:00.802Z

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Dec 1, 2026
@thepastaclaw

thepastaclaw commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 6101e19) · triage: critical

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

This PR adds the protocol-16 AssetLockFunding emergency switch and applies it to all four asset-lock-funded transition routes, with corresponding tests and documentation. CI has no failed code checks; policy, title, book preview, and CodeRabbit checks passed, while Kotlin build and changed-package detection remain in progress.

🟡 3 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — This change modifies consensus-critical state-transition gating for asset-lock-funded credit creation in rs-dpp and rs-drive-abci, directly affecting funds entering Platform and the validity/refusal behavior of transactions.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-dpp/src/state_transition/emergency_switches.rs`:
- [SUGGESTION] packages/rs-dpp/src/state_transition/emergency_switches.rs:582-598: Pool-funded identity transitions can be misclassified without a failing test
  Impact: A future edit could classify identity creation or top-ups from the shielded pool as asset-lock funded and refuse users spending credits already on Platform while the switch is paused.
  The new negative assertions cover `ShieldFromIdentity` and the address-funded identity routes, but `IdentityCreateFromShieldedPool` and `IdentityTopUpFromShieldedPool` are only checked for the `ShieldedPools` switch in the broader fixture list. Moving either variant into the `true` arm of `is_funded_by_an_asset_lock` would still compile and would not fail the current tests. Add the existing pool-funded identity fixtures to the negative assertions, or assert their exact switch sets, to pin that they remain exempt from `AssetLockFunding`.
- [SUGGESTION] packages/rs-dpp/src/state_transition/emergency_switches.rs:178-185: Address funding has conflicting asset-lock-proof classifications
  Impact: Callers of `StateTransition::optional_asset_lock_proof()` see `None` for `AddressFundingFromAssetLock` even though the new emergency-switch classifier treats it as asset-lock funded.
  The new `is_funded_by_an_asset_lock` match creates a second definition of which top-level transitions carry an asset-lock proof: the existing `OptionallyAssetLockProved for StateTransition` delegates only for identity creation, identity top-up, and shielding from an asset lock. This already makes the recheck path skip its dedicated asset-lock unspent/balance verification for address funding, and any future generic caller can make the same misclassification. Delegate the accessor for `AddressFundingFromAssetLock` and derive the emergency-switch gate from the accessor, while restructuring recheck so mixed-input address funding still performs both proof validation and address balance/nonce validation.

In `book/src/architecture/emergency-switches.md`:
- [SUGGESTION] book/src/architecture/emergency-switches.md:88-92: The operator guide says mempool refusal precedes all proof checks
  Impact: During first-time `check_tx` admission, a malformed asset-lock proof can produce a structure error instead of error 41400 even though the guide says the switch is checked first.
  Block processing checks the emergency switch before basic structure validation, but `FirstTimeCheck` runs `validate_basic_structure` before `validate_emergency_switches`; `AddressFundingFromAssetLock` explicitly validates the asset-lock proof structure in that earlier stage, and identity funding routes do the same through their basic-structure validators. Update this documentation to state the guarantee common to both paths—that refusal does not charge a fee or consume the lock—while noting that first-time mempool admission may inspect and reject proof structure before returning the switch refusal.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
…ere check tx reads the switches

The pool-funded identity transitions are now asserted to stay outside
`AssetLockFunding`, and the gate is asserted to agree with
`required_asset_lock_balance_for_processing_start`, the function that already
says which transitions are asset lock transactions.

The book no longer says the switch is read before the proof is: on first
admission check tx validates structure, nonces, address inputs and the
signature first, and a gated transition that fails one of those gets that
error. Neither refusal is charged or uses the lock.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 1, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This incremental head adds cross-check assertions for asset-lock transition classification, covers all shielded transition fixtures, and clarifies the emergency-switch operator guide. The book preview passed; the Kotlin SDK build and review checks are still in progress, with no failed code checks reported.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The change modifies consensus-critical state-transition admission and gates creation of Platform credits backed by Core asset locks, directly affecting funds movement in StateTransition::gating_emergency_switches and protocol-version switch dispatch.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `book/src/architecture/emergency-switches.md`:
- [SUGGESTION] book/src/architecture/emergency-switches.md:163-167: A paused top-up can return 41400 before its asset-lock signature is checked
  Impact: A client submitting an identity top-up with an invalid one-time asset-lock signature can receive 41400 during a pause instead of the signature error implied by this guide.
  The wording overstates the checks completed before the emergency-switch decision. For `IdentityTopUp`, first-time admission retrieves the identity but does not verify an identity-key signature; the switch is checked before `transform_into_action`, where the asset-lock proof and its one-time signature are validated. Qualify “signature” as the identity-key signature check, when applicable, and distinguish it from the later asset-lock signature verification.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
… emergency switches

Only the signature of an identity key comes before the switches. An asset
lock's proof and the signature of its one-time key, like a shielded bundle's
proof, are verified after, so a gated transition that would fail there gets
41400 while a switch refuses.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 1, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This head contains a documentation-only clarification of the emergency-switch check ordering, distinguishing identity-key signatures from later asset-lock and shielded proof checks. The book preview passed; Kotlin SDK build/tests, PastaClaw review, and PR Hygiene remain in progress or pending, with no failed code checks reported.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff changes consensus transaction gating for asset-lock-funded credit creation, a funds-entry surface, but the implementation is a small, straightforward versioned enum and exhaustive match change rather than a large or intricate alteration.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `book/src/architecture/emergency-switches.md`:
- [SUGGESTION] book/src/architecture/emergency-switches.md:170-171: Block processing is documented as using an identity-key signature for every transition
  Impact: Readers may infer that every block transition passes an identity-key signature check before emergency-switch refusal, which misstates the order for identity top-ups and address-based transitions.
  The guide gives an incorrect ordering for transitions that do not use an identity-key signature: `IdentityTopUp` retrieves identity information before calling `validate_emergency_switches`, while address-based transitions likewise may have no identity-key signature step. The block implementation branches between identity-signature validation and identity retrieval before the switch check, so the sentence should qualify the signature as applicable or describe both alternatives.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
… switches

A block reads them before structure, nonces and address inputs, and after
only an identity key's signature when one signs the transition. A top up or a
spend from platform addresses reaches them with no signature verified.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Dec 1, 2026
@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Dec 1, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This head only clarifies the operator guide's description of block-processing order for emergency-switch checks, distinguishing identity-signed transitions from top-ups and platform-address spends. The book preview and policy checks passed; Kotlin SDK and review-hygiene checks remain in progress, with no failed checks reported.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

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: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); 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: critical by gpt-6.2-sol (effort low) — The change is an intricate consensus-critical gating rule in StateTransition::gating_emergency_switches that controls asset-lock-funded credit creation and therefore directly affects funds movement, with protocol-versioned enum and dispatch changes.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
@QuantumExplorer
QuantumExplorer merged commit ba4812b into v5.2-dev Dec 1, 2026
37 of 38 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/asset-lock-funding-emergency-switch branch December 1, 2026 03:03
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
…dsa-65-keys

v5.2-dev gained the emergency switch for funding from asset locks (#6416),
EmergencySwitch::AssetLockFunding, which holds id 8. The ML_DSA_65 switch
this branch added held the same id, so it moves to id 9, after it:
EmergencySwitch::KeyTypeMlDsa65 = 9. 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants