-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Allow to benchmark HRMP messages from the undying collator #6261
base: master
Are you sure you want to change the base?
Conversation
@sandreim What do you think about the final point - useful payload? Now the test just adds messages that consist of only zeroes filled to the specific size. Do we want something more sophisticated? |
79405dc
to
6109424
Compare
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.
Looks good at high level. What I think is missing is a way to measure the amount of messages sent/received in the test and assert against that. We could add some prometheus metrics for this.
pub struct HrmpChannelConfiguration { | ||
/// Where to send HRMP messages | ||
pub destination_para_id: u32, | ||
/// Message size |
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.
I imagine we can have a better interface here to configure the utilization of the channels. For example, can we also add number of messages ?
HrmpChannel::{max_capacity, max_message_size, max_total_size}
already provide the maximum values, maybe we can use them
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.
I was there and there was such a parameter. However, there is a rule that there could be only one message per a combination of sender-recipient in a single candidate: https://github.com/paritytech/polkadot/blob/master/runtime/parachains/src/hrmp.rs#L941
So this parameter would be useless I suppose.
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.
This make sense and it would be nice to document this and show it to the user.
@@ -117,7 +117,7 @@ genesis_state_generator = "undying-collator export-genesis-state --pov-size=1000 | |||
name = "collator07" | |||
image = "{{COL_IMAGE}}" | |||
command = "undying-collator" | |||
args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2006"] | |||
args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2006", "--hrmp-params=2007:4096", "-lruntime::undying=debug"] |
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.
I would create a separate test for this where we match on some channel utilization metrics to be sure everything works as expected.
To make this truly deterministic we would need to be able to configure the test parachain to send a predefined amount of messages then stop. We can then expect this to happen in a number of relay chain blocks - a minimum tput.
|
||
/// Configuration of the HRMP channels | ||
#[clap(long)] | ||
pub hrmp_params: Vec<CliHrmpChannelConfiguration>, |
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.
I think sending messages should be optional.
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.
It is optional, e.g. no messages are sent when a vector is empty.
[[hrmp_channels]] | ||
sender = 2006 | ||
recipient = 2007 | ||
max_capacity = 2 |
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.
Why only 2 ?
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.
In and out.
I think it's enough if we fill it with zeroes. If we were to add something more sophisticated, we would have to build a real runtime and send/receive real messages. |
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.
Looks good overall, just a few things I spotted. We should also have the Zombienet test check the metrics. @pepoviola can you help us with support for querying metrics of collators ?
/// Where to send HRMP messages | ||
pub destination_para_id: u32, | ||
/// Message size | ||
pub message_size: u32, |
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.
This interface seems to allow to configure the rate (even if it will be probabilistic) and actual bandwidth, but as state above I think we need to make clear how many messages one para is allowed to send, and the fact that it is actually a blob.
pub struct HrmpChannelConfiguration { | ||
/// Where to send HRMP messages | ||
pub destination_para_id: u32, | ||
/// Message size |
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.
This make sense and it would be nice to document this and show it to the user.
)) | ||
} | ||
|
||
// Returns coin probability based on hash (assuming that the hash value is indistinguishable from random) |
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.
I am not sure about this. I would use a RNG and allow user to specify seed for reproducibility reasons.
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.
Well, since crypto hashes outputs are indistinguishable from random (by definition), I assume it is fine to use those as PRG that is totally reproducable when needed.
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.
The documentation has been added.
Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
51a173a
to
1a1b696
Compare
Work description
We want to test HRMP/DMP/UMP (and XCM in perspective) during our zombienet automated tests. Hence, it might be a good idea to have an ability to generate and process such messages within our test collators.
Tasks list
Think about useful payload