Skip to content

fix(platform)!: the token marketplace starts with protocol version 16, not 15 - #5910

Merged
QuantumExplorer merged 7 commits into
v5.1-devfrom
claude/token-marketplace-5-2-disables-f60719
Nov 13, 2026
Merged

QuantumExplorer merged 7 commits into
v5.1-devfrom
claude/token-marketplace-5-2-disables-f60719

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: The token marketplace lets a token's holders sell it to each other on Platform. Two of its building blocks were already merged for protocol version 15, and the rest moved to the next release (5.2). This PR moves the whole marketplace to protocol version 16: version 15 no longer creates anything for it and refuses a token marked "tradeable".

Value: 5.1 ships with no half-built marketplace in its state. 5.2 stays free to change how the escrow, the market contract and the tradeable mode are stored, with nothing from 5.1 to migrate. In particular 5.2 changes how the tradeable mode is stored (it gains a minimum fill amount), so a contract that stored it under 5.1 would have been unreadable.

Risks: Medium in size, low for released networks. Protocol version 15 is not released, and nothing changes at protocol version 14 or earlier. At version 15 the genesis state, the state after the upgrade, and fees that depend on the shape of the contracts tree change back to what they were before the marketplace was merged, so every pin of those moves. The marketplace code stays in the tree, selected by no protocol version, and is tested under a test-only version.

Issue being fixed or feature implemented

#5524 (tradeable tokens) and #5526 (escrow trees and the token market contract) are merged at protocol version 15. The order transitions that use them (#5529 to #5532) now target 5.2. Shipping 5.1 as it was would:

  1. Let a token be made tradeable with no transition able to trade it.
  2. Store TokenTradeMode::Tradeable as a unit variant ([1]), which feat(platform)!: token marketplace listings (PV15) #5529 changes to Tradeable { min_fill } ([1, min_fill]) under the same tag.
  3. Put two escrow trees and the token market contract v1 into every 5.1 chain's state before the feature that uses them is final.

What was done?

  • One constant. TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION is 16 and decides everything: the genesis registration of the token market contract, the system contract cache, the SDK context providers, TokenConfiguration::validate_trade_mode and the batch is_allowed gate.
  • Protocol version 15 tables select no marketplace. DRIVE_VERSION_V10 goes back to create_initial_state_structure 4, DRIVE_TOKEN_METHOD_VERSIONS_V2 (calculate_total_tokens_balance 1, escrow methods None), and the previous versions of the four estimators the escrow needed (for_balances, for_token_balances, the contract fee pot and the prefunded balance estimations). SYSTEM_DATA_CONTRACT_VERSIONS_V4 has token_market: 0.
  • The upgrade to 15 no longer inserts the escrow trees or the token market contract.
  • The code stays, selected by no protocol version: create_initial_state_structure 5, DRIVE_TOKEN_METHOD_VERSIONS_V3, the escrow methods, the estimator versions, the token market contract v1.
  • A test version carries it. TEST_PLATFORM_V5 (mock versions) is protocol version 15's tables plus the selections above. The escrow, genesis, data trigger binding, market order, cache and contract tests run under it. It documents what protocol version 16's tables take over.
  • Left selected at 15: data trigger bindings 3, which version 15 needs for DashPay v3. It also lists the rejects of a replace or delete of a token market order; they match the token market contract's id only, so nothing reaches them before that contract exists.
  • The structure description marks both escrow trees as from 16; grovedb-structure.json is regenerated. The stored contract fixture for version 15 loses its token market line.
  • Docs: v15.rs notes 5 and 17, the book's token marketplace chapter, the token market contract README, and the doc comments that named version 15.

Before and after, at protocol version 15

Before After
Genesis and the upgrade to 15 create [Tokens, TOKEN_ORDER_ESCROW_KEY], [PreFundedSpecializedBalances, PREFUNDED_BALANCES_FOR_TOKEN_ORDERS] and the token market contract create none of them
Lookup of AE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e the token market contract absent (cache, Drive and SDK providers)
Contract create or update with "tradeMode": "Tradeable" admitted and stored refused unpaid, StateTransitionNotActiveError (10603), TokenTradeModeTradeable, required version 16
TokenConfigUpdate with MarketplaceTradeMode(Tradeable) token becomes tradeable (10281 if non-transferable) refused unpaid, 10603, TokenConfigUpdateMarketplaceTradeModeTradeable, required version 16
DPNS domain create fee (example of a pin) 5,899,360 6,049,360, the value before #5526

At protocol version 14 and earlier a tradeable token is refused unpaid with 10603 before and after. The error's required_protocol_version reads 16 where it read 15.

Public interface changes

platform-version

  • feature_initial_protocol_versions::TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION changes value from 15 to 16. It now also answers "may a token be tradeable?".
  • Added (feature mock-versions): mocks::v5_test::TEST_PLATFORM_V5 and TEST_PROTOCOL_VERSION_5, registered in the default mock versions.
  • PLATFORM_V15 selects different numbers: drive.methods.initialization.create_initial_state_structure 4 (was 5), drive.methods.token = DRIVE_TOKEN_METHOD_VERSIONS_V2 (was V3), for_balances 0, for_token_balances 0, add_estimation_costs_for_contract_fee_pot_update 0, estimated_cost_for_prefunded_specialized_balance_update 1, system_data_contracts.token_market 0 (was 1).

dpp / data-contracts

  • load_system_data_contract(SystemDataContract::TokenMarket, ..) returns an error at protocol version 15 (it loaded the contract). It loads under a version whose tables set token_market: 1.
  • TokenConfiguration::validate_trade_mode, validate_marketplace_rules and validate_token_configurations return StateTransitionNotActiveError for a tradeable token at protocol version 15, with required_protocol_version 16.
  • TokenTradeMode is unchanged: same variants, same bincode tags, same JSON.

drive

  • Drive::create_initial_state_structure at protocol version 15 creates no escrow tree. Every order_escrow method returns VersionNotActive at 15. SystemDataContracts::find_by_id returns None for the token market id at 15.
  • No signature changes. Drive::insert_token_order_escrow_trees stays public for the upgrade to 16.

rs-sdk-trusted-context-provider

  • The providers serve no contract under the token market id at protocol version 15, preloaded or built in.

SDKs (wasm-dpp2, Swift, Kotlin)

  • No API change. TokenTradeMode.Tradeable() and .tradeable still exist and parse; a network at protocol version 15 refuses a contract or update that uses them.

In-place changes to shipped generations

  • TokenConfiguration::validate_trade_mode (dpp, unversioned) and the batch arm of is_allowed compare against a constant that moved from 15 to 16. For every released protocol version (14 and earlier) the answer is the same: a tradeable token is refused unpaid. Only the error's required_protocol_version field differs, in a refusal that keeps the transition out of the block. No release ever reported 15: v5.0.0 has only NotTradeable and cannot decode the mode.
  • create_genesis_state v1, the system contract cache and the SDK providers compare against the same constant. Released versions are all below both 15 and 16, so they register and serve no token market contract before and after.
  • transition_to_version_15 loses two steps. Protocol version 15 is unreleased.
  • Everything else is table selections of the unreleased protocol version 15.

How Has This Been Tested?

Targeted runs, all passing:

  • cargo test -p drive --lib -- order_escrow structure::tests cache::system_contracts calculate_total_tokens_balance (35), plus the token, balance, fee_pot, prefunded_specialized_balances, estimated_layers and initialization filters earlier in the work.
  • cargo test -p dpp --lib -- system_data_contracts associated_token total_tokens_balance (727) and --test stored_contract_compatibility (3).
  • cargo test -p drive-abci --lib -- create_genesis_state data_triggers::bindings token_market perform_events_on_first_block token_marketplace_gate non_transferable contract_structure batch::tests::token::burn batch::tests::token::direct_selling nullifier_batch_guard batch::tests::document::commit_reveal batch::tests::document::dpns (289).
  • cargo test -p rs-sdk-trusted-context-provider -p token-market-contract -p data-contracts.
  • cargo check --tests on every touched crate.

Tests added or changed:

  • Genesis at 15 and the upgrade to 15 hold neither escrow tree nor the token market contract; genesis registers the contract only under the test version.
  • Every escrow method is refused at 14 and 15 and works under the test version.
  • A tradeable token is refused as not active at 14 and 15, in dpp, in is_allowed, and end to end in check_tx and in a block.
  • The cache, the contract loaders and the SDK providers report the contract absent at 15.
  • The pins the token market contract had moved are back at their values from before feat(platform)!: token marketplace escrow trees and token market contract (PV15) #5526 (DPNS, commit reveal, token burn, direct purchase), and the result hashes of the shielded batch guard and the activation root are regenerated.

Not run: the full suites (pins outside the modules above may still need updating; CI will show them), clippy, and the Swift and JS suites.

Breaking Changes

Consensus at protocol version 15 (unreleased): the genesis state and the state after the upgrade no longer hold the escrow trees or the token market contract, fees that depend on the contracts tree's shape change, and a contract or TokenConfigUpdate that makes a token tradeable is refused. A devnet already running an earlier build of protocol version 15 is not compatible with this one and needs a reset.

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 · f50fcfa

  • Bots — thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Reviewer requests paused — your 5 review slots are occupied; this PR is excluded from reviewers' queues. Required approvals still count without a slot.
  • Build failed
  • Approvals
    • files with no dedicated owner — you own it
    • system-contracts — you own it
    • dpp — you own it
    • rs-drive-abci — you own it
    • rs-drive — you own it
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataContractParserTradeModeTests.swift) — llbartekll or romchornyi

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.

Summary by CodeRabbit

  • Behavior Changes
    • Token marketplace features—including tradeable token configurations, order transitions, escrow, and the marketplace contract—are available starting with protocol version 16.
    • Earlier versions, including version 15, reject attempts to enable tradeable mode without a fee. Non-transferable tokens cannot be configured as tradeable once marketplace support is active.
    • Protocol version 15 no longer initializes marketplace state; the marketplace contract and escrow structures are introduced at version 16.
  • Documentation
    • Updated marketplace and token guidance to reflect the version 16 activation boundary.

…ot 15

The order transitions of the token marketplace moved to the next release, and
they change the stored form of `TokenTradeMode::Tradeable`. Protocol version 15
would have admitted the mode with nothing able to trade the token, and every
contract storing it would hold a form the next release cannot read.

`TOKEN_TRADE_MODE_TRADEABLE_INITIAL_PROTOCOL_VERSION` (16) now gates the mode
on contract create, contract update and a trade mode configuration update:
below it they are refused unpaid as not active (10603).
`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION` stays 15 and keeps selecting the
escrow trees and the token market contract, which stay empty at 15.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v5.1.0 milestone Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 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 Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

Token marketplace activation moves from protocol version 15 to version 16. Tradeable-token admission, escrow structures and methods, and TokenMarket registration now use the version-16 boundary. Tests and documentation cover the pre-activation behavior at version 15.

Changes: Protocol 16 Marketplace Activation

Layer / File(s) Summary
Set the activation contract and test version
packages/rs-platform-version/src/version/*, packages/rs-platform-version/src/version/mocks/*
The marketplace activation constant changes to version 16. A mock platform version adds marketplace tables for activation-related tests.
Gate tradeable-token configurations
packages/rs-dpp/src/data_contract/associated_token/*, packages/rs-drive-abci/src/execution/validation/state_transition/..., book/src/data-model/non-transferable-tokens.md
Tradeable-token configurations and updates are rejected below version 16. Tests cover version-15 refusals and version-16 acceptance for transferable tokens.
Move marketplace registration and state
packages/rs-drive-abci/src/execution/platform_events/*, packages/rs-platform-version/src/version/system_data_contract_versions/*, packages/rs-dpp/src/system_data_contracts.rs, packages/rs-dpp/tests/*, packages/rs-drive/grovedb-structure.json
Version 15 no longer registers TokenMarket or creates marketplace escrow trees. Version and fixture tests check the contract and trees at the updated boundary.
Align escrow and contract consumers
packages/rs-drive/src/drive/tokens/*, packages/rs-drive/src/cache/system_contracts.rs, packages/rs-sdk-trusted-context-provider/src/*, packages/token-market-contract/src/lib.rs, packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/*
Escrow structures and methods use version 16. Contract lookup, provider, schema, and binding tests treat version 15 as pre-activation and use the marketplace test platform for active-version checks.
Update documentation and pinned expectations
book/src/data-model/*, packages/swift-sdk/*, packages/wasm-dpp2/*, packages/token-market-contract/README.md, packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/*
Documentation identifies version 16 as the marketplace start. Tests update fee, balance, and state-hash expectations for the revised genesis contract-tree shape.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant ProtocolVersion
  participant GenesisInitialization
  participant TokenMarket
  participant EscrowTrees
  ProtocolVersion->>GenesisInitialization: select version 16
  GenesisInitialization->>TokenMarket: register contract at genesis
  GenesisInitialization->>EscrowTrees: create marketplace escrow trees
Loading

Suggested reviewers: shumkov

Merge Risk: Minimal · previous review 7c416

This change moves token marketplace activation from protocol version 15 to 16, so version 15 no longer creates escrow trees, registers the market contract, or accepts tradeable tokens. No concrete merge-blocking issue was found. Run the full test suites before release, since they were not run by the author.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the token marketplace's initial protocol version moves from 15 to 16. The raw summary confirms this across the changeset, including the activation constant in feature_…
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.
Full details: Title check

Explanation

The title names the main change: the token marketplace's initial protocol version moves from 15 to 16. The raw summary confirms this across the changeset, including the activation constant in feature_initial_protocol_versions.rs, the v15 and v4 system contract versions, genesis and upgrade paths, fixtures, and tests. The title is specific, short, and in a single sentence. The 'fix(platform)!' prefix is a conventional-commit style marker and does not affect the assessment.

  • 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 b14fcc5 and 7c416f1.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 59

  • book/src/data-model/token-marketplace.md
  • packages/data-contracts/src/lib.rs
  • packages/rs-dpp/Cargo.toml
  • packages/rs-dpp/src/balances/total_tokens_balance/mod.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs
  • packages/rs-dpp/src/system_data_contracts.rs
  • packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl
  • packages/rs-dpp/tests/stored_contract_compatibility.rs
  • packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs
  • packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/v3/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns_v3.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/token_market_orders.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs
  • packages/rs-drive/grovedb-structure.json
  • packages/rs-drive/src/cache/system_contracts.rs
  • packages/rs-drive/src/drive/contract/fee_pots/estimated_costs/v1/mod.rs
  • packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v1/mod.rs
  • packages/rs-drive/src/drive/initialization/v5/mod.rs
  • packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs
  • packages/rs-drive/src/drive/prefunded_specialized_balances/structure.rs
  • packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v0/mod.rs
  • packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v1/mod.rs
  • packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs
  • packages/rs-drive/src/drive/tokens/mod.rs
  • packages/rs-drive/src/drive/tokens/order_escrow/estimated_costs/v0/mod.rs
  • packages/rs-drive/src/drive/tokens/order_escrow/insert_trees.rs
  • packages/rs-drive/src/drive/tokens/order_escrow/mod.rs
  • packages/rs-drive/src/drive/tokens/paths.rs
  • packages/rs-drive/src/drive/tokens/structure.rs
  • packages/rs-drive/src/structure/tests.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v11.rs
  • packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/mod.rs
  • packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v1.rs
  • packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v3.rs
  • packages/rs-platform-version/src/version/drive_versions/v10.rs
  • packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs
  • packages/rs-platform-version/src/version/mocks/mod.rs
  • packages/rs-platform-version/src/version/mocks/v5_test.rs
  • packages/rs-platform-version/src/version/protocol_version.rs
  • packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs
  • packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs
  • packages/rs-platform-version/src/version/v15.rs
  • packages/rs-sdk-trusted-context-provider/Cargo.toml
  • packages/rs-sdk-trusted-context-provider/src/local.rs
  • packages/rs-sdk-trusted-context-provider/src/provider.rs
  • packages/rs-sdk-trusted-context-provider/src/system_contracts.rs
  • packages/rs-sdk-trusted-context-provider/src/verified_provider.rs
  • packages/token-market-contract/Cargo.toml
  • packages/token-market-contract/README.md
  • packages/token-market-contract/src/lib.rs
Files with no reviewable changes: 1

  • packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl
Files skipped from review as they are similar to previous changes: 2

  • packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs
  • packages/rs-platform-version/src/version/v15.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.

@thepastaclaw

thepastaclaw commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

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

@github-actions

github-actions Bot commented Nov 13, 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-11-13T23:46:27.485Z

@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

The PR correctly separates protocol-15 marketplace state from protocol-16 tradeable-token admission, and the available Rust and Swift CI checks pass. One blocking compatibility issue remains: released protocol versions 14 and earlier now return a different serialized activation error payload; the synthetic protocol-16 test helper also needs a guard or exact-version lookup before future tables land.

🔴 1 blocking | 🟡 1 suggestion(s)

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.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a cross-cutting consensus and persisted-serialization compatibility change that modifies protocol-version activation gates and the accepted representation of token marketplace state in rs-dpp and rs-drive-abci.
  • 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.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); 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/data_contract/associated_token/token_configuration/mod.rs`:
- [BLOCKING] packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs:190-196: Preserve the historical activation error for protocol versions below 15
  This changes `StateTransitionNotActiveError.required_protocol_version` from 15 to 16 for protocol version 14 and every earlier released version. The same change exists in the batch `is_allowed` gate at `packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs:174-205`. Although the transition remains unpaid and does not alter the state root, the error is platform-serialized and returned to clients through validation responses, so historical protocol behavior is no longer identical. Preserve the old required version for protocol versions below `TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`, and report 16 only for protocol 15; add tests covering both serialized error payloads through contract validation and batch validation.
- [SUGGESTION] packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs:1236-1240: Prevent synthetic protocol-16 tests from silently using a later version's tables
  `protocol_version_admitting_tradeable()` clones `PlatformVersion::latest()` and changes only its numeric protocol version to 16. This is intentional while protocol-16 tables are absent, but once a later protocol version becomes latest, these tests will exercise that later version's format, fee, and feature tables while claiming to test protocol 16. The same helper is duplicated in `is_allowed.rs`. Make the helper use `PlatformVersion::get(16)` when the real table exists, or fail loudly once protocol 16 is added, so the temporary fallback cannot silently become a false protocol-16 test.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
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 Nov 13, 2026
…ables once they exist

The stand-in (the latest tables under the number 16) is now only the fallback while protocol version 16 has no tables, so the tests cannot end up running a later version's tables under that number.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions

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 Nov 13, 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 2 only (queue backlog)

The activation split correctly keeps marketplace state at protocol 15 while admitting tradeable tokens only from protocol 16. The historical activation-error finding is withdrawn because tradeable mode was introduced after the stable v5.0 release, so no shipped protocol-14 implementation emitted the former required-version-15 payload. One test should construct its acceptance fixture with the same protocol-16 tables used for validation. Rust workspace tests pass; remaining SDK, JavaScript, WASM, Docker, and hygiene checks are still 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: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a cross-cutting consensus and persisted-state compatibility change in token validation and protocol-version activation gates, affecting which state transitions are admitted and preventing an incompatible serialized trade-mode representation from being stored.
  • Phase 1 reviewers: not run (skipped for throughput: 13 PRs queued, above the 10 limit)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); 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-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs:966-970: Build the protocol-16 acceptance fixture with protocol-16 tables
  This test validates with `protocol_version_admitting_tradeable()` but constructs the contract with `PlatformVersion::latest()`. The helper correctly selects the exact protocol-16 table once it exists, whereas `latest()` will eventually select a later protocol version. Because fixture construction and platform-versioned conversion use the supplied version, a later table could make this test depend on unrelated serialization or limits while it claims to test protocol 16. Store the admitting version in a local variable and pass that same value to both construction and validation.

Comment on lines +966 to +970
let result = contract_create_with_trade_mode(
TokenTradeMode::Tradeable,
PlatformVersion::latest(),
)
.validate_is_allowed(&protocol_version_admitting_tradeable())

@thepastaclaw thepastaclaw Nov 13, 2026 •

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.

✅ Resolved at f50fcfa4; see the replies below.

🟡 Suggestion: Build the protocol-16 acceptance fixture with protocol-16 tables

This test validates with protocol_version_admitting_tradeable() but constructs the contract with PlatformVersion::latest(). The helper correctly selects the exact protocol-16 table once it exists, whereas latest() will eventually select a later protocol version. Because fixture construction and platform-versioned conversion use the supplied version, a later table could make this test depend on unrelated serialization or limits while it claims to test protocol 16. Store the admitting version in a local variable and pass that same value to both construction and validation.

Suggested change
let result = contract_create_with_trade_mode(
TokenTradeMode::Tradeable,
PlatformVersion::latest(),
)
.validate_is_allowed(&protocol_version_admitting_tradeable())
let platform_version = protocol_version_admitting_tradeable();
let result = contract_create_with_trade_mode(
TokenTradeMode::Tradeable,
&platform_version,
)
.validate_is_allowed(&platform_version)
.expect("should not error");

source: gpt-6.1-sol (phase2-reviewer: rust-quality)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 92d40fb: the test keeps the admitting version in a local and passes it to both the fixture and the validation. The helper returns version 16 when it has tables and the marketplace test version until then.

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.

Resolved (re-reviewed at f50fcfa4): The current test stores the admitting platform version once and passes that same version to both contract construction and validation, so it no longer mixes protocol-16 validation with latest-version fixture tables.

@github-actions

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 Nov 13, 2026
One constant, TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION = 16, decides the whole marketplace; the separate tradeable constant is gone. Protocol version 15 no longer creates the escrow trees or the token market contract, at genesis or on the upgrade, and its tables select none of the marketplace: create_initial_state_structure 4, calculate_total_tokens_balance 1, the escrow methods None, token_market 0, and the estimators the escrow needed back at their previous versions.

The marketplace code stays and is selected by no protocol version. The test version TEST_PLATFORM_V5 selects it on top of protocol version 15's tables, and the escrow, genesis, binding and contract tests run under it.

Fee and state pins of protocol version 15 return to their values from before the token market contract joined the genesis contracts tree.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🌳 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 (7 nodes)

  • tokens
  • tokens.order_escrow
  • tokens.order_escrow.token
  • tokens.order_escrow.token.order
  • prefunded_balances
  • prefunded_balances.for_token_orders
  • prefunded_balances.for_token_orders.offer

Compared b2e7395b96 with 92481d8514. Updated at 2026-11-13T23:46:14.119Z

@QuantumExplorer QuantumExplorer changed the title fix(platform)!: a token becomes tradeable from protocol version 16, not 15 fix(platform)!: the token marketplace starts with protocol version 16, not 15 Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 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 Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 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.

…sion; history proof pins follow protocol version 15's state

The tests of what the token marketplace's first version admits use that version's tables once they exist and the marketplace test version until then, for the fixture and for the validation alike.

The non-history root and proof pins of protocol version 15 move with its genesis state, which no longer holds the token market contract.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 13, 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.

…ontracts tree

The rule-free restore's processing fee returns to its value from before the token market contract joined the genesis contracts tree. Two comments on unchanged pins name the decision proposals contract alone again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 13, 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.

@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

The marketplace activation move is consistent at protocol 16, and the previously raised fixture-version findings are fixed. Two non-blocking issues remain: two test comments incorrectly say protocol 15 creates marketplace state, and a second mock-version registry initializer can omit TEST_PLATFORM_V5 depending on test initialization order. CI has no reported failures on this head, although workspace tests and several suites remain pending.

💬 1 nitpick(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.

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Keep all mock-version registries in sync with TEST_PLATFORM_V5
packages/rs-platform-version/src/version/system_limits/mod.rs:631-632

The new TEST_PLATFORM_V5 is included in DEFAULT_PLATFORM_TEST_VERSIONS, but this test can initialize the process-global PLATFORM_TEST_VERSIONS OnceLock first with only TEST_PLATFORM_V2 through TEST_PLATFORM_V4. In that order, later protocol-16 acceptance tests that resolve TEST_PROTOCOL_VERSION_5 cannot find it, making test behavior depend on initialization order. Initialize this registry with the same four mock versions as the default registry.

let versions = PLATFORM_TEST_VERSIONS.get_or_init(|| {
            vec![
                TEST_PLATFORM_V2,
                TEST_PLATFORM_V3,
                TEST_PLATFORM_V4,
                crate::version::mocks::v5_test::TEST_PLATFORM_V5,
            ]
        });

source: gpt-6.1-sol (phase2-reviewer: general, architecture-layering, platform-versioning)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a large, intricate change to protocol-version dispatch and persisted genesis/upgrade state structures, directly affecting consensus rules and storage compatibility in the rs-drive-abci and platform-version tables.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (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)
  • Code unchanged since the last final review (b14fcc58): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); 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-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs`:
- [NITPICK] packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs:818-820: Correct protocol-15 marketplace-state test comments
  The helper comment says protocol 15 decodes Tradeable and creates the marketplace state, but this change explicitly makes protocol 15 create neither escrow trees nor the token market contract. The same stale description appears in the DPP test at packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs:1252-1253. Update both comments to say that protocol 15 decodes the mode but creates none of the marketplace state.

@github-actions

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 Nov 13, 2026
…on/processor/traits/is_allowed.rs

Co-authored-by: Lil Claw <pasta+claw@dashboost.org>
@QuantumExplorer
QuantumExplorer merged commit adfa029 into v5.1-dev Nov 13, 2026
9 of 10 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/token-marketplace-5-2-disables-f60719 branch November 13, 2026 23:46
QuantumExplorer added a commit that referenced this pull request Nov 15, 2026
….1-dev

Two doc comment lines in `is_allowed.rs` came in unindented with #5910,
so the format step of the Rust tests fails for every pull request on
`v5.1-dev`. Formatted with `cargo fmt --all`; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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