Skip to content

Deeply nested utility.batch calls in blocks endpoint #1888

Description

@Imod7

Description

A team reported two examples of responses from the /blocks/{blockId} endpoint that return deeply nested utility.batch calls. This causes failure in a downstream tool.

  • /blocks/11667059 in Polkadot Asset Hub chain
  • /blocks/12133615/ in Kusama Asset Hub chain

Example Response

Requesting /blocks/11667059 in Polkadot Asset Hub chain, returns:

...
...
"extrinsics": [
    {
      "method": {
        "pallet": "parachainSystem",
        "method": "setValidationData"
      },
      "signature": null,
      "nonce": null,
...
...
{
      "method": {
        "pallet": "utility",
        "method": "batch"
      },
      "signature": {
        "signature": "0xae74c2d284b8ed599ca169291ac7b03f5104cc7db7d470ae82e1589b111a1d5fe06beaf915a29b48684d039c67069b461228def5034acfed0618edcb3c3a6383",
        "signer": {
          "id": "15mSrBU3CX8SnUL3cKskcrbEPmVZWufmP35oZvfTddRkLqxG"
        }
      },
      "nonce": "0",
      "args": {
        "calls": [
          {
            "method": {
              "pallet": "utility",
              "method": "batch"
            },
            "args": {
              "calls": [
                {
                  "method": {
                    "pallet": "utility",
                    "method": "batch"
                  },
                  "args": {
                    "calls": [
                      {
                        "method": {
                          "pallet": "utility",
                          "method": "batch"
                        },
                        "args": {
                          "calls": [
                            {
                              "method": {
                                "pallet": "utility",
                                "method": "batch"
                              },
                              "args": {
                                "calls": [
                                  {
                                    "method": {
                                      "pallet": "utility",
                                      "method": "batch"
                                    },
                                    "args": {
                                      "calls": [
                                        {
                                          "method": {
                                            "pallet": "utility",
                                            "method": "batch"
                                          },
                                          "args": {
                                            "calls": [
                                              {
                                                "method": {
                                                  "pallet": "utility",
                                                  "method": "batch"
                                                },
                                                "args": {
                                                  "calls": [
                                                    {
                                                      "method": {
                                                        "pallet": "utility",
                                                        "method": "batch"
                                                      },
                                                      "args": {
                                                        "calls": [
                                                          {
                                                            "method": {
                                                              "pallet": "utility",
                                                              "method": "batch"
                                                            },
                                                            "args": {
                                                              "calls": [
                                                                {
                                                                  "method": {
                                                                    "pallet": "utility",
                                                                    "method": "batch"
                                                                  },
                                                                  "args": {
                                                                    "calls": [
                                                                      {
                                                                        "method": {
                                                                          "pallet": "utility",
                                                                          "method": "batch"
                                                                        },
                                                                        "args": {
                                                                          "calls": [
                                                                            {
                                                                              "method": {
                                                                                "pallet": "utility",
                                                                                "method": "batch"
                                                                              },
                                                                              "args": {
                                                                                "calls": [
                                                                                  {
                                                                                    "method": {
                                                                                      "pallet": "utility",
                                                                                      "method": "batch"
                                                                                    },
                                                                                    "args": {
                                                                                      "calls": [
                                                                                        {
                                                                                          "method": {
                                                                                            "pallet": "utility",
                                                                                            "method": "batch"
                                                                                          },
                                                                                          "args": {
                                                                                            "calls": [
                                                                                              {
                                                                                                "method": {
                                                                                                  "pallet": "utility",
                                                                                                  "method": "batch"
                                                                                                },
                                                                                                "args": {
                                                                                                  "calls": [
                                                                                                    {
                                                                                                      "method": {
                                                                                                        "pallet": "utility",
                                                                                                        "method": "batch"
                                                                                                      },
                                                                                                      "args": {
                                                                                                        "calls": [
                                                                                                          {
                                                                                                            "method": {
                                                                                                              "pallet": "utility",
                                                                                                              "method": "batch"
...
...

This deeply nested calls are also present when requesting /blocks/12133615 in Kusama Asset Hub chain.

Proposed Solution

Add a query parameter in the /blocks/{blockId} endpoint that flattens nested calls beyond a safe depth (default: 5 levels):

  • ?flattenNestedCalls=true
  • with a possible additional query parameter maxCallDepth to select a depth other than the default one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions