diff --git a/.github/workflows/ci-pre-commit.yml b/.github/workflows/ci-pre-commit.yml index dbe39baa5b..fb9d4e28a5 100644 --- a/.github/workflows/ci-pre-commit.yml +++ b/.github/workflows/ci-pre-commit.yml @@ -37,6 +37,11 @@ jobs: profile: minimal toolchain: nightly-2024-08-04 components: rustfmt, clippy + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.82.0 + components: rustfmt, clippy - name: Install protoc uses: arduino/setup-protoc@v3 - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a478c50e63..8864297e44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,7 @@ repos: - id: cargo-clippy-hermes name: Cargo clippy for Hermes language: "rust" - entry: cargo +nightly-2024-03-26 clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings + entry: cargo +1.82.0 clippy --manifest-path ./apps/hermes/server/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings pass_filenames: false files: apps/hermes # Hooks for Fortuna diff --git a/apps/hermes/server/Cargo.lock b/apps/hermes/server/Cargo.lock index 798405fd56..4f115df265 100644 --- a/apps/hermes/server/Cargo.lock +++ b/apps/hermes/server/Cargo.lock @@ -5243,9 +5243,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -5264,9 +5264,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", diff --git a/apps/hermes/server/Dockerfile b/apps/hermes/server/Dockerfile index c35332c5f1..25a69ea9c0 100644 --- a/apps/hermes/server/Dockerfile +++ b/apps/hermes/server/Dockerfile @@ -1,15 +1,9 @@ -# The rust version itself is not so important as we install a fixed -# nightly version. We use the latest stable version to get the latest -# updates and dependencies. -FROM rust:1.77.0 AS build +FROM rust:1.82.0 AS build # Install OS packages RUN apt-get update && apt-get install --yes \ build-essential curl clang libssl-dev protobuf-compiler -# Set default toolchain -RUN rustup default nightly-2024-03-26 - # Build WORKDIR /src COPY apps/hermes/server apps/hermes/server @@ -20,7 +14,7 @@ WORKDIR /src/apps/hermes/server RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release -FROM rust:1.77.0 +FROM rust:1.82.0 # Copy artifacts from other images COPY --from=build /src/apps/hermes/server/target/release/hermes /usr/local/bin/ diff --git a/apps/hermes/server/rust-toolchain b/apps/hermes/server/rust-toolchain index 62d16ee6bd..2e2b8c8521 100644 --- a/apps/hermes/server/rust-toolchain +++ b/apps/hermes/server/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2024-03-26" +channel = "1.82.0" diff --git a/apps/hermes/server/src/main.rs b/apps/hermes/server/src/main.rs index b43ad1bfba..7e419556a4 100644 --- a/apps/hermes/server/src/main.rs +++ b/apps/hermes/server/src/main.rs @@ -1,6 +1,3 @@ -#![feature(never_type)] -#![feature(btree_cursors)] - use { anyhow::Result, clap::{ diff --git a/apps/hermes/server/src/network/pythnet.rs b/apps/hermes/server/src/network/pythnet.rs index 0762ad20f0..07d8cfae22 100644 --- a/apps/hermes/server/src/network/pythnet.rs +++ b/apps/hermes/server/src/network/pythnet.rs @@ -141,7 +141,7 @@ async fn fetch_bridge_data( } } -pub async fn run(store: Arc, pythnet_ws_endpoint: String) -> Result +pub async fn run(store: Arc, pythnet_ws_endpoint: String) -> Result<()> where S: Aggregates, S: Wormhole, diff --git a/apps/hermes/server/src/network/wormhole.rs b/apps/hermes/server/src/network/wormhole.rs index f8e176cabf..8903d75294 100644 --- a/apps/hermes/server/src/network/wormhole.rs +++ b/apps/hermes/server/src/network/wormhole.rs @@ -140,7 +140,7 @@ where } #[tracing::instrument(skip(opts, state))] -async fn run(opts: RunOptions, state: Arc) -> Result +async fn run(opts: RunOptions, state: Arc) -> Result<()> where S: Wormhole, S: Send + Sync + 'static, diff --git a/apps/hermes/server/src/state/cache.rs b/apps/hermes/server/src/state/cache.rs index cd7ec93a49..5befcbd5f9 100644 --- a/apps/hermes/server/src/state/cache.rs +++ b/apps/hermes/server/src/state/cache.rs @@ -25,7 +25,6 @@ use { HashMap, HashSet, }, - ops::Bound, sync::Arc, }, strum::IntoEnumIterator, @@ -300,8 +299,8 @@ async fn retrieve_message_state( // Get the first element that is greater than or equal to the lookup time. key_cache - .lower_bound(Bound::Included(&lookup_time)) - .peek_next() + .range(lookup_time..) + .next() .map(|(_, v)| v) .cloned() }