Skip to content

Commit

Permalink
Merge branch 'main' into feat/7702-support
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x authored Dec 17, 2024
2 parents 547c950 + 86e1ea7 commit cf3c433
Show file tree
Hide file tree
Showing 15 changed files with 469 additions and 304 deletions.
13 changes: 12 additions & 1 deletion src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export const compatibilityArgsSchema = z.object({
"op-stack",
"arbitrum",
"hedera",
"mantle"
"mantle",
"skale"
]),
"legacy-transactions": z.boolean(),
"api-version": z
Expand Down Expand Up @@ -210,6 +211,16 @@ export const gasEstimationArgsSchema = z.object({
.transform((val) => BigInt(val))
.default("1000000"),
"call-gas-limit-multiplier": z.string().transform((val) => BigInt(val)),
"simulation-call-gas-limit": z.string().transform((val) => BigInt(val)),
"simulation-verification-gas-limit": z
.string()
.transform((val) => BigInt(val)),
"simulation-paymaster-verification-gas-limit": z
.string()
.transform((val) => BigInt(val)),
"simulation-paymaster-post-op-gas-limit": z
.string()
.transform((val) => BigInt(val)),
"paymaster-gas-limit-multiplier": z.string().transform((val) => BigInt(val))
})

Expand Down
41 changes: 38 additions & 3 deletions src/cli/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,51 @@ export const gasEstimationOptions: CliCommandOptions<IGasEstimationArgsInput> =
type: "string",
require: true,
default: "110"
},
"simulation-call-gas-limit": {
description:
"UserOperation's callGasLimit used during gas estimation simulations",
type: "string",
require: true,
default: "10000000"
},
"simulation-verification-gas-limit": {
description:
"UserOperation's verificationGasLimit used during gas estimation simulations",
type: "string",
require: true,
default: "10000000"
},
"simulation-paymaster-verification-gas-limit": {
description:
"UserOperation's paymasterVerificationGasLimit used during gas estimation simulations",
type: "string",
require: true,
default: "5000000"
},
"simulation-paymaster-post-op-gas-limit": {
description:
"UserOperation's paymasterPostOpGasLimit used during gas estimation simulations",
type: "string",
require: true,
default: "2000000"
}
}

export const compatibilityOptions: CliCommandOptions<ICompatibilityArgsInput> =
{
"chain-type": {
description:
"Indicates weather the chain is a OP stack chain, arbitrum chain, or default EVM chain",
"Indicates what type of chain the bundler is running on",
type: "string",
choices: ["default", "op-stack", "arbitrum", "hedera", "mantle"],
choices: [
"default",
"op-stack",
"arbitrum",
"hedera",
"mantle",
"skale"
],
default: "default"
},
"legacy-transactions": {
Expand Down Expand Up @@ -475,7 +510,7 @@ export const debugOptions: CliCommandOptions<IDebugArgsInput> = {
"Should the bundler deploy the simulations contract on startup",
type: "boolean",
require: true,
default: false
default: true
},
tenderly: {
description: "RPC url follows the tenderly format",
Expand Down
10 changes: 10 additions & 0 deletions src/cli/deploySimulationsContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ export const deploySimulationsContract = async ({
)
}

if (args.entrypointSimulationContract) {
const simulations = args.entrypointSimulationContract
const simulationsCode = await publicClient.getCode({
address: simulations
})
if (simulationsCode !== undefined && simulationsCode !== "0x") {
return args.entrypointSimulationContract
}
}

const walletClient = createWalletClient({
transport: http(args.rpcUrl),
account: utilityPrivateKey
Expand Down
18 changes: 16 additions & 2 deletions src/cli/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
createPublicClient,
createWalletClient,
formatEther,
fallback
fallback,
CallParameters,
publicActions
} from "viem"
import { UtilityWalletMonitor } from "../executor/utilityWalletMonitor"
import type { IOptionsInput } from "./config"
Expand Down Expand Up @@ -93,7 +95,7 @@ export async function bundlerHandler(args_: IOptionsInput): Promise<void> {
}
}

const publicClient = createPublicClient({
let publicClient = createPublicClient({
transport: customTransport(args.rpcUrl, {
logger: logger.child(
{ module: "public_client" },
Expand All @@ -105,6 +107,18 @@ export async function bundlerHandler(args_: IOptionsInput): Promise<void> {
chain
})

if (args.chainType === "skale") {
// SKALE only allows white listed addresses to deploy contracts.
publicClient = publicClient
.extend((client) => ({
async call(args: CallParameters) {
args.account = "0x4337000c2828F5260d8921fD25829F606b9E8680"
return await client.call(args)
}
}))
.extend(publicActions)
}

const createWalletTransport = (url: string) =>
customTransport(url, {
logger: logger.child(
Expand Down
Loading

0 comments on commit cf3c433

Please sign in to comment.