diff --git a/.github/workflows/cosmos-sdk-proto.yml b/.github/workflows/cosmos-sdk-proto.yml index 98d12b1d..b9f63fb0 100644 --- a/.github/workflows/cosmos-sdk-proto.yml +++ b/.github/workflows/cosmos-sdk-proto.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: rust: - - 1.63.0 # MSRV + - 1.65.0 # MSRV target: - x86_64-unknown-linux-gnu - wasm32-unknown-unknown @@ -41,7 +41,7 @@ jobs: strategy: matrix: rust: - - 1.63.0 # MSRV + - 1.65.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/cosmrs.yml b/.github/workflows/cosmrs.yml index 848ec416..8be3e301 100644 --- a/.github/workflows/cosmrs.yml +++ b/.github/workflows/cosmrs.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: rust: - - 1.63.0 # MSRV + - 1.65.0 # MSRV target: - x86_64-unknown-linux-gnu - wasm32-unknown-unknown @@ -42,7 +42,7 @@ jobs: strategy: matrix: rust: - - 1.63.0 # MSRV + - 1.65.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 9b1b420a..e00a6c63 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.63.0 + toolchain: 1.65.0 components: rustfmt - run: cargo fmt --all -- --check @@ -30,6 +30,6 @@ jobs: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.63.0 + toolchain: 1.65.0 components: clippy - run: cargo clippy --all --all-features -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 7d002923..19ac83ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "base16ct" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -121,9 +121,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bip32" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30ed1d6f8437a487a266c8293aeb95b61a23261273e3e02912cdb8b68bf798b" +checksum = "7e40748d60a3296653e45e87e64c6989aebfad607bccce59cc4156c5d81b2f70" dependencies = [ "bs58", "hmac", @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.4.9" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" dependencies = [ "generic-array", "rand_core", @@ -311,9 +311,9 @@ dependencies = [ [[package]] name = "der" -version = "0.6.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +checksum = "82b10af9f9f9f2134a42d3f8aa74658660f2e0234b0eb81bd171df8aa32779ed" dependencies = [ "const-oid", "zeroize", @@ -335,17 +335,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] [[package]] name = "ecdsa" -version = "0.14.8" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +checksum = "a48e5d537b8a30c0b023116d981b16334be1485af7ca68db3a2b7024cbc957fd" dependencies = [ "der", + "digest 0.10.6", "elliptic-curve", "rfc6979", "signature", @@ -353,10 +355,11 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" dependencies = [ + "pkcs8", "signature", ] @@ -381,13 +384,12 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.12.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" dependencies = [ "base16ct", "crypto-bigint", - "der", "digest 0.10.6", "ff", "generic-array", @@ -441,9 +443,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core", "subtle", @@ -577,6 +579,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -594,9 +597,9 @@ dependencies = [ [[package]] name = "group" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core", @@ -874,24 +877,16 @@ dependencies = [ [[package]] name = "k256" -version = "0.11.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", + "once_cell", "sha2 0.10.6", - "sha3", -] - -[[package]] -name = "keccak" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" -dependencies = [ - "cpufeatures", + "signature", ] [[package]] @@ -1013,11 +1008,12 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" dependencies = [ "digest 0.10.6", + "hmac", ] [[package]] @@ -1097,9 +1093,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -1263,13 +1259,12 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint", "hmac", - "zeroize", + "subtle", ] [[package]] @@ -1377,9 +1372,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.3.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ "base16ct", "der", @@ -1504,21 +1499,11 @@ dependencies = [ "digest 0.10.6", ] -[[package]] -name = "sha3" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" -dependencies = [ - "digest 0.10.6", - "keccak", -] - [[package]] name = "signature" -version = "1.6.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest 0.10.6", "rand_core", @@ -1551,9 +1536,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "37a5be806ab6f127c3da44b7378837ebf01dadca8510a0e572460216b228bd0e" dependencies = [ "base64ct", "der", @@ -1623,9 +1608,9 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.30.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b90c3c1e32352551f0f1639ce765e4c66ce250c733d4b9ba1aff81130437465c" +checksum = "a1b58bdb6c44a2621b8b6bd0585d5912ba32546317604130a42410bcc813ef16" dependencies = [ "bytes", "digest 0.10.6", @@ -1654,9 +1639,9 @@ dependencies = [ [[package]] name = "tendermint-config" -version = "0.30.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74efd33bcb53413b77cbe90ccb2cf0403930a5c1f300725deb87a61f7c4fab90" +checksum = "088bac81db392e66eedb508c400ebb2096d1e21cc40d71e3739a9bbd6838809a" dependencies = [ "flex-error", "serde", @@ -1668,9 +1653,9 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.30.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e553ed65874c3f35a71eb60d255edfea956274b5af37a0297d54bba039fe45e3" +checksum = "a1f15666993e193fa4d2b2479aa1e4f1bbe41283c820812df8dd618f41ca3f7a" dependencies = [ "bytes", "flex-error", @@ -1686,9 +1671,9 @@ dependencies = [ [[package]] name = "tendermint-rpc" -version = "0.30.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79bd426571d6a805be5c0b6749707ede6c6ee5e55dd45baef46857a1baa9f54" +checksum = "120ccb296a0ec4485ddb78eb842e481d7a859d5659e0f1881456f8c127d5e950" dependencies = [ "async-trait", "bytes", diff --git a/cosmos-sdk-proto/Cargo.toml b/cosmos-sdk-proto/Cargo.toml index dd61d2fd..2c96fffc 100644 --- a/cosmos-sdk-proto/Cargo.toml +++ b/cosmos-sdk-proto/Cargo.toml @@ -18,7 +18,7 @@ rust-version = "1.63" [dependencies] prost = "0.11" prost-types = "0.11" -tendermint-proto = "0.30" +tendermint-proto = "0.31" # Optional dependencies tonic = { version = "0.8", optional = true, default-features = false, features = ["codegen", "prost"] } diff --git a/cosmrs/Cargo.toml b/cosmrs/Cargo.toml index 3432f6c9..6443cb3f 100644 --- a/cosmrs/Cargo.toml +++ b/cosmrs/Cargo.toml @@ -9,23 +9,23 @@ readme = "README.md" categories = ["cryptography", "cryptography::cryptocurrencies", "encoding"] keywords = ["blockchain", "cosmos", "tendermint", "transaction"] edition = "2021" -rust-version = "1.63" +rust-version = "1.65" [dependencies] cosmos-sdk-proto = { version = "0.17", default-features = false, path = "../cosmos-sdk-proto" } -ecdsa = { version = "0.14", features = ["std"] } +ecdsa = { version = "0.16", features = ["std"] } eyre = "0.6" -k256 = { version = "0.11", features = ["ecdsa", "sha256"] } +k256 = { version = "0.13", features = ["ecdsa", "sha256"] } rand_core = { version = "0.6", features = ["std"] } serde = { version = "1", features = ["serde_derive"] } serde_json = "1" subtle-encoding = { version = "0.5", features = ["bech32-preview"] } -tendermint = { version = "0.30", features = ["secp256k1"] } +tendermint = { version = "0.31", features = ["secp256k1"] } thiserror = "1" # optional dependencies -bip32 = { version = "0.4", optional = true } -tendermint-rpc = { version = "0.30", optional = true, features = ["http-client"] } +bip32 = { version = "0.5", optional = true } +tendermint-rpc = { version = "0.31", optional = true, features = ["http-client"] } tokio = { version = "1", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/cosmrs/src/base/account_id.rs b/cosmrs/src/base/account_id.rs index 09218d4d..d8260e84 100644 --- a/cosmrs/src/base/account_id.rs +++ b/cosmrs/src/base/account_id.rs @@ -21,7 +21,7 @@ impl AccountId { /// Create an [`AccountId`] with the given human-readable prefix and /// public key hash. pub fn new(prefix: &str, bytes: &[u8]) -> Result { - let id = bech32::encode(prefix, &bytes); + let id = bech32::encode(prefix, bytes); if !prefix.chars().all(|c| matches!(c, 'a'..='z' | '0'..='9')) { return Err(Error::AccountId { id }) diff --git a/cosmrs/src/crypto/secp256k1/signing_key.rs b/cosmrs/src/crypto/secp256k1/signing_key.rs index 734a97e0..88b43c84 100644 --- a/cosmrs/src/crypto/secp256k1/signing_key.rs +++ b/cosmrs/src/crypto/secp256k1/signing_key.rs @@ -4,6 +4,7 @@ use crate::{ crypto::{secp256k1::Signature, PublicKey}, ErrorReport, Result, }; +use ecdsa::signature::{Keypair, Signer}; use k256::ecdsa::VerifyingKey; use rand_core::OsRng; @@ -27,14 +28,14 @@ pub struct SigningKey { impl SigningKey { /// Initialize from a provided signer object. /// - /// Use [`SigningKey::from_bytes`] to initialize from a raw private key. + /// Use [`SigningKey::from_slice`] to initialize from a raw private key. pub fn new(signer: Box) -> Self { Self { inner: signer } } /// Initialize from a raw scalar value (big endian). - pub fn from_bytes(bytes: &[u8]) -> Result { - let signing_key = k256::ecdsa::SigningKey::from_bytes(bytes)?; + pub fn from_slice(bytes: &[u8]) -> Result { + let signing_key = k256::ecdsa::SigningKey::from_slice(bytes)?; Ok(Self::new(Box::new(signing_key))) } @@ -77,7 +78,7 @@ impl TryFrom<&[u8]> for SigningKey { type Error = ErrorReport; fn try_from(bytes: &[u8]) -> Result { - Self::from_bytes(bytes) + Self::from_slice(bytes) } } @@ -106,18 +107,6 @@ impl From<&bip32::XPrv> for SigningKey { /// /// Note that this trait is bounded on [`ecdsa::signature::Signer`], which is /// what is actually used to produce a signature for a given message. -pub trait EcdsaSigner: ecdsa::signature::Signer { - /// Get the ECDSA/secp256k1 [`VerifyingKey`] (i.e. public key) which - /// which corresponds to this signer's private key. - fn verifying_key(&self) -> VerifyingKey; -} +pub trait EcdsaSigner: Signer + Keypair {} -impl EcdsaSigner for T -where - T: ecdsa::signature::Signer, - k256::ecdsa::VerifyingKey: for<'a> From<&'a T>, -{ - fn verifying_key(&self) -> VerifyingKey { - self.into() - } -} +impl EcdsaSigner for T where T: Signer + Keypair {} diff --git a/cosmrs/src/dev.rs b/cosmrs/src/dev.rs index 2236308f..73c7a957 100644 --- a/cosmrs/src/dev.rs +++ b/cosmrs/src/dev.rs @@ -35,13 +35,13 @@ where let result = panic::catch_unwind(f); if result.is_err() { - let logs = exec_docker_command("logs", &[&container_id]); + let logs = exec_docker_command("logs", [&container_id]); println!("\n---- docker stdout ----"); println!("{}", logs); } - exec_docker_command("kill", &[&container_id]); + exec_docker_command("kill", [&container_id]); match result { Ok(res) => res, diff --git a/cosmrs/src/tx/sign_doc.rs b/cosmrs/src/tx/sign_doc.rs index fe53caa9..cb7a6366 100644 --- a/cosmrs/src/tx/sign_doc.rs +++ b/cosmrs/src/tx/sign_doc.rs @@ -65,7 +65,7 @@ impl SignDoc { Ok(proto::cosmos::tx::v1beta1::TxRaw { body_bytes: self.body_bytes, auth_info_bytes: self.auth_info_bytes, - signatures: vec![signature.as_ref().to_vec()], + signatures: vec![signature.to_vec()], } .into()) } diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index aac90af0..72c9e47f 100644 --- a/proto-build/src/main.rs +++ b/proto-build/src/main.rs @@ -166,19 +166,19 @@ fn run_rustfmt(dir: &Path) { fn update_submodules() { info!("Updating cosmos/cosmos-sdk submodule..."); - run_git(&["submodule", "update", "--init"]); - run_git(&["-C", COSMOS_SDK_DIR, "fetch"]); - run_git(&["-C", COSMOS_SDK_DIR, "reset", "--hard", COSMOS_SDK_REV]); + run_git(["submodule", "update", "--init"]); + run_git(["-C", COSMOS_SDK_DIR, "fetch"]); + run_git(["-C", COSMOS_SDK_DIR, "reset", "--hard", COSMOS_SDK_REV]); info!("Updating cosmos/ibc-go submodule..."); - run_git(&["submodule", "update", "--init"]); - run_git(&["-C", IBC_DIR, "fetch"]); - run_git(&["-C", IBC_DIR, "reset", "--hard", IBC_REV]); + run_git(["submodule", "update", "--init"]); + run_git(["-C", IBC_DIR, "fetch"]); + run_git(["-C", IBC_DIR, "reset", "--hard", IBC_REV]); info!("Updating wasmd submodule..."); - run_git(&["submodule", "update", "--init"]); - run_git(&["-C", WASMD_DIR, "fetch"]); - run_git(&["-C", WASMD_DIR, "reset", "--hard", WASMD_REV]); + run_git(["submodule", "update", "--init"]); + run_git(["-C", WASMD_DIR, "fetch"]); + run_git(["-C", WASMD_DIR, "reset", "--hard", WASMD_REV]); } fn output_sdk_version(out_dir: &Path) { @@ -361,8 +361,8 @@ fn copy_generated_files(from_dir: &Path, to_dir: &Path) { info!("Copying generated files into '{}'...", to_dir.display()); // Remove old compiled files - remove_dir_all(&to_dir).unwrap_or_default(); - create_dir_all(&to_dir).unwrap(); + remove_dir_all(to_dir).unwrap_or_default(); + create_dir_all(to_dir).unwrap(); let mut filenames = Vec::new(); diff --git a/rust-toolchain b/rust-toolchain index af92bdd9..902c7418 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.63.0 +1.65.0