-
Notifications
You must be signed in to change notification settings - Fork 3
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
Display HRMP/XCM channels for parachains #162
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Can you describe how you want to approach the XCM message parsing ? Especially what kind of things we would be interested in seeing ?
I would suggest an alternative to get all the information without fetching the messages by decoding the HrmpChannel
struct for each channel open to/from a para. We can compute the tput by substracting the total_sizes and msg_count between 2 relay parents that backed consecutive candidates of the para.
pub struct HrmpChannel {
// NOTE: This structure is used by parachains via merkle proofs. Therefore, this struct requires
// special treatment.
//
// A parachain requested this struct can only depend on the subset of this struct. Specifically,
// only a first few fields can be depended upon (See `AbridgedHrmpChannel`). These fields cannot
// be changed without corresponding migration of parachains.
/// The maximum number of messages that can be pending in the channel at once.
pub max_capacity: u32,
/// The maximum total size of the messages that can be pending in the channel at once.
pub max_total_size: u32,
/// The maximum message size that could be put into the channel.
pub max_message_size: u32,
/// The current number of messages pending in the channel.
/// Invariant: should be less or equal to `max_capacity`.s`.
pub msg_count: u32,
/// The total size in bytes of all message payloads in the channel.
/// Invariant: should be less or equal to `max_total_size`.
pub total_size: u32,
/// A head of the Message Queue Chain for this channel. Each link in this chain has a form:
/// `(prev_head, B, H(M))`, where
/// - `prev_head`: is the previous value of `mqc_head` or zero if none.
/// - `B`: is the [relay-chain] block number in which a message was appended
/// - `H(M)`: is the hash of the message being appended.
/// This value is initialized to a special value that consists of all zeroes which indicates
/// that no messages were previously added.
pub mqc_head: Option<Hash>,
/// The amount that the sender supplied as a deposit when opening this channel.
pub sender_deposit: Balance,
/// The amount that the recipient supplied as a deposit when accepting opening this channel.
pub recipient_deposit: Balance,
}
If we prioritize the collector to process these first, they could already be in storage, so we would just need to fetch them from there. But that's for later.
I'm inclined to think that it is better to dump transport protocols here and then do xcm decoding as a separate tool as suggested in #163 |
You mean save the messages to disk from parachain commander ? |
It might be useful to debug messages in the introspector. As the first step, I would suggest to add these fuctions to the parachains commander and then, probably, to the collector.
Example: