eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.64k stars 555 forks source link

Getting error "Development network has a block height of ..." after ganache update #1475

Open AoDev opened 2 years ago

AoDev commented 2 years ago

Environment information

What was wrong?

Context: fresh install, ganache / brownie at latest versions. Steps: running ganache first, then brownie, and expecting brownie to connect to ganache rpc like usual.

Commands Ganache

"ganache-cli --networkId 137 --chain.chainId 137 --accounts 10 --fork https://polygon-mainnet.g.alchemy.com/v2/EDITED --gasLimit 120000000 --mnemonic brownie --port 8547 --hardfork istanbul"

Brownie

brownie console --network polygon-fork

(network config on port 8547)

Error

/Users/.../.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/main.py:44: BrownieEnvironmentWarning: Development network has a block height of 26073929

Could not attach to RPC process. If this issue persists, try killing the RPC and let Brownie launch it as a child process.

Not clear what to do.

The brownie config:

  - name: Polygon fork
    id: polygon-fork
    cmd: ganache-cli --chain.chainId 137
    cmd_settings:
      accounts: 10
      fork: https://polygon-mainnet.g.alchemy.com/v2/EDITED
      gas_limit: 120000000
      mnemonic: brownie
      port: 8547
    host: http://127.0.0.1

I can see that it does make some requests to ganache before failing.

image
AoDev commented 2 years ago

Solved by taking configs from here: https://github.com/eth-brownie/brownie/blob/master/brownie/data/network-config.yaml

AoDev commented 2 years ago

Reopening this as the issue actually didn't go away. I managed to make it work if I let brownie launch ganache. But if Ganache is launched first, I still get the Could not attach to RPC process error.