diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index 268274fae..a35a52b01 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -19,7 +19,7 @@ use crate::{ }; use entropy_shared::{user::ValidatorInfo, BlockNumber, HashingAlgorithm}; use serde::{Deserialize, Serialize}; -use sp_core::{sr25519, Pair}; +use sp_core::{crypto::Ss58Codec, sr25519, Pair}; use subxt::{backend::legacy::LegacyRpcMethods, OnlineClient}; pub use crate::errors::{AttestationRequestError, SubgroupGetError}; @@ -160,7 +160,7 @@ pub async fn request_attestation( rpc: &LegacyRpcMethods, attestee: &sr25519::Pair, ) -> Result<[u8; 32], AttestationRequestError> { - tracing::debug!("{:?} is requesting an attestation.", attestee.public()); + tracing::debug!("{:?} is requesting an attestation.", attestee.public().to_ss58check()); let request_attestation = entropy::tx().attestation().request_attestation(); diff --git a/crates/protocol/src/execute_protocol.rs b/crates/protocol/src/execute_protocol.rs index bfe5434bf..6636cc8e8 100644 --- a/crates/protocol/src/execute_protocol.rs +++ b/crates/protocol/src/execute_protocol.rs @@ -18,7 +18,7 @@ use futures::future::try_join_all; use num::bigint::BigUint; use rand_core::{CryptoRngCore, OsRng}; -use sp_core::{sr25519, Pair}; +use sp_core::{crypto::Ss58Codec, sr25519, Pair}; use std::sync::Arc; use subxt::utils::AccountId32; use synedrion::{ @@ -384,7 +384,8 @@ pub async fn execute_reshare( ProtocolExecutionErr, > { tracing::info!("Executing reshare"); - tracing::debug!("Signing with {:?}", &threshold_pair.public()); + + tracing::debug!("Signing with {:?}", &threshold_pair.public().to_ss58check()); let pair = PairWrapper(threshold_pair.clone()); diff --git a/crates/threshold-signature-server/src/backup_provider/api.rs b/crates/threshold-signature-server/src/backup_provider/api.rs index cf3e10b61..7edb11132 100644 --- a/crates/threshold-signature-server/src/backup_provider/api.rs +++ b/crates/threshold-signature-server/src/backup_provider/api.rs @@ -30,7 +30,10 @@ use entropy_shared::{ use rand::{seq::SliceRandom, RngCore}; use rand_core::OsRng; use serde::{Deserialize, Serialize}; -use sp_core::{sr25519, Pair}; +use sp_core::{ + crypto::{AccountId32, Ss58Codec}, + sr25519, Pair, +}; use std::path::PathBuf; use subxt::{backend::legacy::LegacyRpcMethods, OnlineClient}; use tdx_quote::Quote; @@ -338,7 +341,7 @@ async fn select_backup_provider( tracing::info!( "Selected TSS account {} to act as a db encrpytion key backup provider", - server_info.tss_account + AccountId32::new(server_info.tss_account.0).to_ss58check() ); Ok(BackupProviderDetails { diff --git a/crates/threshold-signature-server/src/helpers/launch.rs b/crates/threshold-signature-server/src/helpers/launch.rs index e0bb8f7a9..4d7177c6c 100644 --- a/crates/threshold-signature-server/src/helpers/launch.rs +++ b/crates/threshold-signature-server/src/helpers/launch.rs @@ -310,6 +310,7 @@ pub async fn check_node_prerequisites( ) -> Result<(), &'static str> { let url = &app_state.configuration.endpoint; let account_id = app_state.account_id(); + let ss58_account = account_id.to_ss58check(); let connect_to_substrate_node = || async { tracing::info!("Attempting to establish connection to Substrate node at `{}`", url); @@ -337,7 +338,7 @@ pub async fn check_node_prerequisites( tracing::info!("Sucessfully connected to Substrate node!"); app_state.cache.connected_to_chain_node().map_err(|_| "Poisoned mutex")?; - tracing::info!("Checking balance of threshold server AccountId `{}`", &account_id); + tracing::info!("Checking balance of threshold server AccountId `{}`", &ss58_account); let balance_query = || async { let has_minimum_balance = crate::validator::api::check_balance_for_fees( @@ -348,7 +349,7 @@ pub async fn check_node_prerequisites( ) .await .map_err(|e| { - tracing::warn!("Account: {} {}", &account_id, e); + tracing::warn!("Account: {} {}", &ss58_account, e); e.to_string() })?; if !has_minimum_balance { @@ -361,7 +362,7 @@ pub async fn check_node_prerequisites( .await .map_err(|_| "Timed out waiting for account to be funded")?; - tracing::info!("The account `{}` has enough funds for submitting extrinsics.", &account_id); + tracing::info!("The account `{}` has enough funds for submitting extrinsics.", &ss58_account); // Now check if there exists a threshold server with our details - if there is not, // we need to wait until there is @@ -381,7 +382,7 @@ pub async fn check_node_prerequisites( Ok(()) }; - tracing::info!("Checking if our account ID has been registered on chain `{}`", &account_id); + tracing::info!("Checking if our account ID has been registered on chain `{}`", &ss58_account); backoff::future::retry(backoff, check_for_tss_account_id) .await .map_err(|_| "Timed out waiting for TSS account to be registered on chain")?; diff --git a/crates/threshold-signature-server/src/user/api.rs b/crates/threshold-signature-server/src/user/api.rs index 85b613844..abcf16497 100644 --- a/crates/threshold-signature-server/src/user/api.rs +++ b/crates/threshold-signature-server/src/user/api.rs @@ -30,6 +30,7 @@ use entropy_shared::{HashingAlgorithm, OcwMessageDkg, NETWORK_PARENT_KEY}; use futures::{channel::mpsc, future::join_all, StreamExt}; use parity_scale_codec::Decode; use serde::{Deserialize, Serialize}; +use sp_core::crypto::{AccountId32, Ss58Codec}; use subxt::{ backend::legacy::LegacyRpcMethods, ext::sp_core::{sr25519, sr25519::Signature, Pair}, @@ -224,7 +225,7 @@ pub async fn sign_tx( let signed_message = encrypted_msg.decrypt(&app_state.x25519_secret, &[])?; let request_author = SubxtAccountId32(*signed_message.account_id().as_ref()); - tracing::Span::current().record("request_author", signed_message.account_id().to_string()); + tracing::Span::current().record("request_author", signed_message.account_id().to_ss58check()); let validators_query = entropy::storage().session().validators(); let validators = query_chain(&api, &rpc, validators_query, None) @@ -394,8 +395,12 @@ async fn handle_protocol_errors( if peers_to_report.is_empty() { return Err(error.to_string()); } - - tracing::debug!("Reporting `{:?}` for `{}`", peers_to_report.clone(), error.to_string()); + let peers_to_report_ss58 = peers_to_report + .clone() + .into_iter() + .map(|x| AccountId32::new(x.0).to_ss58check()) + .collect::>(); + tracing::debug!("Reporting `{:?}` for `{}`", peers_to_report_ss58, error.to_string()); let mut failed_reports = Vec::new(); for peer in peers_to_report { @@ -452,7 +457,7 @@ pub async fn generate_network_key( if in_registration_group.is_err() { tracing::warn!( "The account {:?} is not in the registration group for block_number {:?}", - app_state.subxt_account_id(), + app_state.account_id().to_ss58check(), data.block_number );