diff --git a/docker-compose.yml b/docker-compose.yml index b860353f..4af7ca4d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,5 @@ version: "3" -#docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest - services: database: image: "postgres:16.2" diff --git a/moksha-mint/src/btconchain/lnd.rs b/moksha-mint/src/btconchain/lnd.rs index d21efb72..e73f29a5 100644 --- a/moksha-mint/src/btconchain/lnd.rs +++ b/moksha-mint/src/btconchain/lnd.rs @@ -8,6 +8,7 @@ use fedimint_tonic_lnd::{ }; use std::{collections::HashMap, path::PathBuf, sync::Arc}; use tokio::sync::{MappedMutexGuard, Mutex, MutexGuard}; +use tracing::instrument; use url::Url; pub struct LndBtcOnchain(Arc>); @@ -43,6 +44,7 @@ impl LndBtcOnchain { #[async_trait] impl BtcOnchain for LndBtcOnchain { + #[instrument(level = "debug", skip(self), err)] async fn is_transaction_paid(&self, txid: &str) -> Result { let request = ListUnspentRequest { min_confs: 0, @@ -59,6 +61,7 @@ impl BtcOnchain for LndBtcOnchain { .any(|utxo| utxo.outpoint.clone().unwrap().txid_str == txid && utxo.confirmations > 0)) } + #[instrument(level = "debug", skip(self), err)] async fn is_paid( &self, address: &str, @@ -80,6 +83,7 @@ impl BtcOnchain for LndBtcOnchain { })) } + #[instrument(level = "debug", skip(self), err)] async fn new_address(&self) -> Result { let mut client = self.client_lock().await?; let response = client @@ -93,6 +97,7 @@ impl BtcOnchain for LndBtcOnchain { Ok(response.address) } + #[instrument(level = "debug", skip(self), err)] async fn send_coins( &self, address: &str, @@ -116,6 +121,7 @@ impl BtcOnchain for LndBtcOnchain { }) } + #[instrument(level = "debug", skip(self), err)] async fn estimate_fee( &self, address: &str, diff --git a/moksha-mint/src/database/postgres.rs b/moksha-mint/src/database/postgres.rs index c47dd528..a7c4d6e5 100644 --- a/moksha-mint/src/database/postgres.rs +++ b/moksha-mint/src/database/postgres.rs @@ -52,6 +52,7 @@ impl PostgresDB { #[async_trait] impl Database for PostgresDB { + #[instrument(level = "debug", skip(self), err)] async fn get_used_proofs(&self) -> Result { let proofs = sqlx::query!("SELECT * FROM used_proofs") .fetch_all(&self.pool) @@ -69,6 +70,7 @@ impl Database for PostgresDB { Ok(proofs.into()) } + #[instrument(level = "debug", skip(self), err)] async fn add_used_proofs(&self, proofs: &Proofs) -> Result<(), MokshaMintError> { for proof in proofs.proofs() { sqlx::query!( @@ -119,6 +121,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn delete_pending_invoice(&self, key: String) -> Result<(), MokshaMintError> { sqlx::query!("DELETE FROM pending_invoices WHERE key = $1", key) .execute(&self.pool) @@ -186,6 +189,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn get_bolt11_melt_quote(&self, key: &Uuid) -> Result { let quote: Bolt11MeltQuote = sqlx::query!( "SELECT id, payment_request, expiry, paid, amount, fee_reserve FROM bolt11_melt_quotes WHERE id = $1", @@ -205,6 +209,7 @@ impl Database for PostgresDB { Ok(quote) } + #[instrument(level = "debug", skip(self), err)] async fn add_bolt11_melt_quote(&self, quote: &Bolt11MeltQuote) -> Result<(), MokshaMintError> { sqlx::query!( "INSERT INTO bolt11_melt_quotes (id, payment_request, expiry, paid, amount, fee_reserve) VALUES ($1, $2, $3, $4, $5, $6)", @@ -220,6 +225,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn update_bolt11_melt_quote( &self, quote: &Bolt11MeltQuote, @@ -234,6 +240,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn delete_bolt11_melt_quote( &self, quote: &Bolt11MeltQuote, @@ -247,6 +254,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn get_onchain_mint_quote( &self, key: &Uuid, @@ -268,6 +276,8 @@ impl Database for PostgresDB { Ok(quote) } + + #[instrument(level = "debug", skip(self), err)] async fn add_onchain_mint_quote( &self, quote: &OnchainMintQuote, @@ -285,6 +295,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn update_onchain_mint_quote( &self, quote: &OnchainMintQuote, @@ -299,6 +310,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn delete_onchain_mint_quote( &self, quote: &OnchainMintQuote, @@ -312,6 +324,7 @@ impl Database for PostgresDB { Ok(()) } + #[instrument(level = "debug", skip(self), err)] async fn get_onchain_melt_quote( &self, key: &Uuid, @@ -334,6 +347,8 @@ impl Database for PostgresDB { Ok(quote) } + + #[instrument(level = "debug", skip(self), err)] async fn add_onchain_melt_quote( &self, quote: &OnchainMeltQuote, @@ -352,6 +367,8 @@ impl Database for PostgresDB { .await?; Ok(()) } + + #[instrument(level = "debug", skip(self), err)] async fn update_onchain_melt_quote( &self, quote: &OnchainMeltQuote, @@ -365,6 +382,8 @@ impl Database for PostgresDB { .await?; Ok(()) } + + #[instrument(level = "debug", skip(self), err)] async fn delete_onchain_melt_quote( &self, quote: &OnchainMeltQuote, diff --git a/moksha-mint/src/mint.rs b/moksha-mint/src/mint.rs index 6e02cfff..77830f95 100644 --- a/moksha-mint/src/mint.rs +++ b/moksha-mint/src/mint.rs @@ -100,6 +100,7 @@ impl Mint { Ok(promises) } + #[instrument(level = "debug", skip(self), err)] pub async fn create_invoice( &self, key: String, @@ -112,7 +113,7 @@ impl Mint { Ok((pr, key)) } - #[instrument(level = "debug", skip(self))] + #[instrument(level = "debug", skip(self, outputs), err)] pub async fn mint_tokens( &self, payment_method: PaymentMethod, @@ -145,6 +146,7 @@ impl Mint { !outputs.iter().all(move |x| uniq.insert(x.b_)) } + #[instrument(level = "debug", skip_all, err)] pub async fn swap( &self, proofs: &Proofs,