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.75k stars 1.54k forks source link

outdated bittensor app-config #11001

Closed alpay-falconx closed 10 hours ago

alpay-falconx commented 3 days ago

The app-config for the bittensor spec seems to be outdated so this issue is being opened for a updated version to be added.

When using the bittensor spec in a typesBundle used to run the substrate sidecar, the sidecar is not able to decode (all) blocks from the subtensor network - some blocks can be decoded without any typesBundle. The expected behavior is that when the spec is used for the typesBundle in the sidecar config, the sidecar application is able to decode blocks from the node RPC.

The types bundle would like the following based on the current spec in app-config:

{
  "spec": {
    "subtensor": {
      "types": [
        {
          "minmax": [0, null],
          "types": {
            "Balance": "u64",
            "NeuronMetadata": {
              "version": "u32",
              "ip": "u128",
              "port": "u16",
              "ipType": "u8",
              "uid": "u32",
              "netuid": "u16",
              "modality": "u8",
              "hotkey": "AccountId",
              "coldkey": "AccountId",
              "active": "u32",
              "lastUpdate": "u64",
              "priority": "u64",
              "stake": "u64",
              "rank": "u64",
              "trust": "u64",
              "consensus": "u64",
              "incentive": "u64",
              "dividends": "u64",
              "emission": "u64",
              "bonds": "Vec<(u32, u64)>",
              "weights": "Vec<(u32, u32)>"
            }
          }
        }
      ]
    }
  }
}

Updating the bittensor spec will allow custodial service providers to run subtensor nodes, retrieve block data from the sidecar via REST APIs and index the chain which will enable custodial/multi-sig wallet support for the tao asset.

Relevant links:

TarikGul commented 10 hours ago

The following PR is up which resolves this issue! Should be released tomorrow

alpay-falconx commented 9 hours ago

@TarikGul When I used this typesBundle in a sidecar, decoding a block fails if it contains extrinsics with balances and/or subtensorModule pallet events.

Example error

{
"code": 500,
"message": "createType(SignedBlock):: Struct: failed on block: {\"header\":\"Header\",\"extrinsics\":\"Vec<Extrinsic>\"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: Call: failed decoding system.killStorage:: Struct: failed on args: {\"keys\":\"Vec<Bytes>\"}:: decodeU8aStruct: failed at 0x0300801927120516e378941811b605fe… on keys (index 1/1): Vec<Bytes>:: Vec length 655982592 exceeds 65536",
"stack": "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 system.killStorage:: Struct: failed on args: {\"keys\":\"Vec<Bytes>\"}:: decodeU8aStruct: failed at 0x0300801927120516e378941811b605fe… on keys (index 1/1): Vec<Bytes>:: Vec length 655982592 exceeds 65536\n    at createTypeUnsafe (/usr/src/app/node_modules/@polkadot/types-create/cjs/create/type.js:54:22)\n    at TypeRegistry.createTypeUnsafe (/usr/src/app/node_modules/@polkadot/types/cjs/create/registry.js:230:52)\n    at RpcCore._formatOutput (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:331:25)\n    at RpcCore._formatResult (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:169:20)\n    at callWithRegistry (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:190:25)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"level": "error"
}
TarikGul commented 9 hours ago

@TarikGul When I used this typesBundle in a sidecar, decoding a block fails if it contains extrinsics with balances and/or subtensorModule pallet events.

Example error

{
"code": 500,
"message": "createType(SignedBlock):: Struct: failed on block: {\"header\":\"Header\",\"extrinsics\":\"Vec<Extrinsic>\"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: Call: failed decoding system.killStorage:: Struct: failed on args: {\"keys\":\"Vec<Bytes>\"}:: decodeU8aStruct: failed at 0x0300801927120516e378941811b605fe… on keys (index 1/1): Vec<Bytes>:: Vec length 655982592 exceeds 65536",
"stack": "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 system.killStorage:: Struct: failed on args: {\"keys\":\"Vec<Bytes>\"}:: decodeU8aStruct: failed at 0x0300801927120516e378941811b605fe… on keys (index 1/1): Vec<Bytes>:: Vec length 655982592 exceeds 65536\n    at createTypeUnsafe (/usr/src/app/node_modules/@polkadot/types-create/cjs/create/type.js:54:22)\n    at TypeRegistry.createTypeUnsafe (/usr/src/app/node_modules/@polkadot/types/cjs/create/registry.js:230:52)\n    at RpcCore._formatOutput (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:331:25)\n    at RpcCore._formatResult (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:169:20)\n    at callWithRegistry (/usr/src/app/node_modules/@polkadot/rpc-core/cjs/bundle.js:190:25)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"level": "error"
}

Can you create an issue in sidecar then, with a reproducible example using sidecar?

alpay-falconx commented 8 hours ago

Created issue https://github.com/paritytech/substrate-api-sidecar/issues/1513