From 7e1c3b450183dd19fdd5bf43421955cd4e2b008e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 3 Nov 2021 11:03:18 +0000 Subject: [PATCH] Chore/cosmrs update (#862) * Re-enabled `get_tx` endpoint * Updated cosmrs to 0.3 and prost to 0.9 * [ci skip] Generate TS types Co-authored-by: jstuczyn --- Cargo.lock | 192 ++++++++--------- .../client-libs/validator-client/Cargo.toml | 4 +- .../src/nymd/cosmwasm_client/client.rs | 11 +- .../nymd/cosmwasm_client/signing_client.rs | 38 ++-- .../validator-client/src/nymd/error.rs | 29 ++- tauri-wallet/Cargo.lock | 204 ++++++++---------- tauri-wallet/src-tauri/Cargo.toml | 4 +- validator-api/src/nymd_client.rs | 4 +- validator-api/src/rewarding/error.rs | 2 +- 9 files changed, 232 insertions(+), 256 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22217f3cb9..034a979e0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,15 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -66,15 +57,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anomaly" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "550632e31568ae1a5f47998c3aa48563030fc49b9ec91913ca337cf64fbc5ccb" -dependencies = [ - "backtrace", -] - [[package]] name = "ansi_term" version = "0.11.0" @@ -246,21 +228,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "backtrace" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide 0.4.4", - "object", - "rustc-demangle", -] - [[package]] name = "base-x" version = "0.2.8" @@ -680,7 +647,7 @@ dependencies = [ "ff", "getrandom 0.2.3", "group", - "itertools 0.10.1", + "itertools", "rand 0.8.4", "serde", "serde_derive", @@ -871,9 +838,9 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7115eae4b8518967b8e737a3ef76025f2d007de7906d88c18f00b8bbfc70f51e" +checksum = "edb5204c6ddc4352c74297638b5561f2929d6334866c156e5f3c75e1e1a1436a" dependencies = [ "prost", "prost-types", @@ -882,9 +849,9 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609eba7eee6d9929927cbdf15f9fe96d250c316c5e1b983c4a47a10f60da5ea7" +checksum = "d31147fe89e547e74e2692e4bec35387e1ea406fe8cfb14c0ea177b58fd2a8a9" dependencies = [ "bip32", "cosmos-sdk-proto", @@ -895,6 +862,8 @@ dependencies = [ "prost", "prost-types", "rand_core 0.6.3", + "serde", + "serde_json", "subtle-encoding", "tendermint", "tendermint-rpc", @@ -1476,7 +1445,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc" dependencies = [ - "serde", "signature", ] @@ -1490,7 +1458,6 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "serde_bytes", "sha2", "zeroize", ] @@ -1687,6 +1654,16 @@ dependencies = [ "miniz_oxide 0.4.4", ] +[[package]] +name = "flex-error" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" +dependencies = [ + "eyre", + "paste", +] + [[package]] name = "fluvio-wasm-timer" version = "0.2.5" @@ -2069,12 +2046,6 @@ dependencies = [ "syn", ] -[[package]] -name = "gimli" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" - [[package]] name = "gio" version = "0.14.6" @@ -2551,6 +2522,7 @@ dependencies = [ "tokio", "tokio-rustls", "webpki", + "webpki-roots", ] [[package]] @@ -2711,15 +2683,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.1" @@ -3638,15 +3601,6 @@ dependencies = [ "objc", ] -[[package]] -name = "object" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2" -dependencies = [ - "memchr", -] - [[package]] name = "okapi" version = "0.6.0-alpha-1" @@ -3790,6 +3744,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "paste" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" + [[package]] name = "pbkdf2" version = "0.8.0" @@ -3822,6 +3782,33 @@ dependencies = [ "syn", ] +[[package]] +name = "peg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c0b841ea54f523f7aa556956fbd293bcbe06f2e67d2eb732b7278aaf1d166a" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aa52829b8decbef693af90202711348ab001456803ba2a98eb4ec8fb70844c" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" + [[package]] name = "pem" version = "0.8.3" @@ -4171,9 +4158,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes", "prost-derive", @@ -4181,12 +4168,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools", "proc-macro2", "quote", "syn", @@ -4194,9 +4181,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ "bytes", "prost", @@ -4809,12 +4796,6 @@ dependencies = [ "quote", ] -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - [[package]] name = "rustc_version" version = "0.2.3" @@ -5376,7 +5357,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" dependencies = [ - "itertools 0.10.1", + "itertools", "nom", "unicode_categories", ] @@ -5862,7 +5843,7 @@ dependencies = [ "anyhow", "cfg-expr", "heck", - "itertools 0.10.1", + "itertools", "pkg-config", "strum 0.21.0", "strum_macros 0.21.1", @@ -6077,16 +6058,16 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0752808f59b612916614e92e43be64e9ba566b762a266bcfcf7dce1b324e9319" +checksum = "50d1cdb0236becb17ab35a2ed1566503e412fd910944dc940239857bb7663652" dependencies = [ - "anomaly", "async-trait", "bytes", "chrono", "ed25519", "ed25519-dalek", + "flex-error", "futures", "k256", "num-traits", @@ -6103,21 +6084,32 @@ dependencies = [ "subtle 2.4.1", "subtle-encoding", "tendermint-proto", - "thiserror", - "toml", - "url", "zeroize", ] [[package]] -name = "tendermint-proto" -version = "0.21.0" +name = "tendermint-config" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd0371c6b0c7fc4f6b053b8a1bc868a2a47c49a1408c4cd6f595d9f3bd3c238" +checksum = "2a1f94250d30e3011130a09756b05985d8dbfbd562cf261b5a17e36d89a37992" +dependencies = [ + "flex-error", + "serde", + "serde_json", + "tendermint", + "toml", + "url", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff16a7b42bdbcf31c8cd10a4cffc7631f2a301360ba3a3f71dde48eabfa5bced" dependencies = [ - "anomaly", "bytes", "chrono", + "flex-error", "num-derive", "num-traits", "prost", @@ -6125,30 +6117,32 @@ dependencies = [ "serde", "serde_bytes", "subtle-encoding", - "thiserror", ] [[package]] name = "tendermint-rpc" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fa8d172e3129802d28de980531993dd25cc01841c5bc8fe4a87c7750a7f222" +checksum = "c7842dcd5edb60b077572aa92ff8b29fc810b9b463310f9810a2607474130db4" dependencies = [ "async-trait", "bytes", "chrono", + "flex-error", "futures", "getrandom 0.1.16", "http", "hyper", "hyper-proxy", "hyper-rustls", + "peg", "pin-project", "serde", "serde_bytes", "serde_json", "subtle-encoding", "tendermint", + "tendermint-config", "tendermint-proto", "thiserror", "tokio", @@ -6430,21 +6424,9 @@ checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98863d0dd09fa59a1b79c6750ad80dbda6b75f4e71c437a6a1a8cb91a8bcbd77" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.20" @@ -6665,7 +6647,7 @@ dependencies = [ "cosmrs", "cosmwasm-std", "flate2", - "itertools 0.10.1", + "itertools", "log", "mixnet-contract", "network-defaults", diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 78c7519e4f..689337376f 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -25,8 +25,8 @@ network-defaults = { path = "../../network-defaults" } async-trait = { version = "0.1.51", optional = true } bip39 = { version = "1", features = ["rand"], optional = true } config = { path = "../../config", optional = true } -cosmrs = { version = "0.1", features = ["rpc", "bip32", "cosmwasm"], optional = true } -prost = { version = "0.7", default-features = false, optional = true } +cosmrs = { version = "0.3", features = ["rpc", "bip32", "cosmwasm"], optional = true } +prost = { version = "0.9", default-features = false, optional = true } flate2 = { version = "1.0.20", optional = true } sha2 = { version = "0.9.5", optional = true } itertools = { version = "0.10", optional = true } diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs b/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs index 8bd8a0b207..7edbcb39ae 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs +++ b/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs @@ -22,7 +22,7 @@ use cosmrs::rpc::query::Query; use cosmrs::rpc::{self, HttpClient, Order}; use cosmrs::tendermint::abci::Transaction; use cosmrs::tendermint::{abci, block, chain}; -use cosmrs::{AccountId, Coin, Denom}; +use cosmrs::{tx, AccountId, Coin, Denom}; use prost::Message; use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; @@ -153,12 +153,9 @@ pub trait CosmWasmClient: rpc::Client { .map_err(|_| NymdError::SerializationError("Coins".to_owned())) } - // disabled until https://github.com/tendermint/tendermint/issues/6802 - // and consequently https://github.com/informalsystems/tendermint-rs/issues/942 is resolved - // - // async fn get_tx(&self, id: tx::Hash) -> Result { - // Ok(self.tx(id, false).await?) - // } + async fn get_tx(&self, id: tx::Hash) -> Result { + Ok(self.tx(id, false).await?) + } async fn search_tx(&self, query: Query) -> Result, NymdError> { // according to https://docs.tendermint.com/master/rpc/#/Info/tx_search diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs b/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs index eebdbdf7fd..ab650b36c0 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs +++ b/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs @@ -13,8 +13,8 @@ use cosmrs::distribution::MsgWithdrawDelegatorReward; use cosmrs::rpc::endpoint::broadcast; use cosmrs::rpc::{Error as TendermintRpcError, HttpClient, HttpClientUrl, SimpleRequest}; use cosmrs::staking::{MsgDelegate, MsgUndelegate}; -use cosmrs::tx::{Fee, Msg, MsgType, SignDoc, SignerInfo}; -use cosmrs::{cosmwasm, rpc, tx, AccountId, Coin}; +use cosmrs::tx::{Fee, Msg, SignDoc, SignerInfo}; +use cosmrs::{cosmwasm, rpc, tx, AccountId, Any, Coin}; use log::debug; use serde::Serialize; use sha2::Digest; @@ -52,7 +52,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .unwrap_or_default(), instantiate_permission: Default::default(), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgStoreCode".to_owned()))?; let tx_res = self @@ -114,7 +114,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { init_msg: serde_json::to_vec(msg)?, funds: options.map(|options| options.funds).unwrap_or_default(), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgInstantiateContract".to_owned()))?; let tx_res = self @@ -154,7 +154,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { new_admin: new_admin.clone(), contract: contract_address.clone(), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgUpdateAdmin".to_owned()))?; let tx_res = self @@ -179,7 +179,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { sender: sender_address.clone(), contract: contract_address.clone(), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgClearAdmin".to_owned()))?; let tx_res = self @@ -211,7 +211,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { code_id, migrate_msg: serde_json::to_vec(msg)?, } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgMigrateContract".to_owned()))?; let tx_res = self @@ -243,7 +243,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { msg: serde_json::to_vec(msg)?, funds, } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgExecuteContract".to_owned()))?; let tx_res = self @@ -278,7 +278,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { msg: serde_json::to_vec(&msg)?, funds, } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgExecuteContract".to_owned())) }) .collect::>()?; @@ -312,7 +312,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { to_address: recipient_address.clone(), amount, } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgSend".to_owned()))?; self.sign_and_broadcast_commit(sender_address, vec![send_msg], fee, memo) @@ -332,7 +332,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { validator_address: validator_address.to_owned(), amount, } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgDelegate".to_owned()))?; self.sign_and_broadcast_commit(delegator_address, vec![delegate_msg], fee, memo) @@ -352,7 +352,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { validator_address: validator_address.to_owned(), amount: Some(amount), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgUndelegate".to_owned()))?; self.sign_and_broadcast_commit(delegator_address, vec![undelegate_msg], fee, memo) @@ -370,7 +370,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { delegator_address: delegator_address.to_owned(), validator_address: validator_address.to_owned(), } - .to_msg() + .to_any() .map_err(|_| NymdError::SerializationError("MsgWithdrawDelegatorReward".to_owned()))?; self.sign_and_broadcast_commit(delegator_address, vec![withdraw_msg], fee, memo) @@ -381,7 +381,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { async fn sign_and_broadcast_async( &self, signer_address: &AccountId, - messages: Vec, + messages: Vec, fee: Fee, memo: impl Into + Send + 'static, ) -> Result { @@ -397,7 +397,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { async fn sign_and_broadcast_sync( &self, signer_address: &AccountId, - messages: Vec, + messages: Vec, fee: Fee, memo: impl Into + Send + 'static, ) -> Result { @@ -413,7 +413,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { async fn sign_and_broadcast_commit( &self, signer_address: &AccountId, - messages: Vec, + messages: Vec, fee: Fee, memo: impl Into + Send + 'static, ) -> Result { @@ -428,7 +428,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fn sign_direct( &self, signer_address: &AccountId, - messages: Vec, + messages: Vec, fee: Fee, memo: impl Into + Send + 'static, signer_data: SignerData, @@ -466,7 +466,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { async fn sign( &self, signer_address: &AccountId, - messages: Vec, + messages: Vec, fee: Fee, memo: impl Into + Send + 'static, ) -> Result { @@ -506,7 +506,7 @@ impl Client { #[async_trait] impl rpc::Client for Client { - async fn perform(&self, request: R) -> rpc::Result + async fn perform(&self, request: R) -> Result where R: SimpleRequest, { diff --git a/common/client-libs/validator-client/src/nymd/error.rs b/common/client-libs/validator-client/src/nymd/error.rs index a9a709b955..e1e2e114fd 100644 --- a/common/client-libs/validator-client/src/nymd/error.rs +++ b/common/client-libs/validator-client/src/nymd/error.rs @@ -7,7 +7,10 @@ use cosmrs::{bip32, tx, AccountId}; use std::io; use thiserror::Error; -pub use cosmrs::rpc::error::{Code, Error as TendermintRpcError}; +pub use cosmrs::rpc::error::{ + Error as TendermintRpcError, ErrorDetail as TendermintRpcErrorDetail, +}; +pub use cosmrs::rpc::response_error::{Code, ResponseError}; #[derive(Debug, Error)] pub enum NymdError { @@ -102,17 +105,21 @@ pub enum NymdError { } impl NymdError { - pub fn is_tendermint_timeout(&self) -> bool { + pub fn is_tendermint_response_timeout(&self) -> bool { match &self { - NymdError::TendermintError(tm_err) => { - if tm_err.code() == Code::InternalError { + NymdError::TendermintError(TendermintRpcError( + TendermintRpcErrorDetail::Response(err), + _, + )) => { + let response = &err.source; + if response.code() == Code::InternalError { // 0.34 (and earlier) versions of tendermint seemed to be using phrase "timed out waiting ..." // (https://github.com/tendermint/tendermint/blob/v0.34.13/rpc/core/mempool.go#L124) // while 0.35+ has "timeout waiting for ..." // https://github.com/tendermint/tendermint/blob/v0.35.0-rc3/internal/rpc/core/mempool.go#L99 // note that as of the time of writing this comment (08.10.2021), the most recent version // of cosmos-sdk (v0.44.1) uses tendermint 0.34.13 - if let Some(data) = tm_err.data() { + if let Some(data) = response.data() { data.contains("timed out") || data.contains("timeout") } else { false @@ -125,14 +132,18 @@ impl NymdError { } } - pub fn is_tendermint_duplicate(&self) -> bool { + pub fn is_tendermint_response_duplicate(&self) -> bool { match &self { - NymdError::TendermintError(tm_err) => { - if tm_err.code() == Code::InternalError { + NymdError::TendermintError(TendermintRpcError( + TendermintRpcErrorDetail::Response(err), + _, + )) => { + let response = &err.source; + if response.code() == Code::InternalError { // this particular error message seems to be unchanged between 0.34 and newer versions // https://github.com/tendermint/tendermint/blob/v0.34.13/mempool/errors.go#L10 // https://github.com/tendermint/tendermint/blob/v0.35.0-rc3/types/mempool.go#L10 - if let Some(data) = tm_err.data() { + if let Some(data) = response.data() { data.contains("tx already exists in cache") } else { false diff --git a/tauri-wallet/Cargo.lock b/tauri-wallet/Cargo.lock index f1235d5abd..869006a638 100644 --- a/tauri-wallet/Cargo.lock +++ b/tauri-wallet/Cargo.lock @@ -12,15 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -42,15 +33,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anomaly" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "550632e31568ae1a5f47998c3aa48563030fc49b9ec91913ca337cf64fbc5ccb" -dependencies = [ - "backtrace", -] - [[package]] name = "anyhow" version = "1.0.43" @@ -148,21 +130,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "backtrace" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide 0.4.4", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.13.0" @@ -430,12 +397,9 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "libc", "num-integer", "num-traits", "serde", - "time 0.1.43", - "winapi", ] [[package]] @@ -498,7 +462,7 @@ dependencies = [ "ff", "getrandom 0.2.3", "group", - "itertools 0.10.1", + "itertools", "rand 0.8.4", "serde", "serde_derive", @@ -651,9 +615,9 @@ dependencies = [ [[package]] name = "cosmos-sdk-proto" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7115eae4b8518967b8e737a3ef76025f2d007de7906d88c18f00b8bbfc70f51e" +checksum = "edb5204c6ddc4352c74297638b5561f2929d6334866c156e5f3c75e1e1a1436a" dependencies = [ "prost", "prost-types", @@ -662,9 +626,9 @@ dependencies = [ [[package]] name = "cosmrs" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609eba7eee6d9929927cbdf15f9fe96d250c316c5e1b983c4a47a10f60da5ea7" +checksum = "d31147fe89e547e74e2692e4bec35387e1ea406fe8cfb14c0ea177b58fd2a8a9" dependencies = [ "bip32", "cosmos-sdk-proto", @@ -675,6 +639,8 @@ dependencies = [ "prost", "prost-types", "rand_core 0.6.3", + "serde", + "serde_json", "subtle-encoding", "tendermint", "tendermint-rpc", @@ -1096,7 +1062,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc" dependencies = [ - "serde", "signature", ] @@ -1108,9 +1073,6 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", - "rand 0.7.3", - "serde", - "serde_bytes", "sha2", "zeroize", ] @@ -1247,6 +1209,16 @@ dependencies = [ "miniz_oxide 0.4.4", ] +[[package]] +name = "flex-error" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" +dependencies = [ + "eyre", + "paste", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1550,12 +1522,6 @@ dependencies = [ "syn", ] -[[package]] -name = "gimli" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" - [[package]] name = "gio" version = "0.14.5" @@ -1995,6 +1961,7 @@ dependencies = [ "tokio", "tokio-rustls", "webpki", + "webpki-roots", ] [[package]] @@ -2117,15 +2084,6 @@ dependencies = [ "syn", ] -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.10.1" @@ -2611,15 +2569,6 @@ dependencies = [ "objc", ] -[[package]] -name = "object" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.8.0" @@ -2745,6 +2694,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "paste" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" + [[package]] name = "pbkdf2" version = "0.8.0" @@ -2754,6 +2709,33 @@ dependencies = [ "crypto-mac", ] +[[package]] +name = "peg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c0b841ea54f523f7aa556956fbd293bcbe06f2e67d2eb732b7278aaf1d166a" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aa52829b8decbef693af90202711348ab001456803ba2a98eb4ec8fb70844c" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" + [[package]] name = "percent-encoding" version = "2.1.0" @@ -3062,9 +3044,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes", "prost-derive", @@ -3072,12 +3054,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools", "proc-macro2", "quote", "syn", @@ -3085,9 +3067,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ "bytes", "prost", @@ -3477,12 +3459,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - [[package]] name = "rustc_version" version = "0.3.3" @@ -4194,7 +4170,7 @@ dependencies = [ "anyhow", "cfg-expr", "heck", - "itertools 0.10.1", + "itertools", "pkg-config", "strum 0.21.0", "strum_macros 0.21.1", @@ -4409,16 +4385,16 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0752808f59b612916614e92e43be64e9ba566b762a266bcfcf7dce1b324e9319" +checksum = "50d1cdb0236becb17ab35a2ed1566503e412fd910944dc940239857bb7663652" dependencies = [ - "anomaly", "async-trait", "bytes", "chrono", "ed25519", "ed25519-dalek", + "flex-error", "futures", "k256", "num-traits", @@ -4435,21 +4411,32 @@ dependencies = [ "subtle", "subtle-encoding", "tendermint-proto", - "thiserror", - "toml", - "url", "zeroize", ] [[package]] -name = "tendermint-proto" -version = "0.21.0" +name = "tendermint-config" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd0371c6b0c7fc4f6b053b8a1bc868a2a47c49a1408c4cd6f595d9f3bd3c238" +checksum = "2a1f94250d30e3011130a09756b05985d8dbfbd562cf261b5a17e36d89a37992" +dependencies = [ + "flex-error", + "serde", + "serde_json", + "tendermint", + "toml", + "url", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff16a7b42bdbcf31c8cd10a4cffc7631f2a301360ba3a3f71dde48eabfa5bced" dependencies = [ - "anomaly", "bytes", "chrono", + "flex-error", "num-derive", "num-traits", "prost", @@ -4457,30 +4444,32 @@ dependencies = [ "serde", "serde_bytes", "subtle-encoding", - "thiserror", ] [[package]] name = "tendermint-rpc" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fa8d172e3129802d28de980531993dd25cc01841c5bc8fe4a87c7750a7f222" +checksum = "c7842dcd5edb60b077572aa92ff8b29fc810b9b463310f9810a2607474130db4" dependencies = [ "async-trait", "bytes", "chrono", + "flex-error", "futures", "getrandom 0.1.16", "http", "hyper", "hyper-proxy", "hyper-rustls", + "peg", "pin-project", "serde", "serde_bytes", "serde_json", "subtle-encoding", "tendermint", + "tendermint-config", "tendermint-proto", "thiserror", "tokio", @@ -4657,21 +4646,9 @@ checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.19" @@ -4813,7 +4790,7 @@ dependencies = [ "cosmrs", "cosmwasm-std", "flate2", - "itertools 0.10.1", + "itertools", "log", "mixnet-contract", "network-defaults", @@ -5024,6 +5001,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + [[package]] name = "webview2" version = "0.1.1" diff --git a/tauri-wallet/src-tauri/Cargo.toml b/tauri-wallet/src-tauri/Cargo.toml index 9737017ee4..7a12aca309 100644 --- a/tauri-wallet/src-tauri/Cargo.toml +++ b/tauri-wallet/src-tauri/Cargo.toml @@ -23,12 +23,12 @@ dirs = "3.0" # url = "2.2" bip39 = "1.0" thiserror = "1.0" -tendermint-rpc = "0.21.0" +tendermint-rpc = "0.23.0" ts-rs = "3.0" url = "2.0" rand = "0.6.5" -cosmrs = { version = "0.1", features = ["rpc", "bip32", "cosmwasm"] } +cosmrs = { version = "0.3", features = ["rpc", "bip32", "cosmwasm"] } cosmwasm-std = { git = "https://github.com/jstuczyn/cosmwasm", branch = "0.14.1-updatedk256" } validator-client = { path = "../../common/client-libs/validator-client", features = [ diff --git a/validator-api/src/nymd_client.rs b/validator-api/src/nymd_client.rs index 1a449abb8d..1205736433 100644 --- a/validator-api/src/nymd_client.rs +++ b/validator-api/src/nymd_client.rs @@ -213,7 +213,7 @@ impl Client { match res { Ok(_) => Ok(()), Err(err) => { - if err.is_tendermint_timeout() { + if err.is_tendermint_response_timeout() { // wait until we're sure we're into the next block (remember we're holding the lock) sleep(Duration::from_secs(11)).await; let curr_sequence = client_guard.nymd.account_sequence().await?; @@ -281,7 +281,7 @@ impl Client { match res { Ok(_) => Ok(()), Err(err) => { - if err.is_tendermint_timeout() { + if err.is_tendermint_response_timeout() { // wait until we're sure we're into the next block (remember we're holding the lock) sleep(Duration::from_secs(11)).await; let curr_sequence = client_guard.nymd.account_sequence().await?; diff --git a/validator-api/src/rewarding/error.rs b/validator-api/src/rewarding/error.rs index ea8597dc81..1e54cb48b1 100644 --- a/validator-api/src/rewarding/error.rs +++ b/validator-api/src/rewarding/error.rs @@ -50,7 +50,7 @@ impl RewardingError { pub fn is_tendermint_duplicate(&self) -> bool { match &self { RewardingError::ValidatorClientError(ValidatorClientError::NymdError(nymd_err)) => { - nymd_err.is_tendermint_duplicate() + nymd_err.is_tendermint_response_duplicate() } _ => false, }