Skip to content

Commit

Permalink
Revert "Add binary search verification gas for 0.7"
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf authored Dec 20, 2024
1 parent 5f229bf commit ff39c04
Show file tree
Hide file tree
Showing 14 changed files with 562 additions and 1,638 deletions.
1 change: 0 additions & 1 deletion src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const bundlerArgsSchema = z.object({
)
return validatedAddresses
}),
"deterministic-deployer-address": addressSchema,
"entrypoint-simulation-contract": z.preprocess(
(v) => (v === "" ? undefined : v),
addressSchema.optional()
Expand Down
10 changes: 2 additions & 8 deletions src/cli/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@ export const bundlerOptions: CliCommandOptions<IBundlerArgsInput> = {
alias: "e",
require: true
},
"deterministic-deployer-address": {
description: "Address of the deterministic deployer contract",
type: "string",
alias: "d",
require: false,
default: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
},
"entrypoint-simulation-contract": {
description: "Address of the EntryPoint simulations contract",
type: "string",
alias: "c",
require: false
require: false,
default: "0xBbe8A301FbDb2a4CD58c4A37c262ecef8f889c47"
},
"refill-helper-contract": {
description: "Address of the Executor refill helper contract",
Expand Down
78 changes: 19 additions & 59 deletions src/cli/deploySimulationsContract.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import {
DETERMINISTIC_DEPLOYER_TRANSACTION,
ENTRY_POINT_SIMULATIONS_CREATECALL,
PimlicoEntryPointSimulationsDeployBytecode
} from "@alto/types"
import { PimlicoEntryPointSimulationsDeployBytecode } from "@alto/types"
import {
type Chain,
createWalletClient,
getContractAddress,
type Hex,
http,
type PublicClient,
Expand All @@ -15,16 +10,6 @@ import {
import type { CamelCasedProperties } from "./parseArgs"
import type { IOptions } from "@alto/cli"

const isContractDeployed = async ({
publicClient,
address
}: { publicClient: PublicClient<Transport, Chain>; address: Hex }) => {
const code = await publicClient.getCode({
address
})
return code !== undefined && code !== "0x"
}

export const deploySimulationsContract = async ({
args,
publicClient
Expand All @@ -39,61 +24,36 @@ export const deploySimulationsContract = async ({
)
}

// if (args.entrypointSimulationContract) {
// if (
// await isContractDeployed({
// publicClient,
// address: args.entrypointSimulationContract
// })
// ) {
// return args.entrypointSimulationContract
// }
// }
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
})

if (
!(await isContractDeployed({
publicClient,
address: args.deterministicDeployerAddress
}))
) {
const deterministicDeployHash = await walletClient.sendRawTransaction({
serializedTransaction: DETERMINISTIC_DEPLOYER_TRANSACTION
})

await publicClient.waitForTransactionReceipt({
hash: deterministicDeployHash
})
}

const contractAddress = getContractAddress({
opcode: "CREATE2",
bytecode: PimlicoEntryPointSimulationsDeployBytecode,
from: args.deterministicDeployerAddress,
salt: "0x3132333400000000000000000000000000000000000000000000000000000000" as Hex
})

if (await isContractDeployed({ publicClient, address: contractAddress })) {
return contractAddress
}

const deployHash = await walletClient.sendTransaction({
const deployHash = await walletClient.deployContract({
chain: publicClient.chain,
to: args.deterministicDeployerAddress,
data: ENTRY_POINT_SIMULATIONS_CREATECALL
abi: [],
bytecode: PimlicoEntryPointSimulationsDeployBytecode
})

await publicClient.waitForTransactionReceipt({
const receipt = await publicClient.waitForTransactionReceipt({
hash: deployHash
})

if (await isContractDeployed({ publicClient, address: contractAddress })) {
return contractAddress
const simulationsContract = receipt.contractAddress

if (simulationsContract === null || simulationsContract === undefined) {
throw new Error("Failed to deploy simulationsContract")
}

throw new Error("Failed to deploy simulationsContract")
return simulationsContract
}
Loading

0 comments on commit ff39c04

Please sign in to comment.