Skip to content

Commit 566cdf5

Browse files
committed
Use BoundedVec
1 parent bece514 commit 566cdf5

File tree

1 file changed

+6
-2
lines changed
  • substrate/client/statement-store/statement-latency-bench/src

1 file changed

+6
-2
lines changed

substrate/client/statement-store/statement-latency-bench/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use jsonrpsee::{
2525
};
2626
use log::{debug, info, warn};
2727
use serde::{Deserialize, Serialize};
28-
use sp_core::{blake2_256, sr25519, Bytes, Pair};
28+
use sp_core::{blake2_256, bounded_vec::BoundedVec, sr25519, Bytes, ConstU32, Pair};
2929
use sp_statement_store::{Statement, SubmitResult, TopicFilter};
3030
use std::{sync::Arc, time::Duration};
3131
use tokio::{sync::Barrier, time::timeout};
@@ -179,10 +179,14 @@ async fn run_client(
179179
.map(|idx| generate_topic(test_run_id, neighbour_id, round, idx).to_vec().into())
180180
.collect();
181181

182+
let bounded_topics: BoundedVec<Bytes, ConstU32<128>> = expected_topics
183+
.try_into()
184+
.map_err(|_| anyhow!("Client {client_id}: Too many topics (max 128)"))?;
185+
182186
let mut subscription: Subscription<Bytes> = rpc_client
183187
.subscribe(
184188
"statement_subscribeStatement",
185-
rpc_params![TopicFilter::MatchAny(expected_topics)],
189+
rpc_params![TopicFilter::MatchAny(bounded_topics)],
186190
"statement_unsubscribeStatement",
187191
)
188192
.await

0 commit comments

Comments
 (0)