Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPC-Spec-V2] RuntimeVersion should return "apis" as object, not array of tuples. #1146

Closed
Tracked by #1516
jsdw opened this issue Aug 25, 2023 · 0 comments · Fixed by #1666
Closed
Tracked by #1516

[RPC-Spec-V2] RuntimeVersion should return "apis" as object, not array of tuples. #1146

jsdw opened this issue Aug 25, 2023 · 0 comments · Fixed by #1666
Assignees

Comments

@jsdw
Copy link
Contributor

jsdw commented Aug 25, 2023

See https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_unstable_follow.html#about-the-runtime

Currently we get back something like:

{
  "authoringVersion": 10,
  "specName": "westend",
  "implName": "parity-westend",
  "specVersion": 9122,
  "implVersion": 0,
  "stateVersion": 1,
  "transactionVersion": 7,
  "apis": [
      ["0xdf6acb689907609b", 3],
      ["0x37e397fc7c91f5e4", 1],
      ["0x40fe3ad401f8959a", 5],
      ["0xd2bc9897eed08f15", 3],
      ["0xf78b278be53f454c", 2],
      ["0xaf2c0297a23e6d3d", 1],
      ["0x49eaaf1b548a0cb0", 1],
      ["0x91d5df18b0d2cf58", 1],
      ["0xed99c5acb25eedf5", 3],
      ["0xcbca25e39f142387", 2],
      ["0x687ad44ad37f03c2", 1],
      ["0xab3c0572291feb8b", 1],
      ["0xbc9d89904f5b923f", 1],
      ["0x37c8bb1350a9a2a8", 1]
  ]
}

And we want something like:

{
    "specName": "westend",
    "implName": "parity-westend",
    "specVersion": 9122,
    "implVersion": 0,
    "transactionVersion": 7,
    "apis": {
        "0xdf6acb689907609b": 3
        "0x37e397fc7c91f5e4": 1,
        "0x40fe3ad401f8959a": 5,
        "0xd2bc9897eed08f15": 3,
        "0xf78b278be53f454c": 2,
        "0xaf2c0297a23e6d3d": 1,
        "0x49eaaf1b548a0cb0": 1,
        "0x91d5df18b0d2cf58": 1,
        "0xed99c5acb25eedf5": 3,
        "0xcbca25e39f142387": 2,
        "0x687ad44ad37f03c2": 1,
        "0xab3c0572291feb8b": 1,
        "0xbc9d89904f5b923f": 1,
        "0x37c8bb1350a9a2a8": 1
    }
}

So, remove "authoringVersion" and "stateVersion", and change the APIs to be a map.

@jsdw jsdw changed the title [RPC-Spec-V2] RuntimeVersion should return "apis" as object, not arrey of tuples. [RPC-Spec-V2] RuntimeVersion should return "apis" as object, not array of tuples. Aug 25, 2023
@tadeohepperle tadeohepperle self-assigned this Sep 21, 2023
tadeohepperle added a commit that referenced this issue Sep 29, 2023
…meVersion JSON format (#1666)

This PR adjusts the serialized format of the the returned RuntimeVersion
in the rpc-spec-v2 methods. This is done to match the format defined
here:
https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_unstable_follow.html#about-the-runtime

- ##### `apis` field as object
`apis` field of `RuntimeVersion` is now returned as an object, e.g. 
```
"apis": {
      "0xdf6acb689907609b": 3,
      "0x37e397fc7c91f5e4": 1,
}
```
instead of 
```
"apis": [
      ["0xdf6acb689907609b", 3],
      ["0x37e397fc7c91f5e4", 1],
]
```
- ##### removed `stateVersion` and `authoringVersion`
`stateVersion` and `authoringVersion` are no longer returned in the
`RuntimeVersion` JSON Object.

- ##### block index in chain head events as integer

### Related Issues

Closes: #1507
Closes: #1146

### Testing Done
Adjusted existing tests to make sure data is returned in the correct
format.
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this issue Mar 25, 2024
…meVersion JSON format (paritytech#1666)

This PR adjusts the serialized format of the the returned RuntimeVersion
in the rpc-spec-v2 methods. This is done to match the format defined
here:
https://paritytech.github.io/json-rpc-interface-spec/api/chainHead_unstable_follow.html#about-the-runtime

- ##### `apis` field as object
`apis` field of `RuntimeVersion` is now returned as an object, e.g. 
```
"apis": {
      "0xdf6acb689907609b": 3,
      "0x37e397fc7c91f5e4": 1,
}
```
instead of 
```
"apis": [
      ["0xdf6acb689907609b", 3],
      ["0x37e397fc7c91f5e4", 1],
]
```
- ##### removed `stateVersion` and `authoringVersion`
`stateVersion` and `authoringVersion` are no longer returned in the
`RuntimeVersion` JSON Object.

- ##### block index in chain head events as integer

### Related Issues

Closes: paritytech#1507
Closes: paritytech#1146

### Testing Done
Adjusted existing tests to make sure data is returned in the correct
format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants