Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Error: RuntimeCode(":code hash not found") #449

Open
kaisuki opened this issue Mar 17, 2022 · 9 comments
Open

Unexpected Error: RuntimeCode(":code hash not found") #449

kaisuki opened this issue Mar 17, 2022 · 9 comments

Comments

@kaisuki
Copy link

kaisuki commented Mar 17, 2022

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?

@jsdw
Copy link
Collaborator

jsdw commented Mar 18, 2022

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 :)

@niklasad1
Copy link
Member

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

@andresvsm1
Copy link

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

@xcaptain
Copy link
Contributor

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.

@kaisuki
Copy link
Author

kaisuki commented Apr 28, 2022

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
Copy link
Author

kaisuki commented Apr 28, 2022

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
Copy link
Author

kaisuki commented Apr 28, 2022

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
Copy link
Author

kaisuki commented May 3, 2022

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
Copy link
Author

kaisuki commented May 12, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants