From 9b28a220f409a729e77d930b0805ac3446365a29 Mon Sep 17 00:00:00 2001 From: Jesse Abramowitz Date: Tue, 1 Oct 2024 16:58:00 -0400 Subject: [PATCH] fix do jump start --- .../src/helpers/tests.rs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/threshold-signature-server/src/helpers/tests.rs b/crates/threshold-signature-server/src/helpers/tests.rs index 4e85966fd..2bfb3b395 100644 --- a/crates/threshold-signature-server/src/helpers/tests.rs +++ b/crates/threshold-signature-server/src/helpers/tests.rs @@ -365,6 +365,7 @@ pub async fn do_jump_start( rpc: &LegacyRpcMethods, pair: sr25519::Pair, ) { + run_to_block(rpc, 2).await; let block_number = rpc.chain_get_header(None).await.unwrap().unwrap().number + 1; put_jumpstart_request_on_chain(api, rpc, pair).await; @@ -374,21 +375,23 @@ pub async fn do_jump_start( let validators_info = query_chain(api, rpc, selected_validators_query, None).await.unwrap().unwrap(); let validators_info: Vec<_> = validators_info.into_iter().map(|v| v.0).collect(); - let onchain_user_request = OcwMessageDkg { block_number, validators_info }; + let onchain_user_request = + OcwMessageDkg { block_number, validators_info: validators_info.clone() }; let client = reqwest::Client::new(); - let response_results = join_all( - [3002, 3003, 3004] - .iter() - .map(|port| { - client - .post(format!("http://127.0.0.1:{}/generate_network_key", port)) - .body(onchain_user_request.clone().encode()) - .send() - }) - .collect::>(), - ) - .await; + + let mut results = vec![]; + for validator_info in validators_info { + let url = format!( + "http://{}/generate_network_key", + std::str::from_utf8(&validator_info.ip_address.clone()).unwrap().to_string() + ); + if url != "http://127.0.0.1:3001/generate_network_key".to_string() { + results.push(client.post(url).body(onchain_user_request.clone().encode()).send()) + } + } + + let response_results = join_all(results).await; let jump_start_status_query = entropy::storage().staking_extension().jump_start_progress(); let mut jump_start_status = query_chain(api, rpc, jump_start_status_query.clone(), None)