Compare commits

...

1 Commits

Author SHA1 Message Date
durch 1060888945 wallet tracing POC 2023-01-05 17:30:25 +01:00
23 changed files with 2131 additions and 730 deletions
+1953 -694
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -66,6 +66,14 @@ vesting-contract = { path = "../../contracts/vesting" }
nym-types = { path = "../../common/types" } nym-types = { path = "../../common/types" }
nym-wallet-types = { path = "../nym-wallet-types" } nym-wallet-types = { path = "../nym-wallet-types" }
# Tracing
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tracing-tree = "0.2.2"
opentelemetry = "0.18.0"
opentelemetry-jaeger = { version = "0.17.0", features = ["full"] }
tracing-opentelemetry = "0.18.0"
[dev-dependencies] [dev-dependencies]
tempfile = "3.3.0" tempfile = "3.3.0"
ts-rs = "6.1.2" ts-rs = "6.1.2"
+57 -36
View File
@@ -4,47 +4,68 @@ use fern::colors::ColoredLevelConfig;
use serde::Serialize; use serde::Serialize;
use serde_repr::{Deserialize_repr, Serialize_repr}; use serde_repr::{Deserialize_repr, Serialize_repr};
use tauri::Manager; use tauri::Manager;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::Registry;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use tracing_tree::HierarchicalLayer;
pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> { pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> {
let colors = ColoredLevelConfig::new(); let tracer = opentelemetry_jaeger::new_agent_pipeline()
let base_config = fern::Dispatch::new() .with_service_name("nym-wallet")
.level(global_level()) .install_simple()
.filter_lowlevel_external_components() .unwrap();
.show_operations();
let stdout_config = fern::Dispatch::new() let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
.format(move |out, message, record| {
out.finish(format_args!(
"{}[{}][{}] {}",
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
record.target(),
colors.color(record.level()),
message,
))
})
.chain(std::io::stdout());
let tauri_event_config = fern::Dispatch::new() Registry::default()
.format(move |out, message, record| { .with(EnvFilter::from_default_env())
out.finish(format_args!( .with(
"{}[{}] {}", HierarchicalLayer::new(4)
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"), .with_targets(true)
record.target(), .with_bracketed_fields(true),
message, )
)) .with(telemetry)
}) .init();
.chain(fern::Output::call(move |record| { // let colors = ColoredLevelConfig::new();
let msg = LogMessage { // let base_config = fern::Dispatch::new()
message: record.args().to_string(), // .level(global_level())
level: record.level().into(), // .filter_lowlevel_external_components()
}; // .show_operations();
app_handle.emit_all("log://log", msg).unwrap();
}));
base_config // let stdout_config = fern::Dispatch::new()
.chain(stdout_config) // .format(move |out, message, record| {
.chain(tauri_event_config) // out.finish(format_args!(
.apply() // "{}[{}][{}] {}",
// chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
// record.target(),
// colors.color(record.level()),
// message,
// ))
// })
// .chain(std::io::stdout());
// let tauri_event_config = fern::Dispatch::new()
// .format(move |out, message, record| {
// out.finish(format_args!(
// "{}[{}] {}",
// chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
// record.target(),
// message,
// ))
// })
// .chain(fern::Output::call(move |record| {
// let msg = LogMessage {
// message: record.args().to_string(),
// level: record.level().into(),
// };
// app_handle.emit_all("log://log", msg).unwrap();
// }));
// base_config
// .chain(stdout_config)
// .chain(tauri_event_config)
// .apply()
Ok(())
} }
trait FernExt { trait FernExt {
+2
View File
@@ -172,4 +172,6 @@ fn main() {
.setup(|app| Ok(log::setup_logging(app.app_handle())?)) .setup(|app| Ok(log::setup_logging(app.app_handle())?))
.run(context) .run(context)
.expect("error while running tauri application"); .expect("error while running tauri application");
opentelemetry::global::shutdown_tracer_provider();
} }
@@ -27,6 +27,7 @@ pub async fn connect_with_mnemonic(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result<Balance, BackendError> { pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result<Balance, BackendError> {
let guard = state.read().await; let guard = state.read().await;
let client = guard.current_client()?; let client = guard.current_client()?;
@@ -48,16 +49,19 @@ pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result<Balance
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument]
pub fn create_new_mnemonic() -> String { pub fn create_new_mnemonic() -> String {
random_mnemonic().to_string() random_mnemonic().to_string()
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(mnemonic))]
pub fn validate_mnemonic(mnemonic: &str) -> bool { pub fn validate_mnemonic(mnemonic: &str) -> bool {
Mnemonic::from_str(mnemonic).is_ok() Mnemonic::from_str(mnemonic).is_ok()
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn switch_network( pub async fn switch_network(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
network: WalletNetwork, network: WalletNetwork,
@@ -77,16 +81,19 @@ pub async fn switch_network(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn logout(state: tauri::State<'_, WalletState>) -> Result<(), BackendError> { pub async fn logout(state: tauri::State<'_, WalletState>) -> Result<(), BackendError> {
state.write().await.logout(); state.write().await.logout();
Ok(()) Ok(())
} }
#[tracing::instrument()]
fn random_mnemonic() -> Mnemonic { fn random_mnemonic() -> Mnemonic {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap() Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap()
} }
#[tracing::instrument(skip(state, mnemonic))]
async fn _connect_with_mnemonic( async fn _connect_with_mnemonic(
mnemonic: Mnemonic, mnemonic: Mnemonic,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -169,6 +176,7 @@ async fn _connect_with_mnemonic(
account_for_default_network account_for_default_network
} }
#[tracing::instrument]
async fn run_connection_test( async fn run_connection_test(
untested_nymd_urls: HashMap<WalletNetwork, Vec<Url>>, untested_nymd_urls: HashMap<WalletNetwork, Vec<Url>>,
untested_api_urls: HashMap<WalletNetwork, Vec<Url>>, untested_api_urls: HashMap<WalletNetwork, Vec<Url>>,
@@ -197,6 +205,7 @@ async fn run_connection_test(
.await .await
} }
#[tracing::instrument(skip(mnemonic))]
fn create_clients( fn create_clients(
nymd_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>, nymd_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
api_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>, api_urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
@@ -258,6 +267,7 @@ fn create_clients(
Ok(clients) Ok(clients)
} }
#[tracing::instrument()]
fn select_random_responding_url( fn select_random_responding_url(
urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>, urls: &HashMap<NymNetworkDetails, Vec<(Url, bool)>>,
network: WalletNetwork, network: WalletNetwork,
@@ -283,6 +293,7 @@ fn select_first_responding_url(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument]
pub fn does_password_file_exist() -> Result<bool, BackendError> { pub fn does_password_file_exist() -> Result<bool, BackendError> {
log::info!("Checking wallet file"); log::info!("Checking wallet file");
let file = wallet_storage::wallet_login_filepath()?; let file = wallet_storage::wallet_login_filepath()?;
@@ -296,6 +307,7 @@ pub fn does_password_file_exist() -> Result<bool, BackendError> {
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(mnemonic, password))]
pub fn create_password(mnemonic: &str, password: String) -> Result<(), BackendError> { pub fn create_password(mnemonic: &str, password: String) -> Result<(), BackendError> {
if does_password_file_exist()? { if does_password_file_exist()? {
return Err(BackendError::WalletFileAlreadyExists); return Err(BackendError::WalletFileAlreadyExists);
@@ -311,6 +323,7 @@ pub fn create_password(mnemonic: &str, password: String) -> Result<(), BackendEr
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state, password))]
pub async fn sign_in_with_password( pub async fn sign_in_with_password(
password: String, password: String,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -330,6 +343,7 @@ pub async fn sign_in_with_password(
_connect_with_mnemonic(mnemonic, state).await _connect_with_mnemonic(mnemonic, state).await
} }
#[tracing::instrument(skip(stored_login))]
fn extract_first_mnemonic( fn extract_first_mnemonic(
stored_login: &wallet_storage::StoredLogin, stored_login: &wallet_storage::StoredLogin,
) -> Result<Mnemonic, BackendError> { ) -> Result<Mnemonic, BackendError> {
@@ -350,6 +364,7 @@ fn extract_first_mnemonic(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state, password))]
pub async fn sign_in_with_password_and_account_id( pub async fn sign_in_with_password_and_account_id(
account_id: &str, account_id: &str,
password: &str, password: &str,
@@ -371,6 +386,7 @@ pub async fn sign_in_with_password_and_account_id(
_connect_with_mnemonic(mnemonic, state).await _connect_with_mnemonic(mnemonic, state).await
} }
#[tracing::instrument(skip(stored_login))]
fn extract_mnemonic( fn extract_mnemonic(
stored_login: &wallet_storage::StoredLogin, stored_login: &wallet_storage::StoredLogin,
account_id: &wallet_storage::AccountId, account_id: &wallet_storage::AccountId,
@@ -389,6 +405,7 @@ fn extract_mnemonic(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument]
pub fn remove_password() -> Result<(), BackendError> { pub fn remove_password() -> Result<(), BackendError> {
log::info!("Removing password"); log::info!("Removing password");
let login_id = wallet_storage::LoginId::new(DEFAULT_LOGIN_ID.to_string()); let login_id = wallet_storage::LoginId::new(DEFAULT_LOGIN_ID.to_string());
@@ -396,11 +413,13 @@ pub fn remove_password() -> Result<(), BackendError> {
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument]
pub fn archive_wallet_file() -> Result<(), BackendError> { pub fn archive_wallet_file() -> Result<(), BackendError> {
wallet_storage::archive_wallet_file() wallet_storage::archive_wallet_file()
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state, mnemonic, password))]
pub async fn add_account_for_password( pub async fn add_account_for_password(
mnemonic: &str, mnemonic: &str,
password: &str, password: &str,
@@ -444,6 +463,7 @@ pub async fn add_account_for_password(
} }
// The first `AccoundId` when converting is the `LoginId` for the entry that was loaded. // The first `AccoundId` when converting is the `LoginId` for the entry that was loaded.
#[tracing::instrument(skip(state, stored_login))]
async fn set_state_with_all_accounts( async fn set_state_with_all_accounts(
stored_login: wallet_storage::StoredLogin, stored_login: wallet_storage::StoredLogin,
first_id_when_converting: wallet_storage::AccountId, first_id_when_converting: wallet_storage::AccountId,
@@ -489,6 +509,7 @@ async fn set_state_with_all_accounts(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state, password))]
pub async fn remove_account_for_password( pub async fn remove_account_for_password(
password: &str, password: &str,
account_id: &str, account_id: &str,
@@ -509,6 +530,7 @@ pub async fn remove_account_for_password(
set_state_with_all_accounts(stored_login, first_account_id_when_converting, state).await set_state_with_all_accounts(stored_login, first_account_id_when_converting, state).await
} }
#[tracing::instrument(skip(mnemonic, prefix))]
fn derive_address( fn derive_address(
mnemonic: bip39::Mnemonic, mnemonic: bip39::Mnemonic,
prefix: &str, prefix: &str,
@@ -522,6 +544,7 @@ fn derive_address(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn list_accounts( pub async fn list_accounts(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Vec<AccountEntry>, BackendError> { ) -> Result<Vec<AccountEntry>, BackendError> {
@@ -545,6 +568,7 @@ pub async fn list_accounts(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(password))]
pub fn show_mnemonic_for_account_in_password( pub fn show_mnemonic_for_account_in_password(
account_id: String, account_id: String,
password: String, password: String,
@@ -557,6 +581,7 @@ pub fn show_mnemonic_for_account_in_password(
Ok(mnemonic.to_string()) Ok(mnemonic.to_string())
} }
#[tracing::instrument(skip(password))]
fn _show_mnemonic_for_account_in_password( fn _show_mnemonic_for_account_in_password(
login_id: &wallet_storage::LoginId, login_id: &wallet_storage::LoginId,
account_id: &wallet_storage::AccountId, account_id: &wallet_storage::AccountId,
@@ -10,6 +10,7 @@ use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient};
use validator_client::nymd::Fee; use validator_client::nymd::Fee;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_contract_settings( pub async fn get_contract_settings(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<TauriContractStateParams, BackendError> { ) -> Result<TauriContractStateParams, BackendError> {
@@ -26,6 +27,7 @@ pub async fn get_contract_settings(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn update_contract_settings( pub async fn update_contract_settings(
params: TauriContractStateParams, params: TauriContractStateParams,
fee: Option<Fee>, fee: Option<Fee>,
@@ -23,6 +23,7 @@ pub struct NodeDescription {
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn bond_gateway( pub async fn bond_gateway(
gateway: Gateway, gateway: Gateway,
pledge: DecCoin, pledge: DecCoin,
@@ -54,6 +55,7 @@ pub async fn bond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn unbond_gateway( pub async fn unbond_gateway(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -70,6 +72,7 @@ pub async fn unbond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn bond_mixnode( pub async fn bond_mixnode(
mixnode: MixNode, mixnode: MixNode,
cost_params: MixNodeCostParams, cost_params: MixNodeCostParams,
@@ -103,6 +106,7 @@ pub async fn bond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn pledge_more( pub async fn pledge_more(
fee: Option<Fee>, fee: Option<Fee>,
additional_pledge: DecCoin, additional_pledge: DecCoin,
@@ -130,6 +134,7 @@ pub async fn pledge_more(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn unbond_mixnode( pub async fn unbond_mixnode(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -146,6 +151,7 @@ pub async fn unbond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn update_mixnode_cost_params( pub async fn update_mixnode_cost_params(
new_costs: MixNodeCostParams, new_costs: MixNodeCostParams,
fee: Option<Fee>, fee: Option<Fee>,
@@ -173,6 +179,7 @@ pub async fn update_mixnode_cost_params(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn update_mixnode_config( pub async fn update_mixnode_config(
update: MixNodeConfigUpdate, update: MixNodeConfigUpdate,
fee: Option<Fee>, fee: Option<Fee>,
@@ -198,6 +205,7 @@ pub async fn update_mixnode_config(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_mixnode_avg_uptime( pub async fn get_mixnode_avg_uptime(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Option<u8>, BackendError> { ) -> Result<Option<u8>, BackendError> {
@@ -224,6 +232,7 @@ pub async fn get_mixnode_avg_uptime(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_bond_details( pub async fn mixnode_bond_details(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Option<MixNodeDetails>, BackendError> { ) -> Result<Option<MixNodeDetails>, BackendError> {
@@ -252,6 +261,7 @@ pub async fn mixnode_bond_details(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn gateway_bond_details( pub async fn gateway_bond_details(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Option<GatewayBond>, BackendError> { ) -> Result<Option<GatewayBond>, BackendError> {
@@ -278,6 +288,7 @@ pub async fn gateway_bond_details(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_pending_operator_rewards( pub async fn get_pending_operator_rewards(
address: String, address: String,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -315,6 +326,7 @@ pub async fn get_pending_operator_rewards(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_number_of_mixnode_delegators( pub async fn get_number_of_mixnode_delegators(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -328,6 +340,7 @@ pub async fn get_number_of_mixnode_delegators(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument]
pub async fn get_mix_node_description( pub async fn get_mix_node_description(
host: &str, host: &str,
port: u16, port: u16,
@@ -343,6 +356,7 @@ pub async fn get_mix_node_description(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_mixnode_uptime( pub async fn get_mixnode_uptime(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -144,6 +144,7 @@ pub async fn undelegate_all_from_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_all_mix_delegations( pub async fn get_all_mix_delegations(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Vec<DelegationWithEverything>, BackendError> { ) -> Result<Vec<DelegationWithEverything>, BackendError> {
@@ -5,6 +5,7 @@ use validator_client::nymd::traits::MixnetSigningClient;
use validator_client::nymd::Fee; use validator_client::nymd::Fee;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn create_family( pub async fn create_family(
signature: String, signature: String,
label: String, label: String,
@@ -24,6 +25,7 @@ pub async fn create_family(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn join_family( pub async fn join_family(
signature: String, signature: String,
family_head: String, family_head: String,
@@ -43,6 +45,7 @@ pub async fn join_family(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn leave_family( pub async fn leave_family(
signature: String, signature: String,
family_head: String, family_head: String,
@@ -62,6 +65,7 @@ pub async fn leave_family(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn kick_family_member( pub async fn kick_family_member(
signature: String, signature: String,
member: String, member: String,
@@ -9,6 +9,7 @@ use nym_wallet_types::interval::Interval;
use validator_client::nymd::traits::MixnetQueryClient; use validator_client::nymd::traits::MixnetQueryClient;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_current_interval( pub async fn get_current_interval(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Interval, BackendError> { ) -> Result<Interval, BackendError> {
@@ -19,6 +20,7 @@ pub async fn get_current_interval(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_pending_epoch_events( pub async fn get_pending_epoch_events(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Vec<PendingEpochEvent>, BackendError> { ) -> Result<Vec<PendingEpochEvent>, BackendError> {
@@ -38,6 +40,7 @@ pub async fn get_pending_epoch_events(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_pending_interval_events( pub async fn get_pending_interval_events(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<Vec<PendingIntervalEvent>, BackendError> { ) -> Result<Vec<PendingIntervalEvent>, BackendError> {
@@ -7,6 +7,7 @@ use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient};
use validator_client::nymd::Fee; use validator_client::nymd::Fee;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn claim_operator_reward( pub async fn claim_operator_reward(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -28,6 +29,7 @@ pub async fn claim_operator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn claim_delegator_reward( pub async fn claim_delegator_reward(
mix_id: MixId, mix_id: MixId,
fee: Option<Fee>, fee: Option<Fee>,
@@ -49,6 +51,7 @@ pub async fn claim_delegator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn claim_locked_and_unlocked_delegator_reward( pub async fn claim_locked_and_unlocked_delegator_reward(
mix_id: MixId, mix_id: MixId,
fee: Option<Fee>, fee: Option<Fee>,
@@ -97,6 +100,7 @@ pub async fn claim_locked_and_unlocked_delegator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_current_rewarding_parameters( pub async fn get_current_rewarding_parameters(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<RewardingParams, BackendError> { ) -> Result<RewardingParams, BackendError> {
@@ -6,6 +6,7 @@ use std::str::FromStr;
use validator_client::nymd::{AccountId, Fee}; use validator_client::nymd::{AccountId, Fee};
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn send( pub async fn send(
address: &str, address: &str,
amount: DecCoin, amount: DecCoin,
@@ -12,6 +12,7 @@ use validator_client::models::{
}; };
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_core_node_status( pub async fn mixnode_core_node_status(
mix_id: MixId, mix_id: MixId,
since: Option<i64>, since: Option<i64>,
@@ -23,6 +24,7 @@ pub async fn mixnode_core_node_status(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn gateway_core_node_status( pub async fn gateway_core_node_status(
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
since: Option<i64>, since: Option<i64>,
@@ -34,6 +36,7 @@ pub async fn gateway_core_node_status(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn gateway_report( pub async fn gateway_report(
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -42,6 +45,7 @@ pub async fn gateway_report(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_status( pub async fn mixnode_status(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -50,6 +54,7 @@ pub async fn mixnode_status(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_reward_estimation( pub async fn mixnode_reward_estimation(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -60,6 +65,7 @@ pub async fn mixnode_reward_estimation(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn compute_mixnode_reward_estimation( pub async fn compute_mixnode_reward_estimation(
mix_id: u32, mix_id: u32,
performance: Option<Performance>, performance: Option<Performance>,
@@ -83,6 +89,7 @@ pub async fn compute_mixnode_reward_estimation(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_stake_saturation( pub async fn mixnode_stake_saturation(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -93,6 +100,7 @@ pub async fn mixnode_stake_saturation(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn mixnode_inclusion_probability( pub async fn mixnode_inclusion_probability(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -17,6 +17,7 @@ pub struct SignatureOutputJson {
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn sign( pub async fn sign(
message: String, message: String,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -42,6 +43,7 @@ pub async fn sign(
Ok(output_json) Ok(output_json)
} }
#[tracing::instrument(skip(state))]
async fn get_pubkey_from_account_address( async fn get_pubkey_from_account_address(
address: &AccountId, address: &AccountId,
state: &tauri::State<'_, WalletState>, state: &tauri::State<'_, WalletState>,
@@ -74,6 +76,7 @@ enum VerifyInputKind {
impl TryFrom<Option<String>> for VerifyInputKind { impl TryFrom<Option<String>> for VerifyInputKind {
type Error = BackendError; type Error = BackendError;
#[tracing::instrument]
fn try_from(value: Option<String>) -> Result<Self, Self::Error> { fn try_from(value: Option<String>) -> Result<Self, Self::Error> {
let key = match value { let key = match value {
Some(key) => key, Some(key) => key,
@@ -100,6 +103,7 @@ impl TryFrom<Option<String>> for VerifyInputKind {
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn verify( pub async fn verify(
public_key_as_json_or_account_address: Option<String>, public_key_as_json_or_account_address: Option<String>,
signature_as_hex: String, signature_as_hex: String,
@@ -8,6 +8,7 @@ use mixnet_contract_common::{ContractStateParams, ExecuteMsg};
use nym_wallet_types::admin::TauriContractStateParams; use nym_wallet_types::admin::TauriContractStateParams;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_update_contract_settings( pub async fn simulate_update_contract_settings(
params: TauriContractStateParams, params: TauriContractStateParams,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -9,6 +9,7 @@ use std::str::FromStr;
use validator_client::nymd::{AccountId, MsgSend}; use validator_client::nymd::{AccountId, MsgSend};
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_send( pub async fn simulate_send(
address: &str, address: &str,
amount: DecCoin, amount: DecCoin,
@@ -9,6 +9,7 @@ use mixnet_contract_common::{ExecuteMsg, Gateway, MixId, MixNode};
use nym_types::currency::DecCoin; use nym_types::currency::DecCoin;
use nym_types::mixnode::MixNodeCostParams; use nym_types::mixnode::MixNodeCostParams;
#[tracing::instrument(skip(state))]
async fn simulate_mixnet_operation( async fn simulate_mixnet_operation(
msg: ExecuteMsg, msg: ExecuteMsg,
raw_funds: Option<DecCoin>, raw_funds: Option<DecCoin>,
@@ -36,6 +37,7 @@ async fn simulate_mixnet_operation(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_bond_gateway( pub async fn simulate_bond_gateway(
gateway: Gateway, gateway: Gateway,
pledge: DecCoin, pledge: DecCoin,
@@ -54,6 +56,7 @@ pub async fn simulate_bond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_unbond_gateway( pub async fn simulate_unbond_gateway(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -61,6 +64,7 @@ pub async fn simulate_unbond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_bond_mixnode( pub async fn simulate_bond_mixnode(
mixnode: MixNode, mixnode: MixNode,
cost_params: MixNodeCostParams, cost_params: MixNodeCostParams,
@@ -85,6 +89,7 @@ pub async fn simulate_bond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_pledge_more( pub async fn simulate_pledge_more(
additional_pledge: DecCoin, additional_pledge: DecCoin,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -93,6 +98,7 @@ pub async fn simulate_pledge_more(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_unbond_mixnode( pub async fn simulate_unbond_mixnode(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -100,6 +106,7 @@ pub async fn simulate_unbond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_update_mixnode_cost_params( pub async fn simulate_update_mixnode_cost_params(
new_costs: MixNodeCostParams, new_costs: MixNodeCostParams,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -117,6 +124,7 @@ pub async fn simulate_update_mixnode_cost_params(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_update_mixnode_config( pub async fn simulate_update_mixnode_config(
update: MixNodeConfigUpdate, update: MixNodeConfigUpdate,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -130,6 +138,7 @@ pub async fn simulate_update_mixnode_config(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_delegate_to_mixnode( pub async fn simulate_delegate_to_mixnode(
mix_id: MixId, mix_id: MixId,
amount: DecCoin, amount: DecCoin,
@@ -144,6 +153,7 @@ pub async fn simulate_delegate_to_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_undelegate_from_mixnode( pub async fn simulate_undelegate_from_mixnode(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -152,6 +162,7 @@ pub async fn simulate_undelegate_from_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_claim_operator_reward( pub async fn simulate_claim_operator_reward(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -159,6 +170,7 @@ pub async fn simulate_claim_operator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_claim_delegator_reward( pub async fn simulate_claim_delegator_reward(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -24,6 +24,7 @@ pub(crate) struct SimulateResult {
} }
impl SimulateResult { impl SimulateResult {
#[tracing::instrument]
pub fn new( pub fn new(
gas_info: Option<GasInfo>, gas_info: Option<GasInfo>,
gas_price: GasPrice, gas_price: GasPrice,
@@ -10,6 +10,7 @@ use nym_types::currency::DecCoin;
use nym_types::mixnode::MixNodeCostParams; use nym_types::mixnode::MixNodeCostParams;
use vesting_contract_common::ExecuteMsg; use vesting_contract_common::ExecuteMsg;
#[tracing::instrument(skip(state))]
async fn simulate_vesting_operation( async fn simulate_vesting_operation(
msg: ExecuteMsg, msg: ExecuteMsg,
raw_funds: Option<DecCoin>, raw_funds: Option<DecCoin>,
@@ -37,6 +38,7 @@ async fn simulate_vesting_operation(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_bond_gateway( pub async fn simulate_vesting_bond_gateway(
gateway: Gateway, gateway: Gateway,
pledge: DecCoin, pledge: DecCoin,
@@ -59,6 +61,7 @@ pub async fn simulate_vesting_bond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_unbond_gateway( pub async fn simulate_vesting_unbond_gateway(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -66,6 +69,7 @@ pub async fn simulate_vesting_unbond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_bond_mixnode( pub async fn simulate_vesting_bond_mixnode(
mixnode: MixNode, mixnode: MixNode,
cost_params: MixNodeCostParams, cost_params: MixNodeCostParams,
@@ -92,6 +96,7 @@ pub async fn simulate_vesting_bond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_pledge_more( pub async fn simulate_vesting_pledge_more(
additional_pledge: DecCoin, additional_pledge: DecCoin,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -105,6 +110,7 @@ pub async fn simulate_vesting_pledge_more(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_unbond_mixnode( pub async fn simulate_vesting_unbond_mixnode(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -112,6 +118,7 @@ pub async fn simulate_vesting_unbond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_update_mixnode_cost_params( pub async fn simulate_vesting_update_mixnode_cost_params(
new_costs: MixNodeCostParams, new_costs: MixNodeCostParams,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -129,6 +136,7 @@ pub async fn simulate_vesting_update_mixnode_cost_params(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_update_mixnode_config( pub async fn simulate_vesting_update_mixnode_config(
update: MixNodeConfigUpdate, update: MixNodeConfigUpdate,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -142,6 +150,7 @@ pub async fn simulate_vesting_update_mixnode_config(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_delegate_to_mixnode( pub async fn simulate_vesting_delegate_to_mixnode(
mix_id: MixId, mix_id: MixId,
amount: DecCoin, amount: DecCoin,
@@ -159,6 +168,7 @@ pub async fn simulate_vesting_delegate_to_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_undelegate_from_mixnode( pub async fn simulate_vesting_undelegate_from_mixnode(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -167,6 +177,7 @@ pub async fn simulate_vesting_undelegate_from_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_withdraw_vested_coins( pub async fn simulate_withdraw_vested_coins(
amount: DecCoin, amount: DecCoin,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -177,6 +188,7 @@ pub async fn simulate_withdraw_vested_coins(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_claim_operator_reward( pub async fn simulate_vesting_claim_operator_reward(
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
) -> Result<FeeDetails, BackendError> { ) -> Result<FeeDetails, BackendError> {
@@ -184,6 +196,7 @@ pub async fn simulate_vesting_claim_operator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn simulate_vesting_claim_delegator_reward( pub async fn simulate_vesting_claim_delegator_reward(
mix_id: MixId, mix_id: MixId,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -10,6 +10,7 @@ use nym_types::transaction::TransactionExecuteResult;
use validator_client::nymd::{Fee, VestingSigningClient}; use validator_client::nymd::{Fee, VestingSigningClient};
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_bond_gateway( pub async fn vesting_bond_gateway(
gateway: Gateway, gateway: Gateway,
pledge: DecCoin, pledge: DecCoin,
@@ -41,6 +42,7 @@ pub async fn vesting_bond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_unbond_gateway( pub async fn vesting_unbond_gateway(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -60,6 +62,7 @@ pub async fn vesting_unbond_gateway(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_bond_mixnode( pub async fn vesting_bond_mixnode(
mixnode: MixNode, mixnode: MixNode,
cost_params: MixNodeCostParams, cost_params: MixNodeCostParams,
@@ -94,6 +97,7 @@ pub async fn vesting_bond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_pledge_more( pub async fn vesting_pledge_more(
fee: Option<Fee>, fee: Option<Fee>,
additional_pledge: DecCoin, additional_pledge: DecCoin,
@@ -121,6 +125,7 @@ pub async fn vesting_pledge_more(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_unbond_mixnode( pub async fn vesting_unbond_mixnode(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -144,6 +149,7 @@ pub async fn vesting_unbond_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn withdraw_vested_coins( pub async fn withdraw_vested_coins(
amount: DecCoin, amount: DecCoin,
fee: Option<Fee>, fee: Option<Fee>,
@@ -172,6 +178,7 @@ pub async fn withdraw_vested_coins(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_update_mixnode_cost_params( pub async fn vesting_update_mixnode_cost_params(
new_costs: MixNodeCostParams, new_costs: MixNodeCostParams,
fee: Option<Fee>, fee: Option<Fee>,
@@ -200,6 +207,7 @@ pub async fn vesting_update_mixnode_cost_params(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_update_mixnode_config( pub async fn vesting_update_mixnode_config(
update: MixNodeConfigUpdate, update: MixNodeConfigUpdate,
fee: Option<Fee>, fee: Option<Fee>,
@@ -9,6 +9,7 @@ use nym_types::transaction::TransactionExecuteResult;
use validator_client::nymd::{Fee, VestingSigningClient}; use validator_client::nymd::{Fee, VestingSigningClient};
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_delegate_to_mixnode( pub async fn vesting_delegate_to_mixnode(
mix_id: MixId, mix_id: MixId,
amount: DecCoin, amount: DecCoin,
@@ -39,6 +40,7 @@ pub async fn vesting_delegate_to_mixnode(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_undelegate_from_mixnode( pub async fn vesting_undelegate_from_mixnode(
mix_id: MixId, mix_id: MixId,
fee: Option<Fee>, fee: Option<Fee>,
@@ -173,6 +173,7 @@ pub async fn delegated_free(
/// Returns the total amount of delegated tokens that have vested /// Returns the total amount of delegated tokens that have vested
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn delegated_vesting( pub async fn delegated_vesting(
block_time: Option<u64>, block_time: Option<u64>,
vesting_account_address: &str, vesting_account_address: &str,
@@ -196,6 +197,7 @@ pub async fn delegated_vesting(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_get_mixnode_pledge( pub async fn vesting_get_mixnode_pledge(
address: &str, address: &str,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -217,6 +219,7 @@ pub async fn vesting_get_mixnode_pledge(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_get_gateway_pledge( pub async fn vesting_get_gateway_pledge(
address: &str, address: &str,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -238,6 +241,7 @@ pub async fn vesting_get_gateway_pledge(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_current_vesting_period( pub async fn get_current_vesting_period(
address: &str, address: &str,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -251,6 +255,7 @@ pub async fn get_current_vesting_period(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn get_account_info( pub async fn get_account_info(
address: &str, address: &str,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -8,6 +8,7 @@ use nym_types::transaction::TransactionExecuteResult;
use validator_client::nymd::Fee; use validator_client::nymd::Fee;
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_claim_operator_reward( pub async fn vesting_claim_operator_reward(
fee: Option<Fee>, fee: Option<Fee>,
state: tauri::State<'_, WalletState>, state: tauri::State<'_, WalletState>,
@@ -28,6 +29,7 @@ pub async fn vesting_claim_operator_reward(
} }
#[tauri::command] #[tauri::command]
#[tracing::instrument(skip(state))]
pub async fn vesting_claim_delegator_reward( pub async fn vesting_claim_delegator_reward(
mix_id: MixId, mix_id: MixId,
fee: Option<Fee>, fee: Option<Fee>,