@@ -10,20 +10,6 @@ use futures::FutureExt;
10
10
use sp_core:: { Bytes , Encode } ;
11
11
use zombienet_sdk:: { subxt:: rpc_params, NetworkConfigBuilder } ;
12
12
13
- fn timeout_1min < T > (
14
- fut : impl std:: future:: Future < Output = Result < T , impl Into < anyhow:: Error > > > ,
15
- ) -> impl std:: future:: Future < Output = Result < T , anyhow:: Error > > {
16
- let caller_loc = std:: panic:: Location :: caller ( ) ;
17
- tokio:: time:: timeout ( Duration :: from_secs ( 60 ) , fut) . map ( move |res| match res {
18
- Ok ( res) => res. map_err ( |e| e. into ( ) ) ,
19
- Err ( _) => Err ( anyhow ! (
20
- "Operation timed out after 60s (called from {}:{})" ,
21
- caller_loc. file( ) ,
22
- caller_loc. line( ) ,
23
- ) ) ,
24
- } )
25
- }
26
-
27
13
#[ tokio:: test( flavor = "multi_thread" ) ]
28
14
async fn statement_store ( ) -> Result < ( ) , anyhow:: Error > {
29
15
let _ = env_logger:: try_init_from_env (
@@ -69,13 +55,14 @@ async fn statement_store() -> Result<(), anyhow::Error> {
69
55
} ) ?;
70
56
71
57
let spawn_fn = zombienet_sdk:: environment:: get_spawn_fn ( ) ;
72
- let network = timeout_1min ( spawn_fn ( config) ) . await ?;
58
+ let network = spawn_fn ( config) . await ?;
59
+ assert ! ( network. wait_until_is_up( 60 ) . await . is_ok( ) ) ;
73
60
74
61
let charlie = network. get_node ( "charlie" ) ?;
75
62
let dave = network. get_node ( "dave" ) ?;
76
63
77
- let charlie_rpc = timeout_1min ( charlie. rpc ( ) ) . await ?;
78
- let dave_rpc = timeout_1min ( dave. rpc ( ) ) . await ?;
64
+ let charlie_rpc = charlie. rpc ( ) . await ?;
65
+ let dave_rpc = dave. rpc ( ) . await ?;
79
66
80
67
// Create the statement "1,2,3" signed by dave.
81
68
let mut statement = sp_statement_store:: Statement :: new ( ) ;
@@ -85,13 +72,10 @@ async fn statement_store() -> Result<(), anyhow::Error> {
85
72
let statement: Bytes = statement. encode ( ) . into ( ) ;
86
73
87
74
// Submit the statement to charlie.
88
- let _: ( ) =
89
- timeout_1min ( charlie_rpc. request ( "statement_submit" , rpc_params ! [ statement. clone( ) ] ) )
90
- . await ?;
75
+ let _: ( ) = charlie_rpc. request ( "statement_submit" , rpc_params ! [ statement. clone( ) ] ) . await ?;
91
76
92
77
// Ensure that charlie stored the statement.
93
- let charlie_dump: Vec < Bytes > =
94
- timeout_1min ( charlie_rpc. request ( "statement_dump" , rpc_params ! [ ] ) ) . await ?;
78
+ let charlie_dump: Vec < Bytes > = charlie_rpc. request ( "statement_dump" , rpc_params ! [ ] ) . await ?;
95
79
if charlie_dump != vec ! [ statement. clone( ) ] {
96
80
return Err ( anyhow ! ( "Charlie did not store the statement" ) ) ;
97
81
}
@@ -100,8 +84,7 @@ async fn statement_store() -> Result<(), anyhow::Error> {
100
84
let query_start_time = std:: time:: SystemTime :: now ( ) ;
101
85
let stop_after_secs = 20 ;
102
86
loop {
103
- let dave_dump: Vec < Bytes > =
104
- timeout_1min ( dave_rpc. request ( "statement_dump" , rpc_params ! [ ] ) ) . await ?;
87
+ let dave_dump: Vec < Bytes > = dave_rpc. request ( "statement_dump" , rpc_params ! [ ] ) . await ?;
105
88
if !dave_dump. is_empty ( ) {
106
89
if dave_dump != vec ! [ statement. clone( ) ] {
107
90
return Err ( anyhow ! ( "Dave statement store is not the expected one" ) ) ;
0 commit comments