Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Sep 24, 2024
1 parent c4e2721 commit 7112ac3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 5 additions & 6 deletions crates/threshold-signature-server/src/validator/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub async fn new_reshare(
encoded_data: Bytes,
) -> Result<StatusCode, ValidatorErr> {
let data = OcwMessageReshare::decode(&mut encoded_data.as_ref())?;
println!("Reshare called with block number {}", data.block_number);

let api = get_api(&app_state.configuration.endpoint).await?;
let rpc = get_rpc(&app_state.configuration.endpoint).await?;
validate_new_reshare(&api, &rpc, &data, &app_state.kv_store).await?;
println!("Reshare validated");

let next_signers_query = entropy::storage().staking_extension().next_signers();
let next_signers = query_chain(&api, &rpc, next_signers_query, None)
.await?
Expand Down Expand Up @@ -96,7 +96,7 @@ pub async fn new_reshare(
let is_proper_signer = validators_info
.iter()
.any(|validator_info| validator_info.tss_account == *signer.account_id());
dbg!(is_proper_signer);

if !is_proper_signer {
return Ok(StatusCode::MISDIRECTED_REQUEST);
}
Expand Down Expand Up @@ -157,7 +157,7 @@ pub async fn new_reshare(
converted_validator_info.push(validator_info.clone());
tss_accounts.push(validator_info.tss_account.clone());
}
println!("getting chans");

let channels = get_channels(
&app_state.listener_state,
converted_validator_info,
Expand All @@ -167,7 +167,7 @@ pub async fn new_reshare(
&x25519_secret_key,
)
.await?;
println!("starting protocol");

let (new_key_share, aux_info) =
execute_reshare(session_id.clone(), channels, signer.signer(), inputs, None).await?;

Expand Down Expand Up @@ -276,7 +276,6 @@ pub async fn validate_new_reshare(
if reshare_data.new_signer != chain_data.new_signer
|| chain_data.block_number != reshare_data.block_number
{
println!("{:?} {:?}", reshare_data, chain_data);
return Err(ValidatorErr::InvalidData);
}
kv_manager.kv().delete(LATEST_BLOCK_NUMBER_RESHARE).await?;
Expand Down
4 changes: 1 addition & 3 deletions crates/threshold-signature-server/src/validator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ async fn test_reshare_foo() {
let onchain_reshare_request =
OcwMessageReshare { new_signer: new_signer.0.to_vec(), block_number };

println!("running to block ocws");
run_to_block(&rpc, block_number + 1).await;
println!("Sending ocws");
// Send the OCW message to all TS servers who don't have a chain node
let response_results = join_all(
validator_ports
Expand All @@ -135,7 +133,7 @@ async fn test_reshare_foo() {
for response_result in response_results {
assert_eq!(response_result.unwrap().text().await.unwrap(), "");
}
println!("GOT HERE");

for (tss_account, key_share_and_aux_before) in key_shares_before.iter() {
let (key_share_before, aux_info_before): KeyShareWithAuxInfo =
deserialize(key_share_and_aux_before).unwrap();
Expand Down

0 comments on commit 7112ac3

Please sign in to comment.