@@ -25,7 +25,7 @@ use jsonrpsee::{
2525} ;
2626use log:: { debug, info, warn} ;
2727use 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 } ;
2929use sp_statement_store:: { Statement , SubmitResult , TopicFilter } ;
3030use std:: { sync:: Arc , time:: Duration } ;
3131use 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