From 2706d4366233c609c71edb8eab57b2ee4d3645f9 Mon Sep 17 00:00:00 2001 From: Olga Kunyavskaya Date: Mon, 22 Jan 2024 12:04:09 +0200 Subject: [PATCH] fix sync with eth after init test --- eth2near/eth2-contract-init/src/init_contract.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eth2near/eth2-contract-init/src/init_contract.rs b/eth2near/eth2-contract-init/src/init_contract.rs index 382834aa..1f95bec4 100644 --- a/eth2near/eth2-contract-init/src/init_contract.rs +++ b/eth2near/eth2-contract-init/src/init_contract.rs @@ -256,12 +256,6 @@ mod tests { let mut init_config = get_init_config(&config_for_test, ð_client_contract); init_config.beacon_rpc_version = BeaconRPCVersion::V1_5; - init_contract(&init_config, &mut eth_client_contract).unwrap(); - - let last_finalized_slot_eth_client = eth_client_contract - .get_finalized_beacon_block_slot() - .expect("Error on getting last finalized beacon block slot(Eth client)"); - let beacon_rpc_client = BeaconRPCClient::new( &init_config.beacon_endpoint, init_config.eth_requests_timeout_seconds.unwrap_or(10), @@ -273,8 +267,14 @@ mod tests { .get_last_finalized_slot_number() .expect("Error on getting last finalized beacon block slot"); - const MAX_GAP_IN_EPOCH_BETWEEN_FINALIZED_SLOTS: u64 = 3; + init_contract(&init_config, &mut eth_client_contract).unwrap(); + + let last_finalized_slot_eth_client = eth_client_contract + .get_finalized_beacon_block_slot() + .expect("Error on getting last finalized beacon block slot(Eth client)"); + const MAX_GAP_IN_EPOCH_BETWEEN_FINALIZED_SLOTS: u64 = 3; + assert!( last_finalized_slot_eth_client + ONE_EPOCH_IN_SLOTS * MAX_GAP_IN_EPOCH_BETWEEN_FINALIZED_SLOTS