Conversation
Create a MockStream that connects to the MPC fixture setup. This lets us test the indexer stream <-> MPC glue.
volovyks
left a comment
There was a problem hiding this comment.
Nice! test_channel_contention should be very useful in our work on backlog and stability.
chain-signatures/node/src/cli.rs
Outdated
| crate::metrics::nodes::CONFIGURATION_DIGEST.set(digest); | ||
|
|
||
| let (sign_tx, sign_rx) = mpsc::channel(16384); | ||
| let (sign_tx, sign_rx) = mpsc::channel(if cfg!(test) { 1 } else { 16384 }); |
There was a problem hiding this comment.
I guess this is more of an experiment, but we can make it configurable in tests.
There was a problem hiding this comment.
not related to this PR, but it definitely deserves a constant
There was a problem hiding this comment.
yeah it's just an experiment that I will clean up before removing the draft label
| guard.sign_requests(requests) | ||
| } | ||
|
|
||
| pub async fn rpc_actions(&self, actions: &[RpcAction]) { |
There was a problem hiding this comment.
It is not clear what we are doing with these actions. Are we queuing them? Processing? Adding to a specific block? I'm ok with a bit longer names. That makes the code a bit more readable IMO.
| network[1].mock_streams[0].progress_block_height(1).await; | ||
| network[2].mock_streams[0].progress_block_height(1).await; | ||
|
|
||
| let timeout = Duration::from_secs(10); |
There was a problem hiding this comment.
nit: Such a pattern significantly slows down our tests; I would add a helper that actually waits for N events or specific events with a timeout.
There was a problem hiding this comment.
Wait, doesn't this already do exactly what you ask?
let timeout = Duration::from_secs(10);
let actions = network.assert_actions(1, timeout).await; pub async fn assert_actions(
&self,
threshold_per_node: usize,
timeout: Duration,
) -> HashSet<String> {
let result = tokio::time::timeout(timeout, self.wait_for_actions(threshold_per_node)).await;
if result.is_err() {
self.print_actions().await;
}
result.expect("should produce enough signatures")
}but not with channel capacity?
|
I'm still experimenting here. Getting some interesting results.
I will take a closer look again next week. |
Create a MockStream that connects to the MPC fixture setup. This lets us test the indexer stream <-> MPC glue.