From 7e4ce05cfe78d6f6b81d834c947f83ed0509a397 Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli Date: Tue, 26 Nov 2024 11:13:00 +0100 Subject: [PATCH] fallback to node shieldsync --- workload/src/build_checks/utils.rs | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/workload/src/build_checks/utils.rs b/workload/src/build_checks/utils.rs index 04fbee2..577388e 100644 --- a/workload/src/build_checks/utils.rs +++ b/workload/src/build_checks/utils.rs @@ -55,31 +55,48 @@ pub async fn get_shielded_balance( height: Option, with_indexer: bool ) -> Result, StepError> { - let shiedsync_res = shield_sync(sdk, height, with_indexer).await; + let (res, error) = match shield_sync(sdk, height, with_indexer).await { + Ok(_) => (true, "".to_string()), + Err(e) => { + (false, e.to_string()) + }, + }; + if with_indexer { antithesis_sdk::assert_sometimes!( - shiedsync_res.is_ok(), + res, "Shieldsync (indexer) was successful.", &json!({ "source": source, + "error": error }) ); } else { - antithesis_sdk::assert_always!( - shiedsync_res.is_ok(), + antithesis_sdk::assert_always_or_unreachable!( + res, "Shieldsync (node) was successful.", &json!({ "source": source, + "error": error }) ); } - if shiedsync_res.is_err() { - tracing::info!( - "Shieldsync error: {}", - shiedsync_res.clone().err().unwrap().to_string() + + if with_indexer && !res { + let (res, error) = match shield_sync(sdk, height, false).await { + Ok(_) => (true, "".to_string()), + Err(e) => (false, e.to_string()), + }; + + antithesis_sdk::assert_always_or_unreachable!( + res, + "Shieldsync (node) was successful.", + &json!({ + "source": source, + "error": error + }) ); } - shiedsync_res?; let client = sdk.namada.clone_client(); let mut wallet = sdk.namada.wallet.write().await;