Skip to content

Commit

Permalink
Fix master build (#1088)
Browse files Browse the repository at this point in the history
* Fix master build

* fix

* Fix race condition

* increase TEST_RESHARE_BLOCK

* add logger to sign eth

* fix do jump start

* fmt
  • Loading branch information
JesseAbram authored Oct 1, 2024
1 parent f8cd3a2 commit 121714f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion crates/shared/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub const MAX_SIGNERS: u8 = 15;
pub const SIGNER_THRESHOLD: u8 = 2;

/// For testing to line up chain mock data and reshare_test
pub const TEST_RESHARE_BLOCK_NUMBER: u32 = 7;
pub const TEST_RESHARE_BLOCK_NUMBER: u32 = 9;

/// Program version number, must be incremented if version number changes
pub const PROGRAM_VERSION_NUMBER: u8 = 0;
29 changes: 16 additions & 13 deletions crates/threshold-signature-server/src/helpers/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub async fn do_jump_start(
rpc: &LegacyRpcMethods<EntropyConfig>,
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;

Expand All @@ -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::<Vec<_>>(),
)
.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()
);
if url != *"http://127.0.0.1:3001/generate_network_key" {
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)
Expand Down
3 changes: 2 additions & 1 deletion crates/threshold-signature-server/src/validator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ async fn test_reshare() {
);
}

let current_block_number = rpc.chain_get_header(None).await.unwrap().unwrap().number;
// Check that rotating the network key wont work again later
run_to_block(&rpc, block_number + 9).await;
run_to_block(&rpc, current_block_number + 3).await;

let response_stale =
client.post("http://127.0.0.1:3001/validator/rotate_network_key").send().await.unwrap();
Expand Down
3 changes: 2 additions & 1 deletion crates/threshold-signature-server/tests/sign_eth_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use entropy_testing_utils::{
constants::{AUXILARY_DATA_SHOULD_SUCCEED, TEST_PROGRAM_WASM_BYTECODE},
spawn_testing_validators, test_node_process_testing_state, ChainSpecType,
};
use entropy_tss::helpers::tests::do_jump_start;
use entropy_tss::helpers::tests::{do_jump_start, initialize_test_logger};
use ethers_core::{
abi::ethabi::ethereum_types::{H160, H256},
types::{RecoveryMessage, Transaction, TransactionRequest, U256},
Expand All @@ -46,6 +46,7 @@ const GOERLI_CHAIN_ID: u64 = 5;
#[tokio::test]
#[serial]
async fn integration_test_sign_eth_tx() {
initialize_test_logger().await;
clean_tests();

let (_validator_ips, _validator_ids) =
Expand Down

0 comments on commit 121714f

Please sign in to comment.