Repository navigation
feat(platform)!: token marketplace escrow trees and token market contract (PV15) - #5526
QuantumExplorer wants to merge 68 commits into
Conversation
…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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
`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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
`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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
… 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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
#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 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
|
📜 System contracts This pull request adds or changes system contract document schemas. The contract viewer diagrams each one, and a comparison marks what is added, changed and removed, with the update rule each change meets.
Compared |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Static review of exact head 860dac3 found two non-blocking issues in newly added estimation and regression-test code: layer descriptions are priced eagerly even when depth already determines the result, and the genesis/upgrade equivalence guard does not compare authenticated Merk subtree hashes. All 19 prior findings are fixed; code-related CI checks pass, with only PR Hygiene still pending.
🟡 2 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); 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: 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: platform-versioning); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff changes consensus-critical persisted state through create_initial_state_structure_v5 and transition_to_version_15, adds escrow storage primitives, and changes token supply accounting in packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-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/util/estimated_layers.rs`:
- [SUGGESTION] packages/rs-drive/src/util/estimated_layers.rs:77-84: Price layer descriptions lazily after the depth comparison decides
`Ordering::then` evaluates its argument eagerly, so both `propagation_credits` calls run even when `estimate_levels()` already determines that one description is deeper. Besides repeating GroveDB propagation estimation and fee conversion unnecessarily for every unequal-depth merge, the eager `?` can make the comparison fail because of an irrelevant pricing error. Return the depth ordering first and invoke GroveDB pricing only when the depths tie; reserve the debug tie-break for equal prices.
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:4025-4031: Compare authenticated subtree hashes in the genesis/upgrade guard
The equivalence guard compares decoded `Element` values and recursively compares decoded key/value maps, but `Tree` and `SumTree` elements carry only metadata such as the root key, flags, and aggregate—not the Merk hash or internal AVL topology. Two subtrees with the same keys and values can therefore pass this assertion while having different authenticated root hashes. Since this test is intended to detect the byte-level genesis-versus-upgrade divergence introduced by the new tree construction, open each named subtree through GroveDB's transactional Merk API using `txn_b` and compare its `Merk::root_hash()` with the corresponding genesis subtree hash, while retaining the element walk for diagnostics.
Nothing read an order's creation block height: no index, rule or reader used it, and $createdAt already dates the order. expiresAt only stopped fills; it did not close the order or return its escrow, and the book and depth indexes could not tell expired orders apart, so the token market contract drops both. The genesis state at protocol version 15 changes with the contract, so the shielded guard digests are re-pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…escrow upgrade guard compares authenticated hashes compare_layer_cost ranked by depth but priced both descriptions first; it now prices them only when the depths tie, so an irrelevant pricing error cannot fail a merge. The genesis-versus-upgrade escrow test also compares the value hash of each root element, which commits to the Merk root of the subtree below it, from a raw proof of the committed state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Reviewed the complete diff at exact head ad0d84f and found no actionable in-scope issues. The PV15 activation, escrow accounting, authenticated genesis/upgrade checks, order write protection, and order-independent fee estimation are consistently wired, while CI code checks are passing or pending rather than failing; the Rust workspace test check remains pending.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); 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: platform-versioning); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes consensus-persisted state through create_initial_state_structure_v5 and transition_to_version_15, adds escrow accounting in calculate_total_tokens_balance/v2, and changes versioned batch cost calculation. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-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.
|
Bots are done — your move: post |
…et-escrow-contract # Conflicts: # packages/rs-platform-version/src/version/v15.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…et-escrow-contract # Conflicts: # packages/rs-platform-version/src/version/v15.rs
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
… note 8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix, 2 threads unresolved — resolve them. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The change still has two blocking correctness issues: the protocol-upgrade path inserts the token-market contract through a separate batch without verifying the authenticated DataContractDocuments root against fresh v15 genesis, and the advertised optional expiresAt field is absent from both frozen order schemas. Three non-blocking issues remain around trusted-provider cache activation, the stale v15 binding annotation, and the Debug-based estimator tie-break. The Rust workspace test check is failed on this head, while several changed-package checks remain queued; the supplied snapshot does not identify the Rust failure, so it is not independently attributed here.
🔴 2 blocking | 🟡 3 suggestion(s)
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Do not let the known-contract cache bypass protocol activation
packages/rs-sdk-trusted-context-provider/src/provider.rs:1038-1041
get_data_contract returns a contract from known_contracts before checking system-contract activation. If a TokenMarket contract is registered in that cache while serving protocol 15, a later lookup for the same ID with protocol version 14 returns it even though the contract is absent before protocol 15. Keep system-contract entries version-keyed or perform the activation check before the generic cache lookup so every request receives a contract valid for its requested protocol version.
source: gpt-6.1-sol (phase2-reviewer: architecture-layering)
🟡 Suggestion: Correct the stale PLATFORM_V15 data-trigger binding changelog
packages/rs-platform-version/src/version/v15.rs:112-117
PLATFORM_V15 selects data-trigger bindings generation 3, which appends the four token-market order replace/delete bindings, but note 3 still says that the data trigger bindings stay at 2. Although the following sentence discusses the unchanged DPNS bindings, the unqualified statement contradicts the selected table and note 8 and can mislead protocol-version audits. Clarify that the existing DPNS bindings remain at v2 while the token-market bindings are added by generation 3.
source: gpt-6.1-sol (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.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large, intricate change to consensus-critical protocol-version dispatch and persisted storage migrations, including genesis/upgrade state construction, escrow accounting, and total-token-balance validation in rs-drive and rs-drive-abci. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-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/v0/mod.rs`:
- [BLOCKING] packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:949-956: Use a consensus-equivalent insertion path for the token-market contract
Fresh v15 genesis queues the TokenMarket contract with the other system contracts and applies the complete set through one batch, whereas the v14-to-v15 upgrade calls Drive::apply_contract separately against the already-populated DataContractDocuments Merk. Merk topology and the authenticated parent root can depend on insertion history, so the two paths can produce different application-state roots even when the token-market contract leaf is identical. The current equivalence test only compares the Tokens and PreFundedSpecializedBalances subtrees and does not compare the authenticated DataContractDocuments root. Use a shared deterministic insertion mechanism or extend the equivalence guard to prove the complete DataContractDocuments subtree and authenticated root match.
In `packages/token-market-contract/schema/v1/token-market-contract-documents.json`:
- [BLOCKING] packages/token-market-contract/schema/v1/token-market-contract-documents.json:55-107: Declare the advertised expiresAt property in both order schemas
The PR description explicitly promises an optional expiresAt property for ask and bid orders, but neither document type declares it. Both schemas set additionalProperties to false, so the next marketplace transition that writes an expiry will be rejected as an unknown-property/schema error even though the contract is activated and frozen at protocol version 15. Add the intended optional field to both schemas before activation, or remove the expiration promise and update the associated documentation and follow-up contract design.
In `packages/rs-sdk-trusted-context-provider/src/provider.rs`:
- [SUGGESTION] packages/rs-sdk-trusted-context-provider/src/provider.rs:1038-1041: Do not let the known-contract cache bypass protocol activation
get_data_contract returns a contract from known_contracts before checking system-contract activation. If a TokenMarket contract is registered in that cache while serving protocol 15, a later lookup for the same ID with protocol version 14 returns it even though the contract is absent before protocol 15. Keep system-contract entries version-keyed or perform the activation check before the generic cache lookup so every request receives a contract valid for its requested protocol version.
In `packages/rs-platform-version/src/version/v15.rs`:
- [SUGGESTION] packages/rs-platform-version/src/version/v15.rs:112-117: Correct the stale PLATFORM_V15 data-trigger binding changelog
PLATFORM_V15 selects data-trigger bindings generation 3, which appends the four token-market order replace/delete bindings, but note 3 still says that the data trigger bindings stay at 2. Although the following sentence discusses the unchanged DPNS bindings, the unqualified statement contradicts the selected table and note 8 and can mislead protocol-version audits. Clarify that the existing DPNS bindings remain at v2 while the token-market bindings are added by generation 3.
In `packages/rs-drive/src/util/estimated_layers.rs`:
- [SUGGESTION] packages/rs-drive/src/util/estimated_layers.rs:84-91: Avoid Debug formatting for the layer-estimation tie-break
When two distinct layer descriptions have equal depth and equal GroveDB propagation cost, the merge allocates and compares two Debug-formatted Strings. apply_drive_operations_v2 can execute this branch repeatedly while merging estimated operations. More importantly, Debug output is a presentation representation rather than a protocol-stable ordering; changing a Debug implementation or an upstream formatting detail could select a different descriptor and change the fee estimate for the same protocol generation. Use an explicit allocation-free structural ordering or another canonical stable key.
| self.drive.apply_contract( | ||
| &token_market_contract, | ||
| *block_info, | ||
| true, | ||
| None, | ||
| Some(transaction), | ||
| platform_version, | ||
| )?; |
There was a problem hiding this comment.
🔴 Blocking: Use a consensus-equivalent insertion path for the token-market contract
Fresh v15 genesis queues the TokenMarket contract with the other system contracts and applies the complete set through one batch, whereas the v14-to-v15 upgrade calls Drive::apply_contract separately against the already-populated DataContractDocuments Merk. Merk topology and the authenticated parent root can depend on insertion history, so the two paths can produce different application-state roots even when the token-market contract leaf is identical. The current equivalence test only compares the Tokens and PreFundedSpecializedBalances subtrees and does not compare the authenticated DataContractDocuments root. Use a shared deterministic insertion mechanism or extend the equivalence guard to prove the complete DataContractDocuments subtree and authenticated root match.
source: gpt-6.1-sol (phase2-reviewer: architecture-layering)
| "properties": { | ||
| "tokenId": { | ||
| "type": "array", | ||
| "byteArray": true, | ||
| "minItems": 32, | ||
| "maxItems": 32, | ||
| "contentMediaType": "application/x.dash.dpp.identifier", | ||
| "description": "The token the order is for", | ||
| "position": 0 | ||
| }, | ||
| "price": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "The credits the seller asks per whole token (10 to the power of the order's decimals base units)", | ||
| "position": 1 | ||
| }, | ||
| "amount": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "The token amount, in base units, listed when the order was placed", | ||
| "position": 2 | ||
| }, | ||
| "remaining": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "The token amount, in base units, still open. The order is deleted when it is filled entirely", | ||
| "position": 3 | ||
| }, | ||
| "minFill": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "The smallest amount, in base units, a fill may take, unless it takes everything still open. A fill may not leave less than this open either", | ||
| "position": 4 | ||
| }, | ||
| "decimals": { | ||
| "type": "integer", | ||
| "minimum": 0, | ||
| "maximum": 255, | ||
| "description": "The token's decimals when the order was placed: the price is per 10 to the power of this many base units for the life of the order, even if the token's decimals change later", | ||
| "position": 5 | ||
| } | ||
| }, | ||
| "required": [ | ||
| "tokenId", | ||
| "price", | ||
| "amount", | ||
| "remaining", | ||
| "minFill", | ||
| "decimals", | ||
| "$createdAt", | ||
| "$updatedAt" | ||
| ], | ||
| "additionalProperties": false |
There was a problem hiding this comment.
🔴 Blocking: Declare the advertised expiresAt property in both order schemas
The PR description explicitly promises an optional expiresAt property for ask and bid orders, but neither document type declares it. Both schemas set additionalProperties to false, so the next marketplace transition that writes an expiry will be rejected as an unknown-property/schema error even though the contract is activated and frozen at protocol version 15. Add the intended optional field to both schemas before activation, or remove the expiration promise and update the associated documentation and follow-up contract design.
source: gpt-6.1-sol (phase2-reviewer: architecture-layering)
| // Priced only when the depths tie, so a pricing error of a description the depth already | ||
| // ranks cannot fail the comparison. | ||
| let by_price = | ||
| propagation_credits(a, platform_version)?.cmp(&propagation_credits(b, platform_version)?); | ||
| if by_price != Ordering::Equal { | ||
| return Ok(by_price); | ||
| } | ||
| Ok(format!("{a:?}").cmp(&format!("{b:?}"))) |
There was a problem hiding this comment.
🟡 Suggestion: Avoid Debug formatting for the layer-estimation tie-break
When two distinct layer descriptions have equal depth and equal GroveDB propagation cost, the merge allocates and compares two Debug-formatted Strings. apply_drive_operations_v2 can execute this branch repeatedly while merging estimated operations. More importantly, Debug output is a presentation representation rather than a protocol-stable ordering; changing a Debug implementation or an upstream formatting detail could select a different descriptor and change the fee estimate for the same protocol generation. Use an explicit allocation-free structural ordering or another canonical stable key.
source: gpt-6.1-sol (phase2-reviewer: rust-quality)
Basic explanation
What this does: Prepares Platform's state for the token marketplace. It adds the two places where escrow will live: one tree for the tokens holders list for sale, and one for the credits buyers offer. It also adds a new system data contract, the token market contract, whose two document types,
ask(a listing) andbid(an offer), will hold the open orders. Platform's check that no tokens appear or vanish is taught to count the escrowed tokens. Nothing can place an order yet: the transitions that use all this come in the next pull requests of the stack.Value: The order book becomes readable with the document queries and proofs every SDK already has, including the depth at each price as one proven sum, without any new query endpoint. Each side's depth sums what it holds in escrow, so the sums can never overflow.
Risks: Medium. From protocol version 15 the genesis state and the upgrade both gain two trees and a contract, so every node must build them identically: a test checks that a chain born at 15 and a chain upgraded from 14 build byte-identical
[Tokens]and[PreFundedSpecializedBalances]subtrees. Before 15 nothing changes: the trees, the contract and the new supply calculator are selected only by the protocol version 15 tables. Fee numbers in tests that start at the latest version move, because genesis has one more contract.Issue being fixed or feature implemented
The second PR of the token marketplace stack (PV15), on top of #5524 (tradeable tokens). A listing must hold the tokens it offers and an offer the credits it offers, so a fill always delivers. This PR adds that escrow storage, the contract that records the open orders, and the supply check that keeps counting escrowed tokens.
What was done?
Escrow trees (
DRIVE_VERSION_V10, PV15)[Tokens, TOKEN_ORDER_ESCROW_KEY (96)]: a BigSumTree with one SumTree per token, created with the token's first listing, of SumItems keyed by order id.[PreFundedSpecializedBalances, PREFUNDED_BALANCES_FOR_TOKEN_ORDERS (32)]: a SumTree of SumItems keyed by order id.Drive::insert_token_order_escrow_trees, called last bycreate_initial_state_structure_v5(genesis) and bytransition_to_version_15(upgrade). Each new key becomes a leaf of its Merk, so neither root moves.DriveTokenMethodVersions::order_escrow: add, set, remove and fetch for both escrows, with cost estimation. Each is anOptionalFeatureVersion:NoneinDRIVE_TOKEN_METHOD_VERSIONS_V1(so in every table before 15),Some(0)inDRIVE_TOKEN_METHOD_VERSIONS_V3; called with an earlier protocol version, each returnsDriveError::VersionNotActiveinstead of building operations for trees that do not exist there.util::estimated_layers). The offers' escrow key, 32, sits on the third level of the prefunded specialized balances Merk (128 over 64 and 192), so the credit escrow describes that layer at level 2. The voting balance and contract fee pot estimations describe it at level 1, their keys' depth; from 15 (DRIVE_VERSION_V10) their new generations,estimated_cost_for_prefunded_specialized_balance_update2 andadd_estimation_costs_for_contract_fee_pot_update1, run the previous generation and put back a deeper description it replaced, so the order of registration no longer matters. Likewise a listing's escrow key sits on level 3 of the Tokens Merk, below the balances key the token balance estimation describes at level 0: from 15for_token_balances1 keeps a deeper description of the Tokens layer. Both escrows also sit deeper in the root tree than the identity balances (level 1) and token balances (level 2) keys, so from 15for_balances1,for_token_balances1 and the voting balance estimation 2 keep a deeper description of the root too: an offer's batch, which debits the buyer and credits the escrow, is estimated with the root at level 3 whichever operation is built first. The other writes of a batch (a document, a nonce) register their own descriptions, so the rule is also kept at the batch's boundary:apply_drive_operations2 (protocol 15) lowers each operation of an estimated batch with layer descriptions of its own and merges them into the batch's keeping the costlier one (merge_estimated_layer: the deeper byestimate_levels, then at one depth the one GroveDB's ownaverage_case_merk_propagateprices dearer, in credits at the version's fees, then a fixed tie-break; Drive keeps no size model of its own), so no operation's registration lowers another's and the batch's estimate is the same whatever their order. Applying a batch is unchanged. Before 15 they all run unchanged.Token conservation (
calculate_total_tokens_balance2)TotalTokensBalancegainstotal_token_order_escrow_balances(0 from v0 and v1), andok()/total_balances()add it to the balance side.Tokens moved from a balance into escrow, 1,000 minted and 400 listed:
The credit check needs no change: the prefunded specialized balances root is a SumTree and already counts every child.
Token market contract (new package
packages/token-market-contract,SystemDataContract::TokenMarket = 11, IDAE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e)askandbid:tokenId,price(credits per whole token),amount,remaining,minFill, optionalexpiresAt,decimals(0 to 255, the token's decimals when the order was placed, which every fill prices it at), and forbidthe escrowedescrow.book(tokenId,decimals,price,$createdAt),depth(tokenId,decimals,price,summable+rangeSummable:remainingfor asks,escrowfor bids) andbyOwner. Prices are per whole token at each order'sdecimals, so the book and the depth sums keep each scale apart: a query names the token and its decimals, and a sum never adds prices of two scales.sizedIntegerTypes: false: every integer is i64, as a summed property must be, and a partial fill rewrites an order without changing its size.creationRestrictionMode2; the types stay mutable and deletable (as withdrawals do) so orders carry a revision and storage flags.create_genesis_statev1 behind>= TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION), stored without storage flags bytransition_to_version_15, served by the Drive system contract cache and the trusted context provider from 15.SYSTEM_DATA_CONTRACT_VERSIONS_V4gainstoken_market: 1(0 in V1 to V3).Data trigger bindings 3 (
DRIVE_ABCI_VALIDATION_VERSIONS_V11): v2 plusreject_data_triggeron Replace and Delete ofaskandbid.A user's document transition against an order, protocol version 15:
Test fixtures at the latest version: a genesis at 15 holds one more contract and two more trees, so four document fee baselines move (delete and replace -47_280, DPNS create +137_760, the two DPNS v3 rows at 15 +95_920; each comment says why) and the shielded pool characterization digests of
nullifier_batch_guardthat cover the state root are re-pinned (ten of them, re-pinned again when the orders gaineddecimals). The fee assertions of the same tests still match.Wiring: workspace and Yarn workspace, Dockerfile stages, package filters, CI test lists, codecov,
data-contracts/dpp/rs-sdk/rs-sdk-ffi/wasm-sdk/trusted context provider features, the GroveDB structure description (.since(15)) andgrovedb-structure.json, the book (data-model/token-marketplace.md, architecture overview) and v15 note 6.How Has This Been Tested?
cargo test -p token-market-contract -p data-contracts: the published ID, the schema shape, no contract below 15.cargo test -p dpp --features all_features --lib -- token_market_tests total_tokens_balance: the contract loads with full validation at the latest version (mutable, deletable, no user creation, i64 integers, summeddepth); the escrow term balances the check.cargo test -p drive --lib -- structure order_escrow should_serve_token_market calculate_total_tokens(52 passed): add/set/remove/fetch of both escrows; supply stays balanced when tokens move into escrow at 15 and reads as unbalanced with the PV14 calculator; the cache serves the contract from 15; a new structure fixture reaches every escrow node.cargo test -p drive --lib -- order_escrow estimated_layers fee_pot prefunded(59 passed):VersionNotActiveat protocol version 14 and works at the latest;apply_drive_operations2: a batch of an identity contract nonce update (root level 0) and a prefunded balance write (level 3) is estimated alike in either order at the latest version, and at least as high as either order at protocol version 14, where the two orders differ;merge_estimated_layer: at one depthAllItems(32, 8)beatsAllSubtrees(32, AllBigSumTrees)in either order (GroveDB prices it 254,960 credits against 221,360), a deeper description wins whatever its nodes, andAllItems(32, 8)andAllReference(32, 8), priced alike, merge to the same one in either order;merge_estimated_layer: two descriptions at one depth merge to the one pricing the larger node in either order, a deeper one wins whatever its node, and two that price alike merge to the same one in either order;depthsum at decimals 8 is 500 and at 2 is 50, and the proven per-price sum at 8 verifies against the client's path query with one bucket of 500;data_trigger_bindings_listat the latest version: each replace and delete of anaskand abidmatches exactly one binding, and running it refuses withDataTriggerConditionError; protocol version 14 binds none of them.cargo test -p drive-abci --lib -- batch::tests::token batch::tests::document::{deletion,replacement,dpns} --skip shielded(344 passed): the PV15 token balance estimation moves no pinned fee.yarn workspace @dashevo/token-market-contract test(27 passing):decimalsis required, 0 and 255 pass, 256 is refused.cargo test -p drive-abci --lib -- create_genesis_state perform_events_on_first_block_of_protocol_change data_triggers batch::tests::document::{deletion,replacement,dpns,creation,index_only}:transition_to_version_15inserts it, served by the cache afterwards;[Tokens]and[PreFundedSpecializedBalances]subtrees and root elements;cargo test -p drive-abci --lib -- batch::tests::token state_transitions::data_contract_create state_transitions::data_contract_update(569 passed before the two re-pinned shielded pool digests; both pass after).In-place changes to shipped generations
None. The voting balance, contract fee pot, token balance and identity balance estimations, and
apply_drive_operations, change only through new generations (2, 1, 1, 1 and 2) that onlyDRIVE_VERSION_V10(protocol version 15) selects; the escrow fields ofDRIVE_TOKEN_METHOD_VERSIONS_V1are new andNone.Breaking Changes
Consensus, from protocol version 15: new state trees at genesis and on the upgrade, a new system data contract, a new token conservation calculator and new data trigger bindings. Earlier protocol versions are unchanged.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
436c30c/skip-botsproceeds without the ones not yet reported/self-reviewedgithub(.github/package-filters/js-packages-direct.yml,.github/package-filters/js-packages-no-workflows.yml,.github/package-filters/js-packages.ymland 6 more) — ktechmidas or shumkovsystem-contracts— you own itdpp— you own itrs-drive-abci— you own itrs-drive— you own itrust-sdk-ffi(packages/rs-sdk-ffi/Cargo.toml) — lklimek or shumkovrust-sdk(packages/rs-sdk/Cargo.toml) — lklimek or shumkovjs-wasm-sdk(packages/wasm-sdk/Cargo.toml) — shumkovWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.