polkadot-js / apps

Basic Polkadot/Substrate UI for interacting with a Polkadot and Substrate node. This is the main user-facing application, allowing access to all features available on Substrate chains.
https://dotapps.io
Apache License 2.0
1.76k stars 1.55k forks source link

Unable to decode storage #8836

Closed AurevoirXavier closed 1 year ago

AurevoirXavier commented 1 year ago
RPC-CORE: queryStorageAt(keys: Vec<StorageKey>, at?: BlockHash): Vec<StorageChangeSet>:: Unable to decode storage accountMigration.deposits: entry 0:: createType(Vec<DarwiniaDepositDeposit>):: Vec<DarwiniaDepositDeposit>:: Decoded input doesn't match input, received 0x0400000000a027128c1c2b020000000000000030aca6bb83010000000000000000000001 (36 bytes), created 0x0400000000a027128c1c2b020000000000000030aca6bb8301000000000000000000000100000000000000000000000000000000 (52 bytes)

Reproduce steps:

  1. open https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Fg1.dev.darwinia.network%3A20000#/chainstate
  2. query accountMigration::deposits
jacogr commented 1 year ago

Weird, the type is simple -

{"id":"u16","value":"u128","startTime":"u128","expiredTime":"u128","inUse":"bool"}

(we get this from console.log(api.createType('DarwiniaDepositDeposit').toRawType()) in the JS console on the apps UI)

Since it is simple enough, the length of a single entry should be

2 (u16) + 16 (u128) + 16 (u128) + 16 (u128) + 1 (bool) = 51 bytes

(The missing byte is the length prefix, ie 4 >> 2 = 1 - there is 1 entry)

In this case, the state seems incorrect. One entry of this type should be 51 bytes, with the length received we only go 36 bytes. So it cannot decode that into the above format.

It is possibly a missed migration.

AurevoirXavier commented 1 year ago

Thanks! We did miss a migration.

polkadot-js-bot commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.