JoshOrndorff / recipes

A Hands-On Cookbook for Aspiring Blockchain Chefs
GNU General Public License v3.0
380 stars 186 forks source link

Bad input data provided to validate_transaction: Codec error #463

Closed mrcnski closed 3 years ago

mrcnski commented 3 years ago

I'm trying to run the ocw example but every time I submit a transaction I get:

2021-09-12 14:34:15.755 ERROR     txpool-verifier1 runtime: panicked at 'Bad input data provided to validate_transaction: Codec error', /Users/marcin/Sync/Repos/github.com/substrate-developer-hub/recipes/runtimes/super-runtime/src/lib.rs:412:1    
2021-09-12 14:34:15.755  WARN tokio-runtime-worker sc_rpc::author: Failed to submit extrinsic: Extrinsic verification error: Runtime error: Execution failed: Wasmi(Trap(Trap { kind: Unreachable }))  

Version: version 3.0.0-98d3625-x86_64-macos Runtime: Native runtime: ocw-runtime-1 (ocw-runtime-1.tx1.au1)

apopiak commented 3 years ago

This sounds wrong. If you're running the ocw runtime the super-runtime should not be used.

apopiak commented 3 years ago

One source of failing transactions is type incompatibility. Make sure you're using the correct types.json if you're using Polkadot-js to interact with the chain. (i.e. https://github.com/substrate-developer-hub/recipes/blob/master/runtimes/ocw-runtime/types.json for the ocw runtime)

mrcnski commented 3 years ago

Thanks. I did specify the ocw runtime -- I followed the instructions in the docs and commented out the super-runtime:

https://substrate.dev/recipes/off-chain-workers/transactions.html

The runtime in the output is:

Native runtime: ocw-runtime-1 (ocw-runtime-1.tx1.au1)

Make sure you're using the correct types.json if you're using Polkadot-js to interact with the chain.

How do I do this? I didn't see this mentioned in the docs.

apopiak commented 3 years ago

Yeah, sorry it's not mentioned explicitly. You copy and paste the contents of the types.json into Settings > Developer (e.g. https://polkadot.js.org/apps/#/settings/developer)

mrcnski commented 3 years ago

Thanks, that resolved my issue!

jimmychu0807 commented 3 years ago

It seems is issue is resolved. Closing it now. Please open this issue if there is still any problem. Thanks.

icodezjb commented 2 years ago

I had a similar problem. Using the wrong or outdated polkadot.js types via polkadot.js.org. Resolved it by cleaning and configuring the correct type