Skip to content

BlocksService fails with "GeneralExtrinsic does not have signature implemented" for chains with v5 General Extrinsics #1712

@jfrank-summit

Description

@jfrank-summit

Description:

After upgrading our chain to use General Extrinsics (v5), substrate-api-sidecar throws an error when querying endpoints like /blocks/head that contain general extrinsics. The error occurs because the BlocksService attempts to access .signature on general extrinsics, which don't have traditional signature fields. This breaks block fetching for chains using the v5 format. This has been tested on master branch of substrate-api-sidecar as of commit 1376c359d598d19ba4967c49e6a18c4ec63e451a.

Steps to Reproduce

  1. Run substrate-api-sidecar connected to the Autonomys Network chain (e.g., SAS_SUBSTRATE_URL=wss://rpc.mainnet.subspace.foundation/ws).
  2. Query /blocks/head (e.g., curl http://127.0.0.1:8080/blocks/head).

Expected vs. Actual Behavior

The endpoint should return block data with extrinsics parsed correctly, handling v5 general extrinsics without assuming a traditional .signature field however, the current implementation returns a 500 error.

{"code":500,"message":"Extrinsic: GeneralExtrinsic does not have signature implemented","stack":"Error: Extrinsic: GeneralExtrinsic does not have signature implemented\n    at Type.get signature [as signature] (<sidecar-path>/node_modules/@polkadot/types/cjs/extrinsic/Extrinsic.js:166:19)\n    at <sidecar-path>/src/services/blocks/BlocksService.ts:533:27\n    at Type.map (<anonymous>)\n    at BlocksService.extractExtrinsics (<sidecar-path>/src/services/blocks/BlocksService.ts:532:27)\n    at BlocksService.fetchBlock (<sidecar-path>/src/services/blocks/BlocksService.ts:144:39)\n    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at BlocksController.getLatestBlock (<sidecar-path>/src/controllers/blocks/BlocksController.ts:227:17)\n    at <sidecar-path>/src/controllers/AbstractController.ts:146:5","level":"error"}

See here for origin of the error from polkadot-js types library: https://github.com/paritytech/substrate-api-sidecar/blob/master/src/services/blocks/BlocksService.ts#L533

Additional Context

We are able to workaround the issues by checking if the extrinsic isSigned property is true before accessing the signature property. I don't think this is a proper fix, but it does work for our specific use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions