Skip to content

feat: return each swap's payment hash from pubky_swaps_advance - #233

Open
coreyphillips wants to merge 1 commit into
masterfrom
feat/swap-payment-hash
Open

coreyphillips wants to merge 1 commit into
masterfrom
feat/swap-payment-hash

Conversation

@coreyphillips

Copy link
Copy Markdown
Collaborator

Closes #232.

PubkySwapRouteStatus gains payment_hash_hex, so the app can stop advancing a restored swap whose hold payment failed (synonymdev/bitkit-ios#1386). It defaults to empty in the Swift and Kotlin initializers.

Merge after #230 is tagged: the rc16 archive is built without this.

PubkySwapRouteStatus gains payment_hash_hex, derived from the seed, so a
swap pubky_swaps_restore rebuilt also names its hold payment. Defaults to
empty in the Swift and Kotlin initializers.

@talosmachina talosmachina 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.

No findings. Adds payment_hash_hex to PubkySwapRouteStatus, derived from the seed and the record's key index, so pubky_swaps_advance reports the hold invoice's hash for restored swaps too. Reviewed daaac7a, full tier, static: talos-pr-run could not confirm the author's permission on this repo and refused to build, so nothing was run here.

What I checked, and 4 candidates I ruled out

Read in full: src/modules/pubky_swaps/client.rs (status_of, advance_blocking, record_payment_hash, record_keys, restore paths), types.rs, the pubky_swaps_advance export in src/lib.rs
Call sites traced: status_of (only advance_blocking), record_payment_hash (restore and listing dedupe, unchanged behaviour), record_keys (new, shared by both)
CI at this head: manifests, SwiftPM, paykit-route, wake, native-recovery, unwind green; Android Bindgen, iOS Bindgen and usdt-tests still pending when I posted

Ruled out

  • Restored swap reports a hash that is not its invoice's: restore already rejects a snapshot whose derived hash differs from payment_hash_hex (client.rs:941, :1217), and the new test asserts equality on that path.
  • Swift converter field order: paymentHashHex is read and written last, matching its position as the last field of the Rust struct.
  • Empty default reaching the app: #[uniffi(default = "")] only affects the foreign initializers; every Rust path building the status fills it from the keys.
  • Extra key derivation cost: advance_blocking already derived the keys once; status_of reuses them, no second derivation.

Merge confidence: 4/5, the change crosses the FFI contract and the bindgen jobs had not finished; the Rust side is covered by a_restored_swaps_status_names_its_hold_payment.

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: ✅ Approve

Review: diff, 5 files.

Findings: None.

QA for daaac7a:

Restored swaps identify their hold payment ✅ The restored-status regression and surrounding Pubky Swaps unit tests pass.

Built and ran cargo +1.91.1 test --locked --lib modules::pubky_swaps. The new a_restored_swaps_status_names_its_hold_payment regression confirms the status hash equals the restored snapshot's payment hash.

Swift and Kotlin carry the payment hash ✅ Swift round-trips the hash; regenerated bindings retain the empty initializer default.
  • Built the native library at this head; regenerated Swift matches the committed Swift, header and module map byte for byte.
  • A compiled Swift smoke check linked to that library round-trips every status variant and the default initializer through the FFI buffer converter, and checks equality and hashing.
  • Kotlin generated with the pinned Gobley revision exposes paymentHashHex = ""; its trailing-field reader, writer and allocation size were checked in the generated source. Android compilation was not run.

No device run: this library PR lists no device tests. Live swaps and the apps' response to a failed hold payment were not driven; the live-provider test remains ignored. These checks cover the returned status and bindings, not the mobile tracker integration.

Reviewed the full diff at daaac7a. Also read the existing static review, which reported no executed tests. The release ordering described in the PR still applies.


Reviewed by gpt-6.1-sol-high

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.

feat: return each swap's payment hash from pubky_swaps_advance

2 participants