Skip to content

feat(platform)!: token marketplace listings (PV16) - #5529

Open
QuantumExplorer wants to merge 244 commits into
v5.2-devfrom
claude/token-market-listings
Open

QuantumExplorer wants to merge 244 commits into
v5.2-devfrom
claude/token-market-listings

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: Lets holders of a tradeable token sell it to each other on Platform. A seller lists an amount at a price (TokenPlaceAsk): the tokens leave their balance and wait in escrow. A buyer takes part or all of the listing (TokenFillAsk): the tokens go to the buyer and the credits go to the seller in the same block, so neither side has to trust the other. The seller can withdraw what is left at any time (TokenCancelOrder).

Value: A token can now have a real secondary market without an off-chain exchange or a trusted middleman. Order books are readable with the document queries and proofs every SDK already has, because each listing is an ask document of the token market contract.

Risks: Medium. Three new token transitions from protocol version 16 (the 5.2 line). Before 16 each is refused unpaid at the batch's is_allowed gate, as software that cannot decode them refuses them, so protocol version 15 (the released 5.1 line) and earlier do not change. From 16 the tests check that token supply stays balanced through listings, partial fills, sell-outs and cancels, and that a fill can never move more than the listing holds or cost the buyer more than their limit.

Issue being fixed or feature implemented

The third PR of the token marketplace stack, now on v5.2-dev and gated at protocol version 16. The marketplace moved from 5.1 to 5.2 on 2026-11-13, and #6253 created protocol version 16 with the marketplace's state (v16 note 1: the escrow trees, the token market contract v1, TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION = 16 and transition_to_version_16). This PR merged v5.2-dev and moved its listings note from v15 note 34 to v16 note 5 (#6433 took v16 note 3, #6354 ML-DSA-65 keys note 4); v15.rs is exactly v5.2-dev's. This one adds the sell side: listings. Offers (bids) come next.

What was done?

Transitions (TokenTransition variants 18 to 20, appended)

Transition Fields Effect
TokenPlaceAsk amount, price Seller balance to escrow, ask document created
TokenFillAsk orderId, minAmount, maxAmount, maxTotalPrice Escrow to buyer, buyer credits to seller, ask rewritten or deleted
TokenCancelOrder orderId, side Escrow back to the owner, order deleted

price is credits per whole token. The order id is derived from the token, the seller and the nonce, so a client knows it before placing.

The minimum fill and the decimals are the token's. A listing signs neither:

Before: TokenPlaceAsk { amount, price, decimals, minFill }
After:  TokenPlaceAsk { amount, price }
        marketplaceRules.tradeMode: { "Tradeable": { "minFill": 100 } }   (was "Tradeable")
Before: a holder cannot sell a token to another holder on Platform without trusting them.

After, a listing of 1,000 base units at 10 credits each, of a token whose minimum fill is 100:
  place                         seller 100,000 -> 99,000 tokens, 1,000 in escrow
  fill max 400, limit 4,000     buyer +400 tokens, -4,000 credits plus fee; seller +4,000 credits
  fill max 10,000               takes the 600 left; the listing closes and the seller
                                gets its storage back
On a fresh listing:
  fill min 950, max 950         refused: 950 would leave 50 open, under the minimum fill,
                                so the fill would take 900, under the buyer's 950

Rounding: each fill pays the change in the listing's running total, rounded up, so splitting never changes the total:

1.5 credits per base unit, two fills of 3:  5 + 4 = 9 = 6 x 1.5

Validation

  • Structure (dpp): amount and price in 1..=i64::MAX; a fill needs 1 <= min <= max <= i64::MAX. One function, validate_token_order_terms, checks a new order's terms, so an offer shares it; validate_token_order_terms_for_token checks what it needs of the token (below). New basic errors InvalidTokenOrderPriceError (10462), InvalidTokenOrderFillRangeError (10463) and InvalidTokenOrderValueError (10465); 10464 is unused (orders have no expiry).
  • Transformer (drive): reads the order document; not found, wrong token, self fill, fill range, price limit and not owned each bump the nonce with their error. A listing reads the token's configuration through token_configuration_or_position_error, so a listing of a token its contract does not define bumps the nonce with ContractHasNoTokensError or InvalidTokenPositionError instead of failing as an internal error, and a fill checks the same before reading the listing; the token base structure validation now reads the same helper.
  • Decimals: a listing records the token's decimals when it is placed (ask.decimals, from feat(platform)!: token marketplace escrow trees and token market contract (PV15) #5526) and every fill prices it at them, so an authorized conventions update cannot reprice an open listing. A fill reads the token's minimum fill, not its decimals.
  • Advanced structure (drive-abci, batch advanced_structure 2 from feat(platform)!: tradeable tokens (PV15) #5524, per-action structure validations 0): the rules that read nothing beyond the contract and the block run here, so check_tx refuses them too. A listing needs a tradeable token, an amount of at least the token's minimum fill (10463) and a worth of at most i64::MAX credits at the token's decimals (10465), all paid; a fill a token that is still tradeable.
  • State (drive-abci): not paused, seller not frozen, seller holds the amount; for a fill also the buyer not frozen unless the token allows transfers to frozen balances. A cancel needs nothing beyond ownership, so an order can always be withdrawn.
  • New state errors 40750 to 40756: TokenNotTradeableError (40750), TokenOrderNotFoundError (40751), TokenOrderFillAmountError (40753), TokenOrderPriceLimitError (40754), TokenOrderNotOwnedError (40755), TokenOrderSelfFillError (40756). 40752 is unused (orders have no expiry), and so is 40757 (the value limit is a structure check).
  • State error 40758 TokenOrderDecimalsMismatchError is defined but unused: orders name no decimals. The placement proof reads the decimals the order recorded.
  • The fill's cost counts in the batch's used balances, like a direct purchase, so fee validation checks the buyer can pay.
  • Group actions are refused for the three kinds (they have no action id).

Execution (drive): two new token ops, TokenPlaceInOrderEscrow and TokenReleaseFromOrderEscrow, over the escrow primitives of #5526; the ask document carries the seller's storage flags.

Gate: TokenTransition::is_marketplace_order(), an exhaustive classifier, drives the is_allowed refusal below TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION (16), so an order kind added later is gated without being listed.

Proofs: TokenPlaceAsk proves the ask document and checks its terms. The order id follows from the token, the signer and the nonce, so only this transition creates a document with it: one holding its terms proves the placement after partial fills too, with remaining from the amount down to 1, so a client asking for the proof after a fill still confirms it (a listing filled entirely is proved through its history record from #5531); TokenFillAsk the buyer's token balance; TokenCancelOrder the order's absence. Drive's verify feature now enables dpp/token-market-contract, so a verify-only build (wasm-drive-verify) has the contract the order proofs read: cargo tree -p wasm-drive-verify -e normal,features -i data-contracts lists data-contracts feature "token-market" with the change and not without it.

Events: TokenEvent::OrderPlaced, OrderFilled, OrderCancelled (appended, with JSON shapes). History documents come in a later PR, so these transitions do not write token history yet.

Bindings: wasm-dpp2 TokenPlaceAskTransition, TokenFillAskTransition, TokenCancelOrderTransition and the three event variants (every integer setter takes a BigInt through try_to_u64 and leaves the transition unchanged when it is out of range); wasm-dpp reports the kinds and points to wasm-dpp2; the platform wallet's signing summary shows each.

Docs: book data-model/token-marketplace.md (listings, rounding, rules, storage, proofs) and v16 note 5.

Consensus errors follow v5.2-dev's: BasicError discriminants 217 to 219 (#6354 took 214, #6472 took 215, #6476 took 216), StateError 190 to 196 (after the emergency switch errors, 183 to 189). Codes are unchanged.

Wallet FFI: v5.2-dev's platform_wallet token config update decodes the trade mode from JSON; its payload for a tradeable token is now {"tradeMode":{"Tradeable":{"minFill":<u64>}}} (doc and tests updated; the bare "Tradeable" is refused). Swift's TokenConfigChange.marketplaceTradeMode takes TokenTradeModeChange (.notTradeable / .tradeable(minFill:)) and sends that form; the example app's trade mode form asks for the minimum fill. The Kotlin KDoc and the JNI doc show the tagged form.

How Has This Been Tested?

  • Review round of 2026-12-01: TokenTradeMode::Tradeable { min_fill } moved to bincode tag 2 and the fieldless 5.1 form kept tag 1 as TradeableWithoutMinFill (e09a43b): should_keep_the_bincode_tags_of_the_trade_modes, should_decode_the_fieldless_tradeable_of_protocol_version_15_at_its_tag, should_never_admit_the_fieldless_tradeable_mode; cargo test -p dpp --lib -- trade_mode marketplace_rules tradeable (30), cargo test -p drive-abci --lib -- is_allowed marketplace_gate trade_mode contract_structure_error (58).

  • Review round of 2026-12-02 (review 6142134991): Swift could not enable trading, since the wallet FFI refuses the bare "Tradeable" (ee91144). TokenConfigChange.marketplaceTradeMode now carries TokenTradeModeChange and sends {"tradeMode":{"Tradeable":{"minFill":n}}}; the persisted TokenTradeMode is unchanged. TokenConfigUpdateDecodingTests covers 1000, UInt64.max and NotTradeable; the SDK, that test and the example app typecheck against this branch's headers (XCTests not run, no xcframework here). The Kotlin and JNI docs show the tagged form, and the book's activation row says 5.1 refuses a minFill payload while decoding, not with 10603.

  • v5.2-dev merge of 2026-12-02 (feat(platform)!: add ML-DSA-65 identity keys (PV16) #6354 ML-DSA-65 keys, refactor: remove DPP raw secp256k1 dependency #5519): feat(platform)!: add ML-DSA-65 identity keys (PV16) #6354 took v16 note 4 and BasicError 214, so listings is note 5 and its errors 215 to 217 (offers, history and frozen listings are notes 6, 7 and 8 up the stack). v5.2-dev's drive-abci tests did not compile (feat(platform)!: add ML-DSA-65 identity keys (PV16) #6354's new hash key data test used the secp256k1 Keypair refactor: remove DPP raw secp256k1 dependency #5519 removed); fixed here the way refactor: remove DPP raw secp256k1 dependency #5519 fixed the rest of that module (2e6590f); v5.2-dev then fixed it the same way in fix(drive-abci): build an identity update test's ECDSA key without the removed secp256k1 path #6459, whose version this branch now carries, so the PR no longer changes that file.

  • v5.2-dev merge of 2026-12-03 (feat(dpp): check a document type's typed definition natively at registration #6472 typed document type definition checks, 50a24e7): feat(dpp): check a document type's typed definition natively at registration #6472 took BasicError 215 (InvalidDocumentTypeDefinitionError, code 10284), so the listing errors moved to 216 to 218 (InvalidTokenOrderPriceError, InvalidTokenOrderFillRangeError, InvalidTokenOrderValueError); their codes (10462, 10463, 10465) and the v16 notes are unchanged. cargo test -p dpp --lib errors::consensus (9), cargo test -p drive-abci --lib marketplace (39), cargo check -p wasm-dpp.

  • v5.2-dev merge of 2026-12-03 (feat(platform)!: contract transitions carry typed definitions from protocol version 16 #6476 contract transitions carry typed definitions, f148a7b): feat(platform)!: contract transitions carry typed definitions from protocol version 16 #6476 took BasicError 216 (DataContractMaxSerializedSizeExceededError, code 10285), so the listing errors moved to 217 to 219; their codes and the v16 notes are unchanged (feat(platform)!: contract transitions carry typed definitions from protocol version 16 #6476 extended note 3). cargo test -p dpp --lib -- errors::consensus trade_mode marketplace_rules (38), cargo test -p drive-abci --lib -- marketplace contract_structure_error trade_mode (85), cargo check -p wasm-dpp.

  • After the move to protocol version 16 (merge of v5.2-dev): cargo test -p drive-abci --lib -- marketplace is_allowed contract_structure_error trade_mode token_market (92 passed), cargo test -p drive --lib -- order_escrow estimat token_order (165), cargo test -p dpp --lib -- token discriminant marketplace (1,104), cargo test -p platform-wallet-ffi --lib -- marketplace_trade_mode (3).

  • cargo test -p drive-abci --lib -- batch::tests::token::marketplace (16 tests at the time, then PV15 blocks, now the latest version):

    • listing moves tokens into escrow, the ask holds the terms, the proof verifies;
    • partial fill then sell-out: exact seller credits, buyer pays price plus fee, escrow and document follow, supply balanced, fill proof verifies;
    • running-total rounding across two fills;
    • cancel after a partial fill returns the rest, the absence proof verifies;
    • refusals: not tradeable (check_tx too), more than held, value too large (unpaid, check_tx too), self fill, price limit, min fill, not found, not owner, paused (cancel still works), buyer cannot pay.
  • cargo test -p drive-abci --lib -- token_marketplace_gate: each order kind refused at 14 and 15 under its name, allowed from 16.

  • Review round 2, in batch::tests::token::marketplace:

    • placement, a partial fill, a conventions update from 8 decimals to 2 and a second fill: the second fill costs 1,000 credits at the listing's 8 decimals (at 2 it would cost 1,000,000,000 and the buyer's limit would refuse it); a listing placed after the update records 2;
    • a listing of position 1 of a one-token contract and of DPNS (no tokens) is refused by check_tx and in a block, paid, with InvalidTokenPositionError and ContractHasNoTokensError;
    • a fill naming position 1 is refused the same way, before the listing is read;
    • a buyer short of the fee and a buyer short of the price are each refused with exactly one UnpaidConsensusError(IdentityInsufficientBalanceError), with their credits, nonce, token balance and the listing unchanged.
  • yarn workspace @dashevo/wasm-dpp2 exec mocha tests/unit/TokensTransitions.spec.ts (81 passing): each listing setter sets a value in range and throws on 2^64 and -1, keeping the previous value.

  • cargo test -p drive-abci --lib -- batch::tests::token (regressions in the existing token tests). Round 2: batch::tests::token --skip shielded (264 passed), batch::tests::token::marketplace (20).

  • cargo test -p dpp --features all_features --lib -- token_order consensus::codes state_error basic_error token_event marketplace_rules.

  • cargo test -p drive --lib -- state_transition_action::batch order_escrow verify::state_transition.

  • cargo test -p wasm-dpp2 --lib -- token_event (documented event fields match the serializer).

  • cargo clippy on dpp, drive, drive-abci, wasm-dpp, wasm-dpp2, platform-wallet, platform-version.

  • Review round 2, in batch::tests::token::marketplace:

    • should_refuse_a_listing_signed_at_other_decimals: a holder other than the conventions controller signs a listing at 8 decimals, the contract owner changes the token to 16, and the original listing is refused by check_tx and in a block with TokenOrderDecimalsMismatchError (40758), nothing escrowed; without the check it would execute;
    • should_refuse_filling_a_frozen_makers_listing_and_let_the_maker_cancel: a fill of a frozen maker's listing is refused with the maker's IdentityTokenAccountFrozenError, balances and escrow unchanged, and the frozen maker cancels and gets the escrow back;
    • should_refuse_a_frozen_buyers_fill_unless_the_token_allows_transfers_to_frozen_balances: refused with the buyer's IdentityTokenAccountFrozenError when the token disallows it, executed into the frozen balance when it allows it;
    • after a sell-out the placement proof fails with exactly ProofError::IncorrectProof;
    • wasm-dpp2 specs: decimals is required, settable within a byte, and refused outside it.
  • Review round 4 (the decimals part superseded in round 5): the wallet's listing row names the signed decimals (two listings differing only in them render differently); a listing of two whole tokens at i64::MAX credits at 0 decimals is refused unpaid with InvalidTokenOrderValueError (10465) by check_tx and in a block (dpp unit test at the boundary too); every marketplace proof round trip compares its root with the committed Drive root; a fill whose rounded running total does not change (0.5 credits per base unit, the second of three units) pays 0 credits, takes its unit, advances the nonce and charges its fee.

  • Round 5 (minimum fill and decimals from the token):

    • should_refuse_a_listing_of_less_than_the_tokens_minimum_fill: 99 at a minimum of 100 is refused with 10463 by check_tx and in a block; 100 is placed.
    • should_fill_open_listings_by_the_tokens_current_minimum_fill: the owner raises the minimum from 1 to 600 after a listing of 1,000; a fill of 500 is refused (TokenOrderFillAmountError naming 600), one of everything executes.
    • the value refusal (10465) is now paid, at the token's decimals;
    • dpp: the trade mode's JSON form and bincode tag, the minimum's bounds (0 and i64::MAX + 1 refused), fill_amount with the token's minimum.
    • cargo test -p drive-abci --lib -- tests::token::marketplace is_allowed contract_structure_error tests::token::non_transferable (71 passed), cargo test -p drive --lib -- order_escrow verify token (978), cargo test -p dpp --all-features --lib -- token_order token_place_ask token_configuration token_marketplace_rules token_configuration_item (227), cargo test -p platform-wallet --lib state_transition_summary.
    • Swift and Kotlin parse the trade mode's object form: the Kotlin TokenMaterializerTradeModeTest passes; the Swift DataContractParserTradeModeTests were updated but not run (no xcframework in this worktree).

In-place changes to shipped generations

  • TokenTradeMode: the fieldless Tradeable that protocol version 15 (5.1) decodes keeps its bincode tag 1, renamed TradeableWithoutMinFill (JSON TradeableWithoutMinFill). It is never admitted: below 16 it is refused as not active, exactly as 5.1 refuses those bytes, and from 16 as a minimum fill of 0 (InvalidTokenOrderFillRangeError). The admitted Tradeable { min_fill } is a new variant at tag 2, so a 5.1 decoder fails on it rather than misreading the minimum fill (review thread r4761951500). 5.1 and 5.2 nodes at protocol version 15 decode and refuse both forms alike. NotTradeable keeps its tag and its JSON form.

  • The token base transition action's advanced structure validation (structure_v0, every protocol version) now reads its rule through TokenBaseTransitionActionAccessorsV0::token_configuration_or_position_error. The helper holds the same condition and builds the same two errors with the same fields, so every result is unchanged; it moved so the listing transformer can refuse an unknown token with the same error.

  • The state transition proof paths: verify_state_transition_was_executed_with_proof v0, which its v1 dispatcher generation also calls, the execution path queries a node proves a transition with, and the proof guarantee classifier gain arms for TokenPlaceAsk, TokenFillAsk and TokenCancelOrder. Every arm for an existing kind is unchanged, so a proof of any transition an earlier protocol version admits verifies, or is refused, exactly as before. The new arms are reached only by the marketplace kinds, which the batch's is_allowed gate refuses before protocol version 16, so no earlier version can execute one for a client to verify. These paths are also not consensus: they build and check proofs for clients, and no node's state or result depends on them. A new verifier generation would only duplicate the dispatcher without changing what any version verifies.

  • The batch's other shipped v0 paths gain arms for TokenPlaceAsk, TokenFillAsk and TokenCancelOrder only: BatchTransition::validate_base_structure_v0 (each kind's structure validation), the batch transformer v0 (each kind's transformation), the batch advanced_structure 2, which protocol version 15 selects (each kind's contract-level checks), the batch state validation v0 (each kind's state validation), outputs_only_bundle_tag_v0 in the shielded-proof processor and the accepted token pool nullifiers of the state validation v0 (both list the three kinds among those that touch no shielded pool). No arm of an existing kind changes. The batch's is_allowed gate refuses the three kinds, unpaid, before protocol version 16, so on protocol versions 1 through 15 none of the new arms is reached and every block replays as before.

Breaking Changes

Consensus, from protocol version 16: three new token transitions, new consensus errors and new token events. Earlier protocol versions are unchanged: the new kinds are refused there before anything else runs.

Wire and API, all unreleased (protocol version 16):

  • TokenTradeMode::Tradeable is Tradeable { min_fill } at bincode tag 2; its JSON form is { "Tradeable": { "minFill": n } }, no longer the string "Tradeable". The fieldless 5.1 form is TradeableWithoutMinFill (tag 1, never admitted). A downstream match needs Tradeable { .. }. wasm-dpp2's TokenTradeMode.Tradeable(minFill) takes the minimum and has a minFill getter.
  • TokenOrder loses min_fill; fill_amount takes the token's minimum fill.

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

PR Hygiene · f148a7b

  • Bots — thepastaclaw requested changes — dismiss the review or push a fix
  • Self-review — post /self-reviewed
  • Build green
  • Approvals
    • files with no dedicated owner — you own it
    • kotlin-sdk (packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/services/tokens/TokenMaterializer.kt, packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/services/tokens/TokenMaterializerTradeModeTest.kt, packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/TokensNative.kt and 2 more) — HashEngineering
    • dpp — you own it
    • rs-drive-abci — you own it
    • rs-drive — you own it
    • rs-platform-wallet-ffi (packages/rs-platform-wallet-ffi/src/tokens/update_config.rs) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rs-platform-wallet (packages/rs-platform-wallet/src/wallet/identity/network/state_transition_summary.rs) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/Core/Utils/DataContractParser.swift, packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift, packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/Tokens/TokenActions.swift and 4 more) — llbartekll or romchornyi

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

QuantumExplorer and others added 30 commits October 8, 2026 16:17
…a keywords

From protocol version 14 the DPNS `domain` create is checked by the
contract's own keywords instead of most of its data trigger:

- `normalizedLabel` and `normalizedParentDomainName` are generated from
  `label` and `parentDomainName` (`generatedFrom` homographSafeASCII);
- `preorderSalt` reveals the writer's own preorder, made in an earlier
  block, and deletes it (`refersTo` with a sha256d `findBy`, `where`
  `$ownerId`, `minimumAgeBlocks: 1`, `consume`); the preorder's storage
  is refunded to the writer;
- the `recordsIdentityIsOwner` rule holds a new name's `records.identity`
  to its owner until the name first changes hands;
- `domain` sets `canBeDeleted: false`; `preorder` requires
  `$createdAtBlockHeight`. Positions, transient list and encoding are v2's.

`create_domain_data_trigger` 2 keeps only the parent domain checks, and
data trigger bindings 2 drop the `domain` Replace and Delete rejects.
`transition_to_version_14` re-stores DPNS. A preorder recording no
`$createdAtBlockHeight` (made before the upgrade) counts as old enough
for `minimumAgeBlocks`. The legacy JS SDK hashes the preorder as the
platform does: normalized label, ".", parent as sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A document recording no `$createdAtBlockHeight` is known only to come from
a block before the protocol upgrade that re-stored its system contract, so
it now meets `minimumAgeBlocks: 1` (the DPNS reveal's) and no larger
minimum. Another contract revealing DPNS preorders with a larger minimum
refuses a pre-upgrade preorder; a test covers it.

Also: a trigger-refused DPNS reveal keeps its preorder for a retry (test),
and the check_tx contract update fee pin follows the DPNS v3 preorder type
the test copies in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riscoll-44c981

# Conflicts:
#	packages/rs-platform-version/src/version/v14.rs
`User.DASH` hashes `user.DASH`, the parent as sent, while the domain
carries `parentDomainName: "DASH"` and `normalizedParentDomainName: "dash"`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riscoll-44c981

# Conflicts:
#	packages/rs-platform-version/src/version/v14.rs
Short `description`s and no `$comment`s in DPNS v3; the rules they
restated are in the schema keywords. The check_tx contract update fee pin
follows the smaller preorder type it copies in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…owner

A copy of a pending preorder no longer blocks it, and the copier can no
longer reveal the name with the copy once the owner's reveal shows the salt:

- `preorder` is unique on (`$ownerId`, `saltedDomainHash`), replacing the
  unique index on the hash alone;
- the domain's `preorderSalt` finds it by `$ownerId` and the sha256d of the
  writer's id, the salt, the normalized label, "." and the parent.

The parser (meta-schema v3, parser generation 3) admits `"$ownerId"` as a
findBy function param (`LookupKeyParam::Writer`), a `$ownerId` findBy key on
a transferable type beside a function, and that key for `consume`.

At protocol version 14 every existing preorder is deleted and the type is
rebuilt as a fresh v3 chain lays it out
(`Drive::apply_contract_rebuilding_document_types`), so the minimumAgeBlocks
allowance for preorders recording no creation height is reverted.

rs-sdk and js-dash-sdk compute the preorder hash from the contract's own
declaration, so either side of the upgrade hashes as the platform does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riscoll-44c981

# Conflicts:
#	packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/mod.rs
#	packages/rs-platform-version/src/version/v14.rs
A registration took the preorder's hash form from the DPNS contract the
client already held: the context provider's for the SDK's protocol version
(13 on a fresh SDK), or js-dash-sdk's app cache. Either could still be DPNS
v2 after the network moved to v3, so the preorder committed to the old hash
and the domain create could never find it (40120), after the preorder was
paid.

rs-sdk now refreshes the protocol version (proven) and fetches DPNS from
state before hashing, fetching again when the response raised the version
the contract was parsed under. A preorderSalt reference without a findBy
function is an error instead of a silent fall back to the old hash.
js-dash-sdk fetches the contract with a new `skipCache` option, which also
replaces the cached contract both documents are created against.

Tests: the SDK hash against the real DPNS v2 and v3 contracts, a missing
hashed property, and a mock SDK seeded at 13 with a provider holding v2;
js specs for a cache warmed with v2 and for `skipCache`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…arsed version

Comparing the SDK's protocol version before and after the fetch missed a
node behind the network: after the refresh learned protocol 14, a node at
the block before activation could still prove DPNS v2 at 13, the ratchet
ignores the lower version, and the registration would hash the old way.

The registration now reads each DPNS contract response with its metadata
and takes the first one proved at the version the SDK parsed it under, at
most 3 times. A response proved at a newer version was parsed under an
older one (decoding DPNS v3 under 13 drops the salt's reference) and has
raised the SDK's version, so the next is parsed under it; one proved at an
older version is skipped. Otherwise the registration fails before paying.

The document building moves into `dpns_registration_documents`, so an
offline test drives it against a context provider holding v2 and checks
the preorder's owner-bound hash and the domain's salt. Scripted tests cover
a response parsed under an older version (rebuilt from serialized bytes as
a proof decode does), a node behind the network, and every node behind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`apply_contract_rebuilding_document_types` stored the new contract
through `update_contract_add_operations`, which only builds operations,
so unlike an update it never put the rewritten contract in the block
cache. Until the protocol change events refresh every system contract at
their end, a read in the block could fall back to a global cache entry a
committed-state read had filled with the old contract. The rebuild now
fetches what it stored and seeds it with `insert_rewritten`, as
`update_contract` does. Test: DPNS v2 warm in the global cache, the
preorder type rebuilt, and a read in the block's transaction gets v3.

The book's same-block transfer case says the rule still applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…anwhile

The version a registration compared a DPNS contract response with was
read before the fetch awaited the network. SDK clones share that version,
so another request could raise it from 13 to 14 while the fetch waited; a
response from a node still at 13 proving DPNS v2 then matched the stale
13 and was taken, and the preorder hashed the old way.

A response is now taken only when the SDK's version is unchanged across
the fetch as well as equal to the version the node proved it at. The
version only rises, so one unchanged across the fetch is the version the
response was parsed under. Regression: the first fetch raises the shared
version to the latest while returning DPNS v2 proved at 13, which is
skipped, and the next response, v3, is taken.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riscoll-44c981

# Conflicts:
#	packages/rs-platform-version/src/version/v14.rs
Now that `identifier` and `bytes` + `size` are in v5.0-dev (#5355), the
DPNS v3 schema uses them: `preorderSalt` and `saltedDomainHash` are
`"type": "bytes", "size": 32`, `records.identity` is `"type":
"identifier"`. The parsed types are unchanged; the stored contract keeps
the schema as written, so the check_tx contract-update fee pin moves
(27003089990 to 27003077990).

Protocol 13 cannot decode the shorthands, so the SDK test of a response
parsed under an older version now uses DPNS v2 as the contract read
under 13.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clients:
- js-dash-sdk refuses a records.identity other than the registering
  identity before paying for the preorder when the contract declares
  recordsIdentityIsOwner; the legacy (pre-v3) hash of a top-level name is
  of the salt and the label as sent, as trigger v1 hashes it; the "no
  DPNS app" spec now reaches the code it names.
- rs-sdk `salted_domain_hash` reads the salt and label from the domain's
  properties instead of separate parameters.

Drive and drive-abci:
- the preorder rebuild refuses a type with trees outside its own subtree
  (indexOnly, contested index, moderator deletions, ttl), deletes without
  the backward-reference scan Drive never needs, and drops the
  always-None storage flags parameter.
- trigger v2 queries the parent under the top level directly (a parent
  domain name holds no dot) and gains in-module tests.

Parser and docs:
- the consume check moves into `writer_owns_found_document`, so the
  parse_reference_target match is no longer reflowed.
- `LOOKUP_KEY_WRITER` gives way to the existing `OWNER_ID`; the unused
  `preorder::properties::SALTED_DOMAIN_HASH` and `hash_double` import go.
- meta-schema v3, reference_lookup.rs, wasm-dpp2 and the book describe
  the findBy `$ownerId` entry (40120 for another identity's commitment),
  the per-owner preorder index and the legacy top-level hash.

Tests:
- the strategy tests hash preorders with the shared
  `dpns_salted_domain_hash` (now outside cfg(test)) instead of the rule
  under test, and lose the stale "disable document triggers" comments;
  dead `dpns < 3` arms, the pasted height-1 comments and the derivable
  flag go; the protocol 13 test is renamed `should_...`; preorders are
  read by id; the award test uses `fast_forward_to_block`; the upgrade
  layout reference is a bare genesis state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`DocumentPropertyReferenceTarget::lookup_hash_key` returns the computed
key of the `findBy` function a target declares, the chain
`as_any_document_reference` -> `lookup` -> `hash_key` that rs-sdk's DPNS
preorder hash and document reference validation 0 each spelled out.

Reference validation 0 is a shipped generation edited in place: the
accessor returns exactly what the inline chain returned, so nothing
changes at any protocol version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ties

The register spec mocks `crypto.randomBytes` to zeros for the whole
suite, so two `generateRandomIdentifier()` calls gave the same identity
and the refusal never fired. The spec now uses two fixed, different ids.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s stay deletable

documents.md stated without exception that a findBy `"$ownerId"` source
needs a referring type that cannot be transferred or traded, for a
property's findBy and for creatorRefersTo; beside a function the lookup
is judged on the create alone and the source is allowed, as DPNS v3
declares. The deletion chapter's onlyWhenConsumed preorder example now
says DPNS v3's own preorder keeps `canBeDeleted: true`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three Drive tests used the latest DPNS fixture for writes or proofs at
protocol version 13. DPNS v3 is now written with the `bytes` and
`identifier` type shorthands, which the protocol 13 parser refuses
("unsupported property type: bytes"). A chain at 13 stores DPNS v2, which
every later version reads too, so these tests now load it: the two
contested-poll tests (`..._poll_started_before_protocol_version_14`) and
`verify_batch_document_proof_before_protocol_version_14_carries_no_balance`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion the response reports

A fresh SDK starts at its network's floor (protocol version 13 on
mainnet, testnet and regtest) and learns the network's version only
from a verified response. DPNS v3 is written with the `bytes` and
`identifier` type shorthands, which the protocol version 13 parser
refuses, so on a network at 14 the first proof holding DPNS failed
("unsupported property type: bytes") before the SDK could learn 14,
every time.

When parsing under the SDK's version fails on an unpinned SDK below the
newest version it knows, `parse_proof_at_the_reported_version` parses
under that newest version, which verifies the proof and its quorum
signature over a state id that signs the response's protocol version,
and, when the reported version is another known one, parses again under
it. A pinned SDK, or one at the newest version, reports the first
failure. The fetch traits require cloneable responses (all are) for the
retry.

Tests: a stand-in proof readable only from protocol version 14 parses on
an SDK seeded at 13 and fails on one pinned at 13.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts with #5313, which verifies a response again after fetching a
missing quorum key, in the same clone-and-retry spot as the protocol
version fallback:
- fetch.rs, fetch_many.rs: both sides require a cloneable response; the
  doc names both retries.
- sdk.rs: the Dapi arm takes #5313's `verify_fetching_quorum_key`, whose
  two verifications now go through `parse_proof_at_the_reported_version`
  (the version passed in, so both start from the same one). A failure of
  the quorum signature or its key is reported as it is under either
  version (`fails_after_reading_the_proof`): the signature is checked
  once the proof was read, so a missing key still reaches the fetch and
  no extra quorum lookup is made.

Test: `should_report_a_missing_quorum_key_found_under_the_newest_version`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… verification

`parse_proof_at_the_reported_version` borrows the request and response
and copies them once per parse, so `verify_fetching_quorum_key` keeps one
copy for both of its verifications instead of copying it again before
the first.

The probe is now scripted by its request (the first version that decodes
it, the version its response reports, the versions whose signature or
key fails) and records every version it is parsed under. New tests:
- a reported version between the SDK's and the newest is parsed again
  under it, and its failure there is reported;
- a signature failure under the newest version is reported over the
  first decoding error, and one under the SDK's version is not retried;
- through `verify_fetching_quorum_key`, a fresh SDK reads the proof and
  learns the reported version, and learns none when the signature fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h the version fallback

The probe now asks the provider for its quorum's key instead of failing
outright, so a key the provider fetches makes the second verification
succeed. A new test drives `verify_fetching_quorum_key` with an SDK two
versions back and a provider holding no key: one fetch, the parse
sequence current, newest, current, newest, reported, and the SDK learns
the reported version. A regression of the second verification to a
direct parse at the SDK's version would fail it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riscoll-44c981

# Conflicts:
#	book/src/contract-keywords/refers-to-lookup.md
#	book/src/data-model/documents.md
#	packages/rs-dpp/schema/meta_schemas/document/v3/document-meta.json
#	packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/document/document_reference_validation/v0/mod.rs
#	packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/state/v0/fetch_documents.rs
…riscoll-44c981

# Conflicts:
#	book/src/contract-keywords/refers-to-lookup.md
#	book/src/data-model/documents.md
#	packages/rs-dpp/schema/meta_schemas/document/v3/document-meta.json
#	packages/rs-dpp/src/data_contract/document_type/property/reference_lookup.rs
…ut a salt

A DPNS v3 preorder now holds `ownerNameHash`, the sha256d of the owner's
id, the normalized label, "." and the normalized parent, unique per owner
(`ownerAndNameHash`), and `nameHash`, the same without the owner, indexed
with its creation height (`nameHashAndHeight`). It carries no salt and
lives an hour (`ttl` 3600, so it refunds nothing when consumed). The
domain finds it through `creatorRefersTo` (findBy `$ownerId` and the
`ownerNameHash` function, minimumAgeBlocks 1, consume). `preorderSalt`
stays declared on the domain, transient and no longer required, so
domains stored under v1 and v2 decode.

`nameHash` is there for a first-committer refersTo keyword built in a
separate PR: with it, a name whose older valid preorder belongs to
someone else is refused, which stops a watcher who reads a pending name
from the mempool from preordering and revealing it first under full
blocks. No salted design can check that before the owner reveals.

Without a salt an owner holds one pending preorder of a name: a second
is refused as a duplicate (40105) while the first stands.
`Sdk::register_dpns_name` reveals a pending one instead of preordering
again.

- Drive: `apply_contract_rebuilding_document_types` leaves a type
  already stored as declared (so the v14 upgrade stays idempotent), and
  rebuilds into a type with a ttl, which holds no document and so no
  expiry entry; a stored type with a ttl is still refused.
- rs-sdk and js-dash-sdk build the preorder from the domain's creator
  reference (`nameHash` from its params without `$ownerId`) and send no
  salt from v3; v1 and v2 keep the salted hash.
- Tests: dpp DPNS v3 shape and hash; drive rebuild (ttl new type, type
  left as stored, stored ttl refused); drive-abci dpns_v3 (one pending
  preorder per name, the contested retry reveals the same preorder,
  preorder and domain fees pinned: 62,554,803 credits a name at 14
  against 76,862,280 at 13); the check_tx update pin gains the 0.01 Dash
  non-unique index; rs-sdk and js-dash-sdk preorder shapes.
- Docs: v14 note 90, the book (commit and reveal, documents, deletion,
  transient).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st, and reuses a pending preorder

- rs-sdk registers the DPNS contract it fetched and built the documents
  against with its context provider, so the preorder and domain
  confirmations decode under it. A known-contracts cache warmed with
  DPNS v2 would otherwise decode the v3 preorder's proof under v2's single
  property and refuse it, after the preorder was paid for.
- The v3 preorder property names are spelled in the module rather than
  imported from the bundled DPNS contract, which the SDK builds only with
  that contract's feature (`cargo check -p dash-sdk --no-default-features`
  builds).
- The pending preorder lookup is a shared query builder
  (`pending_preorder_query`).
- js-dash-sdk looks for a pending v3 preorder by its owner and
  `ownerNameHash` before preordering, reveals it instead, and propagates
  a failed query; v1 and v2 keep the fresh salt.

Tests: rs-sdk (the exact predicates, a pending preorder returned, none in
a proven absence, a failed query propagated, no query for a salted
preorder, the registration leaving a writable v2-seeded provider holding
v3); js-dash-sdk (the query, the reuse, a failed query, no query under
v2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…its cache

`WasmTrustedContext` forwarded `get_data_contract` to its inner
`TrustedHttpContextProvider` but not `register_data_contract`, so the
trait's no-op ran. A DPNS registration that registers the v3 contract it
built against left a cache seeded with DPNS v2 (by `addKnownContract`, a
contract fetch or a restored store) in place, and the preorder's
confirmation decoded under v2 and failed after the preorder was paid for.
The call is now forwarded.

Test: a context seeded with DPNS v2 resolves DPNS to v3 once v3 is
registered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts:
- drive contract migration modules: #5350's
  `rekey_unsigned_integer_index_values` beside this branch's
  `apply_contract_rebuilding_document_types`.
- v14 notes: #5350 took note 90 (unsigned integers keyed in value
  order), so the DPNS v3 note moves to 92, after the shorthands note 91;
  the upgrade's comment cites it as 92.

#5369 gave the document reference targets `where_conditions`: the
owner-keyed reveal test's expected `DeletableDocumentLookup` sets it
empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#5378 wrote the book's examples with the type shorthands, among them
the salted DPNS preorder and its reveal in refers-to-lookup, documents
and deletion. This branch already writes them with the shorthands, for
the unsalted DPNS v3 (`ownerNameHash`, `nameHash`, `creatorRefersTo`),
so its versions are kept; documents.md no longer points at "the salt
above".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 2, 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

  • Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (thread, carried)
    Impact: A token holder whose signed listing is placed after a separate conventions controller increases the token's decimals can sell the same base units for fewer credits than the holder authorized.

New on this head: This head merges the v5.2-dev ML-DSA and typed-definition changes and updates one drive-abci test fixture; the marketplace implementation remains unchanged from the previous review. No code check has failed, while the Kotlin build, changed-package detection, PastaClaw review, and PR Hygiene checks are still in progress.

🔴 1 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (1)

  • 🔴 Blocking: Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (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); 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 protocol-versioned change that modifies consensus-critical token state transitions, escrowed funds movement, peer-facing serialization, storage operations, and proof verification across DPP, Drive, and SDK boundaries.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-dpp/src/errors/consensus/basic/basic_error.rs`:
- [SUGGESTION] packages/rs-dpp/src/errors/consensus/basic/basic_error.rs:1203-1222: The PR description maps marketplace error tags and protocol notes to stale values
  Impact: SDK implementers following the PR description can assign the marketplace basic errors to the wrong wire discriminants and look for the listings behavior under the wrong v16 note.
  The source and discriminant assertions now assign tag 214 to `IdentityPublicKeyTypeNotAllowedForPurposeError` and marketplace errors to 215, 216, and 217, while the PR description still states 214 through 216. The merged v16 snapshot likewise places ML-DSA at note 4 and token listings at note 5, but the description still calls listings note 4. Update the PR description to match the merged source; do not change the enum order or its assertions.

In `packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs`:
- [BLOCKING] packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97: Bind the pricing scale into the seller's signed placement
  (carried; thread: https://github.com/dashpay/platform/pull/5529#discussion_r4347888980)

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

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

# Conflicts:
#	packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 2, 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

  • Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (thread, carried)
    Impact: A token holder whose signed listing is pending when an authorized controller increases the token’s decimals can sell the same number of base units for less than they expected without signing again.

New on this head: Since the previous review, this head merged v5.2-dev’s typed document-definition parser and identity-update test fix without changing the marketplace implementation. No code checks had failed when checked: the Kotlin SDK build and tests, Rust WASM tests, and Drive and RS-DAPI image builds passed; Rust workspace tests, the JS build, and the Dashmate helper image build were still pending.

🔴 1 blocking

Still open from earlier rounds (1)

  • 🔴 Blocking: Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (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); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — This large cross-cutting change modifies consensus-critical token state transitions and validation, serialized protocol-versioned data, storage operations, and atomic movement of tokens and credits through marketplace escrow.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (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/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs`:
- [BLOCKING] packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97: Bind the pricing scale into the seller's signed placement
  (carried; thread: https://github.com/dashpay/platform/pull/5529#discussion_r4347888980)

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

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

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 2, 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

  • Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:93-98 (thread, carried)
    Impact: A seller whose signed listing waits in the mempool while the token's conventions controller changes decimals can receive a materially different credit amount than the signed numeric price implies.

New on this head: This head merges v5.2-dev into the token-marketplace branch, adding unrelated document-definition, wallet-storage, SDK subscription, and Dashmate changes while leaving the marketplace implementation unchanged. No code checks have failed; Kotlin SDK, changed-package determination, review, and PR-hygiene checks remain in progress or pending.

🔴 1 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (2)

  • 🔴 Blocking: Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:93-98 (thread)
  • 🟡 Suggestion: The PR description maps marketplace error tags and protocol notes to stale values — packages/rs-dpp/src/errors/consensus/basic/basic_error.rs:1212-1240 (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); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — This large, intricate diff changes consensus-critical token validation and execution, escrow storage, and atomic movement of tokens and credits through new 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
🤖 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/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs`:
- [BLOCKING] packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:93-98: Bind the pricing scale into the seller's signed placement
  (carried; thread: https://github.com/dashpay/platform/pull/5529#discussion_r4347888980)

In `packages/rs-dpp/src/errors/consensus/basic/basic_error.rs`:
- [SUGGESTION] packages/rs-dpp/src/errors/consensus/basic/basic_error.rs:1212-1240: The PR description maps marketplace error tags and protocol notes to stale values
  (carried; thread: https://github.com/dashpay/platform/pull/5529#discussion_r4768833281)

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

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

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 3, 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

  • Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (thread, carried)
    Impact: A holder who signs a listing before an authorized token-conventions update can sell the signed quantity for fewer credits than they approved.

New on this head: This head primarily merges the v5.2-dev contract-definition changes from #6476 and updates related documentation and SDK surfaces; marketplace execution code is unchanged from the previously reviewed head. CI is still in progress for Rust, Docker, JavaScript, wasm32, Swift schema, Kotlin, and PR Hygiene checks; completed policy, title, book-preview, and dependency checks are passing.

🔴 1 blocking

Still open from earlier rounds (1)

  • 🔴 Blocking: Bind the pricing scale into the seller's signed placement — packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97 (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 diff adds three consensus-executed marketplace transitions and changes funds movement in rs-drive’s token_fill_ask_transition.rs, which converts fills into operations that release escrowed tokens, transfer buyer credits to the seller, and update or remove the listing.
  • 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/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs`:
- [BLOCKING] packages/rs-drive/src/state_transition_action/batch/batched_transition/token_transition/token_place_ask_transition_action/v0/transformer.rs:96-97: Bind the pricing scale into the seller's signed placement
  (carried; thread: https://github.com/dashpay/platform/pull/5529#discussion_r4347888980)

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

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

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants