optimism
optimism copied to clipboard
Fatal: Failed to write genesis block: database contains incompatible genesis
Describe the bug I am trying to build a mainnet replica node and I am getting a fatal error when collecting the l2geth logs.
To Reproduce Steps to reproduce the behavior:
- Clone optimism repo to your machine
- cd optimism/infra/op-replica/docker-compose
- Update your .env file as follows: COMPOSE_PROJECT_NAME=op-replica COMPOSE_FILE=replica.yml:replica-shared.yml:replica-toml.yml ETH_NETWORK=mainnet DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=https://mainnet.infura.io/v3/ DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT=https://mainnet.optimism.io REPLICA_HEALTHCHECK__ETH_NETWORK_RPC_PROVIDER=https://mainnet.optimism.io SEQUENCER_CLIENT_HTTP=https://mainnet.optimism.io SHARED_ENV_PATH=../envs/mainnet GCMODE=archive L2GETH_IMAGE_TAG=0.5.19 DTL_IMAGE_TAG=0.5.28 HC_IMAGE_TAG= 1.0.6 L2GETH_HTTP_PORT=9991 L2GETH_WS_PORT=9992 DTL_PORT=7878 GETH_INIT_SCRIPT=check-for-chaindata-berlin.sh
RESTART=unless-stopped 5. Start the replica 6. See error
Expected behavior not sure why the chain id collected is the optimism testnet chain id when I updated my env file with mainnet variables.
Screenshots docker-compose % docker-compose logs -f l2geth-replica Attaching to op-replica-l2geth-replica-1 op-replica-l2geth-replica-1 | + echo running /scripts/check-for-chaindata-berlin.sh op-replica-l2geth-replica-1 | + GETH_DATA_DIR=/geth op-replica-l2geth-replica-1 | + GETH_CHAINDATA_DIR=/geth/geth/chaindata op-replica-l2geth-replica-1 | + GETH_KEYSTORE_DIR=/geth/keystore op-replica-l2geth-replica-1 | + '[' '!' -d /geth/keystore ] op-replica-l2geth-replica-1 | running /scripts/check-for-chaindata-berlin.sh op-replica-l2geth-replica-1 | + '[' '!' -d /geth/geth/chaindata ] op-replica-l2geth-replica-1 | + echo '/geth/geth/chaindata exists, checking for hardfork.' op-replica-l2geth-replica-1 | /geth/geth/chaindata exists, checking for hardfork. op-replica-l2geth-replica-1 | Chain config: op-replica-l2geth-replica-1 | + echo 'Chain config:' op-replica-l2geth-replica-1 | + geth dump-chain-cfg '--datadir=/geth' op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.281] Maximum peer count ETH=50 LES=0 total=50 op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.283] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.287] Allocated cache and file handles database=/geth/geth/chaindata cache=16.00MiB handles=16 op-replica-l2geth-replica-1 | { op-replica-l2geth-replica-1 | "chainId": 69, op-replica-l2geth-replica-1 | "homesteadBlock": 0, op-replica-l2geth-replica-1 | "eip150Block": 0, op-replica-l2geth-replica-1 | "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", op-replica-l2geth-replica-1 | "eip155Block": 0, op-replica-l2geth-replica-1 | "eip158Block": 0, op-replica-l2geth-replica-1 | "byzantiumBlock": 0, op-replica-l2geth-replica-1 | "constantinopleBlock": 0, op-replica-l2geth-replica-1 | "petersburgBlock": 0, op-replica-l2geth-replica-1 | "istanbulBlock": 0, op-replica-l2geth-replica-1 | "muirGlacierBlock": 0, op-replica-l2geth-replica-1 | "berlinBlock": 1138900, op-replica-l2geth-replica-1 | "clique": { op-replica-l2geth-replica-1 | "period": 0, op-replica-l2geth-replica-1 | "epoch": 30000 op-replica-l2geth-replica-1 | } op-replica-l2geth-replica-1 | } op-replica-l2geth-replica-1 | + geth dump-chain-cfg '--datadir=/geth' op-replica-l2geth-replica-1 | + grep -q '"berlinBlock": 3950000' op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.386] Maximum peer count ETH=50 LES=0 total=50 op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.387] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.389] Allocated cache and file handles database=/geth/geth/chaindata cache=16.00MiB handles=16 op-replica-l2geth-replica-1 | + echo 'Hardfork not activated, running init.' op-replica-l2geth-replica-1 | Hardfork not activated, running init. op-replica-l2geth-replica-1 | + geth init '--datadir=/geth' https://storage.googleapis.com/optimism/mainnet/genesis-berlin.json 0x106b0a3247ca54714381b1109e82cc6b7e32fd79ae56fbcc2e7b1541122f84ea op-replica-l2geth-replica-1 | INFO [05-03|10:10:37.460] Fetching genesis file url=https://storage.googleapis.com/optimism/mainnet/genesis-berlin.json op-replica-l2geth-replica-1 | INFO [05-03|10:12:45.986] Maximum peer count ETH=50 LES=0 total=50 op-replica-l2geth-replica-1 | INFO [05-03|10:12:45.986] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory" op-replica-l2geth-replica-1 | INFO [05-03|10:12:45.986] Allocated cache and file handles database=/geth/geth/chaindata cache=16.00MiB handles=16 op-replica-l2geth-replica-1 | INFO [05-03|10:15:46.089] Persisted trie from memory database nodes=4883110 size=490.96MiB time=1m39.609451927s gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-48932.00B op-replica-l2geth-replica-1 | Fatal: Failed to write genesis block: database contains incompatible genesis (have 02adc9b449ff5f2467b8c674ece7ff9b21319d76c4ad62a67a70d552655927e5, new 7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b) op-replica-l2geth-replica-1 | Fatal: Failed to write genesis block: database contains incompatible genesis (have 02adc9b449ff5f2467b8c674ece7ff9b21319d76c4ad62a67a70d552655927e5, new 7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b)
System Specs:
- OS: Monetery 12.3.1
- Package Version (or commit hash): https://github.com/ethereum-optimism/optimism/releases/tag/%40eth-optimism%2Fsdk%401.1.2
Additional context n/a
Otherwise, DTL syncing normally:
op-replica-data-transport-layer-1 | {"level":30,"time":1651574972750,"fromBlock":448001,"toBlock":449001,"msg":"Synchronizing unconfirmed transactions from Layer 2 (Optimism)"}
Also any reason why I get this kind of errors on the DTL, I was getting a lot of these on the testnet version and was suspecting something might be wrong on my end: op-replica-data-transport-layer-1 | {"level":50,"time":1651577018440,"extra":{"message":"Error: missing response (requestBody="{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":467,\"jsonrpc\":\"2.0\"}", requestMethod="POST", serverError={"code":"ECONNRESET","path":null,"host":"mainnet.optimism.io","port":443}, url="https://mainnet.optimism.io", code=SERVER_ERROR, version=web/5.5.1)","stack":"Error: missing response (requestBody="{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":467,\"jsonrpc\":\"2.0\"}", requestMethod="POST", serverError={"code":"ECONNRESET","path":null,"host":"mainnet.optimism.io","port":443}, url="https://mainnet.optimism.io", code=SERVER_ERROR, version=web/5.5.1)\n at Logger.makeError (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/logger/lib/index.js:199:21)\n at Logger.throwError (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/logger/lib/index.js:208:20)\n at /opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/web/lib/index.js:248:36\n at step (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/web/lib/index.js:33:23)\n at Object.throw (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/web/lib/index.js:14:53)\n at rejected (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/web/lib/index.js:6:65)\n at runMicrotasks (
Is USING_OVM=true set in the env?
Is
USING_OVM=trueset in the env?
I did set it to true but the error was the same.
You may need to delete the datadir and run everything again with USING_OVM=true set. So try:
docker-compose down -v
docker-compose up
You may need to delete the datadir and run everything again with
USING_OVM=trueset. So try:docker-compose down -v docker-compose up
Shoot, I did miss the deletion of the datadir indeed. I was not using the -v command. Adding USING_OVM seems to work here. I still need to wait for the DTL to sync completely though as I am getting this error on the l2geth side:
l2geth-replica_1 | INFO [05-05|03:44:52.396] Cannot connect to upstream service msg="Cannot connect to data service: Cannot fetch eth context: 400 cannot GET http://data-transport-layer:7878/eth/context/latest: http error"
I did not see any information on the USING_OVM setting when reading the readme, where was I supposed to infer this from? I saw a mention of USING_OVM here but it was not obvious that I was supposed to add that setting in my .env file. Maybe it should be included by default in the default-mainnet.env file.
Hmm... it is indeed weird that USING_OVM isn't included in that ENV file. I'll make sure the docs get updated to explicitly reference this. Thank you for reporting! Feel free to drop an ETH address and I'll send you a hand-drawn contributor NFT for your troubles :-)
Looking forward to the drawing ;-)
ETH address: 0xf484a6a2cCe70DFDf58E2029B4eC9c45a16dfd2B
@smartcontracts , did you ever get a chance to send the contributor NFT haha? I could not find it in my wallet :_(
@smartcontracts , did you ever get a chance to send the contributor NFT haha? I could not find it in my wallet :_(
Heyo! Sorry I haven't gotten around to this yet. I'm planning to do a large batch of them this week. I draw each one of them individually so it can sometimes take me a while, sorry about that!
Sorry it took so long! https://quixotic.io/asset/0x8954397e87A891f8b23c8baA8C47f726AB00b2B1/23
您可能需要删除 datadir 并使用
USING_OVM=trueset 再次运行所有内容。所以试试:docker-compose down -v docker-compose up
您可能需要删除数据目录并使用再次
USING_OVM=true运行所有内容。docker-compose down -v docker-compose up
Hello, I build an optimization node based on the docker of the main network and keep reporting this error. How can I deal with it? Thank you very much!
| > @eth-optimism/[email protected] start
simple-optimism-node-fault-detector-1 | > ts-node ./src/service.ts
simple-optimism-node-fault-detector-1 |
simple-optimism-node-fault-detector-1 | {"level":30,"time":1668070609510,"msg":"starting app server"}
simple-optimism-node-fault-detector-1 | {"level":30,"time":1668070609540,"port":7300,"hostname":"0.0.0.0","msg":"app server started"}
simple-optimism-node-fault-detector-1 | {"level":30,"time":1668070609541,"msg":"initializing service"}
simple-optimism-node-fault-detector-1 | /opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/logger/src.ts/index.ts:269
simple-optimism-node-fault-detector-1 | const error: any = new Error(message);
simple-optimism-node-fault-detector-1 | ^
simple-optimism-node-fault-detector-1 | Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.1)
simple-optimism-node-fault-detector-1 | at Logger.makeError (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
simple-optimism-node-fault-detector-1 | at Logger.throwError (/opt/optimism/node_modules/@ethersproject/providers/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
simple-optimism-node-fault-detector-1 | at JsonRpcProvider.start failed with error:
simple-optimism-node-fault-detector-1 | npm ERR! Error: command failed
simple-optimism-node-fault-detector-1 | npm ERR! in workspace: @eth-optimism/[email protected]
simple-optimism-node-fault-detector-1 | npm ERR! at location: /opt/optimism/packages/fault-detector