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

Api augmentation fails when calling api.rpc.state.getMetadata(blockHash) #4596

Closed mariopino closed 2 years ago

mariopino commented 2 years ago

I'm using polkadot-js api to harvest blocks for PolkaStats block explorer and found this issue in our crawler that's struggling me over the last days.

I created this code (https://github.com/mariopino/polkadot-js-api-augmentation-error) to reproduce the error:

NOTE: In our crawler we fill our database with blocks in reverse order from current block to the genesis, curious thing is that when you try to harvest blocks in normal order (from genesis to current block, using range function instead reverseRange), it works without errors.

// @ts-check
import '@polkadot/api-augment';
import { ApiPromise, WsProvider } from '@polkadot/api';

const wsNode = 'wss://kusama-rpc.polkadot.io';
const startBlock = 11404470;
const endBlock = 11404500;
const chunkSize = 10;

export const harvestBlock = async (api: ApiPromise, blockNumber: number) => {
  try {
    const blockHash = await api.rpc.chain.getBlockHash(blockNumber);
    const apiAt = await api.at(blockHash);
    const [
      { block },
      blockEvents,
      timestamp,
    ] = await Promise.all([
      api.rpc.chain.getBlock(blockHash),
      apiAt.query.system.events(),
      apiAt.query.timestamp.now(),
    ]);

    console.log(blockNumber);
    // console.log(JSON.stringify(block.toHuman(), null, 2));
    // console.log(JSON.stringify(blockEvents.toHuman(), null, 2));

    const runtimeUpgrade = blockEvents
      .find(({ event }) => api.events.system.CodeUpdated.is(event));
    if (runtimeUpgrade) {
      // problematic query, producing type errors
      const metadata = await api.rpc.state.getMetadata(blockHash);
      console.log(`runtime upgrade at block ${blockNumber}, timestamp ${timestamp}!`);
    }
  } catch (error) {
    console.log(error);
  }
};

const range = (start: number, stop: number, step: number) => Array
  .from({ length: (stop - start) / step + 1 }, (_, i) => start + (i * step));

const reverseRange = (start: number, stop: number, step: number) => Array
  .from({ length: (stop - start) / step + 1 }, (_, i) => stop - (i * step));

const chunker = (a: any[], n: number): any[] => Array.from(
  { length: Math.ceil(a.length / n) },
  (_, i) => a.slice(i * n, i * n + n),
);

const harvestBlocks = async (api: ApiPromise, startBlock: number, endBlock: number) => {
  const blocks = reverseRange(startBlock, endBlock, 1);
  const chunks = chunker(blocks, chunkSize);
  for (const chunk of chunks) {
    await Promise.all(
      chunk.map(
        (blockNumber: number) => harvestBlock(api, blockNumber),
      ),
    );
  }
};

const getPolkadotAPI = async (): Promise<ApiPromise> => {
  const provider = new WsProvider(wsNode);
  const api = await ApiPromise.create({ provider });
  await api.isReady;
  return api;
};

const main = async () => {
  const api = await getPolkadotAPI();
  await harvestBlocks(api, startBlock, endBlock);
  return;
}

main().catch(console.error).finally(() => process.exit());

Output:

11404500
11404499
11404498
11404496
11404497
11404495
11404494
11404493
11404492
11404491
11404490
11404489
11404488
11404487
11404486
11404485
11404484
11404483
11404482
11404481
runtime upgrade at block 11404482, timestamp 1644845568003!
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x3d02a0efbe1a00000000000098683b7b… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x2fb66447de1955202272c06a33176d4b… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 391634885197438369816105664981198006 exceeds 65536
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x3d02a0efbe1a00000000000098683b7b… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x2fb66447de1955202272c06a33176d4b… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 391634885197438369816105664981198006 exceeds 65536
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x3d02a0efbe1a00000000000098683b7b… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x2fb66447de1955202272c06a33176d4b… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
391634885197438369816105664981198006 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003501e8030000e1…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003501e8030000e1da… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x2d01a0a43e0800000500000020b098c4… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x12000000188b43f82ed07da30c387cea… on parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 18, in set
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x2d01a0a43e0800000500000020b098c4… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x12000000188b43f82ed07da30c387cea… on 
parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 18, in set
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x2d01a0a43e0800000500000020b098c4… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x12000000188b43f82ed07da30c387cea… on parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 18, in set
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003500e8030000e1…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003500e8030000e1da… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x28a0a43e080000050000000ad99a5809… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x524a4a4036681487a6217011ff53bced… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 269652628 exceeds 65536
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x28a0a43e080000050000000ad99a5809… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x524a4a4036681487a6217011ff53bced… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 269652628 exceeds 65536
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x28a0a43e080000050000000ad99a5809… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x524a4a4036681487a6217011ff53bced… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
269652628 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x000200000001000000000010ca48c805…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x0200000001000000000010ca48c80500… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xf502a048400200000000000078d3b723… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x3c6d9eb3db6caa8f5f85ec4408392a22… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0x8fa53d47625046704fc0421fcb8b76e7…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x625046704fc0421fcb8b76e7f4dc3329… on data: Bytes:: Bytes length 470914072 exceeds 10485760
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xf502a048400200000000000078d3b723… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x3c6d9eb3db6caa8f5f85ec4408392a22… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0x8fa53d47625046704fc0421fcb8b76e7…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x625046704fc0421fcb8b76e7f4dc3329… on data: Bytes:: Bytes length 470914072 exceeds 10485760
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xf502a048400200000000000078d3b723… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x3c6d9eb3db6caa8f5f85ec4408392a22… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: 
failed at 0x8fa53d47625046704fc0421fcb8b76e7…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x625046704fc0421fcb8b76e7f4dc3329… on data: Bytes:: Bytes length 470914072 exceeds 10485760
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003501d107000030…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003501d107000030da… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x4502a0b7bf1d000000000000a8c13f28… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x9dc3900e026a6fce5810538ca0b7bf1d… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0x900e026a6fce5810538ca0b7bf1d0000…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x6fce5810538ca0b7bf1d00000d000000… on data: Bytes:: Number can only safely store up to 53 bits
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x4502a0b7bf1d000000000000a8c13f28… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x9dc3900e026a6fce5810538ca0b7bf1d… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0x900e026a6fce5810538ca0b7bf1d0000…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x6fce5810538ca0b7bf1d00000d000000… on data: Bytes:: Number can only safely store up to 53 bits
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x4502a0b7bf1d000000000000a8c13f28… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x9dc3900e026a6fce5810538ca0b7bf1d… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: 
failed at 0x900e026a6fce5810538ca0b7bf1d0000…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x6fce5810538ca0b7bf1d00000d000000… on data: Bytes:: Number can only safely store up to 53 bits
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003501e803000036…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003501e803000036e4… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x04a0a7bf1d000067000000e0fe9bd76d… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x67000000e0fe9bd76dab1fab03aa5c46… on parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 103, in set
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x04a0a7bf1d000067000000e0fe9bd76d… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x67000000e0fe9bd76dab1fab03aa5c46… on 
parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 103, in set
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x04a0a7bf1d000067000000e0fe9bd76d… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x67000000e0fe9bd76dab1fab03aa5c46… on parentHeader: {"_enum":{"set":"{\"now\":\"Compact<u64>\"}"}}:: Unable to create Enum via index 103, in set
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at processImmediate (node:internal/timers:437:9)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x00020000000100000000006847079400…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000000000684707940000… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a00800020000000000008a2ef790… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xdb2b5a5dee0a9f2cbe039ce2031166aa… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 23796221278071245312412178777799503502737209924640958247797519123170134759485036635290236881271615090179059411916391912243398736964795324971 exceeds 65536
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a00800020000000000008a2ef790… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xdb2b5a5dee0a9f2cbe039ce2031166aa… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 23796221278071245312412178777799503502737209924640958247797519123170134759485036635290236881271615090179059411916391912243398736964795324971 exceeds 65536
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a00800020000000000008a2ef790… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xdb2b5a5dee0a9f2cbe039ce2031166aa… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
23796221278071245312412178777799503502737209924640958247797519123170134759485036635290236881271615090179059411916391912243398736964795324971 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003501d10700006a…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003501d10700006ac7… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x7902a0f7bf3d0000000000007c2d73d8… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xec6782b9b4b4b8b2cfc82df331fe838f… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0xc57ed8f253ac864694c4287825f16e8e…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x53ac864694c4287825f16e8e0ab4ebd7… on data: Bytes:: Number can only safely store up to 53 bits
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x7902a0f7bf3d0000000000007c2d73d8… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xec6782b9b4b4b8b2cfc82df331fe838f… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: failed at 0xc57ed8f253ac864694c4287825f16e8e…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x53ac864694c4287825f16e8e0ab4ebd7… on data: Bytes:: Number can only safely store up to 53 bits
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x7902a0f7bf3d0000000000007c2d73d8… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xec6782b9b4b4b8b2cfc82df331fe838f… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: decodeU8a: 
failed at 0xc57ed8f253ac864694c4287825f16e8e…: {"recipient":"u32","data":"Bytes"}:: decodeU8a: failed at 0x53ac864694c4287825f16e8e0ab4ebd7… on data: Bytes:: Number can only safely store up to 53 bits
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003501e803000035…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003501e80300003531… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x1101a0b23f3d00000500000040470292… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x939a183a1f847f4759854478a2adbb68… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 203309078420648735271346087067234973023229593818958486165649526458123642805343442039640709273754 exceeds 65536
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x1101a0b23f3d00000500000040470292… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x939a183a1f847f4759854478a2adbb68… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 203309078420648735271346087067234973023229593818958486165649526458123642805343442039640709273754 exceeds 65536    
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x1101a0b23f3d00000500000040470292… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x939a183a1f847f4759854478a2adbb68… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
203309078420648735271346087067234973023229593818958486165649526458123642805343442039640709273754 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x0002000000010000003500e803000035…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x02000000010000003500e80300003531… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:47             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a0008000000000000000c2b52781… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x932a724014865918f36e9b8c698238dd… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 91780693198392981920871173822480744516496440513826050647664244902462196313044032690648200016426 exceeds 65536
2022-02-23 14:06:47        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a0008000000000000000c2b52781… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x932a724014865918f36e9b8c698238dd… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 91780693198392981920871173822480744516496440513826050647664244902462196313044032690648200016426 exceeds 65536     
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0x0d03a0008000000000000000c2b52781… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0x932a724014865918f36e9b8c698238dd… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
91780693198392981920871173822480744516496440513826050647664244902462196313044032690648200016426 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-02-23 14:06:47        RPC-CORE: getStorage(key: StorageKey, at?: BlockHash): StorageData:: Unable to decode storage system.events:: createType(Vec<FrameSystemEventRecord>):: decodeU8a: failed at 0x000200000001000000350128080000b8…: {"phase":"FrameSystemPhase","event":"Event","topics":"Vec<H256>"}:: decodeU8a: failed at 0x0200000001000000350128080000b8b2… on event: 
{"index":"EventId","data":"Null"}:: findMetaEvent: Unable to find Event with index [2, 0]/[2,0]
2022-02-23 14:06:48             VEC: Unable to decode on index 1 createType(ExtrinsicV4):: createType(Call):: Call: failed decoding paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xdd02a0f77f3f0000000000001af55804… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xd39119b4af96a28aa0f77f3f00000b00… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 147783840014561380633515105041748255682638510086059609483939100860322600841442507038925481776431092554036424827902888923572034654706065 exceeds 65536
2022-02-23 14:06:48        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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xdd02a0f77f3f0000000000001af55804… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xd39119b4af96a28aa0f77f3f00000b00… on 
backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 147783840014561380633515105041748255682638510086059609483939100860322600841442507038925481776431092554036424827902888923572034654706065 exceeds 65536
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 paraInherent.enter:: Struct: failed on args: {"data":"{\"bitfields\":\"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>\",\"backedCandidates\":\"Vec<PolkadotPrimitivesV1BackedCandidate>\",\"disputes\":\"Vec<PolkadotPrimitivesV1DisputeStatementSet>\",\"parentHeader\":\"SpRuntimeHeader\"}"}:: decodeU8a: failed at 0xdd02a0f77f3f0000000000001af55804… on data: {"bitfields":"Vec<PolkadotPrimitivesV1SignedUncheckedSigned>","backedCandidates":"Vec<PolkadotPrimitivesV1BackedCandidate>","disputes":"Vec<PolkadotPrimitivesV1DisputeStatementSet>","parentHeader":"SpRuntimeHeader"}:: decodeU8a: failed at 0xd39119b4af96a28aa0f77f3f00000b00… on backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>:: Vec length 
147783840014561380633515105041748255682638510086059609483939100860322600841442507038925481776431092554036424827902888923572034654706065 exceeds 65536
    at createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types-create\create\type.cjs:73:18)
    at TypeRegistry.createTypeUnsafe (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\types\create\registry.cjs:410:46)
    at RpcCore._formatOutput (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:445:21)
    at RpcCore._formatResult (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:253:27)
    at callWithRegistry (C:\_Datos\1.Proyectos\_BlockChain\_Polkastats.io\_DEV\polkadot-ts-augmentation\node_modules\@polkadot\rpc-core\bundle.cjs:281:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
jacogr commented 2 years ago

This is the problematic line - const metadata = await api.rpc.state.getMetadata(blockHash);

The issue is that metadata retrieval also adjust the registry with the types at that point. So when reversing, it is incorrect since the metadata change only needs to kick in at the next blockHash.

I have no solution to get around it atm.

mariopino commented 2 years ago

Thanks for the quick response @jacogr, I'll change block harvesting to go from genesis to current block if I can't get metadata at blockhash using an alternative method (maybe using substrate sidecar).

jacogr commented 2 years ago

@mariopino Please try this version first once in ... https://github.com/polkadot-js/api/pull/4599

Basically it removes the auto-attach to a manual (still auto) process. Which would be more correct and follow the same process actually set by the Metadata itself.

jacogr commented 2 years ago

Please check the latest 7.9.2-8 - it does not follow the same process with the auto-attach of types, so should just allow the reverse to work as-is. Please let me know either way so we can get this squashed and you in a happy place.

mariopino commented 2 years ago

Thanks @jacogr 7.9.2-8 did the trick!

jacogr commented 2 years ago

Nice! It will be in the next stable release Sunday/Monday.

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