0

When I use the follow-chain subcommand I am getting the following error:

2023-03-17 16:22:15.698 ERROR main runtime: panicked at 'Bad input data provided to execute_block: Codec error', /Users/bruno/src/substrate-node-template/runtime/src/lib.rs:351:1    
2023-03-17 16:22:15.705 ERROR main try-runtime::cli: failed to execute block 199 due to Input("failed to execute TryRuntime_execute_block: Execution aborted due to trap: unreachable")    

Steps to reproduce:

Clone repo:

git clone https://github.com/substrate-developer-hub/substrate-node-template
cd substrate-node-template
git checkout polkadot-v0.9.37

Run a dev chain locally. This is the chain that I want to "follow":

cargo b -r
cp target/release/node-template .
./node-template --dev

Compile with try-runtime:

cargo b -r --features=try-runtime
cp target/release/node-template node-template-try-runtime
cp target/release/wbuild/node-template-runtime/node_template_runtime.wasm runtime-try-runtime.wasm

Run the follow-chain subcommand:

./node-template-try-runtime \
    try-runtime \
    --runtime runtime-try-runtime.wasm \ 
    -lruntime=debug \
    follow-chain \
    --uri ws://localhost:9944

Output:

2023-03-17 16:22:15.614  INFO main try-runtime::cli: subscribing to "chain_subscribeFinalizedHeads" / "chain_unsubscribeFinalizedHeads"    
2023-03-17 16:22:15.620  INFO main remote-ext: since no prefix is filtered, the data for all pallets will be downloaded    
2023-03-17 16:22:15.623  INFO main remote-ext: scraping key-pairs from remote at block height 0x6eb4ba25d48529972a1f1a5e1ffebbe5172c39029dc96dacef565291f316b165    
2023-03-17 16:22:15.623  INFO main remote-ext: adding data for hashed prefix: 3a6368696c645f73746f726167653a64656661756c743a, took 0s    
2023-03-17 16:22:15.626  INFO main remote-ext: Querying a total of 232 keys from prefix , splitting among 10 threads, 24 keys per thread    
2023-03-17 16:22:15.637  INFO main remote-ext: adding data for hashed prefix: , took 0s    
2023-03-17 16:22:15.637  INFO main remote-ext: adding data for hashed key: 3a636f6465    
2023-03-17 16:22:15.639  INFO main remote-ext: adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8    
2023-03-17 16:22:15.639  INFO main remote-ext: adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac    
2023-03-17 16:22:15.640  INFO main remote-ext: initialized state externalities with storage root 0x77083beb1844ad008a4ceda26c86be09c3f6f06dd05ef35c4d3197dd2f427fc0 and state_version V1    
2023-03-17 16:22:15.649  INFO main try-runtime::cli: original spec: RuntimeString::Owned("node-template")-100, code hash: 7d73847319954ae2408b067399eafaa10d62326205dc12733b605a1772da8b69    
2023-03-17 16:22:15.656  INFO main try-runtime::cli: new spec: RuntimeString::Owned("node-template")-100, code hash: 2318954729d897d8a61012be4e7faa2cc60b9c46480c33591cf21b3ef5abde9b    
2023-03-17 16:22:15.698 ERROR main runtime: panicked at 'Bad input data provided to execute_block: Codec error', /Users/bruno/src/substrate-node-template/runtime/src/lib.rs:351:1    
2023-03-17 16:22:15.705 ERROR main try-runtime::cli: failed to execute block 199 due to Input("failed to execute TryRuntime_execute_block: Execution aborted due to trap: unreachable")    
2023-03-17 16:22:19.812 ERROR main runtime: panicked at 'Bad input data provided to execute_block: Codec error', /Users/bruno/src/substrate-node-template/runtime/src/lib.rs:351:1    
2023-03-17 16:22:19.812 ERROR main try-runtime::cli: failed to execute block 200 due to Input("failed to execute TryRuntime_execute_block: Execution aborted due to trap: unreachable")  

2 Answers 2

2

This is a typical error and it means that the "block format" (encoding/decoding) between the chain that's currently running (remove or local) and the new runtime that you compiled and passed to the tool are not compatible.

Quoting the documentation of the command:

This can only work if the block format between the remote chain and the new runtime being tested has remained the same, otherwise block decoding might fail.

1
  • 1
    I must be doing something wrong or skipped a step. I updated my question with steps to reproduce. If you can help that would be great!
    – Bruno
    Mar 17 at 20:27
1

This appears to be a bug and an issue has been opened.

I'm not sure if this is the SE etiquette is for these scenarios (or what is), but I will keep this answer updated as progress is made on the issue.

New contributor
liamaharon is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.