Since the call to EntryPointSimulations.simulateHandleOp is made from the simulation entrypoint deployed by the bundler (this.entryPoint in the MethodHandlerERC4337 class) (deployed here) and not the existing entrypoint specified in the config (this.config.entryPoint), the Account reverts it from BaseAccount._requireFromEntryPoint due to msg.sender not being the expected entrypoint.
estimateUserOperationGas handler at MethodHandlerERC4337.ts:139 making the off-chain simulateHandleOp call:
await this._validateParameters(deepHexlify(userOp), entryPointInput)
// todo: validation manager duplicate?
const provider = this.provider
const rpcParams = simulationRpcParams('simulateHandleOp', this.entryPoint.address, userOp, [AddressZero, '0x'],
stateOverride
// {
// allow estimation when account's balance is zero.
// todo: need a way to flag this, and not enable always.
// [userOp.sender]: {
// balance: hexStripZeros(parseEther('1').toHexString())
// }
// }
)
const ret = await provider.send('eth_call', rpcParams)
.catch((e: any) => { throw new RpcError(decodeRevertReason(e) as string, ValidationErrors.SimulateValidation) })
Is the entryPointAddress passed to simulationRpcParams supposed to be the simulation entrypoint? It is strange because the state-override ends up unnecessarily overriding that address with its own bytecode at rpcSimulateValidations.ts:16:
const stateOverride = {
[entryPointAddress]: {
code: EntryPointSimulationsJson.deployedBytecode
}
}
This small update would make it so that the deployed bytecode of the simulation entrypoint corresponds to the entrypoint-address expected by the Account:
- const rpcParams = simulationRpcParams('simulateHandleOp', this.entryPoint.address, userOp, [AddressZero, '0x'],
+ const rpcParams = simulationRpcParams('simulateHandleOp', this.config.entryPoint, userOp, [AddressZero, '0x'],
Since the call to
EntryPointSimulations.simulateHandleOpis made from the simulation entrypoint deployed by the bundler (this.entryPointin theMethodHandlerERC4337class) (deployed here) and not the existing entrypoint specified in the config (this.config.entryPoint), the Account reverts it fromBaseAccount._requireFromEntryPointdue tomsg.sendernot being the expected entrypoint.estimateUserOperationGashandler at MethodHandlerERC4337.ts:139 making the off-chainsimulateHandleOpcall:Is the
entryPointAddresspassed tosimulationRpcParamssupposed to be the simulation entrypoint? It is strange because the state-override ends up unnecessarily overriding that address with its own bytecode at rpcSimulateValidations.ts:16:This small update would make it so that the deployed bytecode of the simulation entrypoint corresponds to the entrypoint-address expected by the Account: