Skip to content

fix(dashpay): floor contact-account coverage on our own requests (MO-1131) - #1708

Open
HashEngineering wants to merge 1 commit into
feat/kotlin-sdk-phase-1from
fix/contact-pay-coverage-floor
Open

HashEngineering wants to merge 1 commit into
feat/kotlin-sdk-phase-1from
fix/contact-pay-coverage-floor

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem (MO-1131)

Post-cutover, ContactPaymentAddressProvider hands out no contact payment address until every DIP-15 receiving account in the wallet is in the SDK's backfill record, covered from no later than the account's floor (contactHistoryUncoveredBecause, added in #1608).

The app computed that floor as the earliest contact request in either direction. The SDK covers a receiving account from the earliest request we sent (receiving_scan_checkpoint): the contact pays to the xpub inside our request, so their request to us bounds nothing.

Whenever the contact's request came first, the app demanded coverage from below the height the SDK covers from, so the account never read covered. The check is wallet-wide, so Pay to every contact stayed disabled, silently (one "Error loading identity" toast) and permanently — no sync, restart or resync clears it.

Reproduced on testnet 12.0.2 (12000204), SDK store read from the device:

Contact Incoming Outgoing SDK coveredFrom Required (before) Covered
contact sent first 1591826 1591833 1591833 1591826 no
we sent first 1591837 1591837 1591837 1591837 yes

Pay was disabled for both contacts, because the first one fails the wallet-wide check.

Change

  • sentRequestFloors(): a contact's coverage floor comes from our outgoing requests only (the SDK's own rule). Still fails closed: a receiving account exists only for a contact we sent a request to, so every account has a floor; unfinished discovery, a missing account, an unreadable record, a missing entry and coverage starting too late all still refuse.
  • The uncovered reason names each account (id prefix, coveredFrom, required height), so a field log tells a missing entry from a floor mismatch.
  • Regression test with the device's heights (contactHistoryCovered_whenTheContactsRequestCameFirst).

Verification

  • ContactPaymentAddressProviderTest 83/83, SdkWalletBinderTest 138/138.
  • Device: the same wallet and contacts on 257e3e4 + this change. The gate passes ("every contact account covered"), both contacts resolve source=SDK, and Send enables at 0.001 DASH for both. Nothing was sent.
  • /pre-review (gpt-6.1-sol) on this range: 0 blocking, 0 suggestions, 0 nitpicks.

Not in this PR

  • The send screen still gives no clear reason when the gate refuses (one-time "Error loading identity" toast, no retry when coverage or discovery completes).
  • Found while reproducing: the legacy contact-request fetch (ContactRequests.get → platform_mobile::fetch_documents_with_query_and_sdk) can block with no timeout, wedging contact sync ("already running") until the app restarts.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved contact-history coverage checks so they account for outgoing contact requests and the wallet’s birth checkpoint.
    • When coverage is incomplete, the affected receiving accounts and the height needed for coverage are reported, making it easier to identify gaps.

…1131)

Post-cutover, no contact payment address is handed out until every DIP-15
receiving account is in the SDK's backfill record, covered from no later than
the account's floor. The app computed that floor as the earliest contact
request in EITHER direction, while the SDK covers an account from the earliest
request WE sent (receiving_scan_checkpoint): the contact pays to the xpub
inside our request, so their request to us bounds nothing.

When the contact's request came first, the app demanded coverage from below
the height the SDK covers from, so the account never read covered. The check
is wallet-wide, so Pay to every contact stayed disabled, silently and
permanently. Reproduced on testnet 12.0.2: incoming 1591826, outgoing
1591833, covered from 1591833, required 1591826.

- sentRequestFloors(): floors from our outgoing requests only
- the uncovered reason names each account with its coveredFrom and the
  height it needs, so a field log tells a missing entry from a mismatch
- regression test with the device's heights

Verified on the device: with this change Pay enables for both contacts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The SDK chain-view caller now derives contact history floors from outgoing requests. The coverage check compares each receiving account’s coverage with the later of the wallet birth checkpoint and the contact’s earliest outgoing-request height. Uncovered account diagnostics identify up to five accounts.

Changes: Contact history coverage

Layer / File(s) Summary
Outgoing request floors and coverage diagnostics
wallet/src/de/schildbach/wallet/service/platform/sdk/ContactPaymentAddressProvider.kt, wallet/test/de/schildbach/wallet/service/platform/sdk/ContactPaymentAddressProviderTest.kt, wallet/test/de/schildbach/wallet/service/platform/sdk/SdkWalletBinderTest.kt
The chain-view caller passes floors derived from outgoing requests to the coverage check. The check reports accounts with missing or late coverage and names up to five accounts. Tests cover outgoing-request floors, incoming requests, late coverage, and missing account entries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 73a04

This change makes the contact-payment coverage check use only outgoing contact requests, so a contact's earlier incoming request no longer disables payments to all contacts. It also improves the uncovered-account diagnostics. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: contact-account coverage floors are now computed from the user's own outgoing contact requests (fix(dashpay), MO-1131). The raw summary confirms the floor now comes only fr…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: contact-account coverage floors are now computed from the user's own outgoing contact requests (fix(dashpay), MO-1131). The raw summary confirms the floor now comes only from outgoing requests, grouped by contact with the earliest creation height, and the test suite adds a regression case for that rule. The title is specific and matches the main change, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 78f0ae2 and 73a0463.

Files selected for processing: 3

  • wallet/src/de/schildbach/wallet/service/platform/sdk/ContactPaymentAddressProvider.kt
  • wallet/test/de/schildbach/wallet/service/platform/sdk/ContactPaymentAddressProviderTest.kt
  • wallet/test/de/schildbach/wallet/service/platform/sdk/SdkWalletBinderTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@thepastaclaw

thepastaclaw commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit 73a0463) · triage: normal

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

The change correctly aligns contact-account coverage floors with the SDK's outgoing-request checkpoint rule while preserving fail-closed behavior for incomplete discovery, missing accounts, unreadable records, missing entries, and late coverage. The helper, production caller, and regression test are consistent, and the CI build and check jobs passed. No actionable in-scope findings were identified.

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: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a contained behavioral fix to wallet-wide contact payment eligibility and coverage validation, with meaningful SDK synchronization logic and regression tests, but it does not change a critical surface such as funds movement, cryptography, consensus, or storage migration.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer

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