Skip to content

Kusama AssetHub: MessagingStateSnapshot #76

@jsdw

Description

@jsdw

It would be good to clarify or add in the types file a comment about where our type definitions for MessagingStateSnapshot come from.

Our types presently:

AbridgedHrmpChannel:
  max_capacity: u32
  max_total_size: u32
  max_message_size: u32
  mqc_head: Option<Hash>
MessagingStateSnapshotEgressEntry: (ParaId, AbridgedHrmpChannel)
MessagingStateSnapshot:
  relay_dispatch_queue_size: (u32, u32)
  relay_dispatch_queue_mqc_head: Hash
  dm_mqc_head: Option<Hash>
  egress_channels: Vec<MessagingStateSnapshotEgressEntry>

The PJS types:

AbridgedHrmpChannel: {
      maxCapacity: 'u32',
      maxTotalSize: 'u32',
      maxMessageSize: 'u32',
      msgCount: 'u32',
      totalSize: 'u32',
      mqcHead: 'Option<Hash>'
},
MessagingStateSnapshotEgressEntry: '(ParaId, AbridgedHrmpChannel)',
MessagingStateSnapshot: {
      relayDispatchQueueSize: '(u32, u32)',
      egressChannels: 'Vec<MessagingStateSnapshotEgressEntry>'
},

Using the PJS types instead of what we have now leads to an error (33 leftover bytes) which actually aligns with the PJS error we get if we try to decode the same:

Error: Unable to decode storage parachainSystem.relevantMessagingState:: createType(MessagingStateSnapshot):: {"relayDispatchQueueSize":"(u32,u32)","egressChannels":"Vec<MessagingStateSnapshotEgressEntry>"}:: Decoded input doesn't match input, received 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (42 bytes), created 0x000000000000000000 (9 bytes)

So the PJS types are wrong, and our types seem to decode things, which is great! But where do our types come from?

Looking myself quickly at the current versions of the types in polkadot-sdk etc I end up with the definitions:

AbridgedHrmpChannel:
  max_capacity: u32
  max_total_size: u32
  max_message_size: u32
  msg_count: u32
  total_size: u32
  mqc_head: Option<Hash>
MessagingStateSnapshotEgressEntry: (ParaId, AbridgedHrmpChannel)
MessagingStateSnapshot:
  dmq_mqc_head: Hash
  relay_dispatch_queue_remaining_capacity: (u32, u32)
  ingress_channels: Vec<(ParaId, AbridgedHrmpChannel)>
  egress_channels: Vec<(ParaId, AbridgedHrmpChannel)>

These also successfully decode the bytes (which, here, should be noted doesn't mean much since all the bytes appear to be 0, so just means that the length we're expecting aligns).

These are the same as the PJS types except that MessagingStateSnapshot has a couple of added fields, but different from our own types.

@soul022 could you share where you found your type definitions? Since they are different from PJS and what I can find (in recentpolkadot-sdk) it would be good to note where said differences come from and possibly comment in the types file to explain so that future us are not confused!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions