Skip to content

Commit 450b8a3

Browse files
committed
wait in a loop to progress block
1 parent 92d3a4e commit 450b8a3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

relayer/crates/starknet-integration-tests/src/tests/light_client.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,18 @@ fn test_starknet_light_client() -> Result<(), Error> {
294294
starknet_status.block_hash.to_bytes_be()
295295
);
296296

297+
let mut cosmos_status = cosmos_chain.query_chain_status().await?;
298+
let cosmos_height = cosmos_status.height;
299+
297300
starknet_to_cosmos_relay
298301
.send_target_update_client_messages(DestinationTarget, &starknet_status.height)
299302
.await?;
300303

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+
}
302309

303310
let consensus_state = cosmos_chain
304311
.query_consensus_state(
@@ -327,11 +334,18 @@ fn test_starknet_light_client() -> Result<(), Error> {
327334

328335
// TODO(rano): how do I query cosmos block root
329336

337+
let mut starknet_status = starknet_chain.query_chain_status().await?;
338+
let starknet_height = starknet_status.height;
339+
330340
starknet_to_cosmos_relay
331341
.send_target_update_client_messages(SourceTarget, &cosmos_status.height)
332342
.await?;
333343

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+
}
335349

336350
let consensus_state = starknet_chain
337351
.query_consensus_state(

0 commit comments

Comments
 (0)