Skip to content

feat(platform-wallet): add gap-limit identity discovery scan#3188

Draft
QuantumExplorer wants to merge 1 commit intov3.1-devfrom
feat/identity-discovery-scan
Draft

feat(platform-wallet): add gap-limit identity discovery scan#3188
QuantumExplorer wants to merge 1 commit intov3.1-devfrom
feat/identity-discovery-scan

Conversation

@QuantumExplorer
Copy link
Member

Issue being fixed or feature implemented

Implements DashSync-style gap-limit identity discovery for the platform-wallet crate, enabling wallet sync to find registered identities by scanning DIP-13 authentication key hashes against Platform.

What was done?

New: Identity Discovery Scanner

Added discover_identities() and discover_identities_with_contacts() methods to PlatformWalletInfo that:

  1. Derive ECDSA authentication keys at consecutive DIP-13 indices (m/9'/COIN_TYPE'/5'/0'/0'/identity_index'/0')
  2. Hash each public key with RIPEMD160(SHA256) to produce a 20-byte hash
  3. Query Platform via Identity::fetch(&sdk, PublicKeyHash(hash))
  4. Add discovered identities to the IdentityManager
  5. Stop scanning after gap_limit (typically 5) consecutive misses
  6. Optionally fetch DashPay contact requests for each discovered identity

This mirrors the pattern used by DashSync iOS (DSIdentitiesManager.retrieveIdentitiesByKeysWithCompletion:) which derives 5 consecutive keys beyond the last known used identity index and batch-queries Platform.

Refactored: Shared Utilities

  • Extracted key derivation logic into key_derivation.rs (derive_identity_auth_key_hash)
  • Moved parse_contact_request_document to shared location in mod.rs
  • matured_transactions.rs now uses these shared helpers (no API changes)

How Has This Been Tested?

  • cargo check -p platform-wallet passes cleanly
  • Existing tests pass unchanged

Breaking Changes

None. All existing public APIs are unchanged.

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 tests
  • I have made corresponding changes to the documentation

For future work:

  • Expose via FFI for Swift SDK integration
  • Wire into SPV sync completion event
  • Add unit tests with mock SDK

🤖 Generated with Claude Code

Add DashSync-style identity discovery to PlatformWalletInfo that
scans consecutive DIP-13 authentication key indices and queries
Platform to find registered identities during wallet sync.

New methods:
- discover_identities: gap-limit scan using PublicKeyHash queries
- discover_identities_with_contacts: same + fetches DashPay contacts

Refactors shared key derivation and contact request parsing into
reusable modules used by both discovery and asset lock processing.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions bot added this to the v3.1.0 milestone Mar 5, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 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: 45da88c4-b2ec-47d0-92ed-064c0d41421c

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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/identity-discovery-scan

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
Contributor

github-actions bot commented Mar 5, 2026

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "35f483c483c97d2313c5429ca821e18553841a6defefc3cc9acbcd2a95eb115a"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

@thepastaclaw
Copy link
Collaborator

@coderabbitai review

@thepastaclaw
Copy link
Collaborator

Follow-up refactor in #3206 — extracts duplicated contact request logic, replaces eprintln with tracing, names magic constants, and logs previously-swallowed parse errors.

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.

2 participants