Skip to content

fix(wallet): surface unresolved Platform funding transfers - #1028

Draft
lklimek wants to merge 36 commits into
v1.0-devfrom
fix/orphaned-tx
Draft

lklimek wants to merge 36 commits into
v1.0-devfrom
fix/orphaned-tx

Conversation

@lklimek

@lklimek lklimek commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: Shows unresolved Core-to-Platform funding in transaction history and updates the wallet backend to Platform #5528. Blocked: pinned to dashpay/platform#5528 (stack #5150 → #5207 → #5210 → #5528), stays a draft until that stack merges into v5.1-dev.

User story

As a wallet user, I want interrupted transfers to remain visible, with a clear explanation of their known status.

Scenario

Funding entries appear alongside ordinary Core transactions, with details and recorded conflicts. Recovered historical funding and completed wallet drains are not presented as pending. Selected-wallet history resync retains screen-owned task-result routing.

Detailed discussion

  • Pin: all four Platform dependencies are pinned to 344e110a630a0ca8060e38299d777cee8d7232e3, the head of fix(platform-wallet): retain drain operation history through funding conflicts platform#5528. That stack now contains v5.1-dev 9fefdf1b4, and with it the 575d961f pin v1.0-dev builds on. The rust-dashcore v0.45 crypto adaptation comes from v1.0-dev (fix(security)!: sign with the self-erasing EcdsaSecretKey #1127, chore(deps): update Platform to v5.1-dev 575d961f #1132), including low-R signing.
  • Kept behaviour: confirmed-spend checks, transfer assessment and history resync. Cancellation and verified delivery checks remain outside this feature.
  • Confirmed-spend check: skips height-only Core rows, which carry no record and so no inputs. Upstream V020 leaves one for every kept coin's mined funding, and recordless UTXOs write them at runtime. Without the skip, an upgraded wallet with a pending spend would refuse every Core send, identity funding and shield.
  • Bridging old profiles: recognized historical profiles are upgraded through a populated intermediate database before the upstream migrations run. The result is validated, the original backup is retained, and the upgrade is published atomically.
  • Upstream V020 (core_transaction_accounting): drops the mined Core history an SPV rescan redelivers and rewinds each filter checkpoint to below wallet birth. It keeps unmined transactions and spent coins whose spender is not known to be mined; their mined funding loses its block details.
    • The bridge recognizes V020 by name and checks the rewind.
    • It accepts Core rows only as an unchanged subset of the original. Kept mined transactions must be stripped exactly as V020 does.
    • Every non-Core row must be preserved.
    • This verification is the same code as fix(wallet): preserve consumed asset-lock reports with SQLite #1036 (see below).
  • Upstream V021 (asset_lock_conflict_evidence): adds the conflicted asset-lock status and an operation revision, and copies every lock unchanged.
    • DET gives a conflicted lock a plain status sentence.
    • The upstream AssetLockConflicted error gets a dedicated AssetLockFundingConflicted message on the shield, identity create, top-up and Platform address funding paths, instead of the generic "retry" advice.
    • The identity create and top-up pickers no longer offer conflicted or completed-drain locks.
    • This handling is defensive. Upstream marks only operation-bound locks (wallet drains) as conflicted, and DET creates none today. A Core-to-Platform funding lock whose coins are swept is removed upstream rather than marked conflicted, so it leaves the unresolved-transfer list instead of showing a conflict.
    • WalletStorageError variants box their source.

Commits taken from sibling PRs

The 344e110a6 pin cannot build or migrate profiles without these, so this PR now carries them (cherry-pick -x):

#1106 and #1036 drop these commits when they are rebuilt on this branch.

Merge blockers and compatibility limits

  • The Platform pin is not yet on v5.1-dev. The strict ancestry guard (scripts/migration-fixtures/check-pin-ancestry.sh) is unchanged and fails deliberately. The migration fingerprint is regenerated for the 21 migrations at the pin.
  • Legacy mainnet identity discovery uses an unsupported response envelope in this SDK. Version detection alone does not restore that decoder.
  • Profiles from a divergent migration history are refused safely and left unchanged. This includes an earlier pin's V019 (such as c0425f7) and profiles opened by earlier builds of this PR at f7500221, whose V007 and V021__core_transaction_accounting differ from V020/V021 here. Those builds were never merged.
  • Migration coverage gap: the archived fixtures are wallet-only and hold no Core history. V020's kept-spend path and the confirmed-spend check after the upgrade are covered only by synthetic SQL in unit tests, not by a captured V019 profile with mined history and a pending spend.

Validation

At pin 344e110a6:

  • Formatting and cargo clippy --all-features --all-targets -- -D warnings are clean.
  • All 3,902 library tests pass.
  • The archived-profile migration matrix runs 7 downloaded fixtures, password scenarios skipped locally.
  • The real weekly-profile bridge test passes.
  • The request_routing UI tests pass.
  • The top_up_identity and add_new_identity UI tests pass.
  • Each new regression test failed before its fix: conflicted and drained locks in the transfer list and the pickers, conflicted-lock errors on the identity funding paths, height-only rows in the confirmed-spend check, and the bridge's kept-spend check.

No live fund-moving tests were run.

🤖 Co-authored by Claudius the Magnificent AI Agent

Expose pending funding and provisional input conflicts in wallet-level history.
Keep cancellation and release disabled until upstream supports safe reconciliation.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

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

@thepastaclaw

thepastaclaw commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 3c2c37a. Normal review starts when eligible; priority review starts as soon as a slot is available.

Use arrays in fixed-size test fixtures and run documentation tests only
through the main Cargo test suite. Replace the retired Cargo action with
a direct command and align CI guidance with manual draft checks.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@lklimek lklimek added the claudius-review Triggers automated code review using claudius plugin, runs as a CI job label Sep 25, 2026
lklimek and others added 17 commits September 25, 2026 10:49
Merge funding observations with Core history and expose row details.
Separate recovered historical funding from pending transfers, label local
refresh accurately, and explain the unsupported cancellation action.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Group compact transaction buttons in the final Actions column. Reload
funding records after wallet refresh, coalescing an in-flight follow-up.
Document the distinction between live conflict cleanup and the missing
historical asset-lock cancellation operation upstream.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Move key import, refresh, and the Testnet faucet into Advanced.
Request a selected-wallet Core scan from genesis without deleting records.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Keep the initial-sync overlay open until the selected wallet and Core
pipeline catch up. Scope completion to the dispatched scan and retain
the existing two-step cancellation flow.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Use platform PR #4777 head f2c162ab and adapt to the new document
property types and identity balance error.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Restore the original Platform pin. Persist wallet-scoped history reset
markers and rebuild display history from block observations, including
records whose finalized events upstream omits. Preserve upstream spend
accounting, reservations, and Platform transfer data.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Check live funding outputs against persisted confirmed transaction records
before Core payments and new asset locks. Preserve the guard across visible
history resets, and fail closed when records cannot be checked.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Track platform PR #4814 at 81f1a1c7 and adapt document property types
and identity balance errors to its updated base.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Track fix/pr-5126 at 60e1f6de and handle the new invitation error
in exhaustive wallet error classifiers.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Pin fix/pr-5126 at 82cec940 with rust-dashcore 18f7f3e6.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Platform moves to 37ea1bbb; rust-dashcore remains at 18f7f3e.
The upstream diff changes only its PR hygiene workflow.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Use Platform c0425f7b to rebuild confirmed spending and finality guards
from persisted Core history before sync can redeliver old funding.
Keep the existing rust-dashcore pin and DET pre-send consistency check.

Co-authored-by: Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
Use the asset-lock input snapshot before returning funded test wallets,
recover prior test funds before budget checks, and await shielded balance
propagation. Raise the withdrawal amount and match asset locks by TXID and
duffs. Retain diagnostics exposing the remaining DET signing-key lookup bug.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Resolve CHANGELOG.md conflicts by keeping both sides' additive entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lklimek added a commit that referenced this pull request Oct 2, 2026
…1042)

* feat(ui): add toolbar dropdown menu support

Bring over the generic toolbar dropdown infrastructure from #1028
(ToolbarMenuItem and DesiredAppAction::Menu, rendered as a popup by the
top panel) so other screens can group actions behind one button.

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

* fix(identity): let users load an identity from the Identities page

Users with identities already loaded had no way to reach "Load an
existing identity" from the picker: the add card promised create or
load but only opened creation, and the identity pill's dropdown needs
a selected identity.

Add an "Add" dropdown to the Identities top bar (create, load, and the
Power-user test-identities entry, matching the pill's dropdown) and make
the "Add a new identity" card open the same choices. Both route through
the hub's existing breadcrumb add effects, so creation keeps the
selected wallet preselected.

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

* fix(identity): drop the unwired "Create multiple test identities" entry

No bulk-creation screen exists, so the entry only opened the single
identity creation screen. Remove it from the Add menu and the identity
pill dropdown until IDH-005 is implemented. Also route the picker scroll
test through the Add card's new create/load menu.

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

* fix(ui): share action menus and cover identity wallet preselection

Clarify the identity menu documentation, consolidate four popup renderers,
and assert selected-wallet preservation through toolbar and picker creation.

Co-Authored-By: OpenAI Codex <noreply@openai.com>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

* fix(ui): align dropdown rows and enlarge menu indicators

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@lklimek lklimek added the blocked Blocked by something external to this issue label Oct 2, 2026
@lklimek
lklimek added this pull request to stack #1101 October 21, 2026 12:18
Preserve confirmed-spend preflight, scoped history resync, and pending
funding history alongside screen-owned result routing and protected keys.
Keep the original Platform pin and strict migration ancestry guard.
Retain FullResync dispatch ownership and cover it with an offline test.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Claude GPT-6 <noreply@anthropic.com>
…tion semantics

Pin Platform to f7500221 and adapt typed Core crypto and SDK APIs while preserving signing bytes and approved contest funds. Run the historical wallet bridge through upstream V021 on populated staging data before verified publication.

Keep divergent accounting histories refused and the strict ancestry guard unchanged. The dependency branch and mainnet discovery compatibility remain draft readiness blockers.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@lklimek
lklimek marked this pull request as ready for review October 21, 2026 18:20
@lklimek
lklimek marked this pull request as draft October 21, 2026 18:20

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final validation — Phase 2 only (no Phase 1 for this repository)

Static verification confirms five blocking issues and one performance suggestion, including the SDK compatibility regression and correctness gaps in spend validation and history resync. Latest CI also fails: Test Suite reports three dependency-sensitive library failures and an archive-migration sync timeout, Clippy reports errors in changed code, and Platform pin guard rejects the side-branch revision. No local builds or tests were run.

🔴 5 blocking | 🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a large cross-cutting diff that changes wallet funding, cryptographic signing and key handling, peer-facing Platform compatibility, and wallet database migration behavior in files such as src/wallet_backend/pending_transfers.rs, src/wallet_backend/det_signer.rs, src/wallet_backend/platform_compatibility/engine.rs, and src/wallet_backend/snapshot.rs.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `Cargo.toml`:
- [BLOCKING] Cargo.toml:27-35: Restore legacy identity-discovery compatibility before adopting this SDK pin
  The base SDK accepts the legacy non-unique identity proof at protobuf field 2. This pin instead reserves field 2 and accepts only the new proof at field 4, so decoding a legacy response discards its proof before verification. Both load_user_identity_from_wallet() and discover_identities_gap_limited() still use NonUniquePublicKeyHashQuery, whose pinned implementation requires proofs; they therefore cannot discover identities through legacy mainnet responses. Selecting protocol 13 cannot recover the discarded field. This is an introduced compatibility regression despite being acknowledged in the draft description. Incorporate the owning SDK's compatibility decoder and verifier tracked in https://github.com/dashpay/platform/pull/5515, then repin all four Platform dependencies together.

In `src/wallet_backend/spend_history.rs`:
- [BLOCKING] src/wallet_backend/spend_history.rs:56-59: Do not treat replaced-branch transaction rows as current confirmed spends
  At the pinned Platform revision, changeset/core_bridge.rs maps ChainTruncated to an empty changeset and explicitly leaves the replaced branch's transaction rows in storage. Meanwhile, key-wallet restores inputs spent by a dropped, non-InstantSend transaction to the live UTXO set. This query treats the stale row's non-null height as authoritative and rejects the restored input with WalletConfirmedInputConflict. Because candidates includes every funding-account UTXO rather than just the inputs selected for the requested payment, one such contradiction also blocks unrelated payments and new asset locks. Full resync retains these upstream rows and cannot reliably remove the obstruction. Resolve canonical-history persistence in the owning upstream layer, tracked in https://github.com/dashpay/platform/pull/5384, or stop treating stale block observations as a current confirmed-spend verdict. Add a confirmation → truncation → payment regression using the restored live state.
- [SUGGESTION] src/wallet_backend/spend_history.rs:56-82: Use the indexed input history instead of scanning every confirmed transaction
  Every guarded payment or new asset lock loads all confirmed transaction IDs and then performs a separate get_core_tx_record() call, including record deserialization, for each transaction before comparing its inputs with the candidate set. Send preparation therefore scales with the wallet's complete confirmed history even when the requested payment uses only a few inputs. The pinned V021 schema creates core_transaction_inputs with an index on (wallet_id, outpoint), and upstream indexes raw transaction inputs when persisting records. Use that indexed lookup to identify candidate spenders and point-read only the matching records, preferably through an upstream storage API. Preserve fail-closed behavior when index completeness cannot be established.

In `src/wallet_backend/snapshot.rs`:
- [BLOCKING] src/wallet_backend/snapshot.rs:793-800: Persist restored history progress before an interrupted rescan resumes
  Restoring a scanned transaction removes its reset entry only in memory. The durable det:core_history_reset:v1 marker is reduced only by finish_history_resync(), after the entire scan completes. For an originally confirmed transaction T, an interrupted scan can restore T and persist an upstream checkpoint beyond its block while leaving the original (T, block_hash) marker unchanged. On restart, restore_history_reset() hides T again because its block hash still matches, but upstream resumes beyond T's block and does not replay it. The pinned rescan API explicitly documents that resumed scans continue from their persisted progress, and DET has no startup path that restarts the original replay or finalizes its marker. Persist retirement of restored entries, or durably restart the original replay until finalization; cover reopening from a checkpoint beyond an already-restored transaction.

In `src/ui/wallets/wallets_screen/mod.rs`:
- [BLOCKING] src/ui/wallets/wallets_screen/mod.rs:1137-1143: Register the actual Full resync action as a screen-owned dispatch
  The production menu emits an ordinary BackendTask action. AppState records request_owners only for BackendTaskWithContext; prepare_backend_task_context() creates a dispatch ID for the resync overlay but never registers a screen owner for this path. Consequently, completion still routes to whichever screen is visible. Stop syncing lowers the overlay before the backend polling loop reports interruption, so the user can navigate and deliver that error to an unrelated screen. This violates the project's screen-owned task-dispatch rule and the PR's stated routing guarantee. Dispatch Full resync through BackendTaskWithContext with a PendingRequest owned by the wallet screen. The new routing test manually pre-records an owner, so extend it to exercise the actual menu-emitted action rather than assuming the missing registration.

In `src/ui/wallets/wallets_screen/pending_transfers.rs`:
- [BLOCKING] src/ui/wallets/wallets_screen/pending_transfers.rs:137-140: Do not label a local confirmation timestamp as UTC
  format_transaction_timestamp() calls model::datetime::local_date_time_seconds(), which renders the instant in the user's local time zone. Appending UTC therefore gives users outside UTC an incorrectly labelled confirmation time, potentially on a different calendar date from the actual UTC date. Remove the suffix to match the transaction table, or obtain an accurate zone label through the datetime model.

Comment thread Cargo.toml Outdated
Comment on lines 27 to 35
@@ -34,15 +34,15 @@ dash-sdk = { git = "https://github.com/dashpay/platform", rev = "9f7ed16935bd540
"core_spv",
"shielded",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Restore legacy identity-discovery compatibility before adopting this SDK pin

The base SDK accepts the legacy non-unique identity proof at protobuf field 2. This pin instead reserves field 2 and accepts only the new proof at field 4, so decoding a legacy response discards its proof before verification. Both load_user_identity_from_wallet() and discover_identities_gap_limited() still use NonUniquePublicKeyHashQuery, whose pinned implementation requires proofs; they therefore cannot discover identities through legacy mainnet responses. Selecting protocol 13 cannot recover the discarded field. This is an introduced compatibility regression despite being acknowledged in the draft description. Incorporate the owning SDK's compatibility decoder and verifier tracked in dashpay/platform#5515, then repin all four Platform dependencies together.

source: gpt-6.1-sol (phase2-reviewer: general)

Comment on lines +56 to +59
let mut query = connection
.prepare(
"SELECT txid FROM core_transactions WHERE wallet_id = ?1 AND height IS NOT NULL",
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Do not treat replaced-branch transaction rows as current confirmed spends

At the pinned Platform revision, changeset/core_bridge.rs maps ChainTruncated to an empty changeset and explicitly leaves the replaced branch's transaction rows in storage. Meanwhile, key-wallet restores inputs spent by a dropped, non-InstantSend transaction to the live UTXO set. This query treats the stale row's non-null height as authoritative and rejects the restored input with WalletConfirmedInputConflict. Because candidates includes every funding-account UTXO rather than just the inputs selected for the requested payment, one such contradiction also blocks unrelated payments and new asset locks. Full resync retains these upstream rows and cannot reliably remove the obstruction. Resolve canonical-history persistence in the owning upstream layer, tracked in dashpay/platform#5384, or stop treating stale block observations as a current confirmed-spend verdict. Add a confirmation → truncation → payment regression using the restored live state.

source: gpt-6.1-sol (phase2-reviewer: general)

Comment on lines +793 to +800
for txid in txids {
if let Some(mut tx) = archived.remove(txid) {
if tx.block_hash != Some(block_hash) || !tx.is_confirmed() {
tx.status = TransactionStatus::Confirmed;
}
tx.height = Some(height);
tx.block_hash = Some(block_hash);
records.entry(*txid).or_insert(tx);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Persist restored history progress before an interrupted rescan resumes

Restoring a scanned transaction removes its reset entry only in memory. The durable det:core_history_reset:v1 marker is reduced only by finish_history_resync(), after the entire scan completes. For an originally confirmed transaction T, an interrupted scan can restore T and persist an upstream checkpoint beyond its block while leaving the original (T, block_hash) marker unchanged. On restart, restore_history_reset() hides T again because its block hash still matches, but upstream resumes beyond T's block and does not replay it. The pinned rescan API explicitly documents that resumed scans continue from their persisted progress, and DET has no startup path that restarts the original replay or finalizes its marker. Persist retirement of restored entries, or durably restart the original replay until finalization; cover reopening from a checkpoint beyond an already-restored transaction.

source: gpt-6.1-sol (phase2-reviewer: general)

Comment on lines +1137 to +1143
action: hd
.map(|wallet| {
DesiredAppAction::BackendTask(Box::new(BackendTask::CoreTask(
CoreTask::FullResyncWallet {
seed_hash: wallet.read_recover().seed_hash(),
},
)))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Register the actual Full resync action as a screen-owned dispatch

The production menu emits an ordinary BackendTask action. AppState records request_owners only for BackendTaskWithContext; prepare_backend_task_context() creates a dispatch ID for the resync overlay but never registers a screen owner for this path. Consequently, completion still routes to whichever screen is visible. Stop syncing lowers the overlay before the backend polling loop reports interruption, so the user can navigate and deliver that error to an unrelated screen. This violates the project's screen-owned task-dispatch rule and the PR's stated routing guarantee. Dispatch Full resync through BackendTaskWithContext with a PendingRequest owned by the wallet screen. The new routing test manually pre-records an owner, so extend it to exercise the actual menu-emitted action rather than assuming the missing registration.

source: gpt-6.1-sol (phase2-reviewer: general)

Comment on lines +137 to +140
.map(|time| format!(
"{date} UTC",
date = Self::format_transaction_timestamp(time)
))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Do not label a local confirmation timestamp as UTC

format_transaction_timestamp() calls model::datetime::local_date_time_seconds(), which renders the instant in the user's local time zone. Appending UTC therefore gives users outside UTC an incorrectly labelled confirmation time, potentially on a different calendar date from the actual UTC date. Remove the suffix to match the transaction table, or obtain an accurate zone label through the datetime model.

Suggested change
.map(|time| format!(
"{date} UTC",
date = Self::format_transaction_timestamp(time)
))
.map(Self::format_transaction_timestamp)

source: gpt-6.1-sol (phase2-reviewer: general)

Comment on lines +56 to +82
let mut query = connection
.prepare(
"SELECT txid FROM core_transactions WHERE wallet_id = ?1 AND height IS NOT NULL",
)
.map_err(sqlite_error)?;
let rows = query
.query_map([wallet_id.as_slice()], |row| row.get::<_, Vec<u8>>(0))
.map_err(sqlite_error)?;
let mut txids = Vec::new();
for row in rows {
let bytes = row.map_err(sqlite_error)?;
let txid = Txid::from_slice(&bytes).map_err(|source| {
sqlite_error(rusqlite::Error::FromSqlConversionFailure(
0,
rusqlite::types::Type::Blob,
Box::new(source),
))
})?;
txids.push(txid);
}
drop(query);
drop(connection);
for txid in txids {
let record = self
.inner
.wallet_persister
.get_core_tx_record(wallet_id, &txid)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟡 Suggestion: Use the indexed input history instead of scanning every confirmed transaction

Every guarded payment or new asset lock loads all confirmed transaction IDs and then performs a separate get_core_tx_record() call, including record deserialization, for each transaction before comparing its inputs with the candidate set. Send preparation therefore scales with the wallet's complete confirmed history even when the requested payment uses only a few inputs. The pinned V021 schema creates core_transaction_inputs with an index on (wallet_id, outpoint), and upstream indexes raw transaction inputs when persisting records. Use that indexed lookup to identify candidate spenders and point-read only the matching records, preferably through an upstream storage API. Preserve fail-closed behavior when index completeness cannot be established.

source: gpt-6.1-sol (phase2-reviewer: rust-quality)

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

Blocked on dashpay/platform#5150 (open, base v5.1-dev). This PR pins Platform to f7500221fa, built from that PR, so the pin-ancestry guard fails and the V021 wallet-database migration is not on v5.1-dev until it merges. Once it lands, the pin moves to the merge commit and this PR leaves draft. #1035 and #1036 are stacked on this branch and wait for it too.

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 13 commits October 27, 2026 11:53
Merge v1.0-dev (ff59f84) and move every dashpay/platform dependency to
344e110a6, the head of dashpay/platform#5528 (stack #5150, #5207, #5210,
#5528), which now contains v5.1-dev 9fefdf1b4 and so the 575d961f pin
v1.0-dev builds on.

v1.0-dev adapted to rust-dashcore v0.45 independently (#1127, #1132). Its
crypto API changes and low-R signing win over this branch's earlier
adaptation; the duplicated contest-fund cap, token setting guard and
document editor notices are taken from v1.0-dev. The batch dispatch path
keeps both the contact-list owner routing and the full-resync SPV block.
The migration fingerprint is regenerated for the 21 migrations at the new
pin (the ancestry guard fails while the pin is off v5.1-dev).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapts DET to the API changes the temporary Platform pin brings.

- A funding asset lock can now be conflicted: another payment spent its
  coins first. The status gets a plain sentence, and the upstream error
  gets a dedicated AssetLockFundingConflicted variant that asks the user
  to start a new transfer instead of the generic retry advice.
- WalletStorageError grew past what TaskError can hold inline, so the
  five variants that carry it now box their source.
- Tracked asset locks carry an operation revision; test locks start at 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 85077af5b6ea7ca3a1a91ab8ce4e3fb57d8ef4cf)
Platform #5528 records a lost Core input conflict on the tracked asset lock
itself (AssetLockStatus::Conflicted). The transfer assessment only reported
a conflict once the competing payment was in local history, so such a lock
read as "awaiting confirmation". It now reports the conflict either way.
A completed wallet drain (DrainCompleted) is as finished as a consumed lock
and no longer appears as an unresolved transfer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Platform 80c680af renumbers the Core accounting migration to V020 and no
longer wipes Core history: it keeps unmined transactions, spent coins whose
spender is not known to be mined, and the mined funding of those coins with
block details stripped. The bridge matched the migration by version 21 and
required the Core tables to be empty, so any legacy profile with a spent coin
would have failed the upgrade.

Match the migration by name, and accept Core rows only as an unchanged subset
of the original (mined transactions compared on wallet, txid and height).
Rows may be dropped, never invented or altered otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit cb7a163)
… history

`rows_retained` read every selected source row, record blobs included, into
memory before checking the migrated table. Both sides now stream in one
explicit order (storage class, then bytes/value) and are merge-walked, so peak
memory is bounded by duplicate rows rather than the whole Core history.

Acceptance still requires exact equality with a source row, so an ordering
disagreement can only refuse, never accept an altered row. Characterisation
tests pin the accept/refuse semantics (dropped, added, changed and repeated
rows; storage classes; NOCASE text; -0.0 vs 0.0; both filters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
(cherry picked from commit 25b1a21)
…merge

Keep set semantics and a single pass per side, but hold each source row as a
SHA-256 over type-tagged, length-prefixed values instead of an ordered merge.
Memory stays at 32 bytes per row while dropping the SQL ordering and Rust
comparator that had to agree with each other.

A new test pins column boundaries so values cannot shift between columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
(cherry picked from commit efb3c43)
…fixtures

Two test fixtures read platform-wallet's `wallets` table, which the TC-DEV-001
substring guard mistook for DET's legacy `wallet` table. Qualify it as
`main.wallets`: same table, no allow-list entry, guard unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
(cherry picked from commit 8608b97)
The bridge checked kept mined `core_transactions` only on (wallet_id, txid,
height), so a staged row could change finalized, block_hash, block_time or
record_blob and still pass. Compare every column against the original with the
pinned accounting migration's stripping applied (NULL block hash, time and
record; finalized = 0). A different migration or a loader mutation now fails
verification.

The drop-only acceptance case now removes mined transactions along with their
outputs, as the migration does, instead of leaving them unstripped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
(cherry picked from commit fa12dd0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts a4aa3dd and drops this branch's other CHANGELOG.md additions, so
the file matches v1.0-dev. Pull requests in this repository do not edit
CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream V020 keeps a height-only row (no record) for every kept coin's
mined funding, and recordless UTXOs write such rows at runtime. The
confirmed-spend check read every mined row's record and failed with
RecordMissing on these, so an upgraded wallet with a pending spend refused
every Core send, identity funding and shield until a rescan, and a restart
did not help. A height-only row names no inputs and cannot contradict a
live coin, so the check now skips it; a row that vanishes between the two
reads still fails closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… funding path

Identity creation, top-up and Platform address funding mapped
AssetLockConflicted to the generic "please retry" envelope; only the shield
path used the dedicated AssetLockFundingConflicted message. All four now
use it.

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

The identity create and top-up pickers, and the "unused lock" gate that
offers them, counted a conflicted lock and a completed drain as usable. Both
are excluded now. Also replace an expect() in snapshot history restoration
with a pattern match.

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

Copy link
Copy Markdown
Collaborator

Update: this PR is now pinned to dashpay/platform#5528 (344e110a6), the head of the stack dashpay/platform#5150 → dashpay/platform#5207 → dashpay/platform#5210 → #5528. v5.1-dev has been merged down that stack, so the pin contains DET's current Platform pin. It stays blocked until #5528 (and the PRs below it) merge into v5.1-dev; then repin to the merge commit, and the pin-ancestry guard will pass. #1035, #1036 and #1106 are stacked on this branch.

🤖 Co-authored by Claudius the Magnificent AI Agent

Re-homes this branch's app.rs dispatch changes onto #1100's unified
dispatch: the full-rescan context preparation runs in execute_requests,
its test seam lives with the other seams in app/result_delivery.rs, and
the transfer-assessment banner suppression moves from a special
AppState error arm to WalletsBalancesScreen's
should_suppress_backend_task_error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Claudius-Maginificent Claudius-Maginificent added the priority: medium Medium priority label Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Blocked by something external to this issue claudius-review Triggers automated code review using claudius plugin, runs as a CI job priority: medium Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants