Repository navigation
Conversation
Pin the scoped asset-lock reconciliation fix and retain its typed consumed report in an actionable user message. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
|
⛔ Final review complete — 1 blocking finding(s) (commit fa12dd0) · triage: critical · Phase 2 only (no Phase 1 for this repository) |
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Bring in the latest v1.0-dev merged into the fix/orphaned-tx base. No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both sides re-pinned dashpay/platform: the base to f7500221 (PR #5150 stack) and this branch to c0fd3b13 (PR #5207), which does not contain f7500221. Resolve to 80c680af, the current #5207 head, which contains both. - Cargo.lock: only the platform git packages move; grovedb follows the new platform pin from fc7028d8 (6.1.0) to 2128ea18 (6.1.1). rust-dashcore stays at aca02026. - Re-record the migration fingerprint for 80c680af: upstream renumbered core_transaction_accounting from V021 to V020 and keeps unmined Core evidence through its rescan. V007 changes only in doc comments. - Drop two redundant derefs in base test code that clippy rejects. 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>
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (no Phase 1 for this repository)
The PR introduces the intended SQLite reconciliation behavior, but the exact head is not mergeable: the pinned Platform revision fails the repository’s ancestry guard, and the required workspace test suite has three deterministic failures caused by the dependency update. The changelog also identifies a different Platform revision, while the new retained-row verifier materializes the full Core history in memory during migration.
🔴 2 blocking | 🟡 2 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:
criticalbygpt-6.1-sol(effort low) — The intricate changes to upgrade_with_hook_locked and rows_retained in src/wallet_backend/platform_compatibility/engine.rs alter storage-migration verification rules for retained Core transactions and spent-coin evidence. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-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-45: Platform pin is outside the guarded release ancestry
All Platform crates are pinned to `80c680affc6d122e64046bd53d49a0d4e7be4bd0`, but `scripts/migration-fixtures/check-pin-ancestry.sh` verifies ancestry against `v5.1-dev` by default. The guard fails because this revision is on the `fix/sqlite-asset-lock-reconciliation` side branch rather than an ancestor of `v5.1-dev`. Updating `expected-migration-fingerprint.txt` to record that side branch does not change the guard: the script reads only the expected pin and fingerprint, not the recorded `target_branch`. Move the pin to a revision after the upstream change lands on the guarded branch, or deliberately update the guard policy and its configuration.
- [BLOCKING] Cargo.toml:27-45: The Platform bump leaves deterministic workspace tests failing
The exact head’s Test Suite reports three deterministic failures after the Platform revision change: `backend_task::platform_info::tests::daily_withdrawal_limit_uses_det_platform_version_not_latest`, `wallet_backend::payments::tests::asset_lock_max_excludes_unconfirmed_funds_counted_by_snapshot`, and `wallet_backend::payments::tests::asset_lock_max_uses_an_in_cap_subset_when_the_wallet_has_too_many_utxos`. The CI log records 3759 passed and 3 failed tests; the withdrawal test observes the pinned upstream’s changed protocol-14 result instead of 4000 Dash, and both asset-lock tests observe that `max_amount + 1` still builds. Choose a compatible upstream revision or update the affected production logic and test contracts together after confirming the intended upstream semantics.
In `CHANGELOG.md`:
- [SUGGESTION] CHANGELOG.md:59-62: The changelog names a different Platform revision than the build uses
The changelog says Platform dependencies track `c0fd3b13`, while the exact build configuration and lockfile resolve the Platform crates to `80c680af`. This makes release auditing and reproduction misleading, especially because the SQLite migration behavior depends on the later revision. Update the changelog to name the actual pinned revision or describe the branch without claiming the older commit is the dependency pin.
In `src/wallet_backend/platform_compatibility/engine.rs`:
- [SUGGESTION] src/wallet_backend/platform_compatibility/engine.rs:775-797: Avoid materializing the entire Core history during migration verification
`rows_retained` reads every selected source row into `Vec<Vec<Cell>>` and then collects it into a `HashSet`; the copied cells include potentially large `record_blob`, script, and InstantLock values. The function is used to verify Core transaction, UTXO, and InstantLock tables, so a restored wallet with a large Core history incurs peak memory proportional to the entire history in addition to the staged and original SQLite databases. Use a keyed SQL anti-join or a sorted streaming comparison so verification remains bounded by the rows being checked rather than the full source history.
… 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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…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
`PlatformVersion::latest()` is protocol 15 at the pinned Platform revision, and upstream redefined protocol 14's relative limit without a fixed cap (15% of the day-old total, 500 Dash floor), matching its own v14 test. Name protocol 14 explicitly and expect 150000 Dash for a million-Dash total. DET itself stays on protocol 13's flat 2000 Dash, which the test still asserts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…ript rust-dashcore 0.46 prices the asset-lock payload by its serialized size instead of a fixed per-output estimate. The Max/Max+1 checks used an empty credit script, 25 bytes cheaper than the P2PKH script real asset locks and the Max probes use, so Max+1 fitted. Use the production length; the quoting logic is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
The migration bridge correctly uses bounded row digests, preserves the typed consumed-asset-lock error, and the previously reported changelog and deterministic-test issues are fixed. One in-scope verification gap remains: mined transaction rows are checked only by identity, so unexpected changes to their accounting fields can pass migration verification. The Platform ancestry failure is intentional and tracked by dashpay/platform#5207; the Test Suite check was still in progress in the supplied CI snapshot.
🟡 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); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a cross-cutting wallet persistence and dependency update that changes asset-lock recovery and error mapping, but the diff does not itself alter funds movement, cryptography, consensus, key handling, or storage migration behavior. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-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 `src/wallet_backend/platform_compatibility/engine.rs`:
- [SUGGESTION] src/wallet_backend/platform_compatibility/engine.rs:1030-1039: Verify transformed mined transaction fields instead of only row identity
For mined `core_transactions`, this branch verifies only `(wallet_id, txid, height)` and then skips the later `equal_rows` check. A staged row with the same identity can therefore change `finalized`, `block_hash`, `block_time`, or `record_blob` to arbitrary values while still passing verification. The pinned accounting migration intentionally transforms these fields to `finalized = 0`, `block_hash = NULL`, `block_time = NULL`, and `record_blob = NULL`; verify that exact transformation so an upstream migration change or unexpected loader mutation cannot publish altered transaction accounting.
…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
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
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
The current head fixes the mined-transaction transformation verification, changelog revision mismatch, and deterministic test-contract failures. One blocking error-routing gap remains: direct already-consumed asset-lock results are actionable only for platform-address funding, while identity and shielded funding paths still convert the same result into generic retry guidance. The Platform pin guard remains intentionally red while the side-branch revision awaits dashpay/platform#5207; Test Suite and Clippy were still running in the captured CI state.
🔴 1 blocking | 🟡 1 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Route direct consumed reports through every asset-lock funding mapper
src/wallet_backend/mod.rs:3594-3620
The new AssetLockReportedUsed mapping handles only map_platform_address_fund_error. The pinned Platform wallet can return the same direct PlatformWalletError::AssetLockAlreadyConsumed while resolving an existing funding lock for identity registration or top-up, and the shielded mapper also places this direct variant in its generic arm at line 3500. Those paths therefore produce TaskError::WalletBackend with generic retry guidance, even though retrying the consumed deposit cannot succeed and the user should choose another deposit or check the earlier payment. Apply the dedicated classification through a shared mapper or each applicable funding façade, and add regression coverage for the direct variant on the identity and shielded paths.
source: gpt-6.1-sol (phase2-reviewer: general)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
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); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The diff is large and intricate and changes wallet funding and SQLite-backed asset-lock recovery insrc/wallet_backend/payments.rsandsrc/wallet_backend/platform_compatibility/engine.rs, directly affecting funds movement and storage persistence. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 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 `src/wallet_backend/mod.rs`:
- [BLOCKING] src/wallet_backend/mod.rs:3594-3620: Route direct consumed reports through every asset-lock funding mapper
The new `AssetLockReportedUsed` mapping handles only `map_platform_address_fund_error`. The pinned Platform wallet can return the same direct `PlatformWalletError::AssetLockAlreadyConsumed` while resolving an existing funding lock for identity registration or top-up, and the shielded mapper also places this direct variant in its generic arm at line 3500. Those paths therefore produce `TaskError::WalletBackend` with generic retry guidance, even though retrying the consumed deposit cannot succeed and the user should choose another deposit or check the earlier payment. Apply the dedicated classification through a shared mapper or each applicable funding façade, and add regression coverage for the direct variant on the identity and shielded paths.
In `src/wallet_backend/platform_compatibility/engine.rs`:
- [SUGGESTION] src/wallet_backend/platform_compatibility/engine.rs:795-817: Avoid materializing the entire Core history during migration verification
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1036#discussion_r4362999256)
`rows_retained_as` now stores fixed-size SHA-256 digests instead of copying large blobs, scripts, and InstantLocks, but it still inserts one digest into `original` for every selected source row before scanning the target. A restored wallet with a large Core history therefore still uses memory proportional to the complete source history, including `HashSet` overhead, even when only a small subset is retained. Use a keyed SQL anti-join, a temporary comparison table, or a sorted streaming comparison so verification does not retain every source row in Rust.
|
Blocked on dashpay/platform#5207 (open; stacked on dashpay/platform#5150, also open). This PR pins Platform to a build containing it, so the pin-ancestry guard fails and the typed consumed-asset-lock report is unavailable on v5.1-dev. It also sits on #1028, so it waits for #5150 as well. After both merge, repin to the v5.1-dev merge commit. 🤖 Co-authored by Claudius the Magnificent AI Agent |
TL;DR
When a saved deposit is reported as already used, Fund now shows that result instead of an unrelated storage error or a generic retry suggestion.
User story
As a wallet user, I can understand why an old deposit cannot fund another payment and choose another deposit or check the earlier payment.
Scenario
In Wallets → Dash Core → Asset Locks, choose Fund for a restored deposit that Platform reports as already consumed. The recovery step previously failed with a missing storage capability, hiding the result. The app now retains the recovery record and shows an actionable already-used message. This does not make spent funds available again or prove that the requested payment succeeded.
Detailed discussion
Stacked on #1028 (
fix/orphaned-tx), independently of the key-lookup fix in #1035.c0fd3b133bf37d0fc79dc8e55d8ad4b25aee662ffrom fix(platform-wallet): require only atomic tracked-lock writes for reconciliation platform#5207. Reconciliation of an already-loaded asset lock requires onlyATOMIC_CHANGESETS | TRACKED_ASSET_LOCKS. Existing capability meanings and FFI callback requirements remain unchanged; SQLite does not claimWALLET_RESTORE.PlatformWalletError::AssetLockAlreadyConsumedto a dedicatedTaskErrorpreserving its source and explaining the result. SDK-originated consumed errors keep their existing classification.18f7f3e695e770ea5d2820aa85597d45160d1b8e.Diagnosis used read-only snapshots of the reported user databases and logs. The logs show a matching already-consumed rejection followed by the misleading persistence-capability failure. A restored Core funding transaction alone does not establish that its Platform credits remain unused; no user records are deleted or marked conclusively consumed on that evidence.
Validation:
cargo fmt --all -- --check, scoped Clippy (--locked --lib --all-features -- -D warnings), andgit diff --checkpassed.🤖 Co-authored by Claudius the Magnificent AI Agent