Repository navigation
fix: mf-6839 decode red packet transactions with 0x-prefixed calldata - #12492
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This branch was previously deployed
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.
Summary
Fixes MF-6839. ERC20 red packet creation on Polygon failed with a misleading toast: "Refund Lucky drop — Failed to refund Lucky Drop." while the dialog stayed stuck at the Confirm step.
Root cause
AccountTransaction.functionParametersreturned calldata without the0xprefix (data.slice(10)).EVMTransactionFormatter.createTransactionContextfeeds it to viem'sdecodeAbiParameters, whosehexToBytesdoeshex.slice(2)unconditionally, dropping one byte and misaligning the decode → throws. Thetry/catchswallows it →methods: undefined, soRedPacketDescriptor.computemisses thecreate_red_packetbranch and falls into the catch-allelse= "Refund Lucky drop". Every create/claim outcome (success included) was announced as a refund.Regression introduced by 9bff15f (migrate TransactionFormatter from abiCoder to viem): web3.js
decodeParametersaccepted unprefixed hex, viem requires0x.Verified with the repo's own viem (
decodeAbiParametersover a realcreate_red_packetcalldata, same call path as the formatter):Bytes value "1,0" is not a valid boolean0x-prefixed (fixed): decodes all 10 parametersNote: this mislabels toasts/popup copy; it does not itself break the transaction. The corrected toast will surface the true underlying error for QA's ERC20 case if anything remains.
Changes
AccountTransaction.functionParametersnow returns0x-prefixed hex (symmetric withfunctionSignature). Its only consumer is the formatter call site.RedPacketDescriptor: the bareelsebecomeselse if (method?.name === 'refund'), so any future undecodable tx to the red packet contract falls through to the generic contract-interaction label instead of claiming "Refund".Test Plan
0x5db05aba, 10 inputs incl._token_addr/_total_tokens)pnpm lintcleancreate_red_packetcalldata viaeth_estimateGason publicnode + drpc both return valid results, so the RPC is not the culprit)