diff --git a/core/src/database/wrapper.rs b/core/src/database/wrapper.rs index b6997923..52977c7f 100644 --- a/core/src/database/wrapper.rs +++ b/core/src/database/wrapper.rs @@ -2,13 +2,12 @@ use std::str::FromStr; use bitcoin::{address::NetworkUnchecked, Address, OutPoint, TxOut, Txid}; use serde::{Deserialize, Serialize}; -use serde_json::Value; use sqlx::{ - postgres::{PgArgumentBuffer, PgRow, PgValueRef}, - Decode, Encode, Postgres, Row, + postgres::{PgArgumentBuffer, PgValueRef}, + Decode, Encode, Postgres, }; -use crate::{ByteArray66, EVMAddress, UTXO}; +use crate::EVMAddress; #[derive(Serialize, Deserialize)] pub struct OutPointDB(pub OutPoint); diff --git a/core/src/errors.rs b/core/src/errors.rs index cdd057fa..3eea15b1 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -32,10 +32,10 @@ pub enum BridgeError { InvalidPeriod(InvalidPeriodError), /// Returned when the secp256k1 crate returns an error #[error("Secpk256Error: {0}")] - Secpk256Error(secp256k1::Error), + Secpk256Error(#[from] secp256k1::Error), /// Returned when the bitcoin crate returns an error in the sighash taproot module #[error("BitcoinSighashTaprootError: {0}")] - BitcoinSighashTaprootError(bitcoin::sighash::TaprootError), + BitcoinSighashTaprootError(#[from] bitcoin::sighash::TaprootError), /// Returned when a non finalized deposit request is found #[error("DepositNotFinalized")] DepositNotFinalized, @@ -53,7 +53,7 @@ pub enum BridgeError { TxidNotFound, /// Returned in RPC error #[error("BitcoinCoreRPCError: {0}")] - BitcoinRpcError(bitcoincore_rpc::Error), + BitcoinRpcError(#[from] bitcoincore_rpc::Error), /// Returned if there is no confirmation data #[error("NoConfirmationData")] NoConfirmationData, @@ -65,7 +65,7 @@ pub enum BridgeError { TryFromSliceError, /// Returned when bitcoin::Transaction error happens, also returns the error #[error("BitcoinTransactionError: {0}")] - BitcoinConsensusEncodeError(bitcoin::consensus::encode::Error), + BitcoinConsensusEncodeError(#[from] bitcoin::consensus::encode::Error), /// TxInputNotFound is returned when the input is not found in the transaction #[error("TxInputNotFound")] TxInputNotFound, @@ -101,34 +101,31 @@ pub enum BridgeError { BlockNotFound, /// Merkle Block Error #[error("MerkleBlockError: {0}")] - MerkleBlockError(MerkleBlockError), + MerkleBlockError(#[from] MerkleBlockError), /// Merkle Proof Error #[error("MerkleProofError")] MerkleProofError, /// JSON RPC call failed #[error("JsonRpcError: {0}")] - JsonRpcError(jsonrpsee::core::client::Error), - /// Given key pair is invalid and new pairs can't be generated randomly - #[error("InvalidKeyPair")] - InvalidKeyPair(std::io::Error), + JsonRpcError(#[from] jsonrpsee::core::client::Error), /// ConfigError is returned when the configuration is invalid #[error("ConfigError: {0}")] ConfigError(String), /// Bitcoin Address Parse Error, probably given address network is invalid #[error("BitcoinAddressParseError: {0}")] - BitcoinAddressParseError(bitcoin::address::ParseError), + BitcoinAddressParseError(#[from] bitcoin::address::ParseError), /// Port error for tests #[error("PortError: {0}")] PortError(String), /// Database error #[error("DatabaseError: {0}")] - DatabaseError(sqlx::Error), + DatabaseError(#[from] sqlx::Error), /// Operator tries to claim with different bridge funds with the same withdrawal idx #[error("AlreadySpentWithdrawal")] AlreadySpentWithdrawal, /// There was an error while creating a server. #[error("ServerError")] - ServerError(std::io::Error), + ServerError(#[from] std::io::Error), /// When the operators funding utxo is not found #[error("OperatorFundingUtxoNotFound: Funding utxo not found, pls send some amount here: {0}, then call the set_operator_funding_utxo RPC")] OperatorFundingUtxoNotFound(bitcoin::Address), @@ -140,19 +137,19 @@ pub enum BridgeError { InvalidKickoffUtxo, #[error("KeyAggContextError: {0}")] - KeyAggContextError(musig2::errors::KeyAggError), + KeyAggContextError(#[from] musig2::errors::KeyAggError), #[error("KeyAggContextTweakError: {0}")] - KeyAggContextTweakError(musig2::errors::TweakError), + KeyAggContextTweakError(#[from] musig2::errors::TweakError), #[error("InvalidScalarBytes: {0}")] - InvalidScalarBytes(InvalidScalarBytes), + InvalidScalarBytes(#[from] InvalidScalarBytes), #[error("NoncesNotFound")] NoncesNotFound, #[error("MuSig2VerifyError: {0}")] - MuSig2VerifyError(musig2::errors::VerifyError), + MuSig2VerifyError(#[from] musig2::errors::VerifyError), #[error("KickoffOutpointsNotFound")] KickoffOutpointsNotFound, @@ -160,10 +157,10 @@ pub enum BridgeError { DepositInfoNotFound, #[error("FromHexError: {0}")] - FromHexError(hex::FromHexError), + FromHexError(#[from] hex::FromHexError), #[error("FromSliceError: {0}")] - FromSliceError(bitcoin::hashes::FromSliceError), + FromSliceError(#[from] bitcoin::hashes::FromSliceError), } impl Into> for BridgeError { @@ -172,18 +169,6 @@ impl Into> for BridgeError { } } -impl From for BridgeError { - fn from(err: secp256k1::Error) -> Self { - BridgeError::Secpk256Error(err) - } -} - -impl From for BridgeError { - fn from(err: bitcoin::sighash::TaprootError) -> Self { - BridgeError::BitcoinSighashTaprootError(err) - } -} - impl From> for BridgeError { fn from(_error: Vec) -> Self { BridgeError::VecConversionError @@ -196,12 +181,6 @@ impl From for BridgeError { } } -impl From for BridgeError { - fn from(err: bitcoin::consensus::encode::Error) -> Self { - BridgeError::BitcoinConsensusEncodeError(err) - } -} - impl From for BridgeError { fn from(_error: TaprootBuilderError) -> Self { BridgeError::TaprootBuilderError @@ -213,69 +192,3 @@ impl From for BridgeError { BridgeError::TaprootBuilderError } } - -impl From for BridgeError { - fn from(err: bitcoincore_rpc::Error) -> Self { - BridgeError::BitcoinRpcError(err) - } -} - -impl From for BridgeError { - fn from(err: MerkleBlockError) -> Self { - BridgeError::MerkleBlockError(err) - } -} - -impl From for BridgeError { - fn from(err: jsonrpsee::core::client::Error) -> Self { - BridgeError::JsonRpcError(err) - } -} - -impl From for BridgeError { - fn from(err: bitcoin::address::ParseError) -> Self { - BridgeError::BitcoinAddressParseError(err) - } -} - -impl From for BridgeError { - fn from(err: sqlx::Error) -> Self { - BridgeError::DatabaseError(err) - } -} - -impl From for BridgeError { - fn from(err: musig2::errors::KeyAggError) -> Self { - BridgeError::KeyAggContextError(err) - } -} - -impl From for BridgeError { - fn from(err: musig2::errors::TweakError) -> Self { - BridgeError::KeyAggContextTweakError(err) - } -} - -impl From for BridgeError { - fn from(err: InvalidScalarBytes) -> Self { - BridgeError::InvalidScalarBytes(err) - } -} - -impl From for BridgeError { - fn from(err: musig2::errors::VerifyError) -> Self { - BridgeError::MuSig2VerifyError(err) - } -} - -impl From for BridgeError { - fn from(err: hex::FromHexError) -> Self { - BridgeError::FromHexError(err) - } -} - -impl From for BridgeError { - fn from(err: bitcoin::hashes::FromSliceError) -> Self { - BridgeError::FromSliceError(err) - } -} diff --git a/core/src/lib.rs b/core/src/lib.rs index f83765a2..ccb91bba 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -45,15 +45,6 @@ pub struct UTXO { pub txout: bitcoin::TxOut, } -impl UTXO { - fn to_vec(&self) -> Vec { - let outpoint_hex = bitcoin::consensus::encode::serialize_hex(&self.outpoint); - let txout_hex = bitcoin::consensus::encode::serialize_hex(&self.txout); - let all = format!("{}{}", outpoint_hex, txout_hex); - hex::decode(all).unwrap() - } -} - #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, sqlx::Type)] #[sqlx(type_name = "bytea")] pub struct ByteArray66(#[serde(with = "hex::serde")] pub [u8; 66]); diff --git a/core/src/musig2.rs b/core/src/musig2.rs index c11673cd..2d5cb8bc 100644 --- a/core/src/musig2.rs +++ b/core/src/musig2.rs @@ -120,7 +120,6 @@ mod tests { use crate::{ actor::Actor, errors::BridgeError, - script_builder, transaction_builder::{TransactionBuilder, TxHandler}, utils, }; diff --git a/core/src/operator.rs b/core/src/operator.rs index 5adb433c..f58b432e 100644 --- a/core/src/operator.rs +++ b/core/src/operator.rs @@ -1,15 +1,11 @@ -use std::borrow::Borrow; -use std::mem::swap; - use crate::actor::Actor; use crate::config::BridgeConfig; use crate::database::operator::OperatorDB; use crate::errors::BridgeError; use crate::extended_rpc::ExtendedRpc; -use crate::musig2::{self, MuSigAggNonce, MuSigPartialSignature, MuSigPubNonce}; +use crate::musig2; use crate::traits::rpc::OperatorRpcServer; use crate::transaction_builder::TransactionBuilder; -use crate::utils::parse_hex_to_btc_tx; use crate::{script_builder, utils, EVMAddress, UTXO}; use ::musig2::secp::Point; use bitcoin::address::NetworkUnchecked; @@ -18,7 +14,6 @@ use bitcoin::hashes::Hash; use bitcoin::sighash::SighashCache; use bitcoin::{Address, OutPoint, TapSighash, Transaction, TxOut, Txid}; use bitcoin_mock_rpc::RpcApiWrapper; -use bitcoincore_rpc::json::{self, SigHashType}; use bitcoincore_rpc::RawTx; use clementine_circuits::constants::BRIDGE_AMOUNT_SATS; use clementine_circuits::sha256_hash; @@ -300,8 +295,8 @@ where async fn withdrawal_proved_on_citrea( &self, - withdrawal_idx: usize, - kickoff_merkle_root: [u8; 32], + _withdrawal_idx: usize, + _kickoff_merkle_root: [u8; 32], ) -> Result<(), BridgeError> { Ok(()) } diff --git a/core/src/script_builder.rs b/core/src/script_builder.rs index 31e6e9b3..bd17f6be 100644 --- a/core/src/script_builder.rs +++ b/core/src/script_builder.rs @@ -4,15 +4,13 @@ //! scripts. use crate::EVMAddress; -use bitcoin::address::NetworkUnchecked; use bitcoin::blockdata::opcodes::all::OP_PUSHNUM_1; -use bitcoin::hashes::Hash; +use bitcoin::Amount; use bitcoin::{ opcodes::{all::*, OP_FALSE}, script::Builder, ScriptBuf, TxOut, }; -use bitcoin::{Address, Amount, OutPoint}; use secp256k1::XOnlyPublicKey; pub fn anyone_can_spend_txout() -> TxOut { diff --git a/core/src/servers.rs b/core/src/servers.rs index 9a5fe5c2..8c5c658f 100644 --- a/core/src/servers.rs +++ b/core/src/servers.rs @@ -1,8 +1,8 @@ //! # Servers //! //! Utilities for operator and verifier servers. +use crate::create_extended_rpc; use crate::mock::common; -use crate::{config, create_extended_rpc}; use crate::{ config::BridgeConfig, create_test_config, create_test_config_with_thread_name, @@ -38,7 +38,6 @@ where .await .unwrap(); database.close().await; - // let config = create_test_config!(config.db_name, config); let server = match Server::builder() .build(format!("{}:{}", config.host, config.port)) .await @@ -48,10 +47,9 @@ where }; let verifier = Verifier::new(rpc, config).await?; - let addr: std::net::SocketAddr = match server.local_addr() { - Ok(a) => a, - Err(e) => return Err(BridgeError::ServerError(e)), - }; + let addr: std::net::SocketAddr = server + .local_addr() + .map_err(|e| BridgeError::ServerError(e))?; let handle = server.start(verifier.into_rpc()); let client = HttpClientBuilder::default() @@ -89,10 +87,9 @@ where Err(e) => return Err(BridgeError::ServerError(e)), }; - let addr = match server.local_addr() { - Ok(s) => s, - Err(e) => return Err(BridgeError::ServerError(e)), - }; + let addr: std::net::SocketAddr = server + .local_addr() + .map_err(|e| BridgeError::ServerError(e))?; let handle = server.start(operator.into_rpc()); let client = HttpClientBuilder::default() diff --git a/core/src/transaction_builder.rs b/core/src/transaction_builder.rs index 642fc191..63986994 100644 --- a/core/src/transaction_builder.rs +++ b/core/src/transaction_builder.rs @@ -12,7 +12,6 @@ use bitcoin::{ use clementine_circuits::constants::{ BRIDGE_AMOUNT_SATS, DEPOSIT_USER_TAKES_AFTER, OPERATOR_TAKES_AFTER, }; -use hex::ToHex; use secp256k1::PublicKey; use secp256k1::XOnlyPublicKey; @@ -282,14 +281,13 @@ impl TransactionBuilder { network, ); let mut op_return_script: Vec = hex::decode(move_txid.to_string()).unwrap(); - let op_return_idx: Vec = if operator_idx < 256 { - vec![operator_idx as u8] // Directly create a Vec for u8 - } else if operator_idx < 65536 { - (operator_idx as u16).to_be_bytes().to_vec() // Convert u16 array to Vec - } else { - (operator_idx as u32).to_be_bytes().to_vec() // Convert u32 array to Vec - }; - op_return_script.extend(op_return_idx); + let usize_bytes = (usize::BITS / 8) as usize; + let bits = operator_idx.max(1).ilog2() + 1; + let len = ((bits + 7) / 8) as usize; + let empty = usize_bytes - len; + let op_idx_bytes = operator_idx.to_be_bytes(); + let op_idx_bytes = &op_idx_bytes[empty..]; + op_return_script.extend(op_idx_bytes); let mut push_bytes = PushBytesBuf::new(); push_bytes.extend_from_slice(&op_return_script).unwrap(); let op_return_txout = script_builder::op_return_txout(push_bytes); @@ -321,13 +319,6 @@ impl TransactionBuilder { nofn_xonly_pk: &XOnlyPublicKey, network: bitcoin::Network, ) -> TxHandler { - tracing::info!("Creating operator takes tx"); - tracing::info!("Parameters:"); - tracing::info!("Bridge fund outpoint: {:?}", bridge_fund_outpoint); - tracing::info!("Slash or take outpoint: {:?}", slash_or_take_utxo.outpoint); - tracing::info!("Slash or take txout: {:?}", slash_or_take_utxo.txout); - tracing::info!("Operator address: {:?}", operator_xonly_pk); - tracing::info!("Nofn xonly pk: {:?}", nofn_xonly_pk); let operator_address = Address::p2tr(&utils::SECP, *operator_xonly_pk, None, network); let ins = TransactionBuilder::create_tx_ins(vec![ bridge_fund_outpoint, @@ -347,9 +338,7 @@ impl TransactionBuilder { Some(*nofn_xonly_pk), network, ); - tracing::info!("Slash or take address: {:?}", slash_or_take_address); - tracing::info!("Relative timelock script: {:?}", relative_timelock_script); - tracing::info!("Slash or take spend info: {:?}", slash_or_take_spend_info); + // Sanity check assert!(slash_or_take_address.script_pubkey() == slash_or_take_utxo.txout.script_pubkey); diff --git a/core/src/user.rs b/core/src/user.rs index 2903d317..e61c6ba1 100644 --- a/core/src/user.rs +++ b/core/src/user.rs @@ -10,11 +10,9 @@ use bitcoin::{Address, TxOut}; use bitcoin::{Amount, OutPoint}; use bitcoin::{TapSighashType, XOnlyPublicKey}; use bitcoin_mock_rpc::RpcApiWrapper; -use clementine_circuits::constants::{ - BRIDGE_AMOUNT_SATS, DEPOSIT_USER_TAKES_AFTER, WITHDRAWAL_EMPTY_UTXO_SATS, -}; +use clementine_circuits::constants::{BRIDGE_AMOUNT_SATS, WITHDRAWAL_EMPTY_UTXO_SATS}; +use secp256k1::schnorr; use secp256k1::SecretKey; -use secp256k1::{schnorr, PublicKey}; #[derive(Debug)] pub struct User { diff --git a/core/src/utils.rs b/core/src/utils.rs index 1bbccf22..83af6250 100644 --- a/core/src/utils.rs +++ b/core/src/utils.rs @@ -20,8 +20,6 @@ use bitcoin::Address; use bitcoin::Amount; use bitcoin::OutPoint; use bitcoin::ScriptBuf; -use bitcoin::TapNodeHash; -use bitcoin::TxOut; use bitcoin::XOnlyPublicKey; use clementine_circuits::sha256_hash; use clementine_circuits::HashType; @@ -148,6 +146,8 @@ pub fn aggregate_slash_or_take_partial_sigs( &musig_agg_xonly_pubkey_wrapped, network, ); + tracing::debug!("SLASH_OR_TAKE_TX: {:?}", tx); + tracing::debug!("SLASH_OR_TAKE_TX weight: {:?}", tx.tx.weight()); let message: [u8; 32] = Actor::convert_tx_to_sighash_script_spend(&mut tx, 0, 0) .unwrap() .to_byte_array(); @@ -211,12 +211,14 @@ pub fn aggregate_operator_takes_partial_sigs( &nofn_xonly_pk, network, ); + tracing::debug!("OPERATOR_TAKES_TX: {:?}", tx); + tracing::debug!("OPERATOR_TAKES_TX weight: {:?}", tx.tx.weight()); let message: [u8; 32] = Actor::convert_tx_to_sighash_pubkey_spend(&mut tx, 0) .unwrap() .to_byte_array(); - println!("Message: {:?}", message); - println!("Partial sigs: {:?}", partial_sigs); - println!("Agg nonce: {:?}", agg_nonce); + // println!("Message: {:?}", message); + // println!("Partial sigs: {:?}", partial_sigs); + // println!("Agg nonce: {:?}", agg_nonce); let final_sig: [u8; 64] = aggregate_partial_signatures( verifiers_pks.clone(), None, diff --git a/core/src/verifier.rs b/core/src/verifier.rs index c434d9a8..a65ad255 100644 --- a/core/src/verifier.rs +++ b/core/src/verifier.rs @@ -3,19 +3,17 @@ use crate::config::BridgeConfig; use crate::database::verifier::VerifierDB; use crate::errors::BridgeError; use crate::extended_rpc::ExtendedRpc; -use crate::merkle::MerkleTree; use crate::musig2::{self, MuSigAggNonce, MuSigPartialSignature, MuSigPubNonce}; use crate::traits::rpc::VerifierRpcServer; use crate::transaction_builder::{TransactionBuilder, TxHandler}; -use crate::{script_builder, utils, EVMAddress, UTXO}; +use crate::{utils, EVMAddress, UTXO}; use ::musig2::secp::Point; use bitcoin::address::NetworkUnchecked; use bitcoin::hashes::Hash; -use bitcoin::{merkle_tree, Address}; +use bitcoin::Address; use bitcoin::{secp256k1, OutPoint}; use bitcoin_mock_rpc::RpcApiWrapper; -use clementine_circuits::constants::{BRIDGE_AMOUNT_SATS, DEPOSIT_USER_TAKES_AFTER}; -use clementine_circuits::incremental_merkle::IncrementalMerkleTree; +use clementine_circuits::constants::BRIDGE_AMOUNT_SATS; use clementine_circuits::sha256_hash; use jsonrpsee::core::async_trait; use secp256k1::{rand, schnorr}; @@ -30,7 +28,6 @@ where db: VerifierDB, config: BridgeConfig, nofn_xonly_pk: secp256k1::XOnlyPublicKey, - idx: usize, operator_xonly_pks: Vec, } @@ -55,11 +52,6 @@ where let agg_point: Point = key_agg_context.aggregated_pubkey_untweaked(); let nofn_xonly_pk = secp256k1::XOnlyPublicKey::from_slice(&agg_point.serialize_xonly())?; let operator_xonly_pks = config.operators_xonly_pks.clone(); - let idx = config - .verifiers_public_keys - .iter() - .position(|&x| x == pk) - .unwrap(); Ok(Verifier { rpc, @@ -67,7 +59,6 @@ where db, config, nofn_xonly_pk, - idx, operator_xonly_pks, }) } @@ -227,13 +218,6 @@ where ) }) .collect::>(); - // let root: bitcoin::hashes::sha256::Hash = bitcoin::merkle_tree::calculate_root( - // kickoff_utxos - // .iter() - // .map(|utxo| Hash::from_byte_array(sha256_hash!(utxo.to_vec().as_slice()))), - // ) - // .unwrap(); - // let root_bytes: [u8; 32] = *root.as_byte_array(); self.db .save_kickoff_utxos(deposit_outpoint, &kickoff_utxos) diff --git a/core/tests/flow.rs b/core/tests/flow.rs index 2013ec21..32aeeb0d 100644 --- a/core/tests/flow.rs +++ b/core/tests/flow.rs @@ -3,7 +3,6 @@ // //! This testss checks if basic deposit and withdraw operations are OK or not. use bitcoin::Address; -use bitcoincore_rpc::RawTx; use clementine_circuits::constants::BRIDGE_AMOUNT_SATS; use clementine_core::actor::Actor; use clementine_core::database::common::Database; @@ -58,7 +57,7 @@ async fn test_deposit() -> Result<(), BridgeError> { // aggregate nonces let mut pub_nonces = Vec::new(); - for (i, (client, ..)) in verifiers.iter().enumerate() { + for (client, _, _) in verifiers.iter() { let musig_pub_nonces = client .verifier_new_deposit_rpc(deposit_outpoint, signer_address.clone(), evm_address) .await @@ -160,7 +159,8 @@ async fn test_deposit() -> Result<(), BridgeError> { slash_or_take_sigs.push(secp256k1::schnorr::Signature::from_slice(&agg_sig)?); } - tracing::debug!("Slash or take sigs: {:#?}", slash_or_take_sigs); + + // tracing::debug!("Slash or take sigs: {:#?}", slash_or_take_sigs); // call burn_txs_signed_rpc let mut operator_take_partial_sigs: Vec> = Vec::new(); for (_i, (client, _, _)) in verifiers.iter().enumerate() { @@ -170,10 +170,10 @@ async fn test_deposit() -> Result<(), BridgeError> { .unwrap(); operator_take_partial_sigs.push(partial_sigs); } - tracing::debug!( - "Operator take partial sigs: {:#?}", - operator_take_partial_sigs - ); + // tracing::debug!( + // "Operator take partial sigs: {:#?}", + // operator_take_partial_sigs + // ); let mut operator_take_sigs = Vec::new(); for i in 0..operator_take_partial_sigs.len() { let agg_sig = aggregate_operator_takes_partial_sigs( @@ -192,10 +192,10 @@ async fn test_deposit() -> Result<(), BridgeError> { operator_take_sigs.push(secp256k1::schnorr::Signature::from_slice(&agg_sig)?); } - tracing::debug!("Operator take sigs: {:#?}", operator_take_sigs); + // tracing::debug!("Operator take sigs: {:#?}", operator_take_sigs); // call operator_take_txs_signed_rpc let mut move_tx_partial_sigs = Vec::new(); - for (i, (client, _, _)) in verifiers.iter().enumerate() { + for (client, _, _) in verifiers.iter() { let move_tx_partial_sig = client .operator_take_txs_signed_rpc(deposit_outpoint, operator_take_sigs.clone()) .await @@ -203,7 +203,7 @@ async fn test_deposit() -> Result<(), BridgeError> { move_tx_partial_sigs.push(move_tx_partial_sig); } - tracing::debug!("Move tx partial sigs: {:#?}", move_tx_partial_sigs); + // tracing::debug!("Move tx partial sigs: {:#?}", move_tx_partial_sigs); // aggreagte move_tx_partial_sigs let agg_move_tx_final_sig = aggregate_move_partial_sigs( @@ -235,7 +235,7 @@ async fn test_deposit() -> Result<(), BridgeError> { move_tx_witness_elements.push(move_tx_sig.serialize().to_vec()); handle_taproot_witness_new(&mut move_tx_handler, &move_tx_witness_elements, 0, 0)?; tracing::debug!("Move tx: {:#?}", move_tx_handler.tx); - tracing::debug!("Move tx_hex: {:?}", move_tx_handler.tx.raw_hex()); + // tracing::debug!("Move tx_hex: {:?}", move_tx_handler.tx.raw_hex()); tracing::debug!("Move tx weight: {:?}", move_tx_handler.tx.weight()); let move_txid = rpc.send_raw_transaction(&move_tx_handler.tx).unwrap(); tracing::debug!("Move txid: {:?}", move_txid); diff --git a/core/tests/withdrawal.rs b/core/tests/withdrawal.rs index a845af3f..70808104 100644 --- a/core/tests/withdrawal.rs +++ b/core/tests/withdrawal.rs @@ -1,24 +1,14 @@ -//! # Deposit and Withdraw Flow Test +//! # Withdrawal Flow Test //! -//! This testss checks if basic deposit and withdraw operations are OK or not. +//! This test checks if basic withdrawal operations are OK or not. -use bitcoin::XOnlyPublicKey; -use bitcoin::{Address, Amount}; -use clementine_circuits::constants::BRIDGE_AMOUNT_SATS; -use clementine_core::actor::Actor; +use bitcoin::Address; use clementine_core::database::common::Database; use clementine_core::extended_rpc::ExtendedRpc; use clementine_core::mock::common; -use clementine_core::script_builder; use clementine_core::servers::*; use clementine_core::traits::rpc::OperatorRpcClient; -use clementine_core::transaction_builder::{TransactionBuilder, TxHandler}; use clementine_core::user::User; -use clementine_core::utils; -use clementine_core::utils::handle_taproot_witness_new; -use clementine_core::utils::SECP; -use clementine_core::EVMAddress; -use clementine_core::UTXO; use clementine_core::{ create_extended_rpc, create_test_config, create_test_config_with_thread_name, }; @@ -68,7 +58,7 @@ async fn test_honest_operator_takes_refund() { None, config.network, ); - let (empty_utxo, withdrawal_tx_out, user_sig) = + let (_empty_utxo, _withdrawal_tx_out, _user_sig) = user.generate_withdrawal_sig(withdrawal_address).unwrap(); // let withdrawal_provide_txid = operator_client // .new_withdrawal_sig_rpc(0, user_sig, empty_utxo, withdrawal_tx_out)