substrate-archive icon indicating copy to clipboard operation
substrate-archive copied to clipboard

Unexpected Error: RuntimeCode("`:code` hash not found")

Open kaisuki opened this issue 2 years ago • 9 comments

When I want to run node-template-archive,and set the data_path like "/var/folders/wn/kxwzfpj11jvfyky_ppb9g_sh0000gn/T/substrate22wl8x/chains/dev/db/full",It happens an error,like below: INFO Open RocksDB at /var/folders/wn/kxwzfpj11jvfyky_ppb9g_sh0000gn/T/substrate22wl8x/chains/dev/db/full, state column budget: 115 MiB, others(11) column cache: 1 MiB Error: Backend error: Unexpected Error: RuntimeCode(":code hash not found") What should I do for this?

kaisuki avatar Mar 17 '22 07:03 kaisuki

A bit of a guess, but it looks like this error is in the area of attempting to sync the RocksDB secondary database with the primary one. I don't have any particularly good suggestions other than, check the wiki, make sure that the path to the rocksDB database is correct, and make sure that the substrate node is using RocksDB (and not eg ParityDB). If you find a solution, I'd love to hear back on what it was :)

jsdw avatar Mar 18 '22 11:03 jsdw

I suspect that the substrate node and substrate archive is using different versions, @kaisuki can you double check which versions you are using?

niklasad1 avatar Mar 21 '22 09:03 niklasad1

I'm also facing the same issue, I managed to make it work but once I stopped it and try to use again, the same error appears. After a few attempts, it worked again and on stop, again fails to run. I don't know what is going on tbh

andresvsm1 avatar Apr 07 '22 14:04 andresvsm1

Same issue here, for me, the first time I start substrate node then substrate archive report :code hash not found, but when I restart substrate node and substrate archive everything goes fine.

xcaptain avatar Apr 12 '22 16:04 xcaptain

Same issue here, for me, the first time I start substrate node then substrate archive report :code hash not found, but when I restart substrate node and substrate archive everything goes fine.

yeah,When the substrate node is started for the first time, it must be interrupted and restart then it can work normally.

kaisuki avatar Apr 28 '22 05:04 kaisuki

I suspect that the substrate node and substrate archive is using different versions, @kaisuki can you double check which versions you are using?

I will check,Thanks.

kaisuki avatar Apr 28 '22 05:04 kaisuki

I suspect that the substrate node and substrate archive is using different versions, @kaisuki can you double check which versions you are using?

Now I use polkadot-v0 9.17, and I found that the chainType of my node is Development, but I configured Local in the archive. Will this affect.

kaisuki avatar Apr 28 '22 14:04 kaisuki

in substrate-archive-backend/database.rs

/// Read genesis hash from database.
pub fn read_genesis_hash<Hash: Decode, D: ReadOnlyDb>(db: &D) -> sp_blockchain::Result<Option<Hash>> {\n
	match db.get(columns::META, meta_keys::GENESIS_HASH) {
		Some(h) => match Decode::decode(&mut &h[..]) {
			Ok(h) => Ok(Some(h)),
			Err(err) => Err(sp_blockchain::Error::Backend(format!("Error decoding genesis hash: {}", err))),
		},
		None => {
			Ok(None)
		},
	}
}

when db get return None,Error: Backend error: Unexpected Error: RuntimeCode(":code hash not found") will happen. It does not return none every time. If you run the code several times without making any changes, there will be success.

kaisuki avatar May 03 '22 06:05 kaisuki

A bit of a guess, but it looks like this error is in the area of attempting to sync the RocksDB secondary database with the primary one. I don't have any particularly good suggestions other than, check the wiki, make sure that the path to the rocksDB database is correct, and make sure that the substrate node is using RocksDB (and not eg ParityDB). If you find a solution, I'd love to hear back on what it was :)

Yes, it seems that there should be a problem when getting the genesis hash, but it doesn't happen every time. Try several times and you will succeed once. Do you have any new clues.

kaisuki avatar May 12 '22 07:05 kaisuki