eth-infinitism / bundler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing Issue saying "wrong version?"

D3athGr1p opened this issue · comments

I already deployed EntryPoint in localhost ganacge using
yarn hardhat-deploy --network localhost

and got output like

yarn run v1.22.19
$ lerna run hardhat-deploy --stream --no-prefix -- --network localhost
lerna notice cli v5.6.2
lerna info Executing command in 1 package: "yarn run hardhat-deploy --network localhost"
$ hardhat deploy --network localhost
Nothing to compile
No need to generate any newer typings.
EntryPoint already deployed at 0x0576a174d229e3cfa37253523e645a78a0c91b57
lerna success run Ran npm script 'hardhat-deploy' in 1 package in 1.7s:
lerna success - @account-abstraction/bundler
Done in 1.95s.

After that I tried to run
yarn run bundler --unsafe

and got error saying

yarn run v1.22.19
$ yarn --cwd packages/bundler bundler --unsafe
$ ts-node ./src/exec.ts --config ./localconfig/bundler.config.json --unsafe
command-line arguments:  {
  config: './localconfig/bundler.config.json',
  auto: false,
  unsafe: true
}
Merged configuration: {"port":"3000","entryPoint":"0x0576a174D229E3cFA37253523E645A78A0C91B57","unsafe":true,"conditionalRpc":false,"gasFactor":"1","network":"http://localhost:8545","beneficiary":"0x5392E4A5Ed9E756D814a2aB903BF365beF12FCED","minBalance":"1","mnemonic":"./localconfig/mnemonic.txt","maxBundleGas":5000000,"minStake":"1","minUnstakeDelay":0,"autoBundleInterval":3,"autoBundleMempoolSize":10}
FATAL: Invalid entryPoint contract at 0x0576a174D229E3cFA37253523E645A78A0C91B57. wrong version?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

very strange...
"wrong version" means that there is a contract in the address, but doesn't support the right method sig: Either it is not an entrypoint at all, or that the UserOperation struct differs.
did you run "yarn preprocess" before running the bundler?

I have encountered the same issue with Ganache v2.7.0 running locally.

I find that the err returned from this line in BundlerServer.ts does not have the property errorName

const err = await EntryPoint__factory.connect(this.config.entryPoint, this.provider).callStatic.simulateValidation(emptyUserOp)
                    .catch(e => e)

Just try use decodeErrorReason to decode err.error.error.data and check if the error message startsWith FailedOp to bypass this issue.

const err = await EntryPoint__factory.connect(this.config.entryPoint, this.provider).callStatic.simulateValidation(emptyUserOp)
      .catch(e => e)
const decoded = decodeErrorReason(err.error?.error?.data ?? '')
const decodedMessage = decoded?.message ?? ''
if (err?.errorName !== 'FailedOp' || decodedMessage.startsWith('FailedOp:')) {
   this.fatal(`Invalid entryPoint contract at ${this.config.entryPoint}. wrong version?`)
}

However, there are many other similar cases (e.g. getSenderAddress) need to handle too.
And even worse that some error reasons may be returned from err.error.error.error.........data

It works fine to switch to use docker image "ethereum/client-go" as the node