diff --git a/Cargo.lock b/Cargo.lock index cf62d3f115..99227202a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -928,7 +928,7 @@ dependencies = [ "tower-service", "url", "utxo_signer", - "uuid 1.2.2", + "uuid", "wagyu-zcash-parameters", "wasm-bindgen", "wasm-bindgen-futures", @@ -1026,7 +1026,7 @@ dependencies = [ "sha2 0.10.7", "shared_ref_counter", "tokio", - "uuid 1.2.2", + "uuid", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test", @@ -1101,9 +1101,9 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c9d2043a9e617b0d602fbc0a0ecd621568edbf3a9774890a6d562389bd8e1c" +checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ "prost", "prost-types", @@ -1112,18 +1112,18 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af13955d6f356272e6def9ff5e2450a7650df536d8934f47052a20c76513d2f6" +checksum = "47126f5364df9387b9d8559dcef62e99010e1d4098f39eb3f7ee4b5c254e40ea" dependencies = [ "cosmos-sdk-proto", "ecdsa", "eyre", - "getrandom 0.2.9", "k256", "rand_core 0.6.4", "serde", "serde_json", + "signature 2.2.0", "subtle-encoding", "tendermint", "thiserror", @@ -1586,7 +1586,7 @@ dependencies = [ "rusqlite", "sql-builder", "tokio", - "uuid 1.2.2", + "uuid", ] [[package]] @@ -2066,11 +2066,10 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "matches", "percent-encoding", ] @@ -2764,6 +2763,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "if-addrs" version = "0.7.0" @@ -3005,9 +3014,7 @@ dependencies = [ "cfg-if 1.0.0", "ecdsa", "elliptic-curve", - "once_cell", "sha2 0.10.7", - "signature 2.2.0", ] [[package]] @@ -3883,7 +3890,7 @@ dependencies = [ "serde_json", "shared_ref_counter", "tokio", - "uuid 1.2.2", + "uuid", "wasm-bindgen-test", ] @@ -4101,7 +4108,7 @@ dependencies = [ "trie-db", "trie-root 0.16.0", "url", - "uuid 1.2.2", + "uuid", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test", @@ -4257,7 +4264,7 @@ dependencies = [ "ser_error_derive", "serde", "serde_json", - "uuid 1.2.2", + "uuid", ] [[package]] @@ -4295,7 +4302,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "uuid 1.2.2", + "uuid", ] [[package]] @@ -4727,9 +4734,9 @@ checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" [[package]] name = "peg" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c0b841ea54f523f7aa556956fbd293bcbe06f2e67d2eb732b7278aaf1d166a" +checksum = "295283b02df346d1ef66052a757869b2876ac29a6bb0ac3f5f7cd44aebe40e8f" dependencies = [ "peg-macros", "peg-runtime", @@ -4737,9 +4744,9 @@ dependencies = [ [[package]] name = "peg-macros" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aa52829b8decbef693af90202711348ab001456803ba2a98eb4ec8fb70844c" +checksum = "bdad6a1d9cf116a059582ce415d5f5566aabcd4008646779dab7fdc2a9a9d426" dependencies = [ "peg-runtime", "proc-macro2", @@ -4748,9 +4755,9 @@ dependencies = [ [[package]] name = "peg-runtime" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" +checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" [[package]] name = "pem" @@ -4763,9 +4770,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" @@ -4890,12 +4897,12 @@ checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" [[package]] name = "prettyplease" -version = "0.1.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28f53e8b192565862cf99343194579a022eb9c7dd3a8d03134734803c7b3125" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 1.0.95", + "syn 2.0.38", ] [[package]] @@ -4977,9 +4984,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes 1.4.0", "prost-derive", @@ -4987,44 +4994,43 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes 1.4.0", "heck", "itertools", - "lazy_static", "log", "multimap", + "once_cell", "petgraph", "prettyplease", "prost", "prost-types", "regex", - "syn 1.0.95", + "syn 2.0.38", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote 1.0.33", - "syn 1.0.95", + "syn 2.0.38", ] [[package]] name = "prost-types" -version = "0.11.9" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ "prost", ] @@ -6753,9 +6759,9 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.32.2" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0a7d05cf78524782337f8edd55cbc578d159a16ad4affe2135c92f7dbac7f0" +checksum = "15ab8f0a25d0d2ad49ac615da054d6a76aa6603ff95f7d18bafdd34450a1a04b" dependencies = [ "bytes 1.4.0", "digest 0.10.7", @@ -6784,9 +6790,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.32.2" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a72dbbea6dde12045d261f2c70c0de039125675e8a026c8d5ad34522756372" +checksum = "e1a02da769166e2052cd537b1a97c78017632c2d9e19266367b27e73910434fc" dependencies = [ "flex-error", "serde", @@ -6798,9 +6804,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.32.2" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cec054567d16d85e8c3f6a3139963d1a66d9d3051ed545d31562550e9bcc3d" +checksum = "b797dd3d2beaaee91d2f065e7bdf239dc8d80bba4a183a288bc1279dd5a69a1e" dependencies = [ "bytes 1.4.0", "flex-error", @@ -6816,9 +6822,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.32.2" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d119d83a130537fc4a98c3c9eb6899ebe857fea4860400a61675bfb5f0b35129" +checksum = "71afae8bb5f6b14ed48d4e1316a643b6c2c3cbad114f510be77b4ed20b7b3e42" dependencies = [ "async-trait", "bytes 1.4.0", @@ -6826,6 +6832,7 @@ dependencies = [ "getrandom 0.2.9", "peg", "pin-project", + "rand 0.8.4", "semver 1.0.6", "serde", "serde_bytes", @@ -6838,7 +6845,7 @@ dependencies = [ "thiserror", "time 0.3.20", "url", - "uuid 0.8.2", + "uuid", "walkdir", ] @@ -7105,9 +7112,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", @@ -7115,8 +7122,6 @@ dependencies = [ "base64 0.21.7", "bytes 1.4.0", "flate2", - "futures-core", - "futures-util", "h2", "http 0.2.12", "http-body 0.4.5", @@ -7125,6 +7130,7 @@ dependencies = [ "percent-encoding", "pin-project", "prost", + "rustls 0.21.10", "rustls-pemfile 1.0.2", "tokio", "tokio-rustls 0.24.1", @@ -7133,20 +7139,20 @@ dependencies = [ "tower-layer", "tower-service", "tracing", - "webpki-roots 0.23.1", + "webpki-roots 0.25.4", ] [[package]] name = "tonic-build" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote 1.0.33", - "syn 1.0.95", + "syn 2.0.38", ] [[package]] @@ -7285,7 +7291,7 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna", + "idna 0.2.3", "ipnet", "lazy_static", "rand 0.8.4", @@ -7370,12 +7376,9 @@ source = "git+https://github.com/KomodoPlatform/mm2-parity-ethereum.git?rev=mm2- [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -7385,9 +7388,9 @@ checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -7444,13 +7447,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.2.2" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna", - "matches", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -7481,15 +7483,9 @@ dependencies = [ [[package]] name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - -[[package]] -name = "uuid" -version = "1.2.2" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom 0.2.9", "rand 0.8.4", @@ -7725,7 +7721,7 @@ dependencies = [ "getrandom 0.2.9", "headers", "hex", - "idna", + "idna 0.2.3", "js-sys", "jsonrpc-core", "log", @@ -7786,16 +7782,6 @@ dependencies = [ "cc", ] -[[package]] -name = "which" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55551e42cbdf2ce2bedd2203d0cc08dba002c27510f86dab6d0ce304cba3dfe" -dependencies = [ - "either", - "libc", -] - [[package]] name = "widestring" version = "0.5.1" diff --git a/mm2src/coins/Cargo.toml b/mm2src/coins/Cargo.toml index 62c0e24ea0..8fa02034c1 100644 --- a/mm2src/coins/Cargo.toml +++ b/mm2src/coins/Cargo.toml @@ -33,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" } @@ -75,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"] } @@ -101,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"] } @@ -124,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" } @@ -149,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"] } @@ -164,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"] } diff --git a/mm2src/coins/tendermint/htlc/iris/htlc.rs b/mm2src/coins/tendermint/htlc/iris/htlc.rs index 09561a4048..59cfb5cd73 100644 --- a/mm2src/coins/tendermint/htlc/iris/htlc.rs +++ b/mm2src/coins/tendermint/htlc/iris/htlc.rs @@ -1,12 +1,9 @@ use super::htlc_proto::{IrisClaimHtlcProto, IrisCreateHtlcProto}; -use cosmrs::proto::traits::TypeUrl; +use cosmrs::proto::traits::Name; use cosmrs::{tx::Msg, AccountId, Coin, ErrorReport}; use std::convert::TryFrom; -pub(crate) const IRIS_CREATE_HTLC_TYPE_URL: &str = "/irismod.htlc.MsgCreateHTLC"; -pub(crate) const IRIS_CLAIM_HTLC_TYPE_URL: &str = "/irismod.htlc.MsgClaimHTLC"; - #[derive(Clone, Debug, Eq, PartialEq)] pub(crate) struct IrisCreateHtlcMsg { /// Sender's address. @@ -87,8 +84,9 @@ impl From<&IrisCreateHtlcMsg> for IrisCreateHtlcProto { } } -impl TypeUrl for IrisCreateHtlcProto { - const TYPE_URL: &'static str = IRIS_CREATE_HTLC_TYPE_URL; +impl Name for IrisCreateHtlcProto { + const NAME: &'static str = "MsgCreateHTLC"; + const PACKAGE: &'static str = "irismod.htlc"; } #[derive(Clone)] @@ -141,6 +139,7 @@ impl From<&IrisClaimHtlcMsg> for IrisClaimHtlcProto { } } -impl TypeUrl for IrisClaimHtlcProto { - const TYPE_URL: &'static str = IRIS_CLAIM_HTLC_TYPE_URL; +impl Name for IrisClaimHtlcProto { + const NAME: &'static str = "MsgClaimHTLC"; + const PACKAGE: &'static str = "irismod.htlc"; } diff --git a/mm2src/coins/tendermint/htlc/nucleus/htlc.rs b/mm2src/coins/tendermint/htlc/nucleus/htlc.rs index a768f7fd4a..2c423285bf 100644 --- a/mm2src/coins/tendermint/htlc/nucleus/htlc.rs +++ b/mm2src/coins/tendermint/htlc/nucleus/htlc.rs @@ -1,12 +1,9 @@ use super::htlc_proto::{NucleusClaimHtlcProto, NucleusCreateHtlcProto}; -use cosmrs::proto::traits::TypeUrl; +use cosmrs::proto::traits::Name; use cosmrs::{tx::Msg, AccountId, Coin, ErrorReport}; use std::convert::TryFrom; -pub(crate) const NUCLEUS_CREATE_HTLC_TYPE_URL: &str = "/nucleus.htlc.MsgCreateHTLC"; -pub(crate) const NUCLEUS_CLAIM_HTLC_TYPE_URL: &str = "/nucleus.htlc.MsgClaimHTLC"; - #[derive(Clone, Debug, Eq, PartialEq)] pub(crate) struct NucleusCreateHtlcMsg { /// Sender's address. @@ -72,8 +69,9 @@ impl From<&NucleusCreateHtlcMsg> for NucleusCreateHtlcProto { } } -impl TypeUrl for NucleusCreateHtlcProto { - const TYPE_URL: &'static str = NUCLEUS_CREATE_HTLC_TYPE_URL; +impl Name for NucleusCreateHtlcProto { + const NAME: &'static str = "MsgCreateHTLC"; + const PACKAGE: &'static str = "nucleus.htlc"; } #[derive(Clone)] @@ -126,6 +124,7 @@ impl From<&NucleusClaimHtlcMsg> for NucleusClaimHtlcProto { } } -impl TypeUrl for NucleusClaimHtlcProto { - const TYPE_URL: &'static str = NUCLEUS_CLAIM_HTLC_TYPE_URL; +impl Name for NucleusClaimHtlcProto { + const NAME: &'static str = "MsgClaimHTLC"; + const PACKAGE: &'static str = "nucleus.htlc"; } diff --git a/mm2src/coins/tendermint/ibc/mod.rs b/mm2src/coins/tendermint/ibc/mod.rs index 51df375ab1..9e1c905398 100644 --- a/mm2src/coins/tendermint/ibc/mod.rs +++ b/mm2src/coins/tendermint/ibc/mod.rs @@ -1,7 +1,6 @@ mod ibc_proto; pub(crate) mod transfer_v1; -pub(crate) const IBC_TRANSFER_TYPE_URL: &str = "/ibc.applications.transfer.v1.MsgTransfer"; pub(crate) const IBC_OUT_SOURCE_PORT: &str = "transfer"; pub(crate) const IBC_OUT_TIMEOUT_IN_NANOS: u64 = 60000000000 * 15; // 15 minutes pub(crate) const IBC_GAS_LIMIT_DEFAULT: u64 = 150_000; diff --git a/mm2src/coins/tendermint/ibc/transfer_v1.rs b/mm2src/coins/tendermint/ibc/transfer_v1.rs index c5780e32b7..22bad1fefe 100644 --- a/mm2src/coins/tendermint/ibc/transfer_v1.rs +++ b/mm2src/coins/tendermint/ibc/transfer_v1.rs @@ -1,6 +1,5 @@ use super::{ibc_proto::IBCTransferV1Proto, IBC_OUT_SOURCE_PORT, IBC_OUT_TIMEOUT_IN_NANOS}; -use crate::tendermint::ibc::IBC_TRANSFER_TYPE_URL; -use cosmrs::proto::traits::TypeUrl; +use cosmrs::proto::traits::Name; use cosmrs::{tx::Msg, AccountId, Coin, ErrorReport}; use std::convert::TryFrom; @@ -99,6 +98,7 @@ impl From<&MsgTransfer> for IBCTransferV1Proto { } } -impl TypeUrl for IBCTransferV1Proto { - const TYPE_URL: &'static str = IBC_TRANSFER_TYPE_URL; +impl Name for IBCTransferV1Proto { + const NAME: &'static str = "MsgTransfer"; + const PACKAGE: &'static str = "ibc.applications.transfer.v1"; } diff --git a/mm2src/coins/tendermint/tendermint_coin.rs b/mm2src/coins/tendermint/tendermint_coin.rs index 9c7a1c1d96..de1753cffe 100644 --- a/mm2src/coins/tendermint/tendermint_coin.rs +++ b/mm2src/coins/tendermint/tendermint_coin.rs @@ -2531,13 +2531,13 @@ impl MarketCoinOps for TendermintCoin { let broadcast_res = try_s!(try_s!(coin.rpc_client().await).broadcast_tx_commit(tx_bytes).await); if broadcast_res.check_tx.log.contains(ACCOUNT_SEQUENCE_ERR) - || broadcast_res.deliver_tx.log.contains(ACCOUNT_SEQUENCE_ERR) + || broadcast_res.tx_result.log.contains(ACCOUNT_SEQUENCE_ERR) { return ERR!( "{}. check_tx log: {}, deliver_tx log: {}", ACCOUNT_SEQUENCE_ERR, broadcast_res.check_tx.log, - broadcast_res.deliver_tx.log + broadcast_res.tx_result.log ); } @@ -2545,8 +2545,8 @@ impl MarketCoinOps for TendermintCoin { return ERR!("Tx check failed {:?}", broadcast_res.check_tx); } - if !broadcast_res.deliver_tx.code.is_ok() { - return ERR!("Tx deliver failed {:?}", broadcast_res.deliver_tx); + if !broadcast_res.tx_result.code.is_ok() { + return ERR!("Tx deliver failed {:?}", broadcast_res.tx_result); } Ok(broadcast_res.hash.to_string()) }; diff --git a/mm2src/coins/utxo/pb.rs b/mm2src/coins/utxo/pb.rs index 3ae572bc23..a9fb741a11 100644 --- a/mm2src/coins/utxo/pb.rs +++ b/mm2src/coins/utxo/pb.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetMempoolInfoRequest {} diff --git a/mm2src/mm2_main/Cargo.toml b/mm2src/mm2_main/Cargo.toml index 5458c853be..259d3fc934 100644 --- a/mm2src/mm2_main/Cargo.toml +++ b/mm2src/mm2_main/Cargo.toml @@ -73,7 +73,7 @@ num-traits = "0.2" parity-util-mem = "0.11" parking_lot = { version = "0.12.0", features = ["nightly"] } primitives = { path = "../mm2_bitcoin/primitives" } -prost = "0.11" +prost = "0.12" rand = { version = "0.7", features = ["std", "small_rng"] } rand6 = { version = "0.6", package = "rand" } rmp-serde = "0.14.3" @@ -134,5 +134,5 @@ url = { version = "2.2.2", features = ["serde"] } [build-dependencies] chrono = "0.4" gstuff = { version = "0.7", features = ["nightly"] } -prost-build = { version = "0.11", default-features = false } +prost-build = { version = "0.12", default-features = false } regex = "1" diff --git a/mm2src/mm2_main/src/lp_swap/komodefi.swap_v2.pb.rs b/mm2src/mm2_main/src/lp_swap/komodefi.swap_v2.pb.rs index 130fb2e3e1..38c6e07106 100644 --- a/mm2src/mm2_main/src/lp_swap/komodefi.swap_v2.pb.rs +++ b/mm2src/mm2_main/src/lp_swap/komodefi.swap_v2.pb.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignedMessage { diff --git a/mm2src/mm2_net/Cargo.toml b/mm2src/mm2_net/Cargo.toml index d92e0c08b6..3962bf1136 100644 --- a/mm2src/mm2_net/Cargo.toml +++ b/mm2src/mm2_net/Cargo.toml @@ -27,7 +27,7 @@ mm2_err_handle = { path = "../mm2_err_handle" } mm2_event_stream = { path = "../mm2_event_stream", optional = true } mm2-libp2p = { path = "../mm2_p2p", package = "mm2_p2p", optional = true } parking_lot = { version = "0.12.0", features = ["nightly"], optional = true } -prost = "0.11" +prost = "0.12" rand = { version = "0.7", features = ["std", "small_rng", "wasm-bindgen"] } serde = "1" serde_json = { version = "1", features = ["preserve_order", "raw_value"] } @@ -41,7 +41,7 @@ http-body = "0.4" httparse = "1.8.0" js-sys = "0.3.27" pin-project = "1.1.2" -tonic = { version = "0.9", default-features = false, features = ["prost", "codegen"] } +tonic = { version = "0.10", default-features = false, features = ["prost", "codegen"] } tower-service = "0.3" wasm-bindgen = "0.2.86" wasm-bindgen-test = { version = "0.3.2" } diff --git a/mm2src/trezor/Cargo.toml b/mm2src/trezor/Cargo.toml index 5f0542d35a..36e5abb0ec 100644 --- a/mm2src/trezor/Cargo.toml +++ b/mm2src/trezor/Cargo.toml @@ -14,7 +14,7 @@ derive_more = "0.99" futures = { version = "0.3", package = "futures", features = ["compat", "async-await"] } hw_common = { path = "../hw_common" } mm2_err_handle = { path = "../mm2_err_handle" } -prost = "0.11" +prost = "0.12" rand = { version = "0.7", features = ["std", "wasm-bindgen"] } rpc_task = { path = "../rpc_task" } serde = "1.0" diff --git a/mm2src/trezor/src/error.rs b/mm2src/trezor/src/error.rs index 798185695c..6a67c592f2 100644 --- a/mm2src/trezor/src/error.rs +++ b/mm2src/trezor/src/error.rs @@ -1,3 +1,5 @@ +use std::convert::TryFrom; + use crate::proto::messages::MessageType; use crate::proto::messages_common::{failure::FailureType, Failure}; use crate::user_interaction::TrezorUserInteraction; @@ -57,7 +59,7 @@ pub enum OperationFailure { impl From for OperationFailure { fn from(failure: Failure) -> Self { - match failure.code.and_then(FailureType::from_i32) { + match failure.code.and_then(|t| FailureType::try_from(t).ok()) { Some(FailureType::FailurePinInvalid) | Some(FailureType::FailurePinMismatch) => { OperationFailure::InvalidPin }, diff --git a/mm2src/trezor/src/response.rs b/mm2src/trezor/src/response.rs index 869b910997..259db41840 100644 --- a/mm2src/trezor/src/response.rs +++ b/mm2src/trezor/src/response.rs @@ -6,6 +6,7 @@ use crate::{TrezorError, TrezorResult}; use async_trait::async_trait; use mm2_err_handle::prelude::*; use rpc_task::RpcTaskError; +use std::convert::TryFrom; use std::fmt; use std::sync::Arc; @@ -150,7 +151,10 @@ impl<'a, 'b, T> fmt::Debug for ButtonRequest<'a, 'b, T> { impl<'a, 'b, T: 'static> ButtonRequest<'a, 'b, T> { /// The type of button request. - pub fn request_type(&self) -> Option { self.message.code.and_then(ButtonRequestType::from_i32) } + #[inline(always)] + pub fn request_type(&self) -> Option { + self.message.code.and_then(|t| ButtonRequestType::try_from(t).ok()) + } /// Ack the request and get the next message from the device. pub async fn ack(self) -> TrezorResult> { @@ -174,8 +178,9 @@ impl<'a, 'b, T> fmt::Debug for PinMatrixRequest<'a, 'b, T> { impl<'a, 'b, T: 'static> PinMatrixRequest<'a, 'b, T> { /// The type of PIN matrix request. + #[inline(always)] pub fn request_type(&self) -> Option { - self.message.r#type.and_then(PinMatrixRequestType::from_i32) + self.message.r#type.and_then(|t| PinMatrixRequestType::try_from(t).ok()) } /// Ack the request with a PIN and get the next message from the device. diff --git a/mm2src/trezor/src/transport/protocol.rs b/mm2src/trezor/src/transport/protocol.rs index 6c553e5d76..e6c822eb3c 100644 --- a/mm2src/trezor/src/transport/protocol.rs +++ b/mm2src/trezor/src/transport/protocol.rs @@ -1,5 +1,7 @@ //! This file is inspired by https://github.com/tezedge/tezedge-client/blob/master/trezor_api/src/transport/protocol.rs +use std::convert::TryFrom; + use crate::proto::messages::MessageType; use crate::proto::ProtoMessage; use crate::{TrezorError, TrezorResult}; @@ -85,9 +87,10 @@ impl Protocol for ProtocolV1 { ); return MmError::err(TrezorError::ProtocolError(error)); } - let message_type_id = BigEndian::read_u16(&chunk[3..5]) as u32; - let message_type = MessageType::from_i32(message_type_id as i32) - .or_mm_err(|| TrezorError::ProtocolError(format!("Invalid message type: {}", message_type_id)))?; + let message_type_id = BigEndian::read_u16(&chunk[3..5]) as i32; + let message_type = MessageType::try_from(message_type_id).map_err(|e| { + TrezorError::ProtocolError(format!("Invalid message type: {}, Error: {}", message_type_id, e)) + })?; let data_length = BigEndian::read_u32(&chunk[5..9]) as usize; let mut data: Vec = chunk[9..].into(); diff --git a/mm2src/trezor/src/utxo/sign_utxo.rs b/mm2src/trezor/src/utxo/sign_utxo.rs index 8b56f4fbd4..7f53182639 100644 --- a/mm2src/trezor/src/utxo/sign_utxo.rs +++ b/mm2src/trezor/src/utxo/sign_utxo.rs @@ -1,3 +1,5 @@ +use std::convert::TryFrom; + use crate::proto::messages_bitcoin as proto_bitcoin; use crate::result_handler::ResultHandler; use crate::utxo::unsigned_tx::UnsignedUtxoTx; @@ -61,7 +63,9 @@ impl<'a> TrezorSession<'a> { loop { extract_serialized_data(&tx_request, &mut result)?; - let request_type = tx_request.request_type.and_then(ProtoTxRequestType::from_i32); + let request_type = tx_request + .request_type + .and_then(|t| ProtoTxRequestType::try_from(t).ok()); let request_type = match request_type { Some(ProtoTxRequestType::Txfinished) => return Ok(result), Some(req_type) => req_type,