Repository navigation
feat(platform): introduce protocol version 16 - #6253
Conversation
Protocol version 16 is the activation gate for the 5.2 line. Its tables are protocol version 15's plus the token marketplace, which already starts at 16 (TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) and was tested under the mock TEST_PLATFORM_V5 until now: - PLATFORM_V16 = PLATFORM_V15 with DRIVE_VERSION_V11 (escrow trees at genesis, escrow token methods, deeper escrow layer estimates) and SYSTEM_DATA_CONTRACT_VERSIONS_V5 (token market contract v1). - transition_to_version_16 inserts the escrow trees and the token market contract on an upgraded chain; the genesis-vs-upgrade equivalence test and the contract insertion test come back for 15 -> 16. - The mock TEST_PLATFORM_V5 and its mock-versions dev-dependencies are gone; its tests run at protocol version 16. - The make-tradeable end-to-end tests run at 16 again; the version 15 refusal test stays. - Latest-version fee and digest pins move with the token market contract in genesis; the version 15 values are kept as _protocol_version_15 pins. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🌳 GroveDB structure This pull request changes the described GroveDB structure. Open it in the structure viewer: new nodes glow, removed ones stay as ghosts, and the tour walks through each change. Changed (34 nodes)
Compared |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-11-24T23:37:49.721Z |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit a2b18a1) |
…version 15, not latest Protocol version 15 installs the zero evidence byte budget. Upgrading from 15 to 16 leaves the policy unchanged, so that update correctly carries no evidence. The test now checks upgrades into 15 and skipped upgrades from below 15 to the latest version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…n 16 The token market contract joins the latest genesis contracts tree and the restore's path crosses it, as it did before #5910. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- The PV16 bump leaves 18 native WASM SDK tests loading PV15 signed fixtures —
packages/rs-platform-version/src/version/protocol_version.rs:79(new)
Impact: On this head, Rust workspace CI stops before the affected SDK tests can exercise broadcast, wait, or contract-cache behavior.
This PR registers protocol version 16, replaces the marketplace test-only version, and installs the token market contract and escrow trees at genesis and on upgrade. Rust workspace CI failed on 18 native WASM SDK regression tests; wasm32 tests, the JS build, and Kotlin SDK tests passed, while JS package tests and lint were pending when checked.
🔴 1 blocking | 🟡 6 suggestion(s) | 💬 2 nitpick(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: Maintainers checking PV15 replay no longer get a like-for-like comparison between PV15 genesis and the decision-proposals migration under PV15.
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284
The test can pass without exercising the historical configuration it names. The genesis fixture is pinned to 15, but the transition_to_version_15 call uses PlatformVersion::latest(), which now selects 16. That runs only the PV15 rung with PV16 tables, not a 14-to-15 or a full 14-to-16 upgrade. Pin the target to 15 here and in should_insert_decision_proposals_on_transition_to_version_15 at line 1946.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, platform-versioning, rust-quality, security-auditor, tenderdash-consensus-security)
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: gpt-6.2-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The change coordinates PV16 dispatch tables with genesis and a first-block storage migration in perform_events_on_first_block_of_protocol_change/v0/mod.rs, where inconsistent activation or persisted state could cause consensus divergence. - 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(lane 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— 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,gpt-6.2-astra— tenderdash-consensus-security (completed, effort high); agentphase2-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-platform-version/src/version/protocol_version.rs`:
- [BLOCKING] packages/rs-platform-version/src/version/protocol_version.rs:79: The PV16 bump leaves 18 native WASM SDK tests loading PV15 signed fixtures
Impact: On this head, Rust workspace CI stops before the affected SDK tests can exercise broadcast, wait, or contract-cache behavior.
The `Rust workspace tests / Tests` job fails in `Run native WASM SDK regression tests` with 18 failures. The logs show `left: 15` and `right: 16` at `broadcast_tests.rs:72` and `contract/cache_tests.rs:266`. Both loaders compare the checked-in fixture protocol version against `PlatformVersion::latest()`, which this line now makes 16. Regenerate `tests/fixtures/state-transition-waits/signed-responses.json` and `tests/fixtures/contract-cache/signed-responses.json` with the existing Drive-ABCI generators so the response metadata, proofs, and signatures agree; changing only the fixture version field is not enough.
In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:4727-4730: Both marketplace migration tests pass even if the upgrade ladder skips PV16
Impact: A maintainer can remove or mis-gate the PV16 rung without either new test detecting that an upgrading chain would lack the escrow trees and token market contract.
The tests verify what the migration writes, but not whether an upgrading block invokes it. The escrow equivalence test and the contract-installation test at line 4855 both call `transition_to_version_16` directly; block execution reaches it through `perform_events_on_first_block_of_protocol_change` and the version-crossing guard. Route the 15-to-16 fixture through that dispatcher and retain the subtree hash and persisted-contract checks.
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: Maintainers checking PV15 replay no longer get a like-for-like comparison between PV15 genesis and the decision-proposals migration under PV15.
The test can pass without exercising the historical configuration it names. The genesis fixture is pinned to 15, but the `transition_to_version_15` call uses `PlatformVersion::latest()`, which now selects 16. That runs only the PV15 rung with PV16 tables, not a 14-to-15 or a full 14-to-16 upgrade. Pin the target to 15 here and in `should_insert_decision_proposals_on_transition_to_version_15` at line 1946.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs:1894-1898: The shielded-payment tests no longer pin PV15 processing fees or settled state
Impact: A later regression that changes what PV15 charges or commits without changing PV16 would no longer fail these checks.
The new processing fees, root hash, and settled digests replace the historical expectations rather than supplementing them. The fixtures build and execute at `PlatformVersion::latest()`, so the assertions now cover only the PV16 genesis layout. Keep the latest cases and add PV15 cases that use version 15 for both genesis and execution, with the previous fee and digest expectations.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs:418-421: The rule-free restore test no longer pins the PV15 fee
Impact: A restore fee regression confined to PV15 would pass this test as long as the PV16 result stayed correct.
The historical processing-fee check is gone: `setup_with_schema` uses `PlatformVersion::latest()`, and the only expectation changes from `1_442_880` to `1_492_880`. Run the same restore assertions with `Setup::new_at_with` at PV15 and the old fee, alongside the latest run with the new fee.
In `packages/rs-drive-abci/src/execution/engine/consensus_params_update/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/engine/consensus_params_update/mod.rs:618-620: The direct PV15-to-PV16 consensus-params update has no test using both real tables
Impact: Maintainers have no assertion that the direct upgrade emits app version 16 while leaving the installed evidence policy untouched.
The direct upgrade response is unpinned. The skipped-upgrade loop starts below 15, and the unchanged-policy case at line 832 clones the latest table and changes only its protocol number, so it checks the equal-policy logic but not the actual 15-to-16 pairing. Add a case using the registered PV15 and PV16 tables that asserts `evidence` is absent and the version update carries `app_version: 16` and `consensus_version: 2`.
In `packages/rs-platform-version/src/version/v16.rs`:
- [SUGGESTION] packages/rs-platform-version/src/version/v16.rs:18-22: The PV16 changelog describes escrowed trading before orders can be placed or filled
Impact: SDK and node developers reading the changelog can mistake marketplace state activation for working order placement and settlement.
The release note overstates what this revision supports. PV16 admits `Tradeable` configurations and installs the contract and escrow trees, but this head has no marketplace transition to place or fill an order. Describe the groundwork activated here and reserve the trading claim for the follow-up transitions, starting with #5529.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs`:
- [NITPICK] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs:42-43: The DPNS fee comment describes an increase where the pin drops by 150,000 credits
Impact: Readers comparing the PV15 and PV16 pins get the opposite fee direction from the explanation.
The comment says the DPNS node is billed more bytes, but its own delta is negative and the pin drops from `6_049_360` to `5_899_360`. Describe the decrease so the explanation matches the assertion.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs`:
- [NITPICK] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs:37-39: The direct-purchase fee comment describes an increase where the pin drops by 97,280 credits
Impact: Readers checking the effect of the token market contract on direct-purchase fees are told the opposite of what the test asserts.
The comment says `97_280 credits more`, but the pin drops from `699_868_098_480` at PV15 to `699_868_001_200` at PV16. State the decrease rather than copying the direction of the burn fee change.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…rsion 16 Both fixtures pin the latest protocol version, so they are regenerated with their drive-abci examples, generate_wasm_contract_cache_vectors and generate_wasm_state_transition_wait_vectors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
…nd pin v15 beside v16 - The escrow equivalence and token market contract tests run the protocol change from 15 to 16 through perform_events_on_first_block_of_protocol_change, so they fail if the ladder stops reaching the rung for 16. - A direct 15 to 16 consensus params update carries no evidence and moves only the app version. - The rule-free restore fee is pinned at 15 as well as at the latest version. - v16 note 1 describes the marketplace state this version activates, with orders coming in follow-ups. The DPNS fee comment now states the decrease. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: The latest commits regenerate both WASM SDK signed-response fixtures at PV16, route both marketplace migration tests through the upgrade dispatcher, and add direct consensus-parameter and PV15 restore-fee checks. The Kotlin SDK check passed; Rust workspace tests, Rust wasm32 tests, and JS and Docker builds were still pending, with no failed code checks reported for this head.
🟡 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.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: Maintainers checking the 14-to-15 upgrade can miss a regression specific to the PV15 migration because the test writes the migrated contract using PV16 tables.
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284
The comparison no longer tests both ways of reaching PV15 under the same rules. The reference chain selects PV15 at genesis, but transition_to_version_15 uses the supplied latest() table, now PV16, to load and store the decision-proposals contract. PV16 currently inherits the relevant settings, but a later table change can affect this test without changing the real 14-to-15 upgrade. Pass the registered PV15 table to the migration and direct contract reads.
let platform_version = PlatformVersion::get(15).expect("expected protocol version 15");
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.2-astra (phase2-reviewer: general, architecture-layering, rust-quality, security-auditor, tenderdash-consensus-security)
🟡 Suggestion: The new PV15 restore test builds its inputs with the latest protocol rules
Impact: A future document-format change can make the historical restore test fail before its fee assertion even if PV15 execution is unchanged.
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs:423-429
The new PV15 case pins execution but not the inputs it executes. process_at takes PV15 from platform state, so the moderation delete records a hash of the document serialized under PV15. remove_post instead gets the restore payload from Setup::document_bytes, which serializes with latest(); the document-create and moderation builders also select latest(). The relevant formats match today, but a later encoding change can make the restore payload fail decoding or no longer match the recorded hash. Use the fixture's selected version for input construction as well as execution.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, platform-versioning, rust-quality, security-auditor, tenderdash-consensus-security)
Still open from earlier rounds (1)
- 🟡 Suggestion: The shielded-payment tests no longer pin PV15 processing fees or settled state —
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs:1894-1898(thread)
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: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The diff coordinates consensus activation across version tables, validation, and genesis, and adds a persisted-state migration intransition_to_version_16that must create the same marketplace state as v16 genesis. - 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(lane 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— 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,gpt-6.2-astra— tenderdash-consensus-security (completed, effort high); agentphase2-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-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: Maintainers checking the 14-to-15 upgrade can miss a regression specific to the PV15 migration because the test writes the migrated contract using PV16 tables.
The comparison no longer tests both ways of reaching PV15 under the same rules. The reference chain selects PV15 at genesis, but `transition_to_version_15` uses the supplied `latest()` table, now PV16, to load and store the decision-proposals contract. PV16 currently inherits the relevant settings, but a later table change can affect this test without changing the real 14-to-15 upgrade. Pass the registered PV15 table to the migration and direct contract reads.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs:423-429: The new PV15 restore test builds its inputs with the latest protocol rules
Impact: A future document-format change can make the historical restore test fail before its fee assertion even if PV15 execution is unchanged.
The new PV15 case pins execution but not the inputs it executes. `process_at` takes PV15 from platform state, so the moderation delete records a hash of the document serialized under PV15. `remove_post` instead gets the restore payload from `Setup::document_bytes`, which serializes with `latest()`; the document-create and moderation builders also select `latest()`. The relevant formats match today, but a later encoding change can make the restore payload fail decoding or no longer match the recorded hash. Use the fixture's selected version for input construction as well as execution.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs:1894-1898: The shielded-payment tests no longer pin PV15 processing fees or settled state
(carried; thread: https://github.com/dashpay/platform/pull/6253#discussion_r4687611769)
|
Bots are done — your move: post |
… version 15 The sponsored payment test runs at protocol version 15 as well as at the latest version, with the fees protocol version 15 charges. The root and settled digest pins stay at the latest version only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Updated after discussion: 1 finding(s) of this review were settled in the inline threads.
- ✅ Withdrawn: 🟡 The PV15 sponsored-payment test still depends on latest-version funding and signing
New on this head: This revision adds a PV15 regression test for both transparent and shielded sponsored payments, checking the processing fees, the sponsor’s actual debit, and token conservation. The Kotlin SDK build and tests passed; Rust workspace tests are pending on this head.
🟡 3 2 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.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The new PV15 restore test builds its inputs with the latest protocol rules
Impact: A maintainer who changes document encoding or transition construction only at latest can change or break the PV15 fixture even when PV15 restore behavior is unchanged.
packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs:423-429
The fee is measured at PV15, but the inputs to that measurement are not pinned to PV15. Setup::process_at uses the platform state’s active version, while add_document_type and create_document_of_type_with use latest() to build the schema and create the post. document_bytes serializes the restore payload at latest(), and moderate builds both the removal and restore transitions at latest(). Use the setup’s selected version for those helpers as well as execution.
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.2-astra (phase2-reviewer: general, rust-quality, security-auditor, tenderdash-consensus-security)
🟡 Suggestion: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: A maintainer can break decision-proposals installation specifically under the PV15 tables without this equivalence test detecting it.
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284
The test no longer runs the migration with the destination tables used on a direct 14-to-15 upgrade. Its reference chain starts at 15, but latest() now supplies PV16 to transition_to_version_15, which forwards it to load_system_data_contract and apply_contract. The direct element reads use the same PV16 table. The two tables select the same decision-proposals contract revision today; use the registered PV15 table so the test keeps checking the historical boundary when they diverge.
let platform_version = PlatformVersion::get(15).expect("expected protocol version 15");
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.2-astra (phase2-reviewer: general, rust-quality, security-auditor, tenderdash-consensus-security)
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: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The coordinated changes to protocol dispatch, genesis, and marketplace validation make this an intricate consensus change, andtransition_to_version_16migrates persisted state on the activation block by creating escrow trees and installing the token market system contract. - 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(lane 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— 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,gpt-6.2-astra— tenderdash-consensus-security (completed, effort high); agentphase2-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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs:72-78: The PV15 sponsored-payment test still depends on latest-version funding and signing
Impact: A maintainer who changes identity storage, token funding, or shield signing only in a newer protocol version can break the historical fee test without changing what PV15 charges.
The new PV15 case can fail during setup before it measures either payment fee. It selects PV15 for genesis, admission, and execution, but `setup_identity` and `add_tokens_to_identity` use `latest()` for the identity, token balance, and supply writes. `fund_and_shield` executes at the selected version but still gets its output-only sighash from `build_shield_bundle` at `latest()`; the anchor write and pool readbacks also use `latest()`. PV15 and PV16 share the relevant signing and storage generations today. Use the fixture’s selected version for those writes, signing, and readbacks so a later bump cannot change the inputs to the PV15 fee test.
In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs:423-429: The new PV15 restore test builds its inputs with the latest protocol rules
Impact: A maintainer who changes document encoding or transition construction only at latest can change or break the PV15 fixture even when PV15 restore behavior is unchanged.
The fee is measured at PV15, but the inputs to that measurement are not pinned to PV15. `Setup::process_at` uses the platform state’s active version, while `add_document_type` and `create_document_of_type_with` use `latest()` to build the schema and create the post. `document_bytes` serializes the restore payload at `latest()`, and `moderate` builds both the removal and restore transitions at `latest()`. Use the setup’s selected version for those helpers as well as execution.
In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:3284: The PV15 decision-proposals equivalence test now runs the migration with PV16 tables
Impact: A maintainer can break decision-proposals installation specifically under the PV15 tables without this equivalence test detecting it.
The test no longer runs the migration with the destination tables used on a direct 14-to-15 upgrade. Its reference chain starts at 15, but `latest()` now supplies PV16 to `transition_to_version_15`, which forwards it to `load_system_data_contract` and `apply_contract`. The direct element reads use the same PV16 table. The two tables select the same decision-proposals contract revision today; use the registered PV15 table so the test keeps checking the historical boundary when they diverge.
|
Bots are done — your move: post |
…et-listings The token marketplace moved to protocol version 16 (#6253). v15.rs is v5.2-dev's unchanged; the listings note becomes v16 note 3, and every order kind and the tradeable mode are refused below TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION (16). The marketplace's consensus errors follow v5.2-dev's (BasicError 214-216, StateError 190-196). Ports DataContractFetchInfo::parsed_under_protocol_version and DeleteDocument::deleter_id, and the wallet FFI's trade mode payload to Tradeable { min_fill }. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
What this does: Platform's rules are numbered by "protocol version". Every change to how nodes agree on the chain switches on at a specific version, so all nodes switch at the same block. This PR creates version 16 for the 5.2 line. Version 16 is version 15 plus the token marketplace. The marketplace was already set to start at 16, but 16 did not exist yet, so its code was only tested under a stand-in test version that no network runs.
Value: 5.2 changes now have a real version to switch on. The marketplace stack (#5529 to #5532), delta contract updates (#4730) and the streaming work (#6249, which already declares
needs_protocol_version16) can build on one shared version 16. None of them has to create its own copy.Risks: Low for any running network. Nothing changes at version 15 or below. A chain at 16 creates the marketplace's escrow trees and the token market contract, and accepts tradeable tokens. Orders still can't be placed until #5529 lands, so tradeable tokens have nothing to trade on yet. Version 16 is unreleased, so the marketplace PRs can still change its tables in place. As with every new version, once the network votes 16 in, nodes on binaries without it can no longer follow the chain.
Issue being fixed or feature implemented
On v5.2-dev,
TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSIONis 16 (#5910). ButLATEST_VERSIONis still 15, so the marketplace was tested only under the mockTEST_PLATFORM_V5(PV15 tables plus the marketplace). #5910 recorded what needed to happen once 16 exists: give its tables what the mock selects, add the escrow trees and the contract to the upgrade to 16, restore the genesis-vs-upgrade equivalence test and the "make tradeable" end-to-end tests, and remove the mock.A version 16 that only copied version 15 would not work. The constant already admits tradeable tokens and registers the token market contract at genesis from 16. But
token_market: 0andcreate_initial_state_structure4 would give that chain no contract to load and no escrow trees.What was done?
Version tables (
rs-platform-version)v16.rs:PROTOCOL_VERSION_16andPLATFORM_V16. It names only the two tables it changes and takes the rest with..PLATFORM_V15. So a fix made in place to an unreleased PV15 table on v5.1-dev also reaches 16 when 5.1 is merged into 5.2. If 16 listed every field, someone would have to remember to copy each such fix by hand. The doc comment is the changelog, with note 1 for the marketplace.drive_versions/v11.rs:DRIVE_VERSION_V11=DRIVE_VERSION_V10plus what the mock selected:create_initial_state_structure5,DRIVE_TOKEN_METHOD_VERSIONS_V3, fee pot estimate 1,for_balances1,for_token_balances1, prefunded balance estimate 2.system_data_contract_versions/v5.rs:token_market: 1.LATEST_VERSION/LATEST_PLATFORM_VERSIONare now 16, andPLATFORM_V16is registered.mocks/v5_test.rsis deleted and removed from the test versions.Upgrade (
drive-abci)previous < 16 && new >= 16rung,transition_to_version_16, in the v0 ladder. It runsinsert_token_order_escrow_treesand stores the token market contract without storage flags, the way genesis stores system contracts. It is the code fix(platform)!: the token marketplace starts with protocol version 16, not 15 #5910 removed fromtransition_to_version_15, moved to 16.Before / after:
Tests
test_genesis_v16_and_upgrade_to_v16_build_identical_token_order_escrow_treesandshould_insert_the_token_market_contract_on_transition_to_version_16.should_not_create_the_token_marketplace_at_genesis_v15_or_on_the_upgrade_to_v15stays.should_refuse_making_a_non_transferable_token_tradeable_with_a_paid_error_10281andshould_make_a_transferable_token_tradeable_from_protocol_version_16. The version 15 "not active" refusal test stays.platform-versionmock-versionsdev-dependencies come out ofrs-dpp,rs-sdk-trusted-context-providerandtoken-market-contract._protocol_version_15tests keep the version 15 values. The nullifier batch guard's root and settled digests and its sponsored payment fees are pinned again at latest.keep_history_delete_versionspinnedlatest() == 15. It now reads version 15 explicitly.grovedb-structure.jsonregenerated:latest_protocol_versionis 16 and it includes the escrow layers.How Has This Been Tested?
Targeted runs only, per repo practice:
cargo test -p platform-version --all-features: all pass.cargo test -p drive-abci --libfiltered toprotocol_upgrade create_genesis_state is_allowed bindings token_market_orders non_transferable nullifier_batch_guard commit_reveal_lookupand the document deletion/dpns/replacement, token burn and direct selling modules: 360 tests. The 6 first-run failures were the pins above and pass after re-pinning.cargo test -p drive --lib -- cache::system_contracts order_escrow structure::: pass.cargo test -p dpptoken configuration, system contract and token market tests plusstored_contract_compatibility(pinned at 15, unchanged): pass.cargo test -p token-market-contract,rs-sdk-trusted-context-provider(token market),dash-sdk --lib protocol: pass.cargo clippy --all-targets --all-features --locked -- --no-deps -D warningson every touched crate: clean.Not yet verified: the full workspace suites (CI), and a local network upgrade rehearsal from 15 to 16.
Breaking Changes
Adds a protocol version. Nodes on binaries without v16 can't follow the chain once the network votes it in. At 16 the token marketplace's state exists and tradeable tokens are admitted. Nothing changes at 15 or below.
For test code built with
mock-versions:platform_version::version::mocks::v5_test(TEST_PLATFORM_V5,TEST_PROTOCOL_VERSION_5) is removed. UsePlatformVersion::get(16)/PLATFORM_V16.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 ·
a2b18a1/self-revieweddpp— you own itrs-drive-abci— you own itrs-drive— you own itjs-wasm-sdk(packages/wasm-sdk/tests/fixtures/contract-cache/signed-responses.json,packages/wasm-sdk/tests/fixtures/state-transition-waits/signed-responses.json) — shumkovWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.