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

Cannot get polkadot block #3904932 with `api.rpc.chain.getBlock` #3203

Closed emostov closed 3 years ago

emostov commented 3 years ago

The following code

// "@polkadot/api": "^3.10.1",
async function main() {
    const api = await ApiPromise.create({
        provider: new WsProvider('wss://rpc.polkadot.io'),
    });

    const hashBlock3904932 = await api.rpc.chain.getBlockHash(3904932);
    const { block: block3904932 } = await api.rpc.chain.getBlock(
        hashBlock3904932
    );

    console.log(block3904932.toHuman());
}

results in the errors

2021-02-22 15:16:08        REGISTRY: Error: Call: failed decoding balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
    at new GenericCall (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/generic/Call.js:147:13)
    at new Type (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:340:16)
    at initType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:49:19)
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:69:12)
    at createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:84:10)
    at TypeRegistry.createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:297:39)
    at Function.decodeExtrinsic (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:47:31)
    at new GenericExtrinsicV4 (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:30:27)
    at new Type (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:340:16)
    at initType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:49:19)
2021-02-22 15:16:08        REGISTRY: Error: createType(Call):: Call: failed decoding balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:72:11)
    at createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:84:10)
    at TypeRegistry.createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:297:39)
    at Function.decodeExtrinsic (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:47:31)
    at new GenericExtrinsicV4 (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:30:27)
    at new Type (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:340:16)
    at initType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:49:19)
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:69:12)
    at createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:84:10)
    at TypeRegistry.createType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:297:39)
2021-02-22 15:16:08             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
2021-02-22 15:16:08        REGISTRY: Error: Struct: failed on block: {"header":"Header","extrinsics":"Vec<Extrinsic>"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: Call: failed decoding balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
    at /Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/codec/Struct.js:70:13
    at Array.reduce (<anonymous>)
    at decodeStructFromObject (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/codec/Struct.js:24:29)
    at decodeStruct (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/codec/Struct.js:111:10)
    at new Struct (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/codec/Struct.js:132:26)
    at new <anonymous> (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/codec/Struct.js:150:9)
    at new Type (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/registry.js:340:16)
    at initType (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:49:19)
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:69:12)
    at RpcCore._formatOutput (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/rpc-core/index.js:394:41)
2021-02-22 15:16:08        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 balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
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 balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Balance: Input too large. Found input with 164 bits, expected 128
    at createTypeUnsafe (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/types/create/createType.js:72:11)
    at RpcCore._formatOutput (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/rpc-core/index.js:394:41)
    at callWithRegistry (/Users/zeke/Documents/parity/tools-sandbox/node_modules/@polkadot/rpc-core/index.js:262:42)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

Looks like the cause is this failed extrinsic: https://polkadot.subscan.io/extrinsic/3904932-1

septerr commented 3 years ago

+1 experiencing this issue as well.

jacogr commented 3 years ago

It fails on this extrinsic -

0x
1102
84
00
f6a299ecbfec56e238b5feedfb4cba567d2902af5d946eaf05e3badf05790e45
01
7c4a297e394aa3f1ec0ba605cc383605461878ece0d6448cbd763797678b9a2f
0c1d7e510522b388f3928e33d7fcdd924446d17bb279c8c76f799f3508fe5688
0502
1000
0500
// issue here - Address20 encoding fails
04
67f89207abe6e1b093befd84a48f033137659292
07009e292608
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.