Skip to content

chore: backport v3.1-dev into feat/platform-wallet + DPNS suffix fix + UTXO double-spend prevention#3465

Closed
lklimek wants to merge 41 commits into
feat/platform-walletfrom
backport/v3.1-dev-into-platform-wallet
Closed

chore: backport v3.1-dev into feat/platform-wallet + DPNS suffix fix + UTXO double-spend prevention#3465
lklimek wants to merge 41 commits into
feat/platform-walletfrom
backport/v3.1-dev-into-platform-wallet

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented Apr 9, 2026

Summary

Merges 39 upstream v3.1-dev commits into feat/platform-wallet and adds two targeted fixes backported from dash-evo-tool. The feat/platform-wallet branch hosts the new rs-platform-wallet crate — wallet logic extracted from dash-evo-tool into platform so both DET and the Swift SDK can share it.

What moved from dash-evo-tool to this repo

The feat/platform-wallet refactor created packages/rs-platform-wallet/ with code previously in dash-evo-tool:

From dash-evo-tool Now in platform
src/spv/manager.rs — SPV lifecycle, event handling, broadcast rs-platform-wallet/src/spv/{mod,runtime,event_forwarder}.rs — rewritten around WalletManager
src/backend_task/dashpay/dip14_derivation.rs — DIP-14 key derivation rs-platform-wallet/src/wallet/dashpay/dip14.rs
src/model/wallet/asset_lock_transaction.rs — asset lock tracking rs-platform-wallet/src/wallet/asset_lock/
Wallet state, balance, UTXO management (scattered) rs-platform-wallet/src/wallet/core/wallet.rs — unified CoreWallet

The old MempoolManager is eliminated. WalletManager<PlatformWalletInfo> handles transaction processing directly, with IS locks arriving as events via SpvEventForwarder → broadcast channel.

Meaningful changes

Backported from v3.1-dev (39 commits)

  • Test coverage — Expanded suites for drive-abci, dpp, drive, platform-value (token operations, identity state transitions, vote resolution, document serialization)
  • CI — Excluded state transition boilerplate and non-unit-testable code from coverage metrics
  • Dependencies — rust-dashcore bumped to 88e8a9aa
  • SDK — Regtest support for trusted context provider activation height
  • Swift SDK — Pending transaction display fix, dropped x86_64 architecture

Fix: Case-insensitive .dash suffix (SDK)

File: packages/rs-sdk/src/platform/dpns_usernames/mod.rs

resolve_dpns_name() stripped the .dash suffix using suffix == ".dash" — case-sensitive. Inputs like "Alice.DASH" or "alice.Dash" would fail to match, causing the full string (including .dash) to be normalized and used as the label → DPNS lookup miss.

Fix: suffix.eq_ignore_ascii_case(".dash") — matches any casing of the .dash suffix.

Backported from dash-evo-tool PR #810 which fixed the same bug in DET's local DPNS helpers.

Fix: UTXO double-spend prevention (platform-wallet)

File: packages/rs-platform-wallet/src/wallet/core/wallet.rs

CoreWallet::send_transaction() had a race window:

  1. Read spendable UTXOs (acquires read lock on self.state, drops it)
  2. Select UTXOs, build tx, sign — no lock held
  3. Broadcast — no lock held

Between steps 1 and 3, concurrent callers could select the same UTXOs. The network rejects the conflicting transaction (no IS lock issued), but the user sees a failed payment with no clear error.

Fix: After signing (step 5), acquire write lock and call check_core_transaction(&tx, TransactionContext::Mempool, true, true) to immediately mark spent UTXOs in the wallet state. The lock is dropped before the async broadcast. This mirrors the fix in dash-evo-tool v1.0-dev commit f4d3b3b3 which called process_mempool_transaction() for the same reason.

Conflict resolutions

Minimal — only 2 overlapping files:

File Resolution Detail
Cargo.lock Accepted theirs v3.1-dev has canonical dependency tree
Cargo.toml Combined Ours rs-platform-wallet workspace member + theirs dependency bumps (rust-dashcore)

Companion PR

🤖 Co-authored by Claudius the Magnificent AI Agent

QuantumExplorer and others added 30 commits April 2, 2026 13:48
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ement (part 1) (#3393)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…#3427)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n encode + exclusions (#3431)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… converters, and replacement (#3428)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r FFI (#3433)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Borja Castellano <borja.castellano@dash.org>
…3434)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… API (#3423)

Co-authored-by: PastaClaw <thepastaclaw@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Quantum Explorer <quantum@dash.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… validation (#3438)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ncoding (#3439)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
#3441)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…zation, and address witness (#3440)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…erations, and diff (#3437)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…3442)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…erage (#3443)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d vote resolution (#3449)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…scripts, and asset lock proofs (#3450)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
QuantumExplorer and others added 10 commits April 8, 2026 10:06
…and identity nonces (#3453)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s, and asset lock proofs (#3452)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ments, and methods (#3454)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… keys in creation (#3456)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ncy action, and destroy frozen funds (#3459)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…height (#3464)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-into-platform-wallet

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	packages/rs-platform-wallet/src/platform_wallet_info/wallet_info_interface.rs
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

Important

Review skipped

Draft detected.

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

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 865dc6c5-931d-410e-a9e8-507339fdc55d

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backport/v3.1-dev-into-platform-wallet

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

📖 Book Preview built successfully.

Download the preview from the workflow artifacts.
To view locally: download the artifact, unzip, and open index.html.

Updated at 2026-04-09T10:50:02.635Z

- SDK: resolve_dpns_name() now handles ".DASH", ".Dash" etc. via
  eq_ignore_ascii_case (backport of dash-evo-tool PR #810 fix)
- platform-wallet: send_transaction() now calls check_core_transaction()
  after signing to mark spent UTXOs before broadcast, preventing
  concurrent callers from selecting the same inputs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek changed the title chore: backport v3.1-dev into feat/platform-wallet chore: backport v3.1-dev into feat/platform-wallet + DPNS suffix fix + UTXO double-spend prevention Apr 9, 2026
@lklimek lklimek closed this Apr 9, 2026
@lklimek lklimek deleted the backport/v3.1-dev-into-platform-wallet branch April 9, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants