@@ -294,11 +294,18 @@ fn test_starknet_light_client() -> Result<(), Error> {
294
294
starknet_status. block_hash. to_bytes_be( )
295
295
) ;
296
296
297
+ let mut cosmos_status = cosmos_chain. query_chain_status ( ) . await ?;
298
+ let cosmos_height = cosmos_status. height ;
299
+
297
300
starknet_to_cosmos_relay
298
301
. send_target_update_client_messages ( DestinationTarget , & starknet_status. height )
299
302
. await ?;
300
303
301
- runtime. sleep ( Duration :: from_secs ( 2 ) ) . await ;
304
+ // wait till the starknet_status is incremented
305
+ while cosmos_status. height == cosmos_height {
306
+ runtime. sleep ( Duration :: from_secs ( 1 ) ) . await ;
307
+ cosmos_status = cosmos_chain. query_chain_status ( ) . await ?;
308
+ }
302
309
303
310
let consensus_state = cosmos_chain
304
311
. query_consensus_state (
@@ -327,11 +334,18 @@ fn test_starknet_light_client() -> Result<(), Error> {
327
334
328
335
// TODO(rano): how do I query cosmos block root
329
336
337
+ let mut starknet_status = starknet_chain. query_chain_status ( ) . await ?;
338
+ let starknet_height = starknet_status. height ;
339
+
330
340
starknet_to_cosmos_relay
331
341
. send_target_update_client_messages ( SourceTarget , & cosmos_status. height )
332
342
. await ?;
333
343
334
- runtime. sleep ( Duration :: from_secs ( 2 ) ) . await ;
344
+ // wait till the starknet_status is incremented
345
+ while starknet_status. height == starknet_height {
346
+ runtime. sleep ( Duration :: from_secs ( 1 ) ) . await ;
347
+ starknet_status = starknet_chain. query_chain_status ( ) . await ?;
348
+ }
335
349
336
350
let consensus_state = starknet_chain
337
351
. query_consensus_state (
0 commit comments