-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf3aa9c
commit 603cff2
Showing
38 changed files
with
334 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "root", | ||
"private": true, | ||
"version": "1.5.10", | ||
"version": "1.5.11", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 14 additions & 6 deletions
20
packages/executor/src/services/BundlingService/utils/estimateBundleGasLimit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
import { BigNumber } from "ethers"; | ||
import { BigNumber, BigNumberish } from "ethers"; | ||
import { UserOperationStruct } from "@skandha/types/lib/executor/contracts/EntryPoint"; | ||
import { MempoolEntry } from "../../../entities/MempoolEntry"; | ||
|
||
export function estimateBundleGasLimit( | ||
markup: number, | ||
bundle: MempoolEntry[] | ||
bundle: MempoolEntry[], | ||
estimationGasLimit: BigNumberish = 0 | ||
): BigNumber { | ||
let gasLimit = BigNumber.from(markup); | ||
for (const { userOp } of bundle) { | ||
gasLimit = getUserOpGasLimit(userOp, gasLimit); | ||
gasLimit = getUserOpGasLimit(userOp, gasLimit, 0); | ||
} | ||
if (gasLimit.lt(1e5)) { | ||
// gasLimit should at least be 1e5 to pass test in test-executor | ||
gasLimit = BigNumber.from(1e5); | ||
} | ||
return gasLimit; | ||
return gasLimit.gt(estimationGasLimit) | ||
? gasLimit | ||
: BigNumber.from(estimationGasLimit); | ||
} | ||
|
||
export function getUserOpGasLimit( | ||
userOp: UserOperationStruct, | ||
markup: BigNumber = BigNumber.from(0) | ||
markup: BigNumber = BigNumber.from(0), | ||
estimationGasLimit: BigNumberish = 0 | ||
): BigNumber { | ||
return BigNumber.from(userOp.verificationGasLimit) | ||
const gasLimit = BigNumber.from(userOp.verificationGasLimit) | ||
.mul(3) | ||
.add(200000) // instead of PVG | ||
.add(userOp.callGasLimit) | ||
.mul(11) | ||
.div(10) | ||
.add(markup); | ||
|
||
return gasLimit.gt(estimationGasLimit) | ||
? gasLimit | ||
: BigNumber.from(estimationGasLimit); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.