Skip to content

Commit a77c834

Browse files
committed
revert if initial run fails
1 parent 927701e commit a77c834

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/v07/EntryPointSimulations.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ contract EntryPointSimulations is EntryPoint, IEntryPointSimulations {
172172
targetSuccess = true;
173173
targetResult = hex"";
174174
minGas = initialMinGas;
175+
176+
(targetSuccess, targetResult) = thisContract.simulateCall(entryPoint, payload, gasleft());
177+
178+
// If the call reverts then don't binary search.
179+
if (!targetSuccess) {
180+
return TargetCallResult(0, targetSuccess, targetResult);
181+
}
175182
} else {
176183
// Find the minGas (reduces number of iterations + checks if the call reverts).
177184
uint256 remainingGas = gasleft();
178-
179185
(targetSuccess, targetResult) = thisContract.simulateCall(entryPoint, payload, gasleft());
180186
minGas = remainingGas - gasleft();
181187

0 commit comments

Comments
 (0)