diff --git a/Makefile b/Makefile index 24815917..b338c689 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) ##### Rust ##### -rustVer=1.70-slim +rustVer=1.88-slim rustImageName=rust:$(rustVer) rustImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(rustImageName) diff --git a/rust/.cargo/config b/rust/.cargo/config.toml similarity index 100% rename from rust/.cargo/config rename to rust/.cargo/config.toml diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 512d2608..d360ec71 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -6,8 +6,8 @@ exclude = ["codegen", "no-std-check"] license = "Apache-2.0" name = "ics23" repository = "https://github.com/cosmos/ics23/tree/master/rust" -rust-version = "1.60" -version = "0.12.0" +rust-version = "1.88" +version = "0.12.1" [workspace] members = ["codegen", "no-std-check"] @@ -19,7 +19,8 @@ blake2 = {version = "0.10.6", optional = true, default-features = false} blake3 = {version = "1.5.0", optional = true, default-features = false} bytes = {version = "1.0.1", default-features = false} hex = {version = "0.4.3", default-features = false, features = ["alloc"]} -prost = {version = "0.13", default-features = false, features = ["prost-derive"]} +prost = {version = "0.14.1", default-features = false, features = ["derive"]} +prost-derive = "0.14.1" ripemd = {version = "0.1.1", optional = true, default-features = false} sha2 = {version = "0.10.2", optional = true, default-features = false} sha3 = {version = "0.10.2", optional = true, default-features = false} diff --git a/rust/codegen/Cargo.toml b/rust/codegen/Cargo.toml index 566a8f98..aa95e173 100644 --- a/rust/codegen/Cargo.toml +++ b/rust/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "codegen" -version = "0.1.0" +version = "0.1.1" authors = ["Ethan Frey "] edition = "2018" @@ -8,6 +8,6 @@ edition = "2018" [dependencies] bytes = "1.0.1" -prost = "0.13" -prost-build = "0.13" +prost = "0.14.1" +prost-build = "0.14.1" informalsystems-pbjson-build = "0.7.0" diff --git a/rust/src/cosmos.ics23.v1.rs b/rust/src/cosmos.ics23.v1.rs index 6e78c086..8bf155ff 100644 --- a/rust/src/cosmos.ics23.v1.rs +++ b/rust/src/cosmos.ics23.v1.rs @@ -19,7 +19,6 @@ /// With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field /// in the ProofSpec is valuable to prevent this mutability. And why all trees should /// length-prefix the data before hashing it. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExistenceProof { #[prost(bytes = "vec", tag = "1")] @@ -35,7 +34,6 @@ pub struct ExistenceProof { /// NonExistenceProof takes a proof of two neighbors, one left of the desired key, /// one right of the desired key. If both proofs are valid AND they are neighbors, /// then there is no valid proof for the given key. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NonExistenceProof { /// TODO: remove this as unnecessary??? we prove a range @@ -48,7 +46,6 @@ pub struct NonExistenceProof { } /// /// CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitmentProof { #[prost(oneof = "commitment_proof::Proof", tags = "1, 2, 3, 4")] @@ -56,7 +53,6 @@ pub struct CommitmentProof { } /// Nested message and enum types in `CommitmentProof`. pub mod commitment_proof { - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Proof { #[prost(message, tag = "1")] @@ -84,8 +80,7 @@ pub mod commitment_proof { /// /// Then combine the bytes, and hash it /// output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct LeafOp { #[prost(enumeration = "HashOp", tag = "1")] pub hash: i32, @@ -116,8 +111,7 @@ pub struct LeafOp { /// Any special data, like prepending child with the length, or prepending the entire operation with /// some value to differentiate from leaf nodes, should be included in prefix and suffix. /// If either of prefix or suffix is empty, we just treat it as an empty string -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct InnerOp { #[prost(enumeration = "HashOp", tag = "1")] pub hash: i32, @@ -137,8 +131,7 @@ pub struct InnerOp { /// generate a given hash (by interpretting the preimage differently). /// We need this for proper security, requires client knows a priori what /// tree format server uses. But not in code, rather a configuration object. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ProofSpec { /// any field in the ExistenceProof must be the same as in this spec. /// except Prefix, which is just the first bytes of prefix (spec can be longer) @@ -168,8 +161,7 @@ pub struct ProofSpec { /// isLeftMost(spec: InnerSpec, op: InnerOp) /// isRightMost(spec: InnerSpec, op: InnerOp) /// isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct InnerSpec { /// Child order is the ordering of the children node, must count from 0 /// iavl tree is \[0, 1\] (left then right) @@ -192,14 +184,12 @@ pub struct InnerSpec { } /// /// BatchProof is a group of multiple proof types than can be compressed -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BatchProof { #[prost(message, repeated, tag = "1")] pub entries: ::prost::alloc::vec::Vec, } /// Use BatchEntry not CommitmentProof, to avoid recursion -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BatchEntry { #[prost(oneof = "batch_entry::Proof", tags = "1, 2")] @@ -207,7 +197,6 @@ pub struct BatchEntry { } /// Nested message and enum types in `BatchEntry`. pub mod batch_entry { - #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Proof { #[prost(message, tag = "1")] @@ -216,7 +205,6 @@ pub mod batch_entry { Nonexist(super::NonExistenceProof), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompressedBatchProof { #[prost(message, repeated, tag = "1")] @@ -225,16 +213,14 @@ pub struct CompressedBatchProof { pub lookup_inners: ::prost::alloc::vec::Vec, } /// Use BatchEntry not CommitmentProof, to avoid recursion -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CompressedBatchEntry { #[prost(oneof = "compressed_batch_entry::Proof", tags = "1, 2")] pub proof: ::core::option::Option, } /// Nested message and enum types in `CompressedBatchEntry`. pub mod compressed_batch_entry { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Proof { #[prost(message, tag = "1")] Exist(super::CompressedExistenceProof), @@ -242,8 +228,7 @@ pub mod compressed_batch_entry { Nonexist(super::CompressedNonExistenceProof), } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CompressedExistenceProof { #[prost(bytes = "vec", tag = "1")] pub key: ::prost::alloc::vec::Vec, @@ -255,8 +240,7 @@ pub struct CompressedExistenceProof { #[prost(int32, repeated, tag = "4")] pub path: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct CompressedNonExistenceProof { /// TODO: remove this as unnecessary??? we prove a range #[prost(bytes = "vec", tag = "1")] @@ -289,16 +273,16 @@ impl HashOp { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - HashOp::NoHash => "NO_HASH", - HashOp::Sha256 => "SHA256", - HashOp::Sha512 => "SHA512", - HashOp::Keccak256 => "KECCAK256", - HashOp::Ripemd160 => "RIPEMD160", - HashOp::Bitcoin => "BITCOIN", - HashOp::Sha512256 => "SHA512_256", - HashOp::Blake2b512 => "BLAKE2B_512", - HashOp::Blake2s256 => "BLAKE2S_256", - HashOp::Blake3 => "BLAKE3", + Self::NoHash => "NO_HASH", + Self::Sha256 => "SHA256", + Self::Sha512 => "SHA512", + Self::Keccak256 => "KECCAK256", + Self::Ripemd160 => "RIPEMD160", + Self::Bitcoin => "BITCOIN", + Self::Sha512256 => "SHA512_256", + Self::Blake2b512 => "BLAKE2B_512", + Self::Blake2s256 => "BLAKE2S_256", + Self::Blake3 => "BLAKE3", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -352,15 +336,15 @@ impl LengthOp { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - LengthOp::NoPrefix => "NO_PREFIX", - LengthOp::VarProto => "VAR_PROTO", - LengthOp::VarRlp => "VAR_RLP", - LengthOp::Fixed32Big => "FIXED32_BIG", - LengthOp::Fixed32Little => "FIXED32_LITTLE", - LengthOp::Fixed64Big => "FIXED64_BIG", - LengthOp::Fixed64Little => "FIXED64_LITTLE", - LengthOp::Require32Bytes => "REQUIRE_32_BYTES", - LengthOp::Require64Bytes => "REQUIRE_64_BYTES", + Self::NoPrefix => "NO_PREFIX", + Self::VarProto => "VAR_PROTO", + Self::VarRlp => "VAR_RLP", + Self::Fixed32Big => "FIXED32_BIG", + Self::Fixed32Little => "FIXED32_LITTLE", + Self::Fixed64Big => "FIXED64_BIG", + Self::Fixed64Little => "FIXED64_LITTLE", + Self::Require32Bytes => "REQUIRE_32_BYTES", + Self::Require64Bytes => "REQUIRE_64_BYTES", } } /// Creates an enum from field names used in the ProtoBuf definition.