From 60f752c3315ff3335c4f22043520bddade30855f Mon Sep 17 00:00:00 2001 From: William Cory Date: Thu, 24 Oct 2024 20:25:01 -0700 Subject: [PATCH] :bug: Fix: bug with gasLimit being set to block max --- .changeset/tough-balloons-poke.md | 5 +++++ packages/actions/src/Call/executeCall.js | 3 ++- test/bench/src/gasFailing.ts | 25 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .changeset/tough-balloons-poke.md create mode 100644 test/bench/src/gasFailing.ts diff --git a/.changeset/tough-balloons-poke.md b/.changeset/tough-balloons-poke.md new file mode 100644 index 0000000000..1fe49872e7 --- /dev/null +++ b/.changeset/tough-balloons-poke.md @@ -0,0 +1,5 @@ +--- +"@tevm/actions": patch +--- + +Fixed bug where gasLimit was set to block max when simulating calls diff --git a/packages/actions/src/Call/executeCall.js b/packages/actions/src/Call/executeCall.js index 9940519acb..62ed61931c 100644 --- a/packages/actions/src/Call/executeCall.js +++ b/packages/actions/src/Call/executeCall.js @@ -52,7 +52,8 @@ export const executeCall = async (client, evmInput, params) => { skipBlockGasLimitValidation: true, // we currently set the nonce ourselves user can't set it skipNonce: true, - skipBalance: evmInput.skipBalance ?? false, + // we must skipBalance for now because we have no clue what the gasLimit should be so this initial run we set it to block maximum + skipBalance: true, ...(evmInput.block !== undefined ? { block: /** @type any*/ (evmInput.block) } : {}), tx, }) diff --git a/test/bench/src/gasFailing.ts b/test/bench/src/gasFailing.ts new file mode 100644 index 0000000000..2906f75fb3 --- /dev/null +++ b/test/bench/src/gasFailing.ts @@ -0,0 +1,25 @@ +import { createMemoryClient, http } from "tevm"; + +const memoryClient = await createMemoryClient({ + fork: { + transport: http("https://bartio.rpc.berachain.com/")({}), + }, +}); + +const txData = { + data: "0xd0e30db0", + to: "0x7507c1dc16935B82698e4C63f2746A2fCf994dF8", + from: + "0x2a440A6B506bC8e70343497505829caF27Ab255f", + value: "100000000000000", +} as const; + +const callResult = await memoryClient.tevmCall({ + from: txData.from, + to: txData.to, + ...(txData.data !== null ? { data: txData.data } : {}), + value: BigInt("100000000000000"), + createTransaction: "on-success", +}); + +console.log(callResult); \ No newline at end of file