Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride committed Aug 13, 2024
1 parent dd43840 commit 03b99c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/executor/src/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { GetNodeAPI, NetworkConfig } from "../interfaces";
import { EntryPointVersion } from "../services/EntryPointService/interfaces";
import { getUserOpGasLimit } from "../services/BundlingService/utils";
import { maxBn, minBn } from "../utils/bignumber";
import {
EstimateUserOperationGasArgs,
SendUserOperationGasArgs,
Expand Down Expand Up @@ -223,17 +224,17 @@ export class Eth {
});
//>

let callGasLimit = binarySearchCGL;
let callGasLimit = minBn(binarySearchCGL, paidFeeCGL);
if (userOp.factoryData !== undefined && userOp.factoryData.length > 2) {
await this.provider
.estimateGas({
from: entryPoint,
to: userOp.sender,
data: userOp.callData,
gasLimit: binarySearchCGL,
gasLimit: callGasLimit,
})
.catch((_) => {
callGasLimit = paidFeeCGL;
callGasLimit = maxBn(binarySearchCGL, paidFeeCGL);
});
}
this.logger.debug(
Expand Down
9 changes: 9 additions & 0 deletions packages/executor/src/utils/bignumber.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BigNumber } from "ethers";

export function minBn(lhs: BigNumber, rhs: BigNumber): BigNumber {
return lhs.gt(rhs) ? rhs : lhs;
}

export function maxBn(lhs: BigNumber, rhs: BigNumber): BigNumber {
return lhs.lt(rhs) ? rhs : lhs;
}

0 comments on commit 03b99c5

Please sign in to comment.