Repository navigation
fix: validate minimum paykit request amounts - #1457
Conversation
|
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Rejects incoming on-chain Paykit requests of 546 sats or less with the existing Amount Too Low toast before the balance check, so a funded wallet no longer sees "0 more needed". Reviewed 43a184e, light tier (one 11-line change in AppViewModel.onScanOnchain).
What I checked, and 4 candidates I ruled out
Read: the commit's diff, onScanOnchain around the new guard, validateAmount, Env.dustLimit (546), the five new tests in AppViewModelSendFlowTest.kt, the journey and README rows.
CI at review time: lint, detekt, build-local and Greptile green; build and the local e2e shards still running. This review is reasoned from the code and CI; the branch was not built here.
Ruled out
- Off by one:
amount <= dustLimitwithdustLimit = 546rejects 546 and accepts 547, matching the> dustLimitrule invalidateAmountand the 547 shown in the toast. The boundary test covers both sides. - Rejecting a payable Lightning request: the guard runs only once
payMethodisONCHAIN, after the unified fallback, andsmall incoming unified request remains payable over Lightningcovers that path. - Hardware funding source: a hardware wallet forces
ONCHAINand the guard runs beforeselectHardwareFundingSourceForAmount, so dust never reaches the hardware send path. - Request lost or auto-reopening:
clearActiveContactPaymentContext(retryIncomingRequest = false)is the same cleanup the shortfall branch uses. The test keeps the request pending and shows that manual Pay retries it while a new 547-sat request still opens.
Merge confidence: 4/5, no findings and the change has tests, but build and e2e had not finished at review time.
There was a problem hiding this comment.
Suggestion: 👍 Approve
Review: diff 6 files.
Twin: synonymdev/bitkit-ios#913 identical at commit
QA:
Tests queued.
Reviewed by gpt-6.1-sol-high via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
There was a problem hiding this comment.
Suggestion: 👍 Approve
Interim test report for the review; the rest resumes on its own.
QA:
🟠 Test J1
Test J1
Incomplete: The lane disconnected during app launch and UI inspection.
Reviewed by gpt-6.1-sol-high via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Reviewed the full PR diff against its merge base, at 43a184ec.
No new actionable code findings.
Incoming on-chain Paykit requests of 546 sats or less are rejected in onScanOnchain after payment-method selection. That matches validateAmount: Defaults.dustLimit is 546, so 547 sats remains payable. The existing Amount Too Low toast states that minimum, preparation closes, and the request stays in the pending list so Pay can retry it. A funded 547-sat on-chain request still reaches confirmation, and a small unified request that Lightning can pay does not hit this guard. Amounts above the minimum still use the balance-shortfall toast.
Parity with bitkit-ios#913 at 932ed17 matches this boundary. iOS rejects amounts below Env.dustLimit (547) and shows 547. Both platforms share journeys/payment-requests/minimum-onchain-amount.xml and PaymentRequestAmountTooLowToast. Android formats the amount with the active display unit; the journey sets that unit to sats.
Validation: inspected the five new AppViewModelSendFlowTest cases and the journey. Did not run them locally. CI build on this revision completed testDevDebugUnitTest successfully; lint and detekt also passed. Device testing: not performed in this review. The author reports running the new journey on an API 36 regtest emulator and dismissing the 547-sat confirmation without paying.
Ready for device testing.
Suggested additional test cases
- Android. Payer has a usable Lightning channel and at least 100,000 spendable sats. Issuer sends a new 100-sat unified request with on-chain and Lightning endpoints. Expected: Lightning confirmation opens, and the amount-too-low toast does not appear.
piotr-iohk
left a comment
There was a problem hiding this comment.
QA tested on Android at 43a184ec using staging regtest and a dedicated fresh wallet/profile.
Device checks passed:
- 100- and 546-sat on-chain contact requests show the 547-sat minimum feedback and close preparation.
- Unpaid requests remain retryable; manual retry repeats the minimum feedback.
- A fresh 547-sat request reaches enabled confirmation; dismissing it creates no payment.
- An above-minimum 500,000-sat request shows the genuine balance shortfall.
- Unpaid state survives app restart, and retry still clears preparation correctly.
Manual follow-up by Piotr: 100-sat unified contact payment requests paid successfully over Lightning in both directions (Android → iOS and iOS → Android). This is user-reported testing, without an agent recording.
Deferred Lightning preparation falling back to on-chain below the minimum remains untested on both platforms. No confirmed product defect was found in the tested scope. Approving as explicitly requested by Piotr with that coverage gap disclosed.
jvsena42
left a comment
There was a problem hiding this comment.
No finding at 43a184e.
Checked and clean:
- Validated amount = paid amount. The guard reads
incomingPaymentRequest.amountSats, the same value written tosendUiState.amount, and the request amount is fixed on Confirm. The guard only rejects; it never changes what is spent. - Boundary.
Defaults.dustLimitis 546, the guard rejectsamount <= 546, and 547 passes both the guard andvalidateAmount. The toast value isdustLimit + 1throughUSat. - Only the on-chain route is rejected. The guard runs after payment-method selection, so a small unified request Lightning can pay still opens confirmation, and a hardware wallet (forced on-chain) is rejected before
selectHardwareFundingSourceForAmount. - No other way to pay the rejected amount. The request is marked presented, stays in the pending list and can be retried from it, which repeats the guard. The same address opened without the request context lands on the Amount screen, where
validateAmountblocks dust. Switching funding source on Confirm recomputesisAmountInputValidand cannot enable Pay for a sub-dust on-chain amount. - Cancel and Back. Closing the preparing sheet before the guard cancels the scheduled scan and marks nothing presented. After the guard the sheet, the contact context and the requested id are all cleared, and the next presentation skips this request and opens the following one.
- Journey.
PaymentRequestsBellandPaymentRequestAmountTooLowToastexist at head and the strings match;minimum-onchain-amount.xmlis byte-identical to the one in synonymdev/bitkit-ios#913.
CI is green at this head.
Device gate: 43a184e — journeys: 0 driven by me; perf: not relevant; Figma: no screen changed; iOS: same journey file on synonymdev/bitkit-ios#913.
Skipped — already driven this round: minimum-onchain-amount.xml (Android, by @piotr-iohk at 43a184e, passed: 100, 546, 547 and 500,000 sats, manual retry and restart, in the approving review of 2026-10-12)
Skipped — covered by CI at 43a184e: unit tests, lint, detekt, e2e (all green)
This PR fixes misleading balance feedback for on-chain Paykit requests below 547 sats.
Description
Out of Scope
Design
N/A — no design available. Reuses the existing minimum-invoice toast.
Preview
QA Notes
Journeys
minimum-onchain-amount.xml— 100 and 546 sats show the 547-sat minimum, preparation closes, unpaid requests remain retryable, and 547 sats reaches confirmation.Manual Tests
N/A
Automated Checks
AppViewModelSendFlowTest.kt— five regressions cover below-minimum feedback, delayed preparation cleanup and retry, the payable boundary, genuine balance shortfall, and a small valid Lightning alternative.minimum-onchain-amount.xmlon an API 36 regtest emulator with a disposable staging issuer — minimum feedback and manual retry verified; a prepared 547-sat confirmation was dismissed without paying.