fix(linea): send stateOverride to linea_estimateGas - #5069
Merged
jxom merged 1 commit intoSep 10, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: c763a43 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@moyanghe-uniswap is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
This was referenced Sep 11, 2026
Merged
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.
Problem
estimateGasfromviem/lineaacceptsstateOverridein its parameter type (inherited from the baseEstimateGasParameters), but the implementation silently drops it: the argument is destructured into a rest object that is never serialized, andparamsis built asblock ? [request, block] : [request]. Overrides never reach the node.This matters on Linea specifically because
linea_estimateGasalways validates the sender's real balance againstgas * price + value(unlikeeth_estimateGas, which skips the balance check when no gas price is supplied). Without a working balance override there is no way to quote gas for an account that isn't funded yet — e.g. previewing a WETH unwrap for a wallet that holds no native ETH, which is exactly when users unwrap. Such calls fail withtransaction up-front cost … exceeds transaction sender account balance(or a BesuCannot remove … wei from accountinternal error once a non-zerovaluereaches the transfer step).Fix
Serialize
stateOverridewith the existing internalserializeStateOverrideand send it onlinea_estimateGas. When no block is given it rides as the second positional param in the eth_call account-map shape — verified accepted by the Linea mainnet public sequencer (rpc.linea.build), Linea Sepolia (rpc.sepolia.linea.build), and Alchemy's Linea endpoints:Add the missing
[transaction, stateOverride]variant toLineaRpcSchema'sParametersunion, and allowHexfor the block position of the 3-param variant (the 2-param variant already allowed it; the implementation passesnumberToHex(blockNumber)).New test
args: stateOverrideagainst Linea Sepolia: the exact unfunded-sender call that the existingerror: insufficient balancetest expects to fail now succeeds with a balance override — it fails without this PR and passes with it.Notes for reviewers
error: insufficient balancetest currently fails onmainagainst Linea Sepolia: the node now reports a non-zero-value transfer from an unfunded sender as a BesuCannot remove … wei from accountinternal error rather than the up-front-cost message. This PR loosens that assertion to accept either message; happy to split that out if preferred.linea_estimateGascall that includes a block param ([tx, "latest"],[tx, blockNumberHex], and the 3-param shape all returnInternal error), so the block path appears unusable against current nodes. This PR leaves that path as-is and only threadsstateOverridethrough.