eth-infinitism / bundler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

runop: getDefaultProvider error

weiihann opened this issue · comments

I have successfully ran a Geth node using the docker command provided as well as successfully running the bundler following the instruction stated in the README file. When I attempt to run yarn run runop --deployFactory --network localhost, I get the following error:

Error: unsupported getDefaultProvider network (operation="getDefaultProvider", network="localhost", code=NETWORK_ERROR, version=providers/5.7.2)
    at Logger.makeError (/Users/weihan/Documents/Codes/bundler/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/Users/weihan/Documents/Codes/bundler/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at getDefaultProvider (/Users/weihan/Documents/Codes/bundler/node_modules/@ethersproject/providers/src.ts/index.ts:70:16)
    at main (/Users/weihan/Documents/Codes/bundler/packages/bundler/src/runner/runop.ts:112:38)
    at Object.<anonymous> (/Users/weihan/Documents/Codes/bundler/packages/bundler/src/runner/runop.ts:194:6)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module.m._compile (/Users/weihan/Documents/Codes/bundler/packages/bundler/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/weihan/Documents/Codes/bundler/packages/bundler/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1117:32) {
  reason: 'unsupported getDefaultProvider network',
  code: 'NETWORK_ERROR',
  operation: 'getDefaultProvider',
  network: 'localhost'
}

May I ask for help on this?

the network string should be possibly localhost:8545 instead

Running yarn run runop --deployFactory --network http://localhost:8545/ seems to solve the getDefaultProvider error, but another error has occurred.

$ yarn --cwd packages/bundler runop --deployFactory --network http://localhost:8545/ $ ts-node ./src/runner/runop.ts --deployFactory --network http://localhost:8545/ /Users/weihan/Documents/Codes/bundler/packages/sdk/dist/src/BaseAccountAPI.js:75 throw new Error('must handle revert'); ^ Error: must handle revert at SimpleAccountAPI.getCounterFactualAddress (/Users/weihan/Documents/Codes/bundler/packages/sdk/dist/src/BaseAccountAPI.js:75:15) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Runner.getAddress (/Users/weihan/Documents/Codes/bundler/packages/bundler/src/runner/runop.ts:43:12) at async main (/Users/weihan/Documents/Codes/bundler/packages/bundler/src/runner/runop.ts:159:16)

Any idea on how to solve it?

Make sure you've deploy your contracts first

Yup I've deployed the contracts and got the following message, so I'm assuming everything works fine

$ hardhat deploy --network localhost
Nothing to compile
No need to generate any newer typings.
Deployed EntryPoint at 0x0576a174d229e3cfa37253523e645a78a0c91b57
funding hardhat account 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
lerna success run Ran npm script 'hardhat-deploy' in 1 package in 1.9s:
lerna success - @account-abstraction/bundler

For more context, everytime I ran yarn run runop --deployFactory --network localhost, the bundler will output sent eth_chainId - 0x539.

@weiihann I just found that in the runop script, it hardcodes the entry point address:

const ENTRY_POINT = '0x1306b01bc3e4ad202612d3843387e94737673f53'

If you are same as me to follow the guide in the README, the entry point address would be deployed in the local testnet at 0x0576a174D229E3cFA37253523E645A78A0C91B57.

After updating the address, I can run runop script successfully.

@weiihann I just found that in the runop script, it hardcodes the entry point address:

const ENTRY_POINT = '0x1306b01bc3e4ad202612d3843387e94737673f53'

If you are same as me to follow the guide in the README, the entry point address would be deployed in the local testnet at 0x0576a174D229E3cFA37253523E645A78A0C91B57.

After updating the address, I can run runop script successfully.

It works now! Thanks a lot :)