Skip to content
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
14 changes: 6 additions & 8 deletions packages/boba/bundler/src/BundlerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { BundlerConfig } from './BundlerConfig'
import { UserOpMethodHandler } from './UserOpMethodHandler'
import { Server } from 'http'
import { RpcError } from './utils'
import { UserOperationStruct } from '@boba/accountabstraction'
import { EntryPointWrapper__factory, EntryPointWrapper, UserOperationStruct } from '@boba/accountabstraction'
import { DebugMethodHandler } from './DebugMethodHandler'

import Debug from 'debug'
Expand Down Expand Up @@ -80,13 +80,11 @@ export class BundlerServer {
maxPriorityFeePerGas: 0,
signature: '0x',
}
// TODO: https://github.com/bobanetwork/boba/issues/759
// // await EntryPoint__factory.connect(this.config.entryPoint,this.provider).callStatic.addStake(0)
// const err = await EntryPoint__factory.connect(this.config.entryPoint, this.provider).callStatic.simulateValidation(emptyUserOp)
// .catch(e => e)
// if (err?.errorName !== 'FailedOp') {
// this.fatal(`Invalid entryPoint contract at ${this.config.entryPoint}. wrong version?`)
// }
const ret = await EntryPointWrapper__factory.connect(this.config.entryPointWrapper, this.wallet).callStatic.simulateValidation(emptyUserOp)
const [failedOpStatus, _]: [EntryPointWrapper.FailedOpStatusStructOutput, any] = ret
if (failedOpStatus?.status !== true) {
this.fatal(`Invalid entryPoint contract at ${this.config.entryPoint}. wrong version?`)
}
const bal = await this.provider.getBalance(this.wallet.address)
console.log(
'signer',
Expand Down
23 changes: 18 additions & 5 deletions packages/boba/bundler/src/runBundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ export let showStackTraces = false

export async function connectContracts(
wallet: Wallet,
entryPointAddress: string
): Promise<EntryPoint> {
entryPointAddress: string,
entryPointWrapperAddress: string
): Promise<{ entryPoint: EntryPoint, entryPointWrapper: EntryPointWrapper }> {
const entryPoint = EntryPoint__factory.connect(entryPointAddress, wallet)
return entryPoint
const entryPointWrapper = EntryPointWrapper__factory.connect(entryPointWrapperAddress, wallet)
return { entryPoint, entryPointWrapper }
}

export async function connectContractsViaAddressManager (
Expand All @@ -48,7 +50,7 @@ export async function connectContractsViaAddressManager (
const entryPointWrapperAddress = await addressManager.getAddress('L2_EntryPointWrapper')
const entryPoint = EntryPoint__factory.connect(entryPointAddress, wallet)
const entryPointWrapper = EntryPointWrapper__factory.connect(entryPointWrapperAddress, wallet)
return { entryPoint: entryPoint, entryPointWrapper }
return { entryPoint, entryPointWrapper }
}

function getAddressManager (provider: any, addressManagerAddress: any): ethers.Contract {
Expand Down Expand Up @@ -176,8 +178,19 @@ export async function runBundler(
entryPoint = eP
entryPointWrapper = epW
} else {
const eP = await connectContracts(wallet, config.entryPoint)
const { entryPoint: eP, entryPointWrapper: epW } = await connectContracts(wallet, config.entryPoint, config.entryPointWrapper)
config.entryPoint = eP.address
entryPoint = eP
config.entryPointWrapper = epW.address
entryPointWrapper = epW
}

const entryPointFromWrapper = await entryPointWrapper.entryPoint()
if (
entryPointFromWrapper.toLowerCase() !== entryPoint.address.toLowerCase()
) {
console.error('WARN: entryPointWrapper may be incompatible with entryPoint')
process.exit(1)
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EntryPointWrapper has been made a compulsion now

// bundleSize=1 replicate current immediate bundling mode
const execManagerConfig = {
Expand Down