Skip to content

feat: Dash Platform client library behind --enable-platform-gui - #7626

Draft
PastaPastaPasta wants to merge 6 commits into
dashpay:developfrom
PastaPastaPasta:feat/platform-client-lib
Draft

feat: Dash Platform client library behind --enable-platform-gui#7626
PastaPastaPasta wants to merge 6 commits into
dashpay:developfrom
PastaPastaPasta:feat/platform-client-lib

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Second PR of the DashPay series (stacked on #7623; tracking: #7512). DashPay needs a client for Dash Platform: DAPI transport, cryptographic proof verification, DPP document/identity handling and state-transition construction. This PR adds that client library, compiled and linked only under the new --enable-platform-gui configure flag. dashd and every non-GUI binary are byte-for-byte unaffected in default builds.

What was done?

First two commits are #7623 (depends: Rust toolchain + platform_cxx behind PLATFORM_GUI=1) — review the commits after those.

  • --enable-platform-gui: requires the GUI + wallet, autodetects mbedtls (with brew support on macOS), locates the Platform CXX archive via PLATFORM_CXX_{CFLAGS,LIBS} (exported by depends' config.site), and link-tests it at configure time.
  • src/platform/ (libdash_platform.a):
    • transport/: gRPC-Web-over-TLS DAPI client on mbedtls — HTTP/1.1 + chunked/dechunking, protobuf codecs, per-query endpoint pinning with scoped freshness, retry/rotate-out.
    • drive/: GroveDB query construction and proof verification through the Platform-owned Rust bridge (platform_ffi), root-hash-bound to the quorum-signed metadata.
    • dpp/: identity/document decoding and state-transition build+sign (signable bytes == broadcast bytes).
    • walletrecords.h/cpp: versioned serialization for DashPay's per-wallet records (identity record, payment cursors) — pure functions, storage arrives with the GUI PR.
  • Tests (all behind the flag): platform_client_tests, platform_dpp_tests, platform_drive_tests with Rust-generated fixed vectors (GroveDB proofs, DPP identities, state transitions, drive queries, quorum signatures), Platform-record + payment-cursor coverage in platformkeys_tests, and a platform_bridge fuzz target over the bridge's decode/verify entry points.
  • CI: the linux64_platform_gui lane (added in build: consume Dash Platform CXX bindings from depends #7623) now configures with --enable-platform-gui and runs the platform suites.

How Has This Been Tested?

  • Extracted verbatim from the composite integration branch (green CI, 49/49 checks, including this lane) where the same code has been through: a 9-agent security-focused review round (transport overflow, proof-binding and "empty result == proven absent" findings all fixed on the branch), thepastaclaw review rounds, and a live-testnet E2E (identity registration → DPNS username → contact request round-trip → contact payment against real evonodes).
  • Locally: full --enable-platform-gui build and the platform unit suites + fuzz smoke on this branch (macOS arm64).
  • A descriptor-wallet E2E rerun against this series is planned once the GUI PR is up (the previous E2E predates the descriptor-only gate).

Breaking Changes

None. Everything is behind --enable-platform-gui (default off).

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

native_rust installs the pinned prebuilt Rust toolchain as a native package and rust_stdlib provides the precompiled standard library for every supported cross target; contrib/devtools/update-rust-hashes.py maintains both pins together. funcs.mk gains a cargo environment wired to the depends cross toolchain and a per-package crate-vendoring template: any package that declares a vendored archive name and a cargo manifest gets a vendor-<package>-crates target and extracts the archive before building, so cargo builds run locked and fully offline.
…I knob

PLATFORM_GUI=1 adds mbedtls, native_protobuf, tenderdash_sources and platform_cxx to the package set. platform_cxx builds libdash_platform_cxx.a and its installed headers from a pinned dashpay/platform commit (packages/rs-platform-cxx), offline via the per-package vendored crates. config.site.in exports enable_platform_gui and PLATFORM_CXX_{CFLAGS,LIBS} discovery for the configure flag that arrives with the first C++ consumer.
…lane

The new lane builds depends with PLATFORM_GUI=1 (producing and hash-verifying the Platform CXX archive offline from vendored crates), then builds dash-qt against that prefix and runs the unit tests. The cache-sources producer generates and caches the platform-cxx vendored-crates archive, handing it to same-run consumers as an artifact on cache miss.

The --enable-platform-gui configure flag is added to this lane's BITCOIN_CONFIG by the Platform client library PR; until then the lane proves the depends knob and prefix link-compatibility. build.yml runs PR validation from the base branch (pull_request_target), so the lane first runs on push CI for this branch and takes effect for PRs after merge.
libdash_platform.a is a DAPI client for the Dash Platform GUI: a gRPC-Web-over-TLS transport on mbedtls with per-query endpoint pinning and scoped freshness, GroveDB drive queries whose proofs verify through the Platform-owned CXX bridge bound to the quorum-signed root, DPP identity/document decoding and state-transition construction where the signable bytes are the broadcast bytes, and versioned serialization for DashPay's per-wallet records. The new --enable-platform-gui configure flag requires the GUI and wallet, autodetects mbedtls and link-tests the Platform CXX archive from depends. Nothing outside the flag changes: dashd and default builds do not compile or link any of this.
Unit suites for the transport (dechunking, retry, freshness), DPP and drive layers run against Rust-generated fixed vectors: GroveDB proofs (keys, ranges, subqueries, absence, references, sum trees), DPP identities and state transitions, drive queries and quorum signatures. platformkeys_tests gains Platform record round-trip and payment-cursor coverage, and a fuzz target exercises the bridge's decode and verify entry points.
…lane

The lane introduced with the depends knob now passes --enable-platform-gui to configure, so the platform unit suites run in CI.
@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant