Registry Mirror
Skip to content

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: Records token marketplace activity in token history, the way transfers are recorded today. When a token keeps transfer history (the default), every listing, offer, fill and cancel now leaves a document in the token history system contract saying who did what, at what price and for how much.

Value: Wallets, explorers and apps can show a token's trades and an identity's own marketplace activity with the history queries and proofs they already use for transfers, instead of reconstructing it from order documents that disappear when an order closes.

Risks: Medium-low. From protocol version 16 (the 5.2 line) the token history contract is upgraded to v3 (three new document types, the existing ones unchanged), and the marketplace transitions of a token that keeps transfer history pay for one more document. Protocol version 15 (the released 5.1 line) and earlier do not change: they keep token history v2, and the upgrade, the v3 contract and the history writes are reached only at 16.

Issue being fixed or feature implemented

The fifth PR of the token marketplace stack, gated at protocol version 16, on top of #5530 (offers). The marketplace moved to 5.2 (protocol version 16, #6253); this PR merged that move and its history note is now v16 note 7 (was v15 note 19; #6433 took v16 note 3, #6354 note 4). Orders live as documents only while open, so once filled or cancelled nothing on Platform says they existed. Tokens already keep a history of their transfers; marketplace fills are transfers too.

What was done?

Token history contract v3 (SYSTEM_DATA_CONTRACT_VERSIONS_V5.token_history = 3, the table PLATFORM_V16 selects; SYSTEM_DATA_CONTRACT_VERSIONS_V4, protocol version 15's, keeps token_history: 2): v2 plus

Document type Written by Properties Indexes
orderPlaced TokenPlaceAsk, TokenPlaceBid tokenId, orderId, side, amount, price, decimals byDate, byOwnerIdForToken, byOwnerId, byOrder
orderFilled TokenFillAsk, TokenFillBid tokenId, orderId, side, makerId, amount, credits, decimals the same plus byMakerId
orderCancelled TokenCancelOrder tokenId, orderId, side the same as orderPlaced

The v2 types are byte-for-byte unchanged in the schema. transition_to_version_16 applies v3 keeping the stored contract's storage ownership, exactly as transition_to_version_14 did for v2; a chain born at 16 stores v3 at genesis.

History writes: the token transition converter appends a TokenHistory operation after each marketplace transition's own operations when TokenTransitionAction::keeps_history says the token keeps its kind of history (transfer history for the marketplace), with the event TokenTransitionAction::associated_token_event builds (OrderPlaced, OrderFilled, OrderCancelled). One helper, token_history_operation, holds that decision for all five, so the gate and the event have a single authority.

Proofs: a fill is still proved by the token balance and a cancel by the order's absence. A placement of a token keeping transfer history is proved by the order's document and the orderPlaced record together (one merged path query): while the order is open its document proves the placement, after partial fills too; once it has closed (filled entirely or cancelled) the record does, verified against the transition's terms. A closed order of a token keeping no history is not taken as placed: its absence alone proves nothing, and the verification refuses. The record holds every term of the placement (amount, price), all compared with the transition's, so a placement with the same signer and nonce but other terms does not verify against it. Its decimals (the token's at placement, recorded on fills too) is not a term of the transition and is not compared (the verifier ignores the field): a later conventions update may change the token's decimals. No record holds a minimum fill, which is the token's (#5529).

Before: a filled or cancelled order leaves no trace on Platform.
After, a token keeping transfer history:
  seller lists 1,000 at 10 credits      -> orderPlaced    {side 0, amount 1000, price ...}  owned by the seller
  buyer takes 400                        -> orderFilled    {side 0, makerId seller, amount 400, credits 4000}  owned by the buyer
  seller cancels the rest                -> orderCancelled {side 0}  owned by the seller
A token with keepsTransferHistory false writes none of these.

Tests pinned to protocol version 14: token_history_storage_flags_tests cover the upgrade to 14 but used PlatformVersion::latest() as that target; with the latest version now upgrading the contract again, they are pinned to 14 (pv14()), including the genesis of the "already current" case. The 13-to-latest row now checks a jump to 16, with a 13-to-15 row (v2, compiled) beside it.

Re-pinned characterization digests: genesis at 16 stores the larger token history contract, so the settled-state hashes of nullifier_batch_guard, which cover the state root, move; each changed value is re-pinned against v5.2-dev's (ten settled digests; the validation digests are unchanged).

Moved fee baselines (latest version only): two token tests that write a history document pin exact fees at the latest version. The history contract's document type Merk is deeper with three more types, so at 16 the burn group-action confirmer's processing fee moves +180 (4,404,840 to 4,405,020) and the direct purchase buyer pays 91,100 more (699,868,001,200 to 699,867,910,100). v5.2-dev's _protocol_version_15 twins pass unchanged, so the shift is protocol-16 only.

Docs: book "History" section; v16 note 7; CHANGELOG (Unreleased): the TokenEvent order events and their decimals field, and token history v3, both at protocol version 16.

How Has This Been Tested?

  • Review round of 2026-12-01 (7598bf8): a closed offer proved by its orderPlaced record is refused when the escrow at the record's decimals passes the transition's max_total_price, and so is an open one (from feat(platform)!: token marketplace offers (PV16) #5530): history::should_not_prove_a_closed_offer_whose_signed_limit_is_below_its_escrow. The direct upgrade row of the storage flags test is pinned to pv16(); the CHANGELOG entries moved under Unreleased. cargo test -p drive-abci --lib -- token_history_storage_flags marketplace (86).

  • After the move to protocol version 16 (merge of feat(platform)!: token marketplace offers (PV16) #5530's move, ac7ca25): cargo test -p token-history-contract (2, v3 at 16, v2 at 14 and 15), cargo test -p drive-abci --lib -- token_history_storage_flags (10), cargo test -p drive-abci --lib -- batch::tests::token restore_constraints yes_no_tests --skip nullifier_batch_guard (433), and cargo test -p drive-abci --lib -- shielded::nullifier_batch_guard (14, after the re-pin).

  • cargo test -p drive-abci --lib -- batch::tests::token::marketplace::history: a listing, its fill and its cancel record orderPlaced, orderFilled (maker, amount, credits) and orderCancelled owned by each signer; an offer and a sale into it record the bid side; a token keeping no transfer history records nothing.

  • cargo test -p drive-abci --lib -- perform_events_on_first_block_of_protocol_change create_genesis_state token_history_storage_flags_tests: the upgrade to 16 adds the three types and keeps the contract's storage flags; the upgrade-to-14 storage flag tests pass pinned to 14.

  • Review round 2, in marketplace::history:

    • a closed listing and a closed offer are proved by their record; placements with the same signer, nonce and amount but another price each fail verification against that proof (round 5: these compared the minimum fill, which orders no longer carry);
    • a listing placed at 8 decimals and filled after the token changes to 2 records 8 on its placement and its fill, and its placement is still proved after it closed;
    • the listing records carry decimals 8 and no minFill.
  • Round 5: should_prove_a_closed_order_after_the_tokens_decimals_change: a listing placed at 8 decimals and filled, then the token set to 2, is proved by its record (8) by a client holding the contract as it is now; cargo test -p drive-abci --lib -- tests::token::marketplace (63 + 1 passed), cargo test -p dpp --all-features --lib -- token_event token_transition (73).

  • cargo test -p drive-abci --test strategy_tests -- credit_pool_backfill: the activation lifecycle tests, which describe the upgrade to 14 (credit pool nullifier backfill, token history v2), now target protocol version 14 explicitly instead of the latest version, whose upgrade installs token history v3 (protocol version 16).

  • token_history_storage_flags_tests::should_carry_flagged_token_history_through_the_upgrades_to_14_and_16: a token history contract installed by the historical upgrade path, flagged with an owner and an earlier allocation, goes through the upgrades to 14 (epoch 7) and from 14 to 16 (epoch 9, running the upgrades to 15 and 16): the owner and base epoch stay, the allocations at epochs 5 and 7 stay, v3's growth is allocated at epoch 9, the version item keeps its owner, the legacy claim and its index entries are untouched, and an orderPlaced document can be written afterwards. With transition_to_version_16 passing no flags the test fails.

  • token_history_storage_flags_tests::should_preserve_token_history_flag_owners_and_allocation_epochs runs the upgrade from 13 straight to 14, to 15 and to 16. On the jump to 16 transition_to_version_14 already applies v3 (loaded from the version 16 tables) and transition_to_version_16 applies it again (growth 14,436, allocations 14,488 / 14,441; 8,006 at 15, where v2 is re-stored compiled). For seven storage flag shapes over a legacy claim it checks the owner, base epoch and earlier allocations, the pinned growth and allocation (so the second apply adds nothing), the untouched legacy documents, native integrity and the version item 3; review round 6 adds that the committed contract is v3 and takes an orderPlaced document (assert_order_placed_writable, shared with the 14-then-16 test).

  • History tests: a cancelled offer records orderCancelled with side 1 owned by the buyer; a token that keeps no transfer history records nothing for a listing, its fill and cancel, an offer, a sale into it and an offer's cancel.

  • cargo test -p drive-abci --lib -- batch::tests::token (regressions, including every marketplace test now writing history; round 1: 435 passed with --skip shielded together with the protocol change, genesis and document tests), batch::tests::document::{deletion,replacement,dpns,creation,index_only}, nullifier_batch_guard, data_triggers.

  • cargo test -p token-history-contract -p data-contracts.

In-place changes to shipped generations

  • The five marketplace converters, their generation 0 and the actions they convert are new in this stack (feat(platform)!: token marketplace listings (PV16) #5529, feat(platform)!: token marketplace offers (PV16) #5530) and in no release; is_allowed refuses the five transitions before protocol version 16, and replaying any earlier block never reaches them.
  • The token transition converter (TokenTransitionAction::into_high_level_batch_drive_operations, which has no version of its own) appends the marketplace history operation after the operations of the five marketplace kinds only. Every other kind's arm is unchanged, so every earlier block converts as before.
  • verify_state_transition_was_executed_with_proof v0, which both verifier generations call: the TokenPlaceAsk and TokenPlaceBid arms gain the fallback that proves a closed order by its orderPlaced record for a token that keeps transfer history, with the group-information refusal in front of it. Only the marketplace kinds reach those arms, and is_allowed refuses them before protocol version 16, so no earlier version executes one for a client to verify. Every other kind's arm is unchanged. This path builds and checks proofs for clients; no node's state or result depends on it.
  • perform_events_on_first_block_of_protocol_change v0, which every protocol version's upgrade runs (v1 calls it and v2 calls v1): transition_to_version_16 gains the token history v3 apply that keeps the stored contract's storage ownership. transition_to_version_16 is new on the 5.2 line and runs only under previous_protocol_version < 16 && platform_version.protocol_version >= 16, so no upgrade into 15 or earlier reaches it; transition_to_version_15 is v5.2-dev's, unchanged. The contract transition_to_version_14 applies is loaded through the running version's tables, which name token history v3 only at 16 (SYSTEM_DATA_CONTRACT_VERSIONS_V5): an upgrade into 14 or 15 still applies v2, and only a network jumping from 13 straight to 16 applies v3 there, then again at 16 (covered by should_preserve_token_history_flag_owners_and_allocation_epochs).

Breaking Changes

Consensus, from protocol version 16: the token history contract v3 (at genesis and on the upgrade), and history documents written by the marketplace transitions. Earlier protocol versions are unchanged.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

QuantumExplorer and others added 3 commits October 22, 2026 00:42
The token history contract v3 (SYSTEM_DATA_CONTRACT_VERSIONS_V4) is v2 plus
the orderPlaced, orderFilled and orderCancelled document types. A chain born
at 15 stores it at genesis, and transition_to_version_15 applies it keeping
the stored contract's storage ownership, as transition_to_version_14 did for
v2. The marketplace transitions of a token that keeps transfer history now
write the matching history document.

The upgrade-to-14 storage flag tests used PlatformVersion::latest() as their
target and are pinned to 14; the shielded pool characterization root and
settled-state hashes, which cover the genesis state, are re-pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…story

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two token tests writing a history document pin exact fees at the latest version: the burn group-action confirmer moves +180 and the direct purchase buyer pays 91,100 more, for the deeper document type Merk of the token history contract v3. Each keeps its old value in a protocol version 14 twin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@github-actions

github-actions Bot commented Oct 21, 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-03T16:48:47.051Z

@thepastaclaw

thepastaclaw commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 1682bae) · 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

The PV15 contract migration and marketplace history writes are correctly gated, and no blocking consensus, proof-safety, or funds defects were found. The execution-proof path does not attest the new marketplace history documents, and the converters duplicate the history policy and event construction; the remaining findings are non-blocking test, versioning, and documentation follow-ups. The supplied CI snapshot has no failures, though it does not include a dedicated Rust build or test result.

🟡 5 suggestion(s) | 💬 1 nitpick(s)

2 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Marketplace execution proofs do not attest the new history documents
packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs:223-258

The five marketplace converters now write orderPlaced, orderFilled, and orderCancelled documents when keeps_transfer_history() is enabled, but the execution-path query still requests only the order document for placements/cancellations and only the token balance for fills. The proof verifier has the same marketplace-only branches and therefore never verifies that the newly written history document exists or matches the transition. This leaves marketplace activity inconsistent with other history-keeping token operations, and it contradicts the PR's stated goal of making marketplace activity available through the existing history queries and proofs. Select the historical-document query when transfer history is enabled, while retaining or merging the existing order/balance attestation where it is needed.

source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality)

💬 Nitpick: Mention the token history upgrade in the PV15 migration comment
packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:911-914

The transition_to_version_15 doc comment describes the DPNS and token marketplace changes but omits the token history contract's v3 upgrade, which is another state migration performed by the function. Update the comment so it documents all PV15 contract changes.

source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality)

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: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); 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 consensus-critical token state-transition behavior and a persisted token-history contract storage migration activated by protocol version 15.
  • 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 (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.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
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs`:
- [SUGGESTION] packages/rs-drive/src/verify/state_transition/state_transition_execution_path_queries/token_transition.rs:223-258: Marketplace execution proofs do not attest the new history documents
  The five marketplace converters now write `orderPlaced`, `orderFilled`, and `orderCancelled` documents when `keeps_transfer_history()` is enabled, but the execution-path query still requests only the order document for placements/cancellations and only the token balance for fills. The proof verifier has the same marketplace-only branches and therefore never verifies that the newly written history document exists or matches the transition. This leaves marketplace activity inconsistent with other history-keeping token operations, and it contradicts the PR's stated goal of making marketplace activity available through the existing history queries and proofs. Select the historical-document query when transfer history is enabled, while retaining or merging the existing order/balance attestation where it is needed.

In `packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_place_ask_transition.rs`:
- [SUGGESTION] packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_place_ask_transition.rs:78-96: Centralize the marketplace history gate and event construction
  Each of the five marketplace converters independently reconstructs both the `keeps_transfer_history()` gate and the `TokenEvent` value. Drive already has `TokenTransitionAction::keeps_history()` and `TokenTransitionAction::associated_token_event()`, with the latter covering the resolved maker, fill amount, credits, order side, and order identifier. The new converter logic does not use either helper, leaving multiple authorities that can drift when marketplace fields or history policy change. Move the shared decision and event construction into a Drive-side action helper and have the converters append the resulting history operation.
- [SUGGESTION] packages/rs-drive/src/state_transition_action/action_convert_to_operations/batch/token/token_place_ask_transition.rs:78-96: Document the inert in-place edit to the shipped marketplace converter generation
  The new history operation is added to the existing v0 converter arm, and the same in-place edit is made to the other four marketplace converters. Those v0 arms are present in shipped platform tables, although the `is_allowed` stage rejects marketplace transitions before protocol 15, making the added writes unreachable on earlier protocol versions. The coding conventions require an explicit `In-place changes to shipped generations` section when retaining an inert in-place edit. Add that section to the PR description, naming the protocol-15 gate and explaining why earlier execution and replay cannot reach the new behavior, or introduce v1 converter generations selected only by the PV15 tables.

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:4136-4139: Exercise the PV15 migration with historical storage flags
  This assertion compares `None` with `None`: the fixture starts from a PV14 genesis state, whose system contracts have no storage flags. Consequently, removing the storage-flag preservation logic from `transition_to_version_15` would still leave this test passing. The existing detailed storage-ownership tests are intentionally pinned to PV14 and do not cover this new migration. Add a fixture that installs TokenHistory through the historical upgrade path, creates or retains a flagged contract with prior allocations, then upgrades to PV15 at a later epoch and verifies that ownership, prior allocations, existing history documents, and post-upgrade marketplace history writes survive.
- [NITPICK] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:911-914: Mention the token history upgrade in the PV15 migration comment
  The `transition_to_version_15` doc comment describes the DPNS and token marketplace changes but omits the token history contract's v3 upgrade, which is another state migration performed by the function. Update the comment so it documents all PV15 contract changes.

In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:1474-1501: Cover bid-side cancellation in marketplace history tests
  The new history tests cover ask placement, ask fill, ask cancellation, bid placement, and bid fill, but no bid cancellation. The bid cancellation path differs from ask cancellation because it releases the credit escrow and records the bid side. Add a bid-cancel case that asserts an `orderCancelled` document with side `1` owned by the buyer, and extend the no-history case to cover a bid path as well.

QuantumExplorer and others added 7 commits October 22, 2026 09:51
…story

The ten nullifier_batch_guard digests covering the state root are re-pinned for the merged genesis (token history v3 and the token market contract's decimals).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The token transition converter appends the marketplace history operation
  through one helper, token_history_operation, gated by keeps_history() and
  built from associated_token_event(); the five converters no longer
  rebuild the gate and the event. The operations and their order are
  unchanged.
- New migration test: a token history contract installed by the historical
  path with an owner and earlier allocations keeps them through the upgrades
  to 14 and 15, its legacy documents are untouched and a v3 document type
  can be written afterwards; it fails if transition_to_version_15 passes no
  flags.
- History tests cover an offer's cancel (side 1, owned by the buyer) and,
  for a token keeping no transfer history, the bid side and both cancels.
- transition_to_version_15's doc comment names the token history v3
  upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…story

The ten nullifier_batch_guard digests covering the state root are re-pinned for the merged genesis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…story

With the merge, a placement's proof covers a closed order too. For a token
keeping transfer history, the PlaceAsk and PlaceBid proofs hold the order's
document and the orderPlaced record the placement wrote (one merged path
query). While the order is open its document proves the placement, after
partial fills as well; once it has closed, the record does, verified
against the transition's terms. A closed order of a token keeping no
history is not taken as placed. Tests: a listing and an offer filled
entirely are proved by their record; a closed listing of a token without
history is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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

Verified the supplied findings and all six prior findings against b8b9df3. Two blockers remain: closed-order proofs do not bind minimum-fill and expiry terms, and the TokenHistory v3 activation breaks historical strategy-test expectations; one suggestion addresses missing historical pricing scale. This was static verification only: current CI reports successful checks but no native Rust test result, and no builds or tests were run locally.

🔴 2 blocking | 🟡 1 suggestion(s)

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: tenderdash-consensus-security); reviewer 7: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 9: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 10: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 12: gpt-6-astra (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) — The cross-cutting diff changes consensus-executed marketplace storage operations in TokenTransitionAction::into_high_level_batch_drive_operations, migrates the persisted history contract in transition_to_version_15, and modifies placement proof verification.
  • 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, gpt-6.1-sol — tenderdash-consensus-security (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — general (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — security-auditor (completed, effort xhigh); agent phase2-reviewer
  • Model comparison: every Phase-2 reviewer also ran on gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs`:
- [BLOCKING] packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs:1375-1381: Bind closed-order proofs to minimum fill and expiry
  When an order has closed, this fallback accepts its `orderPlaced` history document instead of checking the order document. However, `TokenEvent::OrderPlaced` records only the order ID, side, amount and price, and neither the order ID nor the history document ID commits to `min_fill` or `expires_at`. A genuine proof for an executed-and-closed placement therefore also verifies against a different placement with the same signer, token, nonce, amount and price but different minimum-fill or expiry terms. The live-order branch rejects those differences, but this fallback and the corresponding bid fallback accept them. Because `state_transition_proof_binds_execution` classifies both placements as `ExecutionProved`, strict SDK waits accept that incomplete evidence. Persist and compare the missing terms, or a commitment binding them, through the canonical DPP event, v3 schema and Drive verifier; otherwise reject history-only confirmation or downgrade its guarantee. Add negative ask- and bid-side proof tests that independently alter each term after full fills and cancellations.

In `packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs`:
- [BLOCKING] packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs:22: Pin the historical activation strategy fixtures to PV14
  Selecting TokenHistory v3 here invalidates both lifecycle tests in `packages/rs-drive-abci/tests/strategy_tests/test_cases/credit_pool_backfill_tests.rs`. Their shared `activation_lifecycle` still upgrades from PV13 to `PlatformVersion::latest()`—PV15—but the candidate-state assertion at lines 470–475 passes expected contract version 2. `assert_token_history` directly compares the stored contract version at line 184 and also contains v2-specific cache, version-item and allocation expectations. The upgrade now installs version 3, so those expectations no longer match. The full chain-simulation workflow includes these tests on push/nightly runs while excluding them from ordinary PR runs. Keep the production table at 3 and pin this historical fixture's upgrade target, proposal versions and lookup versions to PV14, or parameterize PV14/PV15 with matching expectations.

In `packages/token-history-contract/schema/v3/token-history-contract-documents.json`:
- [SUGGESTION] packages/token-history-contract/schema/v3/token-history-contract-documents.json:1046-1051: Preserve the order's pricing scale in durable marketplace history
  `TokenOrder` snapshots `decimals` because a conventions update can change the token's decimals while existing orders continue pricing fills at their original scale. The existing ask- and bid-side decimals-change tests exercise this behavior. The new history retains an amount in base units and a price per whole token, but not the scale connecting them; once the order closes, its document is deleted. A consumer using the current token configuration can therefore misinterpret historical quantities and prices, contrary to the goal of making marketplace activity usable without reconstructing former state. Preserve the order's original decimals in the canonical event and history schema, sourcing them from the resolved placement/order action rather than the current configuration at fill time. Extend the decimals-change scenarios to verify the retained history after closure.

- orderPlaced records every term of the placement: TokenEvent::OrderPlaced
  and the v3 orderPlaced type gain minFill, an optional expiresAt and the
  token's decimals at placement. A closed order's placement proof, through
  its record, now binds amount, price, minimum fill and expiry; decimals,
  not a term of the transition, is not compared.
- orderFilled records the decimals the order was placed at, taken from the
  order, so history keeps each order's price scale after a conventions
  update.
- The credit pool backfill activation strategy tests target protocol
  version 14 explicitly (they describe its upgrade and token history v2)
  instead of the latest version.
- Genesis at 15 stores the larger contract: the ten nullifier_batch_guard
  digests are re-pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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

Static verification confirms one blocking regression: DPP's default state-transitions configuration loses the trait import required by the new decimals() calls. The prior proof-binding, pricing-scale, fixture, migration-coverage and shared-history-policy issues are addressed; the shipped-generation premise and blanket history-proof requirement are withdrawn. Current PR checks, including Kotlin build/tests, pass, but no Rust build/test result is listed; no local builds or tests were run.

🔴 1 blocking

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: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); 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); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The intricate cross-crate change modifies consensus state writes in TokenTransitionAction::into_high_level_batch_drive_operations, migrates the persisted token history contract in transition_to_version_15, and changes execution-proof verification.
  • 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 — ffi-engineer (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/batched_transition/token_transition.rs`:
- [BLOCKING] packages/rs-dpp/src/state_transition/state_transitions/document/batch_transition/batched_transition/token_transition.rs:2-4: Keep the decimals accessor available without serde conversion
  The existing serde-conversion attribute now guards TokenConfigurationConventionV0Getters rather than the serde import. associated_token_event is unconditional, and its four new marketplace decimals() calls require this trait; TokenConfigurationConvention has no inherent decimals() method. DPP defaults to state-transitions without serde-conversion, so that supported configuration now fails method resolution. Builds whose dependency graph enables serde-conversion mask the failure. Import the accessor unconditionally and restore the attribute to the serde import; validate the standalone default/non-serde state-transitions configuration as well as feature-unified consumers.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Complete token proof-result marshalling in the raw WASM verifier — packages/wasm-drive-verify/src/state_transition/verify_state_transition_was_executed_with_proof.rs maps VerifiedTokenActionWithDocument to a successful object with type "Unknown", discarding the verified document. The identical fallback exists on the base revision and already affects history-bearing token operations; this PR introduces no new result variant. The separate wasm-dpp2 converter preserves this payload correctly.
    • Follow-up: Track a separate binding-parity fix that preserves token proof-result payloads in wasm-drive-verify and adds JavaScript boundary tests.

QuantumExplorer and others added 2 commits October 22, 2026 16:09
…story

Listings and offers now sign their decimals: the expected orderPlaced record takes them from the transition and the closed-order proof compares them with every other term (no field ignored). The dpp accessor import is unconditional again, with the serde-conversion attribute back on the serde import, so dpp builds with its default features.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 complete diff at 9dcda6a has no confirmed blocking defects; eight prior findings are fixed and two are withdrawn after source verification. One non-blocking suggestion remains: exercise closed-order proof verification with the refreshed contract in the new decimals-change regression. Validation was static only; current CI checks have passed except for the queued Kotlin SDK build/tests, and no completed Rust test result was available.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-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: ffi-engineer); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: 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 large, intricate change that modifies consensus-critical token marketplace execution and proof verification while introducing a protocol-versioned token-history storage migration.
  • 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 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 — ffi-engineer (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 — ffi-engineer (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:2579-2582: Verify the decimals-change proof with a refreshed contract
  `market.set_decimals(2)` executes the configuration update but does not refresh `market.contract`. Both proof-verification helpers construct their contract lookup from `self.contract.clone()`, so this assertion supplies the original 8-decimal configuration even though the prover reads updated state. The history assertions correctly check retention of the original scale, but the proof assertion would miss a regression that rejects an old placement when the client's contract provider has refreshed to 2 decimals. Fetch the updated contract before verification, explicitly assert its decimals are 2, and verify the closed placement against it; retaining verification against both snapshots would cover both client states.

QuantumExplorer and others added 2 commits October 22, 2026 17:27
…story

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ore and after a decimals change

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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

Static verification found one in-scope blocking proof-soundness defect in the new closed-order placement fallback. When a placement carries group metadata, the fallback can accept an absent order and absent history record based only on unrelated group-action participation, while the classifier still reports ExecutionProved; the queued CI checks do not change this source-level finding.

🔴 1 blocking

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: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: 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 large cross-cutting change that modifies protocol-versioned consensus behavior, persisted contract storage migration, token-history writes, and state-transition proof verification.
  • 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 — ffi-engineer (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs`:
- [BLOCKING] packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs:1375-1381: Require an actual placement record in the closed-order fallback
  The closed ask fallback calls `historical_query(true)` after proving that the order document is absent, and the bid fallback does the same at lines 1444-1450. However, `historical_query` permits an absent history document whenever `using_group_info()` is present: lines 743-765 verify the signer's participation in an active group action and return `VerifiedTokenGroupActionWithDocument(sum_power, document)` even when `document` is `None`. The execution classifier then treats every `PlaceAsk` and `PlaceBid` as `ExecutionProved` at lines 3385-3387, regardless of whether the returned placement record exists. Because the proof-verification entry point only deserializes the untrusted requested transition and does not run node-side validation, a caller can add group metadata referring to an unrelated active mint/burn action they signed. A genuine state proof showing the order and `orderPlaced` record absent, the unrelated group participation present, and the relevant balance can then be accepted as execution confirmation for a placement that never escrowed anything. Reject group metadata for marketplace placements in this verifier, or require a present, matching `orderPlaced` record in both history-only fallbacks before returning success; add negative ask- and bid-side cases with unrelated active group metadata and both placement records absent.

QuantumExplorer and others added 2 commits October 22, 2026 18:22
A placement is never a group action (the node refuses group information on
it), but the proof verifier deserializes the requested transition without
that validation. With group information, the closed-order fallback went
through the group-aware history check, which accepts a missing record when
the signer took part in an active group action, so an unrelated group
action could stand in for the placement's record. The PlaceAsk and PlaceBid
arms now refuse group information first; the closed-order fallback then
requires the orderPlaced record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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

Reviewed the complete 24-file diff at 56b8faf and found no substantiated blocking defects; all 25 prior findings were independently reconciled as 20 fixed, four withdrawn, and one outdated. One nonblocking suggestion remains: the high-decimal regression does not validate the stored records against their schemas. This was static review only; current CI checks are green, but the check listing provides no dedicated Rust build or test results.

🟡 1 suggestion(s)

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: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 9: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 15: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 16: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The substantial diff changes consensus-executed marketplace history operations, persisted contract migration in transition_to_version_15, and placement proof acceptance in verify_state_transition_was_executed_with_proof/v0/mod.rs.
  • 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 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 — ffi-engineer (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 — tenderdash-consensus-security (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 — ffi-engineer (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 — tenderdash-consensus-security (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3354-3358: Validate high-decimal history records against the v3 schemas
  This regression checks that placement and fill records retain 200 decimals, but it does not exercise the schema bounds that must admit those records. `add_token_transaction_history_operations_v0` constructs and inserts history documents without calling schema validation, so reverting either new schema's decimals maximum to 16 would leave this test passing. Load the v3 TokenHistory contract, validate both retrieved documents through DPP's `validate_document`, and assert that each returned consensus validation result is valid. That protects compatibility between the independently maintained event builder and schemas, rather than only storage round-tripping.

QuantumExplorer and others added 2 commits October 31, 2026 15:33
…market-history

The closing mint group's settled digest is re-measured with the estimate that
keeps every layer description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3 schemas

The 200-decimals regression checked the records' stored decimals but not that
the token history contract's v3 schemas admit them; the history writes records
without schema validation, so a schema bound reverted to 16 would have passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 reviewed head implements the PV15 marketplace-history feature consistently, and the prior findings are addressed or no longer applicable. One in-scope test-coverage suggestion remains: the direct PV13-to-PV15 storage-flags case uses PlatformVersion::latest(), so a future protocol release would silently retarget a test with PV15-specific expectations. No blocking defects or failed code checks were identified; Kotlin SDK and one policy check were still in progress in the supplied CI snapshot.

🟡 1 suggestion(s)

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: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); 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); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: 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) — The intricate cross-crate change modifies persisted consensus state through transition_to_version_15 in packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs, adds marketplace history writes, and changes placement-proof verification.
  • 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 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 — ffi-engineer (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 — ffi-engineer (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. Verify each finding against the current code and only fix it if needed.

In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/token_history_storage_flags_tests.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/token_history_storage_flags_tests.rs:364-366: Pin the PV15 storage-flags case to PV15 instead of latest()
  This matrix is intended to test the direct PV13-to-PV15 migration, but the second case selects PlatformVersion::latest(). The assertions use PV15-specific expectations—TokenHistory version 3 and exact growth/allocation byte counts—so adding PV16 will retarget this case to PV16 and either make it fail for unrelated reasons or stop testing the migration it names. Pin the tuple to PlatformVersion::get(15), as the existing pv14() helper pins the historical case.

QuantumExplorer and others added 2 commits October 31, 2026 16:14
… to 15

Its expectations (token history v3, the growth and allocation bytes) are
protocol version 15's; latest() would retarget it once a later version lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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

Static verification of the complete diff at 75ead63 found no remaining actionable findings; all 27 prior findings were independently reconciled. PV15 activation, centralized history construction, storage-ownership preservation, and placement-proof verification are consistent with the source and project ownership rules. Current reported checks pass, including Kotlin SDK tests; no builds or tests were run locally, and the reported checks do not establish Rust regression-suite results.

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

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: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 9: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 15: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 16: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This intricate change modifies consensus-executed history writes, placement-proof verification in rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs, and persisted-contract migration in transition_to_version_15.
  • 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 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 — ffi-engineer (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 — tenderdash-consensus-security (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 — ffi-engineer (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 — tenderdash-consensus-security (completed, effort xhigh); 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.

Brings the move to protocol version 16. Token history v3 moves from
SYSTEM_DATA_CONTRACT_VERSIONS_V4 (protocol version 15, released) to
SYSTEM_DATA_CONTRACT_VERSIONS_V5 (16), and its upgrade step from
transition_to_version_15 to transition_to_version_16; the history note
becomes v16 note 5. PV15 keeps token history v2.

Pins at the latest version: burn 4_405_020 and direct purchase
699_867_910_100 (+180 and -91_100 against v5.2-dev for the three history
types at genesis), the 13 -> 16 token history growth 14_436 (allocations
14_488 / 14_441), the PV15 row 8_006 (v2, compiled), and the shielded
nullifier_batch_guard settled digests (validation digests unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer changed the title feat(platform)!: record token marketplace events in token history (PV15) feat(platform)!: record token marketplace events in token history (PV16) 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

Changes requested: 1 blocker

  • A bid proof can confirm an offer whose signed limit would have forbidden the escrow — packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs:1514-1548 (new)
    Impact: A client verifying a bid can receive ExecutionProved for an offer whose original escrow exceeded the buyer-signed max_total_price, even though consensus would have refused that placement.

New on this head: This head retargets marketplace history and token marketplace activation from protocol version 15 to 16, updates the migration tests and version tables, and merges the buyer-signed escrow limit for bids. Book and migration documentation still contain stale protocol-15 references, while the Kotlin SDK build and review check remain in progress; no completed code check is failing.

🔴 1 blocking | 🟡 3 suggestion(s)

Still open from earlier rounds (1)

  • 🟡 Suggestion: Document the in-place edit to the protocol-upgrade v0 generation — packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:1058-1063 (thread)
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: The marketplace history guide still says PV15 installs history v3
Impact: Integrators following the History section may query orderPlaced, orderFilled, or orderCancelled on PV15, where TokenHistory is still v2.
book/src/data-model/token-marketplace.md:266-269

The opening History paragraph correctly says marketplace events begin at protocol version 16, but the final paragraph still says that the upgrade to 15 and a chain born at 15 install v3. Change both references to 16 so the guide agrees with PLATFORM_V15 selecting v2 and PLATFORM_V16 selecting v3.

source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, platform-versioning, rust-quality, security-auditor)

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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); 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) — This is a large, intricate change that modifies consensus-critical token transition execution, persisted token-history storage migrations, and state-transition proof verification across protocol version 15.
  • 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)
  • New since the last final review (75ead63f): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed; 1 suggestion(s) on unchanged code listed as follow-up candidates
  • 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-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs`:
- [BLOCKING] packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs:1514-1548: A bid proof can confirm an offer whose signed limit would have forbidden the escrow
  Impact: A client verifying a bid can receive `ExecutionProved` for an offer whose original escrow exceeded the buyer-signed `max_total_price`, even though consensus would have refused that placement.
  The proof verifier accepts both open and closed bid placements without checking the newly signed escrow ceiling. The placement transformer rejects a `TokenPlaceBid` when `TokenOrder::order_value(amount, price, placement_decimals)` exceeds `max_total_price`, but the open branch only checks the persisted order's terms and escrow invariant, while the closed history branch authenticates an `orderPlaced` record that does not contain the limit. Because the order and history identifiers omit `max_total_price`, a genuine proof for a bid with the same buyer, nonce, amount, and price but a higher limit also verifies against a lower-capped transition; a malicious proof responder can therefore make strict client confirmation report execution for a request the node would have rejected. Recompute the original escrow from the authenticated order or history decimals and reject it when it exceeds the requested bid's limit in both branches, or persist and compare a commitment to the signed limit.

  _Raised on code unchanged since the last review, and confirmed by an independent pass: A client calling the public state-transition proof verifier with a TokenPlaceBid whose signed max_total_price is below the authenticated order's original escrow can receive an execution-proved result from a proof for an otherwise identical bid with a higher limit. The open-order branch checks only the order terms and escrow-after-fills invariant, while the closed-order history branch authenticates an orderPlaced record whose decimals are ignored and which has no limit; neither compares max_total_price, even though the placement transformer rejects that transition with TokenOrderPriceLimitError. This lets an untrusted proof responder make strict confirmation report execution for a bid the node would reject._

In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/token_history_storage_flags_tests.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/token_history_storage_flags_tests.rs:377: The PV16 storage-flags case retargets itself when another protocol version is added
  Impact: Adding PV17 will make the tuple use PV17 while retaining PV16-specific contract and allocation byte expectations, so the test can fail for unrelated reasons or stop testing the migration it names.
  The third matrix row is intended to characterize the PV16 direct upgrade, but it uses `PlatformVersion::latest()`. Pin this row to `PlatformVersion::get(16)` and add a `pv16()` helper, as the historical PV14 and PV15 cases are pinned, so later protocol versions cannot silently change the behavior under test.

In `CHANGELOG.md`:
- [SUGGESTION] CHANGELOG.md:952-971: Record the breaking TokenEvent API change in the Unreleased changelog
  Impact: SDK consumers looking under Unreleased miss the marketplace event migration, while the historical 5.1.0-dev.1 notes incorrectly attribute the PV16 change to that release.
  The TokenEvent API and TokenHistory v3 entries are currently under `5.1.0-dev.1` rather than the active `## [Unreleased]` section. Move both existing bullets into Unreleased without changing their PV16 wording.

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:1058-1063: Document the in-place edit to the protocol-upgrade v0 generation
  (carried; thread: https://github.com/dashpay/platform/pull/5531#discussion_r4412845442)

Comment thread CHANGELOG.md Resolved
QuantumExplorer and others added 2 commits December 2, 2026 05:29
Brings the new bincode tag of the tradeable mode with a minimum fill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#6433 took v16 note 3: the history note is v16 note 6. Brings the offer
proof's signed limit check, which the open-offer branch of this PR's
restructured verifier now applies too.

Review round of 2026-12-01 on #5531:
- A closed offer, proved by its orderPlaced record, is refused when the
  escrow at the record's decimals passes the transition's
  max_total_price (should_not_prove_a_closed_offer_whose_signed_limit_
  is_below_its_escrow).
- The token history storage flags row of the direct upgrade is pinned
  to protocol version 16 (pv16()), not latest().
- The TokenEvent and token history v3 CHANGELOG entries move under
  Unreleased.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 adds the bid escrow-limit proof fix to both open and closed offer verification, pins the PV16 migration coverage, and moves the marketplace changelog entries to Unreleased. Static review found no blocking defects; policy, title, book, and contract checks pass, while the Kotlin SDK and PastaClaw review checks remain in progress.

🟡 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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); 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) — This is a large, intricate change to consensus-critical state-transition validation, token-history storage migration, and proof verification, including protocol-versioned persisted schemas and marketplace fund-related events.
  • 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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3322-3331: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
  Impact: A regression that uses the client's refreshed token configuration instead of the authenticated placement record would pass this test, allowing a closed bid's escrow-limit proof to be checked at the wrong decimal scale.
  The boundary assertions are valid, but both the `orderPlaced` record and `market.contract` currently use eight decimals, so reading either source produces the same 10,000-credit escrow. Change this fixture to use owner-controlled conventions, close the bid, update the token to a different scale such as nine decimals, refresh the contract, and retain the 10,000/9,999 assertions; with the wrong source, the current configuration would price the order at 1,000 and the 9,999 case would incorrectly pass.

Comment on lines +3322 to +3331
let contract = market.contract.clone();
assert_matches!(
market.verify_proof_of_as(&place, &with_limit(10_000), &contract),
Ok(StateTransitionProofResult::VerifiedTokenActionWithDocument(
_
))
);
assert_matches!(
market.verify_proof_of_as(&place, &with_limit(9_999), &contract),
Err(DriveError::Proof(ProofError::UnexpectedResultProof(_)))

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.

🟡 Suggestion: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
Impact: A regression that uses the client's refreshed token configuration instead of the authenticated placement record would pass this test, allowing a closed bid's escrow-limit proof to be checked at the wrong decimal scale.

The boundary assertions are valid, but both the orderPlaced record and market.contract currently use eight decimals, so reading either source produces the same 10,000-credit escrow. Change this fixture to use owner-controlled conventions, close the bid, update the token to a different scale such as nine decimals, refresh the contract, and retain the 10,000/9,999 assertions; with the wrong source, the current configuration would price the order at 1,000 and the 9,999 case would incorrectly pass.

source: gpt-6.2-astra (phase2-reviewer: general)

Comment thread CHANGELOG.md Resolved

@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.

CI failed after approval — commit 7598bf8

The standing review approved this commit; this follow-up moves the verdict to COMMENT: checks that failed after the review may relate to this change, and the evidence does not rule it out.

Failing checks:

Why it is unclear: The log only shows a Gradle task failure and exit code 1, without the underlying assertion, compilation error, or failing file. Although the PR changes Platform Rust and token-history code rather than Kotlin SDK files, the available evidence is insufficient to determine whether affected behavior or generated interfaces caused the failure.

Nothing was re-reviewed: the findings of the standing review are unchanged. The next push gets a full review; a re-run that passes does not restore the approval.

Review provenance

Source: CI-check lane gpt-6.2-sol (agent: triage); no reviewer or verifier lanes ran for this follow-up

  • Verdict moved because CI failed on this commit after the review; failure logs read: 1 GitHub Actions job(s)

…orm into claude/token-market-history

# Conflicts:
#	packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs

@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 merges the offers branch’s AffectedState classification for bid placement proofs into the PV16 marketplace history work and picks up the Swift trade-mode payload fix. GitHub reports that the Kotlin SDK build and tests and the book preview passed; only the review check is pending.

🟡 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.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals — packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3335 (thread)
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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); 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) — This is a large, intricate change to consensus-critical token marketplace execution, token-history storage migration, and proof verification, including protocol-versioned persisted state and funds-related transitions.
  • 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)
  • New since the last final review (7598bf8e): 1 follow-up candidate(s) already listed by an earlier review, not repeated
  • 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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3335: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
  (carried; thread: https://github.com/dashpay/platform/pull/5531#discussion_r4762601366)

@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 update brings in the latest offers-base changes and renumbers the PV16 TokenHistory v3 note and its references from 6 to 7, without changing the history implementation. The Kotlin SDK emulator build and tests passed; no reported checks failed, and PastaClaw review was the only pending check.

🟡 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.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals — packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3336 (thread)
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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); 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) — This is a large, intricate change to consensus-critical token transition execution, proof verification, and a persisted token-history contract storage migration across protocol versions.
  • 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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3336: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
  (carried; thread: https://github.com/dashpay/platform/pull/5531#discussion_r4762601366)

@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 retains the token marketplace history implementation and incorporates the latest v5.2 base-branch merges. CI has no failed code checks; the Kotlin SDK build and PastaClaw review are still in progress, while the completed checks pass.

🟡 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.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals — packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3308-3336 (thread)
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-astra (agent: phase2-reviewer, role: general); 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); reviewer 9: gpt-6.2-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The PV16 upgrade in perform_events_on_first_block_of_protocol_change/v0/mod.rs migrates persisted contract state, while action_convert_to_operations/batch/token/token_transition.rs changes consensus-executed writes and fees across five marketplace transitions.
  • 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, gpt-6.2-astra — tenderdash-consensus-security (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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3308-3336: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
  (carried; thread: https://github.com/dashpay/platform/pull/5531#discussion_r4762601366)
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • The new document-definition error shifts existing token-order error discriminants — The current base branch contains InvalidDocumentTypeDefinitionError before the three token-order errors, shifting their positional serialized discriminants. This violates the append-only consensus-error convention, but the file is unchanged in the PR diff: the insertion comes from the base branch’s merged feat(dpp): check a document type's typed definition natively at registration (#6472) commit rather than this marketplace-history change.
    • Follow-up: Fix the error ordering in the branch carrying #6472 by appending InvalidDocumentTypeDefinitionError after the existing BasicError tail and preserving the token-order discriminants.

@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 merges the updated offers branch, including v5.2-dev’s typed contract registration and proof changes, without changing the PV16 marketplace history writes or placement-proof branches. The Kotlin x86_64 emulator build and tests and the book preview passed; no code check showed a failure, and the review check was still pending.

🟡 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.

Still open from earlier rounds (1)

  • 🟡 Suggestion: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals — packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3335 (thread)
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-astra (agent: phase2-reviewer, role: general); 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); reviewer 9: gpt-6.2-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The PV16 first-block migration in transition_to_version_16 changes the persisted token-history contract, while action_convert_to_operations/batch/token/token_transition.rs adds consensus-executed history writes across five marketplace transitions.
  • 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, gpt-6.2-astra — tenderdash-consensus-security (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-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/marketplace/mod.rs:3326-3335: The closed-bid limit test passes even if the verifier prices escrow at today’s decimals
  (carried; thread: https://github.com/dashpay/platform/pull/5531#discussion_r4762601366)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants