paritytech / subport

Parity Substrate(-based) chains usage and development support
https://docs.substrate.io
Apache License 2.0
84 stars 13 forks source link

How to Remove an Invalid Data? (Unable to Decode Dispatch Queue Items) #201

Closed AurevoirXavier closed 3 years ago

AurevoirXavier commented 3 years ago

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fcrab-rpc.darwinia.network#/democracy/dispatch

Not sure why there's an invalid data.

keys = api.query.scheduler.agenda.keys()
// This will failed
api.query.scheduler.agenda(keys[0])
// These are OK (but currently there's no other scheduled task)
api.query.scheduler.agenda(keys[1])
api.query.scheduler.agenda(keys[2])
api.query.scheduler.agenda(keys[3])
...

And my question is how to remove the invalid data?

If I use remove storage directly, does it care about the type? Would this break other storage? (seems the item's size is calculate from its scale-type)

shawntabrizi commented 3 years ago

Not sure why there's an invalid data.

Looks like you might have made a breaking change to your Call enum, which is generated from the construct_runtime!.

This means you may have removed or added a pallet in the middle of other existing pallets, changed one of your pallets to remove or add an extrinsic somewhere, and stuff like that.

To remove the storage, you need to just delete the affected storage items. There should be no problems with doing that deletion on-chain with a storage migration.

However, the better solution will be to probably migrate that data.