Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve call gas estimations #310

Merged
merged 21 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/config.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"min-entity-unstake-delay": 1,
"max-bundle-wait": 3,
"max-bundle-size": 3,
"port": 3000,
"port": 4337,
"executor-private-keys": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"utility-private-key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"entrypoints": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"entrypoint-simulation-contract": "0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87",
"entrypoint-simulation-contract": "0xAE6035bEE0802C969265C8A3193CE8878c99A66A",
"enable-debug-endpoints": true,
"expiration-check": false,
"safe-mode": false,
"api-version": "v1,v2",
"public-client-log-level": "error"
"public-client-log-level": "info"
}
4 changes: 2 additions & 2 deletions scripts/localDeployer/constants.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/localDeployer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ const main = async () => {
"0x988C135a1049Ce61730724afD342fb7C56CD2776",
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985",
"0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87",
"0xAE6035bEE0802C969265C8A3193CE8878c99A66A",
"0x2dd68b007B46fBe91B9A7c3EDa5A7a1063cB5b47",
"0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226",
"0x8EcD4ec46D4D2a6B64fE960B3D64e8B94B2234eb",
Expand Down
17 changes: 16 additions & 1 deletion src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ export const debugArgsSchema = z.object({
tenderly: z.boolean()
})

export const gasEstimationArgsSchema = z.object({
"binary-search-tolerance-delta": z
.string()
.transform((val) => BigInt(val))
.default("1000"),
"binary-search-gas-allowance": z
.string()
.transform((val) => BigInt(val))
.default("1000000")
})

export type IBundlerArgs = z.infer<typeof bundlerArgsSchema>
export type IBundlerArgsInput = z.input<typeof bundlerArgsSchema>

Expand All @@ -216,14 +227,18 @@ export type ILogArgsInput = z.input<typeof logArgsSchema>
export type IDebugArgs = z.infer<typeof debugArgsSchema>
export type IDebugArgsInput = z.input<typeof debugArgsSchema>

export type IGasEstimationArgs = z.infer<typeof gasEstimationArgsSchema>
export type IGasEstimationArgsInput = z.input<typeof gasEstimationArgsSchema>

export const optionArgsSchema = z.object({
...bundlerArgsSchema.shape,
...compatibilityArgsSchema.shape,
...logArgsSchema.shape,
...serverArgsSchema.shape,
...rpcArgsSchema.shape,
...bundleCopmressionArgsSchema.shape,
...debugArgsSchema.shape
...debugArgsSchema.shape,
...gasEstimationArgsSchema.shape
})

export type IOptions = z.infer<typeof optionArgsSchema>
Expand Down
19 changes: 19 additions & 0 deletions src/cli/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
IBundlerArgsInput,
ICompatibilityArgsInput,
IDebugArgsInput,
IGasEstimationArgsInput,
ILogArgsInput,
IOptionsInput,
IRpcArgsInput,
Expand Down Expand Up @@ -188,6 +189,24 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
}
}

export const gasEstimationOptions: CliCommandOptions<IGasEstimationArgsInput> =
{
"binary-search-tolerance-delta": {
description:
"Defines the threshold for when to stop the gas estimation binary search",
type: "string",
require: false,
default: "10000"
},
"binary-search-gas-allowance": {
description:
"Added to the initial minimum gas to determine the upper bound of the binary search",
type: "string",
require: false,
default: "1000000"
}
}

export const compatibilityOptions: CliCommandOptions<ICompatibilityArgsInput> =
{
"chain-type": {
Expand Down
10 changes: 10 additions & 0 deletions src/cli/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ export async function bundlerHandler(args: IOptionsInput): Promise<void> {
parsedArgs["entrypoint-simulation-contract"] = simulationsContract
}

// TODO: THIS IS TEMPORARY, REMOVE AFTER THIS PR IS DEPLOYED + ENV VARS ARE SET
parsedArgs["entrypoint-simulation-contract"] =
"0xAE6035bEE0802C969265C8A3193CE8878c99A66A"

if (chainId === 19411) {
// geo-testnet
parsedArgs["entrypoint-simulation-contract"] =
"0x98F36cDFCE8cF2AB75d8E164b99060f9e41775Dd"
}

const gasPriceManager = new GasPriceManager(
chain,
client,
Expand Down
4 changes: 4 additions & 0 deletions src/cli/setupServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const getValidator = ({
parsedArgs["chain-type"],
parsedArgs["block-tag-support"],
utilityWalletAddress,
parsedArgs["binary-search-tolerance-delta"],
parsedArgs["binary-search-gas-allowance"],
parsedArgs["entrypoint-simulation-contract"],
parsedArgs["fixed-gas-limit-for-estimation"],
parsedArgs.tenderly,
Expand All @@ -106,6 +108,8 @@ const getValidator = ({
parsedArgs["chain-type"],
parsedArgs["block-tag-support"],
utilityWalletAddress,
parsedArgs["binary-search-tolerance-delta"],
parsedArgs["binary-search-gas-allowance"],
parsedArgs["entrypoint-simulation-contract"],
parsedArgs["fixed-gas-limit-for-estimation"],
parsedArgs.tenderly,
Expand Down
Loading
Loading