Repository navigation
feat: let reverse swaps wake the wallet when they can be claimed - #223
coreyphillips wants to merge 2 commits into
Conversation
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Asks reverse quotes for claimable-hint-v1, records whether the provider takes a wake, and adds pubky_swaps_send_wake_capability to hand over a swap.claimable grant with the token kept out of records and errors. Reviewed f791c03, full tier, static: talos-pr-run could not confirm the author's permission on this repo and failed closed, so nothing was built or run here.
What I checked, and 6 candidates I ruled out
Read in full: the diff in client.rs, errors.rs, store.rs, types.rs, lib.rs, mod.rs; transport.rs for logging and error paths
Contract checked against the pinned pubky-swap rev f45e204: swap-provider/src/wake.rs (check, hold), accept_wake_capability and offer features in swap-provider/src/lib.rs, cap_adapter.rs (claimable hint read from the RFQ), swap-common/src/paykit_cap.rs (RFQ copies request.features)
CI: green so far (paykit-route, wake, manifests, recovery fixture); iOS/Android bindgen and usdt still pending
Ruled out
- Hint never reaches the provider:
paykit_capbuilds the RFQ withfeatures: request.features.clone(), andcap_adapter.rssetsclaimable_hintfrom those, so the signed path carries it without a swap-common bump, as the body says. - Client and provider token checks drift:
wake_capabilitymirrorsWake::checkexactly (wkg_prefix,WAKE_TOKEN_MAX_LEN,[A-Za-z0-9_-],expires_at > now); gateway allowlist and topic stay provider-side, and their refusals are token-free. - Wake sent to a provider that cannot parse it:
takes_wakeneeds bothswap-wake-v1andclaimable-hint-v1, matching the provider, which advertises wake only alongside the hint and refuses a swap quoted without it. - Token leaks through an error or log:
WakeCapability'sDebugredacts the token, the non-snapshot arm avoidsunexpected(...),transport.rslogs nothing per message, andredactcovers everyPubkySwapErrorvariant includingRefused.code. - Old records fail to load:
takes_wakeis#[serde(default)], anda_record_saved_before_wakes_takes_nonecovers it; restored swaps getfalse, which the README states. - Race where the swap turns claimable while the grant is held: the provider re-reads the record after
holdand returns the snapshot, so the returnedclaimablecovers it; the doc comment tells the app to advance ontrue.
Merge confidence: 4/5, not built here, no CI job runs modules::pubky_swaps so the new tests ran only on the author's machine, and the live regtest wake is untested.
Closes #200
claimable-hint-v1when the provider's offer does.PubkySwapRoutePayment.provider_takes_wakeis true when the offer also listsswap-wake-v1. The swap record keeps it.pubky_swaps_send_wake_capabilitysends the app'sswap.claimablegrant as aSwapWakeCapabilityand returns the snapshot'sclaimablehint. It refuses a swap whose provider takes no wake, since an older provider never answers.Reject.No swap-common bump: the pinned
paykit-capRFQ carriesfeatures, and current providers still answer that wire and take a plainSwapWakeCapability.Tests:
cargo test --lib pubky_swapspasses, with new tests for the feature list, the capability message and token redaction. Not run: the live regtest swap, which needs a provider with a gateway allowlist.