From 8b26910ebb39d24c22e694ebed8847ba5c7923f3 Mon Sep 17 00:00:00 2001 From: Miraculous Owonubi Date: Fri, 22 Nov 2024 16:20:40 +0300 Subject: [PATCH] fix(CI): advance after transactions are fully finalized (#982) --- contracts/context-config/tests/sandbox.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/contracts/context-config/tests/sandbox.rs b/contracts/context-config/tests/sandbox.rs index 612f10890..8282be74e 100644 --- a/contracts/context-config/tests/sandbox.rs +++ b/contracts/context-config/tests/sandbox.rs @@ -1124,7 +1124,6 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { let node1_balance = worker.view_account(&node1.id()).await?.balance; - // Deploy proxy contract let res = node1 .call(contract.id(), "mutate") .args_json(Signed::new( @@ -1155,11 +1154,15 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { let expected_log = format!("Context `{}` added", context_id); assert!(res.logs().iter().any(|log| log == &expected_log)); + worker.fast_forward(1).await?; + let node1_balance_after = worker.view_account(&node1.id()).await?.balance; let diff = node1_balance.saturating_sub(node1_balance_after); let node1_balance = node1_balance_after; + println!("Node1 balance diff: {}", diff); + assert!( diff < NearToken::from_millinear(10), "Node1 balance should not be reduced by more than 10 milliNEAR, but was reduced by {}", @@ -1185,6 +1188,7 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { println!("Initial storage usage: {}", initial_storage); println!("Initial WASM size: {}", initial_code_size); println!("Initial Balance: {}", initial_balance); + println!("Initial Node1 Balance: {}", node1_balance); let res = contract .call("set_proxy_code") @@ -1216,11 +1220,15 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { assert!(res.failures().is_empty(), "{:#?}", res.failures()); + worker.fast_forward(1).await?; + let node1_balance_after = worker.view_account(&node1.id()).await?.balance; let diff = node1_balance.saturating_sub(node1_balance_after); let node1_balance = node1_balance_after; + println!("Node1 balance diff: {}", diff); + assert!( diff < NearToken::from_millinear(10), "Node1 balance should not be reduced by more than 10 milliNEAR, but was reduced by {}", @@ -1236,6 +1244,7 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { println!("Intermediate storage usage: {}", intermediate_storage); println!("Intermediate WASM size: {}", intermediate_code_size); println!("Intermediate Balance: {}", intermediate_balance); + println!("Intermediate Node1 Balance: {}", node1_balance); // Calculate raw differences (can be negative) let storage_change = intermediate_storage as i64 - initial_storage as i64; @@ -1291,10 +1300,14 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { assert!(res.failures().is_empty(), "{:#?}", res.failures()); + worker.fast_forward(1).await?; + let node1_balance_after = worker.view_account(&node1.id()).await?.balance; let diff = node1_balance.saturating_sub(node1_balance_after); + println!("Node1 balance diff: {}", diff); + assert!( diff < NearToken::from_millinear(10), "Node1 balance should not be reduced by more than 10 milliNEAR, but was reduced by {}", @@ -1310,6 +1323,7 @@ async fn test_storage_usage_matches_code_size() -> eyre::Result<()> { println!("Final storage usage: {}", final_storage); println!("Final WASM size: {}", final_code_size); println!("Final Balance: {}", final_balance); + println!("Final Node1 Balance: {}", node1_balance); // Calculate raw differences (can be negative) let storage_change = final_storage as i64 - intermediate_storage as i64;