Skip to content

test: MPC + stream component test#739

Draft
jakmeier wants to merge 3 commits intosig-net:developfrom
jakmeier:stream_component_test
Draft

test: MPC + stream component test#739
jakmeier wants to merge 3 commits intosig-net:developfrom
jakmeier:stream_component_test

Conversation

@jakmeier
Copy link
Copy Markdown
Contributor

@jakmeier jakmeier commented Apr 2, 2026

Create a MockStream that connects to the MPC fixture setup. This lets us test the indexer stream <-> MPC glue.

jakmeier added 2 commits April 2, 2026 21:47
Create a MockStream that connects to the MPC fixture
setup. This lets us test the indexer stream <-> MPC glue.
Copy link
Copy Markdown
Contributor

@volovyks volovyks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! test_channel_contention should be very useful in our work on backlog and stability.

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 });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is more of an experiment, but we can make it configurable in tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this PR, but it definitely deserves a constant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
@jakmeier
Copy link
Copy Markdown
Contributor Author

jakmeier commented Apr 9, 2026

I'm still experimenting here. Getting some interesting results.

  1. There is some luck involved if nodes can handle 50 signature requests at once coming from the Solana stream. However, channel buffers have no influence on that. So probably that is not problem.
  2. Meanwhile, 50 requests seems to be a hard threshold for successful signatures. To get more (e.g. 51) I have to send way more requests. I think then they have better chances, with more requests running in parallel.
  3. I often observed 25, 50 or 75 successful signatures. Don't know why, yet. Could be an artifact from the test setup.

I will take a closer look again next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants