feat(sdk)!: pure DPNS and DashPay document builders shared with embedders - #4632
Draft
PastaPastaPasta wants to merge 2 commits into
Draft
feat(sdk)!: pure DPNS and DashPay document builders shared with embedders#4632PastaPastaPasta wants to merge 2 commits into
PastaPastaPasta wants to merge 2 commits into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cargo vendor --locked refused the workspace with two dual-source packages: serde-wasm-bindgen came from the QuantumExplorer fork (wasm-dpp) and the dashpay fork (wasm-sdk, wasm-dpp2) at once, and versioned-feature-core 1.0.0 came from crates.io (via grovedb-version) and from git (rs-platform-version). Offline build systems that vendor the workspace, such as Dash Core's depends packaging of the C++ embedding crate, cannot proceed past that error. Point wasm-dpp at the dashpay fork, which is the QuantumExplorer branch plus the uint8array fix and the current wasm-bindgen pin, and point rs-platform-version at the crates.io release of versioned-feature-core, which is the same commit the git pin held (the repo's only substantive commit, published as 1.0.0 two days after the pin was written; src/lib.rs is byte-identical). The lockfile loses the two duplicate entries and nothing else changes. Validated: cargo check for platform-version, dash-platform-queries, dash-sdk, rs-sdk-ffi and drive-abci on the host; wasm-dpp, wasm-sdk and wasm-dpp2 check for wasm32-unknown-unknown; the tests-rs-workspace transport-free guards still pass; cargo vendor --locked now succeeds (829 crates).
dash-platform-queries gains build_dpns_preorder_document / build_dpns_domain_document / salted_domain_hash (dpns_usernames) and build_contact_request_document (new dashpay module): the document-assembly halves of dash-sdk's register_dpns_name and create_contact_request as pure functions that take caller-supplied entropy, salt and ciphertexts and touch no network or randomness. dash-sdk's networked flows now call them, so an embedder that assembles its own transitions (the Dash Core platform GUI) and the SDK share one implementation. The builders lean on what the codebase already has rather than re-deriving it: normalization is dpp's consensus convert_to_homograph_safe_chars (the crate's ASCII-only copy, whose non-ASCII behaviour differed from the data trigger's, is replaced by a re-export); the preorder commitment uses dpp::util::hash::hash_double; property names come from the dpns-contract / dashpay-contract constants; and the DashPay byte-array bounds (96 / 48-80 / 38-102) are read from the contract schema instead of being hard-coded. The DPNS domain builder rejects a label the contract's pattern refuses before a preorder is paid for. The entropy/document-id consistency check moves into dpp's DocumentCreateTransitionV0::from_document, where every create-transition caller (SDK, wasm, FFI, embedders) inherits it instead of having to remember an opt-in helper; it refuses with the same InvalidDocumentTransitionIdError Drive would return after the nonce bump. dash-sdk's private ensure_entropy_matches_document_id and its tests are removed in favour of that. API shape (unreleased v4.2-dev): ContactRequestResult now carries the assembled document plus entropy instead of id/owner_id/properties; send_contact_request no longer hand-rebuilds a DocumentV0.
PastaPastaPasta
force-pushed
the
build/vendor-locked-single-source
branch
from
September 8, 2026 21:16
05927f9 to
1e8f252
Compare
PastaPastaPasta
force-pushed
the
feat/shared-dpns-dashpay-builders
branch
from
September 8, 2026 21:16
0631c07 to
5279114
Compare
Base automatically changed from
build/vendor-locked-single-source
to
v4.2-dev
September 8, 2026 21:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
Stacked on #4631 (review from
feat(sdk)onward). Carries forward the pure-builder half of #4619, without that PR's request-drivenFromProof<GetDocumentsRequest>verifier, which the SDK-first C++ embedding (dashpay/dash#7512, next PR in this series) no longer needs: the SDK retains the rich query it built and verifies against it, so no wire request is reconstructed from bytes.dash-sdk'sregister_dpns_nameandcreate_contact_requestassemble DPNS and DashPay documents inline. An embedder that signs with a wallet-held key (Dash Core's platform GUI) needs the same assembly as a pure function over caller-supplied entropy, salt and ciphertexts, and must not reimplement it in C++.What was done?
Pure document builders, in
dash-platform-queries:dpns_usernames::{build_dpns_preorder_document, build_dpns_domain_document, salted_domain_hash}anddashpay::build_contact_request_document, the assembly halves ofdash-sdk'sregister_dpns_name/create_contact_requestas pure functions.dash-sdk's networked flows now call them.convert_to_homograph_safe_chars(the crate'sto_ascii_lowercasecopy, which differed from the data trigger on non-ASCII input, is replaced by a re-export); the preorder commitment usesdpp::util::hash::hash_double; property names come from thedpns-contract/dashpay-contractconstants; the DashPay byte bounds are read from the contract schema'sDocumentPropertyTypesizes. The domain builder rejects a label the contract pattern refuses before a preorder is paid for.DocumentCreateTransitionV0::from_document, so every create-transition caller (SDK, wasm, FFI, embedders) inherits it instead of remembering an opt-in helper; it fails with the sameInvalidDocumentTransitionIdErrorDrive would return after the nonce bump.dash-sdk's privateensure_entropy_matches_document_idis removed.How Has This Been Tested?
dash-platform-queries: 61 lib tests pass, including builder tests against the real DPNS/DashPay system contracts (preorder commitment matches the domain document's salt+label, id derivation, label-pattern rejection, schema byte-bound enforcement).dpp:from_document_refuses_an_id_the_entropy_does_not_derive; thedocument_create_transitionsuites pass.dash-sdk --lib: 185 pass.cargo fmt --checkclean.register_dpns_name/send_contact_request; the on-wire behaviour is byte-identical by construction (assembly moved, not changed) and the unit tests pin the property maps. The C++ crate in the next PR pins the transitions built from these documents byte for byte against rs-dpp-generated vectors.Breaking Changes
API shape on unreleased
v4.2-dev(not on crates.io):dash_sdk::platform::dashpay::ContactRequestResultnow carries the assembleddocumentplusentropyinstead ofid/owner_id/properties. No consumer outsiders-sdkuses it.register_dpns_namenow rejects a label the DPNS contract pattern refuses locally instead of after the preorder is broadcast.Checklist:
For repository code-owners and collaborators only