polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.07k stars 350 forks source link

Failed to decode Kusama block #7487667 #3535

Closed emostov closed 3 years ago

emostov commented 3 years ago

Running with @polkadot/api@4.9.3-23

    const api = await ApiPromise.create({
        provider: new WsProvider('wss://kusama.api.onfinality.io/public-ws'),
    });

    const blockHash7487667 = await api.rpc.chain.getBlockHash(7487667);
    const block7487667 = await api.rpc.chain.getBlock(blockHash7487667);

Results in

2021-05-15 23:52:27             VEC: Unable to decode on index 2 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding electionProviderMultiPhase.submitUnsigned:: Struct: failed on args: {"solution":"RawSolution","witness":"SolutionOrSnapshotSize"}:: u32: Input too large. Found input with 77 bits, expected 32
2021-05-15 23:52:27        RPC-CORE: getBlock(hash?: BlockHash): SignedBlock:: createType(SignedBlock):: Struct: failed on block: {"header":"Header","extrinsics":"Vec<Extrinsic>"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: Call: failed decoding electionProviderMultiPhase.submitUnsigned:: Struct: failed on args: {"solution":"RawSolution","witness":"SolutionOrSnapshotSize"}:: u32: Input too large. Found input with 77 bits, expected 32
Error: createType(SignedBlock):: Struct: failed on block: {"header":"Header","extrinsics":"Vec<Extrinsic>"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: Call: failed decoding electionProviderMultiPhase.submitUnsigned:: Struct: failed on args: {"solution":"RawSolution","witness":"SolutionOrSnapshotSize"}:: u32: Input too large. Found input with 77 bits, expected 32
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.cjs:55:11)
    at RpcCore._formatOutput (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/rpc-core/index.cjs:381:41)
    at callWithRegistry (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/rpc-core/index.cjs:247:42)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

(electionprovidermultiphase.submitUnsigned extrinsic on subscan: https://kusama.subscan.io/extrinsic/7487667-2)

emostov commented 3 years ago

The issue is also reproducible on Kusama block #7491223

jacogr commented 3 years ago

Honestly don’t know. Looked at those types this week and they seemed sane compare to Substrate. So another pair of eyes appreciated.

Will take a look later again.

jacogr commented 3 years ago

@arjanz Figured it out... it is related to the bump to 24 nominators, there are now 8 extra entries in the struct.

polkadot-js-bot commented 3 years 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.