Skip to content

Commit

Permalink
Merge pull request #99 from informalsystems/bump-msrv
Browse files Browse the repository at this point in the history
Bump minimum supported Rust version to 1.56.1
  • Loading branch information
romac authored Aug 8, 2022
2 parents 9788227 + f5eaa0a commit cd4abee
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- "/go/pkg/mod"
rust:
docker:
- image: rust:1.51.0
- image: rust:1.56.1
working_directory: ~/proofs/rust
steps:
- checkout:
Expand All @@ -61,7 +61,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- v4-cargo-cache-rust:1.51.0-{{ arch }}-{{ checksum "Cargo.toml" }}
- v4-cargo-cache-rust:1.56.1-{{ arch }}-{{ checksum "Cargo.toml" }}
- run:
name: install protobuf dependencies
command: |
Expand Down Expand Up @@ -91,14 +91,14 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: v4-cargo-cache-rust:1.51.0-{{ arch }}-{{ checksum "Cargo.toml" }}
key: v4-cargo-cache-rust:1.56.1-{{ arch }}-{{ checksum "Cargo.toml" }}
- run:
name: Run all tests
command: cargo test --all

lint-rust:
docker:
- image: rust:1.51.0
- image: rust:1.56.1
working_directory: ~/proofs/rust
steps:
- checkout:
Expand All @@ -108,7 +108,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version; rustup target list --installed
- restore_cache:
keys:
- cargocache-v2-lint-rust:1.51.0-{{ checksum "Cargo.toml" }}
- cargocache-v2-lint-rust:1.56.1-{{ checksum "Cargo.toml" }}
- run:
name: Add rustfmt component
command: rustup component add rustfmt
Expand All @@ -130,4 +130,4 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: cargocache-v2-lint-rust:1.51.0-{{ checksum "Cargo.toml" }}
key: cargocache-v2-lint-rust:1.56.1-{{ checksum "Cargo.toml" }}
3 changes: 2 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
name = "ics23"
version = "0.8.0-alpha"
authors = ["Ethan Frey <ethanfrey@users.noreply.github.com>"]
edition = "2018"
edition = "2021"
exclude = ["codegen"]
description = "Merkle proof verification library - implements Cosmos ICS23 Spec"
repository = "https://github.com/confio/ics23/tree/master/rust"
license = "Apache-2.0"
rust-version = "1.56.1"

[workspace]
members = ["codegen"]
Expand Down
2 changes: 1 addition & 1 deletion rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Unless you modify the protobuf file, you can ignore this step.

## MSRV

The minimum supported Rust version (MSRV) is 1.51.0.
The minimum supported Rust version (MSRV) is 1.56.1.
4 changes: 2 additions & 2 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub use api::{
};
pub use compress::{compress, decompress, is_compressed};
pub use helpers::{Hash, Result};
pub use verify::calculate_existence_root;
pub use host_functions::HostFunctionsProvider;
pub use verify::calculate_existence_root;

#[cfg(feature ="std")]
#[cfg(feature = "std")]
pub use host_functions::host_functions_impl::HostFunctionsManager;
13 changes: 7 additions & 6 deletions rust/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ fn prepare_leaf_data<H: HostFunctionsProvider>(
fn do_hash<H: HostFunctionsProvider>(hash: HashOp, data: &[u8]) -> Hash {
match hash {
HashOp::NoHash => Hash::from(data),
HashOp::Sha256 => Hash::from(H::sha2_256(data).as_slice()),
HashOp::Sha512 => Hash::from(H::sha2_512(data).as_slice()),
HashOp::Keccak => Hash::from(H::sha3_512(data).as_slice()),
HashOp::Ripemd160 => Hash::from(H::ripemd160(data).as_slice()),
HashOp::Bitcoin => Hash::from(H::ripemd160(H::sha2_256(data).as_slice()).as_slice()),
HashOp::Sha512256 => Hash::from(H::sha2_512_truncated(data).as_slice()),
HashOp::Sha256 => Hash::from(H::sha2_256(data)),
HashOp::Sha512 => Hash::from(H::sha2_512(data)),
HashOp::Keccak => Hash::from(H::sha3_512(data)),
HashOp::Ripemd160 => Hash::from(H::ripemd160(data)),
HashOp::Bitcoin => Hash::from(H::ripemd160(&H::sha2_256(data)[..])),
HashOp::Sha512256 => Hash::from(H::sha2_512_truncated(data)),
}
}

Expand Down Expand Up @@ -81,6 +81,7 @@ fn proto_len(length: usize) -> Result<Hash> {
mod tests {
use super::*;
use crate::host_functions::host_functions_impl::HostFunctionsManager;
use sp_std::vec;
use sp_std::vec::Vec;

fn decode(input: &str) -> Vec<u8> {
Expand Down

0 comments on commit cd4abee

Please sign in to comment.