Repository navigation
fix: pass args when decoding simulateBlocks call results - #5620
Conversation
|
@mortezashojaei is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 5f9b8a9 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 |
|
Checked the decode step on its own on 5f9b8a9: with the two
I also went through the other |
simulateBlocksencodes a contract call with itsargs, so the matching overload runs, but it decodes the result without them.decodeFunctionResultthen picks an overload withgetAbiItem's no-args fallback: the zero-input overload if there is one, otherwise the first match in the ABI.simulateCallsreturns the same results, since it goes throughsimulateBlocks.With an overloaded function whose overloads have different outputs, the result comes from the wrong overload:
ownerOf() returns (uint256)next toownerOf(uint256) returns (address),ownerOf(420n)on the wagmi contract returns946538057168212150337809235825562151080949086380ninstead of0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC, with no error.bool), the wholesimulateBlockscall rejects withBytes value "…" is not a valid boolean.readContract,simulateContractandmulticallalready passargstodecodeFunctionResult, andreadContractreturns the address for the same ABI and args. ThesimulateBlocksdocs describe contract calls as identified byabi,functionNameandargs.This passes
argstodecodeFunctionResultinsimulateBlocks, and in Tempo'ssimulate.simulateBlocks, which has the same decode call.argswas already destructured there and passed togetContractError. Results for functions without overloads are unchanged.behavior: overloaded functiontest tosrc/actions/public/simulateBlocks.test.tsthat runs against Anvil. It fails without this change (the result is theuint256).Checks run:
pnpm test --run src/actions/public/simulateBlocks.test.ts src/actions/public/simulateCalls.test.ts --maxWorkers=1: 48 passed.pnpm check:typeswas not run becausetscruns out of memory on my machine.