darwinia-network / darwinia

Darwinia Chain, EVM+, Polkadot parachain and integrating with XCMP.
https://darwinia.network
GNU General Public License v3.0
238 stars 49 forks source link

how to migrate and delete garbage storage in scheduler.agenda(2332800) #665

Closed hackfisher closed 3 years ago

hackfisher commented 3 years ago

https://github.com/darwinia-network/apps/issues/245

https://crab.subscan.io/referenda/1?tab=proposal_preimage

referenda/1 was successfully voted, but its agenda was not deleted after execution(no sure), there are deprecated version of ScheduledV1 which is different with current ScheduledV2

We are not sure whether it is safe to delete the storage without know exactly what's its type.

agendas when block=5600982:

[0x3db7a24cfdc9de785974746c14a99df91643f5419718219c95679ddd2d825574862bc7e6c00ceb4180982300, 0x3db7a24cfdc9de785974746c14a99df91643f5419718219c95679ddd2d8255749c9b2b276dc73066405a5600]

and values: [0x0401013064656d6f63726163010000003f21165dcfc20d2356679a67cf8d6b4dbba0e75ed35b290e030c85729dd9d0e4fa332101000000000000, 0x0401013064656d6f63726163140000003f2416ae25f392ae08d6977d69b61eef5aa391d91df0ae32d4e4f669059b1112aeda7014000000000000]

the first is referenda/1, the second might be referenda/20

hackfisher commented 3 years ago

https://github.com/paritytech/substrate/blob/d0891796ed48acfad7445b884c8d035dc4a2487a/frame/support/src/storage/unhashed.rs#L28

https://github.com/paritytech/substrate/blob/d0891796ed48acfad7445b884c8d035dc4a2487a/frame/support/src/storage/generator/value.rs#L104

https://github.com/paritytech/substrate/blob/d0891796ed48acfad7445b884c8d035dc4a2487a/frame/support/src/storage/generator/map.rs#L237

@AurevoirXavier If we use storage kill() or remove() instead of take(), it looks that we does not need to care about the value's type.