fix: handle zero swap tx gas value in 'executeSwapQuote'#257
Open
gabrielstoica wants to merge 1 commit intoacross-protocol:masterfrom
Open
fix: handle zero swap tx gas value in 'executeSwapQuote'#257gabrielstoica wants to merge 1 commit intoacross-protocol:masterfrom
gabrielstoica wants to merge 1 commit intoacross-protocol:masterfrom
Conversation
|
@gabrielstoica is attempting to deploy a commit to the UMA Team on Vercel. A member of the Team first needs to authorize it. |
|
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.
There's an issue currently when using the
useTestnet: trueflag with certain RPC providers, where viem rejects the swap tx when thegetSwapQuotecall returnsswapTx.quoteas0n.That's because the current gas conversion logic treats it as a valid value because "0" is a truthy string in JavaScript:
gas: swapTx.gas ? BigInt(swapTx.gas) : undefined. This producesgas: 0n, which gets passed tooriginClient.call()for transaction simulation.Certain RPC providers (e.g. Alchemy on testnets) reject
eth_callrequests with gas: "0x0", resulting in anIntrinsicGasTooLowError.Explicitly checking for zero-ish
swapTx.gasfixes the issue and returnsundefinedfor0ngas values.Steps to reproduce
useTestnet: trueand testnet chains (e.g. Base Sepolia, Sepolia);getSwapQuote;executeSwapQuote;IntrinsicGasTooLowError: The amount of gas provided forthe transaction is too low;Full log: