Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Aug 12, 2024
1 parent 397cf09 commit 3ed6cac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
12 changes: 4 additions & 8 deletions crates/protocol/src/execute_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ pub async fn execute_reshare(
session_id: SessionId,
chans: Channels,
threshold_pair: &sr25519::Pair,
threshold_accounts: Vec<AccountId32>,
inputs: KeyResharingInputs<KeyParams, PartyId>,
aux_info_option: Option<AuxInfo<KeyParams, PartyId>>,
) -> Result<
Expand All @@ -343,8 +342,6 @@ pub async fn execute_reshare(
tracing::debug!("Executing proactive refresh");
tracing::debug!("Signing with {:?}", &threshold_pair.public());

let party_ids: BTreeSet<PartyId> =
threshold_accounts.iter().cloned().map(PartyId::new).collect();
let pair = PairWrapper(threshold_pair.clone());

let session_id_hash = session_id.blake2(None)?;
Expand All @@ -353,13 +350,12 @@ pub async fn execute_reshare(
&mut OsRng,
SynedrionSessionId::from_seed(session_id_hash.as_slice()),
pair,
&party_ids,
inputs,
&inputs.new_holders,
inputs.clone(),
)
.map_err(ProtocolExecutionErr::SessionCreation)?;

let (new_key_share, chans) = execute_protocol_generic(chans, session, session_id_hash).await?;

let aux_info = if let Some(aux_info) = aux_info_option {
aux_info
} else {
Expand All @@ -369,11 +365,11 @@ pub async fn execute_reshare(
&mut OsRng,
SynedrionSessionId::from_seed(session_id_hash_aux_data.as_slice()),
PairWrapper(threshold_pair.clone()),
&party_ids,
&inputs.new_holders,
)
.map_err(ProtocolExecutionErr::SessionCreation)?;

execute_protocol_generic(chans, session, session_id_hash).await?.0
execute_protocol_generic(chans, session, session_id_hash_aux_data).await?.0
};

Ok((new_key_share.ok_or(ProtocolExecutionErr::NoOutputFromReshareProtocol)?, aux_info))
Expand Down
3 changes: 1 addition & 2 deletions crates/protocol/tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ pub async fn server(
new_threshold: old_key.threshold(),
};

let new_keyshare =
execute_reshare(session_id, channels, &pair, tss_accounts, inputs, None).await?;
let new_keyshare = execute_reshare(session_id, channels, &pair, inputs, None).await?;
Ok(ProtocolOutput::Reshare(new_keyshare.0))
},
SessionId::Dkg { .. } => {
Expand Down
11 changes: 2 additions & 9 deletions crates/threshold-signature-server/src/signing_client/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,8 @@ pub async fn do_proactive_refresh(
)
.await?;

let result = execute_reshare(
session_id,
channels,
signer.signer(),
tss_accounts,
inputs,
Some(aux_info),
)
.await?;
let result =
execute_reshare(session_id, channels, signer.signer(), inputs, Some(aux_info)).await?;
Ok(result)
}

Expand Down
3 changes: 1 addition & 2 deletions crates/threshold-signature-server/src/validator/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ pub async fn new_reshare(
.await?;

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

let serialized_key_share = key_serialize(&(new_key_share, aux_info))
.map_err(|_| ProtocolErr::KvSerialize("Kv Serialize Error".to_string()))?;
Expand Down

0 comments on commit 3ed6cac

Please sign in to comment.