fix(ocp): accept a receive payment when polling for a grabbed bill - #1664
Merged
Merged
Conversation
pollIntentMetadata filtered with 'it as? T', which is unchecked because T isn't reified. A grab that the server reported as RECEIVE_PAYMENTS_PUBLICLY reached the SendPublicPayment copy in GrabBillTransactor and threw ClassCastException after the funds had moved. The grab now asks for PublicPayment and handles either side. The poll takes a KClass and fails with GetIntentMetadataError.UnexpectedType on a mismatch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Grabbing a multi-mint bill on 2026.10.1 (4718) crashed with
ClassCastException: hre cannot be cast to ire(Bugsnag). With the 4718 mapping, that isReceivePublicPaymentcast toSendPublicPaymentinGrabBillTransactor.handleMultiMintScan. The crash happens after the grab has settled on the server.The grab asks
pollIntentMetadataforSendPublicPayment, but the poll'sit as? Thas no effect at runtime becauseTisn't reified. When the server returnedRECEIVE_PAYMENTS_PUBLICLYfor the rendezvous (isIndirectSend=truein the breadcrumbs), it went straight through to thecopy(verifiedExchangeData = …)in the grab, and the cast there threw. iOS already accepts both:ScanCashOperationhandles.sendPaymentand.receivePaymentfrom the same poll.PublicPaymentand applies the give request's exchange data to either a send or a receive.BillTransactionManageronly readsexchangeDatafrom the result, so it doesn't change.pollIntentMetadatatakes aKClass<T>and checks the type for real. A mismatch now fails at once withGetIntentMetadataError.UnexpectedTypeinstead of passing through unchecked. The error is reported to Bugsnag, and its message names the types with fixed strings because R8 renames the classes.SendPublicPaymentexplicitly. If the server ever returned something else there, the give used to get the wrong type back unchecked; now it getsUnexpectedType.Tests cover a grab that comes back as
ReceivePublicPayment, and both outcomes of the poll's type check.