Skip to content

Commit

Permalink
Downgrade check_in_registration_group error log to warning (#832)
Browse files Browse the repository at this point in the history
* check_in_registration_group logs warning

* Emit warning event on registration group error

---------

Co-authored-by: Hernando Castano <[email protected]>
  • Loading branch information
JesseAbram and HCastano authored May 15, 2024
1 parent dd2996d commit 6c5a1e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 13 additions & 1 deletion crates/threshold-signature-server/src/user/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,19 @@ pub async fn new_user(
let api = get_api(&app_state.configuration.endpoint).await?;
let rpc = get_rpc(&app_state.configuration.endpoint).await?;
let (signer, x25519_secret_key) = get_signer_and_x25519_secret(&app_state.kv_store).await?;
check_in_registration_group(&data.validators_info, signer.account_id())?;
let in_registration_group =
check_in_registration_group(&data.validators_info, signer.account_id());

if in_registration_group.is_err() {
tracing::warn!(
"The account {:?} is not in the registration group for block_number {:?}",
signer.account_id(),
data.block_number
);

return Ok(StatusCode::MISDIRECTED_REQUEST);
}

validate_new_user(&data, &api, &rpc, &app_state.kv_store).await?;

// Do the DKG protocol in another task, so we can already respond
Expand Down
6 changes: 1 addition & 5 deletions crates/threshold-signature-server/src/user/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,7 @@ async fn test_store_share() {
.await
.unwrap();

assert_eq!(response_not_validator.status(), StatusCode::INTERNAL_SERVER_ERROR);
assert_eq!(
response_not_validator.text().await.unwrap(),
"Invalid Signer: Invalid Signer in Signing group"
);
assert_eq!(response_not_validator.status(), StatusCode::MISDIRECTED_REQUEST);

check_if_confirmation(&api, &rpc, &alice.pair(), new_verifying_key).await;
// TODO check if key is in other subgroup member
Expand Down

0 comments on commit 6c5a1e4

Please sign in to comment.