Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into eth-maker-tpu-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Oct 15, 2024
2 parents eeead52 + 4e8bc50 commit f7eab3c
Show file tree
Hide file tree
Showing 36 changed files with 276 additions and 5,482 deletions.
2,001 changes: 218 additions & 1,783 deletions Cargo.lock

Large diffs are not rendered by default.

35 changes: 7 additions & 28 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ edition = "2018"

[features]
zhtlc-native-tests = []
# TODO
enable-solana = [
"dep:bincode",
"dep:ed25519-dalek-bip32",
"dep:solana-client",
"dep:solana-sdk",
"dep:solana-transaction-status",
"dep:spl-token",
"dep:spl-associated-token-account",
"dep:satomic-swap"
]
enable-sia = [
"dep:reqwest",
"dep:blake2b_simd",
Expand Down Expand Up @@ -44,7 +33,7 @@ cfg-if = "1.0"
chain = { path = "../mm2_bitcoin/chain" }
chrono = { version = "0.4.23", "features" = ["serde"] }
common = { path = "../common" }
cosmrs = { version = "0.14.0", default-features = false }
cosmrs = { version = "0.15", default-features = false }
crossbeam = "0.8"
crypto = { path = "../crypto" }
db_common = { path = "../db_common" }
Expand Down Expand Up @@ -86,7 +75,7 @@ mocktopus = "0.8.0"
num-traits = "0.2"
parking_lot = { version = "0.12.0", features = ["nightly"] }
primitives = { path = "../mm2_bitcoin/primitives" }
prost = "0.11"
prost = "0.12"
protobuf = "2.20"
proxy_signature = { path = "../proxy_signature" }
rand = { version = "0.7", features = ["std", "small_rng"] }
Expand All @@ -96,7 +85,6 @@ rlp = { version = "0.5" }
rmp-serde = "0.14.3"
rpc = { path = "../mm2_bitcoin/rpc" }
rpc_task = { path = "../rpc_task" }
satomic-swap = { git = "https://github.com/KomodoPlatform/satomic-swap.git", rev = "413e472", optional = true }
script = { path = "../mm2_bitcoin/script" }
secp256k1 = { version = "0.20" }
ser_error = { path = "../derives/ser_error" }
Expand All @@ -113,7 +101,7 @@ sha2 = "0.10"
sha3 = "0.9"
utxo_signer = { path = "utxo_signer" }
# using the same version as cosmrs
tendermint-rpc = { version = "0.32.0", default-features = false }
tendermint-rpc = { version = "0.34", default-features = false }
tokio-tungstenite-wasm = { git = "https://github.com/KomodoPlatform/tokio-tungstenite-wasm", rev = "d20abdb", features = ["rustls-tls-native-roots"]}
url = { version = "2.2.2", features = ["serde"] }
uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
Expand All @@ -125,15 +113,6 @@ zcash_client_backend = { git = "https://github.com/KomodoPlatform/librustzcash.g
zcash_extras = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }
zcash_primitives = {features = ["transparent-inputs"], git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }

[target.'cfg(all(not(target_os = "ios"), not(target_os = "android"), not(target_arch = "wasm32")))'.dependencies]
bincode = { version = "1.3.3", default-features = false, optional = true }
ed25519-dalek-bip32 = { version = "0.2.0", default-features = false, optional = true }
solana-client = { version = "1", default-features = false, optional = true }
solana-sdk = { version = "1", default-features = false, optional = true }
solana-transaction-status = { version = "1", optional = true }
spl-token = { version = "3", optional = true }
spl-associated-token-account = { version = "1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
blake2b_simd = "0.5"
ff = "0.8"
Expand All @@ -145,7 +124,7 @@ mm2_db = { path = "../mm2_db" }
mm2_metamask = { path = "../mm2_metamask" }
mm2_test_helpers = { path = "../mm2_test_helpers" }
time = { version = "0.3.20", features = ["wasm-bindgen"] }
tonic = { version = "0.9", default-features = false, features = ["prost", "codegen", "gzip"] }
tonic = { version = "0.10", default-features = false, features = ["prost", "codegen", "gzip"] }
tower-service = "0.3"
wasm-bindgen = "0.2.86"
wasm-bindgen-futures = { version = "0.4.1" }
Expand All @@ -170,7 +149,7 @@ rustls = { version = "0.21", features = ["dangerous_configuration"] }
secp256k1v24 = { version = "0.24", package = "secp256k1" }
tokio = { version = "1.20" }
tokio-rustls = { version = "0.24" }
tonic = { version = "0.9", features = ["tls", "tls-webpki-roots", "gzip"] }
tonic = { version = "0.10", features = ["tls", "tls-webpki-roots", "gzip"] }
webpki-roots = { version = "0.25" }
zcash_client_sqlite = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }
zcash_proofs = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1", default-features = false, features = ["local-prover", "multicore"] }
Expand All @@ -185,5 +164,5 @@ mm2_test_helpers = { path = "../mm2_test_helpers" }
wagyu-zcash-parameters = { version = "0.2" }

[build-dependencies]
prost-build = { version = "0.11", default-features = false }
tonic-build = { version = "0.9", default-features = false, features = ["prost"] }
prost-build = { version = "0.12", default-features = false }
tonic-build = { version = "0.10", default-features = false, features = ["prost"] }
152 changes: 0 additions & 152 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,6 @@ macro_rules! try_f {
};
}

#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
macro_rules! try_tx_fus_err {
($err: expr) => {
return Box::new(futures01::future::err(crate::TransactionErr::Plain(ERRL!(
"{:?}", $err
))))
};
}

#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
macro_rules! try_tx_fus_opt {
($e: expr, $err: expr) => {
match $e {
Some(ok) => ok,
None => {
return Box::new(futures01::future::err(crate::TransactionErr::Plain(ERRL!(
"{:?}", $err
))))
},
}
};
}

/// `TransactionErr` compatible `try_fus` macro.
macro_rules! try_tx_fus {
($e: expr) => {
Expand Down Expand Up @@ -280,30 +257,6 @@ pub mod tx_history_storage;
#[cfg(feature = "enable-sia")] pub mod siacoin;
#[cfg(feature = "enable-sia")] use siacoin::SiaCoin;

#[doc(hidden)]
#[allow(unused_variables)]
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub mod solana;
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub use solana::spl::SplToken;
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub use solana::{SolTransaction, SolanaActivationParams, SolanaCoin, SolanaFeeDetails};

pub mod utxo;
use utxo::bch::{bch_coin_with_policy, BchActivationRequest, BchCoin};
use utxo::qtum::{self, qtum_coin_with_policy, Qrc20AddressError, QtumCoin, QtumDelegationOps, QtumDelegationRequest,
Expand Down Expand Up @@ -631,8 +584,6 @@ pub trait Transaction: fmt::Debug + 'static {
pub enum TransactionEnum {
UtxoTx(UtxoTx),
SignedEthTx(SignedEthTx),
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SolTransaction(SolTransaction),
ZTransaction(ZTransaction),
CosmosTransaction(CosmosTransaction),
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -641,8 +592,6 @@ pub enum TransactionEnum {

ifrom!(TransactionEnum, UtxoTx);
ifrom!(TransactionEnum, SignedEthTx);
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
ifrom!(TransactionEnum, SolTransaction);
ifrom!(TransactionEnum, ZTransaction);
#[cfg(not(target_arch = "wasm32"))]
ifrom!(TransactionEnum, LightningPayment);
Expand All @@ -666,8 +615,6 @@ impl Deref for TransactionEnum {
TransactionEnum::CosmosTransaction(ref t) => t,
#[cfg(not(target_arch = "wasm32"))]
TransactionEnum::LightningPayment(ref p) => p,
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
TransactionEnum::SolTransaction(ref s) => s,
}
}
}
Expand Down Expand Up @@ -2273,13 +2220,6 @@ pub enum TxFeeDetails {
Qrc20(Qrc20FeeDetails),
Slp(SlpFeeDetails),
Tendermint(TendermintFeeDetails),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
Solana(SolanaFeeDetails),
}

/// Deserialize the TxFeeDetails as an untagged enum.
Expand All @@ -2294,27 +2234,13 @@ impl<'de> Deserialize<'de> for TxFeeDetails {
Utxo(UtxoFeeDetails),
Eth(EthTxFeeDetails),
Qrc20(Qrc20FeeDetails),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
Solana(SolanaFeeDetails),
Tendermint(TendermintFeeDetails),
}

match Deserialize::deserialize(deserializer)? {
TxFeeDetailsUnTagged::Utxo(f) => Ok(TxFeeDetails::Utxo(f)),
TxFeeDetailsUnTagged::Eth(f) => Ok(TxFeeDetails::Eth(f)),
TxFeeDetailsUnTagged::Qrc20(f) => Ok(TxFeeDetails::Qrc20(f)),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
TxFeeDetailsUnTagged::Solana(f) => Ok(TxFeeDetails::Solana(f)),
TxFeeDetailsUnTagged::Tendermint(f) => Ok(TxFeeDetails::Tendermint(f)),
}
}
Expand All @@ -2332,16 +2258,6 @@ impl From<Qrc20FeeDetails> for TxFeeDetails {
fn from(qrc20_details: Qrc20FeeDetails) -> Self { TxFeeDetails::Qrc20(qrc20_details) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SolanaFeeDetails> for TxFeeDetails {
fn from(solana_details: SolanaFeeDetails) -> Self { TxFeeDetails::Solana(solana_details) }
}

impl From<TendermintFeeDetails> for TxFeeDetails {
fn from(tendermint_details: TendermintFeeDetails) -> Self { TxFeeDetails::Tendermint(tendermint_details) }
}
Expand Down Expand Up @@ -3546,20 +3462,6 @@ pub enum MmCoinEnum {
SlpToken(SlpToken),
Tendermint(TendermintCoin),
TendermintToken(TendermintToken),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
SolanaCoin(SolanaCoin),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
SplToken(SplToken),
#[cfg(not(target_arch = "wasm32"))]
LightningCoin(LightningCoin),
#[cfg(feature = "enable-sia")]
Expand All @@ -3579,26 +3481,6 @@ impl From<TestCoin> for MmCoinEnum {
fn from(c: TestCoin) -> MmCoinEnum { MmCoinEnum::Test(c) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SolanaCoin> for MmCoinEnum {
fn from(c: SolanaCoin) -> MmCoinEnum { MmCoinEnum::SolanaCoin(c) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SplToken> for MmCoinEnum {
fn from(c: SplToken) -> MmCoinEnum { MmCoinEnum::SplToken(c) }
}

impl From<QtumCoin> for MmCoinEnum {
fn from(coin: QtumCoin) -> Self { MmCoinEnum::QtumCoin(coin) }
}
Expand Down Expand Up @@ -3656,20 +3538,6 @@ impl Deref for MmCoinEnum {
#[cfg(feature = "enable-sia")]
MmCoinEnum::SiaCoin(ref c) => c,
MmCoinEnum::Test(ref c) => c,
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
MmCoinEnum::SolanaCoin(ref c) => c,
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
MmCoinEnum::SplToken(ref c) => c,
}
}
}
Expand Down Expand Up @@ -4379,14 +4247,6 @@ pub enum CoinProtocol {
network: BlockchainNetwork,
confirmation_targets: PlatformCoinConfirmationTargets,
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SOLANA,
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SPLTOKEN {
platform: String,
token_contract_address: String,
decimals: u8,
},
ZHTLC(ZcoinProtocolInfo),
#[cfg(feature = "enable-sia")]
SIA,
Expand Down Expand Up @@ -4648,14 +4508,6 @@ pub async fn lp_coininit(ctx: &MmArc, ticker: &str, req: &Json) -> Result<MmCoin
CoinProtocol::NFT { .. } => return ERR!("NFT protocol is not supported by lp_coininit"),
#[cfg(not(target_arch = "wasm32"))]
CoinProtocol::LIGHTNING { .. } => return ERR!("Lightning protocol is not supported by lp_coininit"),
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SOLANA => {
return ERR!("Solana protocol is not supported by lp_coininit - use enable_solana_with_tokens instead")
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SPLTOKEN { .. } => {
return ERR!("SplToken protocol is not supported by lp_coininit - use enable_spl instead")
},
#[cfg(feature = "enable-sia")]
CoinProtocol::SIA { .. } => {
return ERR!("SIA protocol is not supported by lp_coininit. Use task::enable_sia::init");
Expand Down Expand Up @@ -5240,10 +5092,6 @@ pub fn address_by_coin_conf_and_pubkey_str(
CoinProtocol::LIGHTNING { .. } => {
ERR!("address_by_coin_conf_and_pubkey_str is not implemented for lightning protocol yet!")
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SOLANA | CoinProtocol::SPLTOKEN { .. } => {
ERR!("Solana pubkey is the public address - you do not need to use this rpc call.")
},
CoinProtocol::ZHTLC { .. } => ERR!("address_by_coin_conf_and_pubkey_str is not supported for ZHTLC protocol!"),
#[cfg(feature = "enable-sia")]
CoinProtocol::SIA { .. } => ERR!("address_by_coin_conf_and_pubkey_str is not supported for SIA protocol!"), // TODO Alright
Expand Down
Loading

0 comments on commit f7eab3c

Please sign in to comment.