From 694253bc6f350f5753a40aa6501282635c1f5039 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:50:05 +0000 Subject: [PATCH] fix infinite callgaslimit binary search --- src/v07/EntryPointSimulations.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/v07/EntryPointSimulations.sol b/src/v07/EntryPointSimulations.sol index acb8ed3..f54a12c 100644 --- a/src/v07/EntryPointSimulations.sol +++ b/src/v07/EntryPointSimulations.sol @@ -193,6 +193,11 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations { uint256 remainingGas = gasleft(); (targetSuccess, targetResult) = thisContract.simulateCall(entryPoint, target, targetCallData, gasleft()); minGas = remainingGas - gasleft(); + + // If the call reverts then don't binary search. + if (!targetSuccess) { + return TargetCallResult(0, targetSuccess, targetResult); + } } // Set bounds for binary search.