api: `democracy.delegations.entries()` doesn't work at kusama height 295787
Network: kusama. Tried api version: 8.0.2, 8.1.2
My code to test:
const { getApi } = require("../api");
const { encodeAddress } = require("@polkadot/util-crypto");
;(async () => {
const api = await getApi();
const height = 295787;
const blockHash = await api.rpc.chain.getBlockHash(height);
const blockApi = await api.at(blockHash);
const delegations = await blockApi.query.democracy.delegations.entries(); // the code which produce error
console.log(delegations);
})()
The error produced:
Error: Unable to decode storage democracy.delegations: entry 0:: createType((AccountId,Conviction)):: (AccountId,Conviction):: Decoded input doesn’t match input, received 0xca5bc1915da74aba3aadd7ce7b809045d5eb5b73559259755fdcd85a40a5dc6e060000 (35 bytes), created 0xca5bc1915da74aba3aadd7ce7b809045d5eb5b73559259755fdcd85a40a5dc6e06 (33 bytes)
Same bug also happens at heights 433879, 452692, 504000, 504329, etc. What I’m trying to do is calculating the tally for kusama historical referendums while you know there is no direct storage for these data.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
100%, if you have a list of all the people who delegated, you can check the hash of each against the hashed key.
Please do check against the current API version - it now correctly returns the
Linkage
results for older blocks.Digging 😃
Weird will do some digging, not sure what the extra byte would be, but certainly a type mismatch on these.