paritytech / zombienet

A cli tool to easily spawn ephemeral Polkadot/Substrate networks and perform tests against them.
https://paritytech.github.io/zombienet/
GNU General Public License v3.0
157 stars 92 forks source link

More informative error when failing to decode type #1599

Open mrcnski opened 9 months ago

mrcnski commented 9 months ago

Is your feature request related to a problem? Please describe.

It's possible to get an error like this:

         Error:  
                 createType(Header):: decodeU8aStruct: failed at 0xf10d89ba1e7bce… on extrinsicsRoot (index 4/5): H256:: Expected input with 32 bytes (256 bits), found 7 bytes

The fix is to add these lines, but it's not obvious:

[types.Header]
number = "u64"
parent_hash = "Hash"
post_state = "Hash"

Describe the solution you'd like

The error message could suggest how to fix the error, with a link to [Types] doc (and we can add an example to that doc).

Describe alternatives you've considered

No response

Additional context

No response

pepoviola commented 8 months ago

Hi @mrcnski, thanks for your feedback! The main issue there is that the error is generated by polkadot.js itself. We can catch and match the message for producing a better output. I will try to explore this path and ping you back for testing.

Thanks!!

mrcnski commented 8 months ago

Would it be worthwhile to analyze polkadot.js and see why it seems to work fine and display information correctly for the same network? Does it use polkadot.js or something different? Thanks!