internet-sicherheit / caliper-docker

Run Hyperledger Caliper inside Docker and setup SUT using Docker
Apache License 2.0
1 stars 0 forks source link

err="invalid block 18: unknown ancestor" #5

Closed chinmay241 closed 4 years ago

chinmay241 commented 4 years ago

One Prominent error when you run docker-compose build in Ethereum 1node is.

INFO [04-30|08:08:43.591] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-30|08:08:43.591] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [04-30|08:08:43.592] Allocated cache and file handles         database=/root/.ethereum/geth/chaindata cache=16.00MiB handles=16
INFO [04-30|08:08:43.597] Writing custom genesis block 
INFO [04-30|08:08:43.597] Persisted trie from memory database      nodes=1 size=171.00B time=56.226µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-30|08:08:43.598] Successfully wrote genesis state         database=chaindata                      hash=cbc198…847427
INFO [04-30|08:08:43.598] Allocated cache and file handles         database=/root/.ethereum/geth/lightchaindata cache=16.00MiB handles=16
INFO [04-30|08:08:43.602] Writing custom genesis block 
INFO [04-30|08:08:43.602] Persisted trie from memory database      nodes=1 size=171.00B time=47.514µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-30|08:08:43.602] Successfully wrote genesis state         database=lightchaindata                      hash=cbc198…847427
INFO [04-30|08:08:43.662] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-30|08:08:43.662] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [04-30|08:08:43.662] Allocated cache and file handles         database=/root/.ethereum/geth/chaindata cache=512.00MiB handles=524288
INFO [04-30|08:08:43.681] Opened ancient database                  database=/root/.ethereum/geth/chaindata/ancient
INFO [04-30|08:08:43.682] Disk storage enabled for ethash caches   dir=/root/.ethereum/geth/ethash count=3
INFO [04-30|08:08:43.682] Disk storage enabled for ethash DAGs     dir=/root/.ethash               count=2
INFO [04-30|08:08:43.682] Loaded most recent local header          number=0 hash=cbc198…847427 td=524288 age=11mo4w1d
INFO [04-30|08:08:43.682] Loaded most recent local full block      number=0 hash=cbc198…847427 td=524288 age=11mo4w1d
INFO [04-30|08:08:43.682] Loaded most recent local fast block      number=0 hash=cbc198…847427 td=524288 age=11mo4w1d
INFO [04-30|08:08:43.683] Importing blockchain                     file=/root/bc.dat
ERROR[04-30|08:08:43.684] 
########## BAD BLOCK #########
Chain config: {ChainID: 21194 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 40000, Muir Glacier: <nil>, Engine: ethash}

Number: 1
Hash: 0x0f34a5d81e4a0c7a8cd84b5a96ed026086cad450b51eb425cdc0cde28e087b7d

Error: unknown ancestor
##############################

ERROR[04-30|08:08:43.686] Import error                             err="invalid block 18: unknown ancestor"
INFO [04-30|08:08:43.686] Blockchain stopped 
chinmay241 commented 4 years ago

One possible way to understand this https://geth.ethereum.org/docs/interface/private-network

kiview commented 4 years ago

I have a hunch, that the values in genesis.json and bc.dat might not fit together, but unsure if this is the reason. Would be great to solve this before adding PR for https://github.com/hyperledger/caliper-benchmarks/issues/68.

kiview commented 4 years ago

bc.dat indeed not fitting. Could be related to the fact, that when bc.dat was created, instanbul-fork was not active yet, so really don't fit together.

Since we regenerate new private chain, it is possibly fine to just remove bc.dat.

kiview commented 4 years ago

bc.dat is indeed necessary. When omitted, the values in ethereum.json don't seem to align anymore.

chinmay241 commented 4 years ago

When running geth these are the initial configuration for those blocks

INFO [05-05|15:38:19.588] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, Engine: ethash}"

I could only find one reference https://github.com/ethereum/go-ethereum/blob/master/params/config.go

It also mentions the Jan'20 update of Muir Glacier.

kiview commented 4 years ago

I am pretty sure these values refer to the public Ethereum mainnet. They therefore don't relate to our setup, since we are spinning up a private network from scratch.

chinmay241 commented 4 years ago

Need to still find a way around this, getting the blockchain import failure got to do with bc.dat caliper | INFO [05-05|14:11:20.293] Disk storage enabled for ethash DAGs dir=/root/.ethash count=2 caliper | INFO [05-05|14:11:20.296] Loaded most recent local header number=0 hash=cbc198…847427 td=524288 age=1y4d17h caliper | INFO [05-05|14:11:20.296] Loaded most recent local full block number=0 hash=cbc198…847427 td=524288 age=1y4d17h caliper | INFO [05-05|14:11:20.296] Loaded most recent local fast block number=0 hash=cbc198…847427 td=524288 age=1y4d17h caliper | INFO [05-05|14:11:20.296] Importing blockchain file=/root/bc.dat caliper | ERROR[05-05|14:11:20.300] caliper | ########## BAD BLOCK ######### caliper | Chain config: {ChainID: 21194 Homestead: 0 DAO: DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 0, Muir Glacier: , Engine: ethash} caliper | caliper | Number: 1 caliper | Hash: 0x0f34a5d81e4a0c7a8cd84b5a96ed026086cad450b51eb425cdc0cde28e087b7d caliper | caliper | caliper | Error: unknown ancestor caliper | ############################## caliper |
caliper | ERROR[05-05|14:11:20.305] Import error err="invalid block 18: unknown ancestor"

chinmay241 commented 4 years ago

Since this was fixed with https://github.com/hyperledger/caliper-benchmarks/pull/74