Repository navigation
Fix USDT backup identity and acknowledgement handling - #169
Conversation
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Canonicalizes user-operation and refund hashes on restore, runs the refund-ownership check inside the restore transaction, maps foreign callback errors to BackupUnavailable, and skips re-uploading an unchanged snapshot already acknowledged in the current wallet session. Reviewed 57f96f7, full tier (wallet backup path).
What I checked, and 5 candidates I ruled out
Read in full: usdt/backup.rs, the changed regions of usdt/store.rs and usdt/wallet.rs, and the new tests in usdt/tests.rs and usdt/tests/backup.rs
Call sites traced: persist_backup (send path under operation lock, and recover_pending under refresh_pending_transfers' lock), refund_claimed (live refund path and both restore branches), every writer of user_operation_hash (wallet.rs and history.rs, both {:#x})
CI: usdt-tests, iOS Bindgen, SwiftPM and manifest checks green; Android Bindgen still running when this was posted. Not built here, CI is the gate.
Ruled out
- Canonical form drifting from stored hashes:
B256'sDisplaywithout the alternate flag prints the full lowercase0xhex, the same as the{:#x}every writer uses, so a backup from the current code canonicalizes to the storedhashcolumn andexisting != hashdoes not misfire. - Older backups now failing restore: master already parsed
refund_txasB256before storing it, anduser_operation_hashwas always formatted from aB256, so the new parse cannot reject a snapshot this code produced. - Self-match in the seed-discovered branch:
require_refund_owneris called with the row's pre-rename id, whichrefund_claimedexcludes, so the record cannot conflict with itself. - Duplicate refund inside one snapshot: the in-memory pass does not catch it, but the second insert sees the first in the same transaction and the whole restore rolls back; the new test covers it on an empty wallet.
- Stale acknowledgement after a failed or changed save: the cached hash is set only after
persistreturnsOk, and any restore or new record changes the snapshot bytes, so the callback runs again.
Merge confidence: 4/5, the change is covered by the new restore and retry tests, but Android Bindgen had not finished on this head.
There was a problem hiding this comment.
Verdict: ✅ Approve
Review: diff 8 files.
Findings:
1 inline (1 MEDIUM)
Reviewed by gpt-6-sol-high via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
There was a problem hiding this comment.
Verdict: ✅ Approve
Reaudit: diff 1 file.
No new findings; the rest is in the review.
QA:
No reviewer test ran because the PR description reports only validation the author already completed and lists no journey or manual test.
Reviewed by gpt-6-sol-medium via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
|
Two independent reviews, nothing blocking a merge. worth doing, does not block
nits
|
|
Thanks, addressed all three points in The existing refund test covers persisted prefixless claims through restart, pruning and restore. The retry test now asserts that the operation was rebroadcast while the acknowledged backup was reused. The callback docs are clarified, the Swift bindings are regenerated, and I checked the generated Kotlin docs too. All 85 USDT tests pass, with the opt-in fork test skipped. Formatting passes and Clippy has no introduced diagnostics. The iOS device/simulator archive was rebuilt with its matching checksum, and the Swift backup smoke check passes. |
There was a problem hiding this comment.
Verdict: ✅ Approve
Reaudit: diff 6 files.
No new findings; the rest is in the review.
QA:
No reviewer test ran; the PR description says the author completed tests, lint, checksum and manifest checks, and lists no journey or manual test.
Reviewed by gpt-6-sol-high via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
Restoring a USDT backup could assign one signed operation or refund receipt to multiple payments. Restore now canonicalizes operation/refund hashes and checks refund ownership inside the merge transaction, including pruned terminal records and seed-discovered payments. A conflict rolls back the whole restore. Live updates and restore recognize the same refund regardless of hash casing or an optional
0xprefix.Unexpected Swift/Kotlin backup callback errors return
BackupUnavailable. Pending-payment retries reuse an unchanged acknowledged snapshot within the wallet session; failed saves, changed snapshots and reopening still require acknowledgement before broadcast. The callback docs clarify that applications must back up subsequent application-only association changes separately.Includes the rebuilt XCFramework checksum and updated generated Swift documentation for the unpublished
0.8.0-rc2. No schema changes, migrations or new public APIs.Validation:
cargo fmt --check,git diff --checkand Clippy completed with no introduced diagnostics. Existing Clippy warnings are outside the changed code.