fix(cctp): decode the V2 burn event, and stop expiring quotes mid-payment - #209
Merged
Conversation
…ment Two separate faults, both hit while paying from MetaMask on Sepolia. ## "not found on ethereum (or not a CCTP burn)" for a real, successful burn `TOKEN_MESSENGER_V2_ABI` declared `DepositForBurn` V1-shaped, with a leading `uint64 indexed nonce`. CCTP V2 does not emit that field. One extra parameter changes the whole topic hash — 0xe3db7593… instead of the 0x0c8c1cbd… chains actually log — so no receipt ever matched and every EVM burn was reported as "not a CCTP burn". Successful ones included. Verified against tx 0xce93dc50…c46ca1c9 on Sepolia (block 11454876, status 0x1): it now decodes to 0.01 USDC, destination domain 27 (Stellar), with the depositor intact. Iris had the burn all along — cctpVersion 2, its own eventNonce, waiting on confirmations. The nonce goes with it. V2 assigns no nonce at burn time: the on-chain MessageSent payload carries a zero placeholder, and Circle stamps the real one during attestation. `ParsedBurn.nonce` is `bigint | null` accordingly, and the processor now prefers Iris's `eventNonce`, falling back to the burn's own — Stellar still surfaces one — so `cctpNonce` keeps being populated rather than quietly becoming a column of nulls. Also split the two null paths in `parseBurnReceipt`. They shared one message that led with "not found", so a real burn that merely failed to decode sent you auditing RPC config instead of the ABI. Each now logs what it actually saw, and the no-match case names the topic it wanted. ## Quotes expiring during the payment they were quoted for The TTL was 30 seconds for everything. A wallet payment is read-quote, approve (a transaction, mined), then burn — comfortably longer than that on a busy testnet, so the quote died mid-flow and the payer got an error for doing nothing wrong. 30 seconds prices in rate risk. That risk is real across assets and absent within one: USDC → USDC quotes at exactly 1 now and in ten minutes, and the only other variable is a fixed bps of the merchant's own config. Same-asset quotes now get 600s; anything cross-asset keeps 30. Tests: 303 (+6). The burn spec is pinned to the real Sepolia log and imports the client's own ABI rather than a copy — reverting the ABI fails all three of its cases, which was checked rather than assumed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Two separate faults, both hit paying from MetaMask on Sepolia.
1. A real, successful burn reported as "not a CCTP burn"
TOKEN_MESSENGER_V2_ABIdeclaredDepositForBurnV1-shaped, with a leadinguint64 indexed nonce. CCTP V2 does not emit that field, and one extra parameter changes the whole topic hash:0xe3db7593…0x0c8c1cbd…So no log ever matched, and every EVM burn came back as "not a CCTP burn" — successful ones included.
Verified against the actual transaction (Sepolia, block 11454876, status
0x1). It now decodes to 0.01 USDC, destination domain 27 (Stellar), depositor intact. Iris had it the whole time —cctpVersion: 2, its owneventNonce, waiting on confirmations.The nonce goes with it
V2 assigns no nonce at burn time: the on-chain
MessageSentpayload carries a zero placeholder (confirmed by decoding the message header), and Circle stamps the real one during attestation. SoParsedBurn.nonceis nowbigint | null, and the processor prefers Iris'seventNonce, falling back to the burn's own — Stellar still surfaces one.cctpNoncekeeps getting populated instead of quietly becoming a column of nulls.Diagnosability
The two null paths in
parseBurnReceiptshared one message that led with "not found", so a real burn that merely failed to decode sent you auditing RPC config instead of the ABI. Each now logs what it actually saw, and the no-match case names the topic it wanted.2. Quotes expiring during the payment they were quoted for
The TTL was 30 seconds for everything. A wallet payment is read-quote → approve (a transaction, mined) → burn — comfortably longer than 30s on a busy testnet, so the quote died mid-flow and the payer got an error for doing nothing wrong.
30 seconds prices in rate risk. That risk is real across assets and absent within one: USDC → USDC quotes at exactly 1 now and in ten minutes, and the only other variable is a fixed bps of the merchant's own config.
Same-asset quotes now get 600s; anything cross-asset keeps 30. Live check: the crypto path went from
expiresInSeconds: 29to599.Verification
select-cryptolive: quote window 599s,chainId: 11155111, Sepolia USDC.