Skip to content

Commit

Permalink
chore: bump msrv and run clippy (#1167)
Browse files Browse the repository at this point in the history
## Summary
latest rust is now 1.79 and also our code was using items supported in
rust 1.76 and the ci is using 1.76.0, so the msrv should be bumped:
```
error: current MSRV (Minimum Supported Rust Version) is `1.73.0` but this item is stable since `1.76.0`
   --> crates/astria-conductor/src/celestia/convert.rs:151:10
    |
151 |           .inspect_err(|err| {
    |  __________^
152 | |             info!(
153 | |                 error = err as &StdError,
154 | |                 target = SubmittedMetadataList::full_name(),
155 | |                 "failed decoding blob bytes; dropping the blob",
156 | |             );
157 | |         })
    | |__________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
```

also ran clippy and fixed the various lint issues.
  • Loading branch information
noot authored Jun 10, 2024
1 parent 684fd74 commit 6902ef3
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: dtolnay/rust-toolchain@1.76.0
- uses: dtolnay/rust-toolchain@1.78.0
with:
components: clippy
- uses: Swatinem/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-bridge-withdrawer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "astria-bridge-withdrawer"
version = "0.1.0"
edition = "2021"
rust-version = "1.73"
rust-version = "1.76"
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-composer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "astria-composer"
version = "0.7.0"
edition = "2021"
rust-version = "1.73"
rust-version = "1.76"
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-composer/src/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct Composer {
/// The map of chain ID to the URLs to which geth collectors should connect.
rollups: HashMap<String, String>,
/// The gRPC server that listens for incoming requests from the collectors via the
/// GrpcCollector service. It also exposes a health service.
/// `GrpcCollector` service. It also exposes a health service.
grpc_server: GrpcServer,
/// Used to signal the Composer to shut down.
shutdown_token: CancellationToken,
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-composer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct Config {
/// The chain ID of the sequencer chain
pub sequencer_chain_id: String,

/// A list of <rollup_name>::<url> pairs
/// A list of `<rollup_name>::<url>` pairs
pub rollups: String,

/// Path to private key for the sequencer account used for signing transactions
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-composer/src/executor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ async fn full_bundle() {

// verify only one signed transaction was received by the mock sequencer
// i.e. only the full bundle was sent and not the second one due to the block timer
let expected_seq_actions = vec![seq0];
let expected_seq_actions = [seq0];
let requests = response_guard.received_requests().await;
assert_eq!(requests.len(), 1);

Expand Down Expand Up @@ -347,7 +347,7 @@ async fn bundle_triggered_by_block_timer() {
.unwrap();

// verify only one signed transaction was received by the mock sequencer
let expected_seq_actions = vec![seq0];
let expected_seq_actions = [seq0];
let requests = response_guard.received_requests().await;
assert_eq!(requests.len(), 1);

Expand Down Expand Up @@ -441,7 +441,7 @@ async fn two_seq_actions_single_bundle() {
.unwrap();

// verify only one signed transaction was received by the mock sequencer
let expected_seq_actions = vec![seq0, seq1];
let expected_seq_actions = [seq0, seq1];
let requests = response_guard.received_requests().await;
assert_eq!(requests.len(), 1);

Expand Down
2 changes: 1 addition & 1 deletion crates/astria-conductor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "astria-conductor"
version = "0.17.0"
edition = "2021"
rust-version = "1.73"
rust-version = "1.76"
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
Expand Down
6 changes: 3 additions & 3 deletions crates/astria-conductor/src/celestia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ struct RunningReader {
/// The next Celestia height that will be fetched.
celestia_next_height: u64,

/// The reference Celestia height. celestia_reference_height + celestia_variance = C is the
/// The reference Celestia height. `celestia_reference_height` + `celestia_variance` = C is the
/// maximum Celestia height up to which Celestia's blobs will be fetched.
/// celestia_reference_height is initialized to the base Celestia height stored in the
/// `celestia_reference_height` is initialized to the base Celestia height stored in the
/// rollup genesis. It is later advanced to that Celestia height from which the next block
/// is derived that will be executed against the rollup (only if greater than the current
/// value; it will never go down).
celestia_reference_height: u64,

/// celestia_variance + celestia_reference_height define the maximum Celestia height from
/// `celestia_variance` + `celestia_reference_height` define the maximum Celestia height from
/// Celestia blobs can be fetched. Set once during initialization to the value stored in
/// the rollup genesis.
celestia_variance: u64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use tonic::{
};

pub struct MockGrpc {
pub _server: JoinHandle<eyre::Result<()>>,
_server: JoinHandle<eyre::Result<()>>,
pub mock_server: MockServer,
pub local_addr: SocketAddr,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "astria-core"
version = "0.1.0"
edition = "2021"
rust-version = "1.73"
rust-version = "1.76"
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-core/src/primitive/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ impl std::fmt::Display for Address {
/// It is the responsibility of the caller to ensure that the iterable is
/// deterministic. Prefer types like `Vec`, `BTreeMap` or `IndexMap` over
/// `HashMap`.
pub fn derive_merkle_tree_from_rollup_txs<'a, T: 'a, U: 'a>(rollup_ids_to_txs: T) -> merkle::Tree
pub fn derive_merkle_tree_from_rollup_txs<'a, T, U>(rollup_ids_to_txs: T) -> merkle::Tree
where
T: IntoIterator<Item = (&'a RollupId, &'a U)>,
U: AsRef<[Vec<u8>]> + 'a + ?Sized,
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-core/src/sequencerblock/v1alpha1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
},
};

pub(crate) fn are_rollup_ids_included<'a, TRollupIds: 'a>(
pub(crate) fn are_rollup_ids_included<TRollupIds>(
ids: TRollupIds,
proof: &merkle::Proof,
data_hash: [u8; 32],
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-sequencer-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "astria-sequencer-client"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.73"
rust-version = "1.76"
repository = "https://github.com/astriaorg/astria"
homepage = "https://astria.org"

Expand Down
2 changes: 1 addition & 1 deletion crates/astria-sequencer-relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "astria-sequencer-relayer"
version = "0.14.0"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.73"
rust-version = "1.76"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
homepage = "https://astria.org"
Expand Down
1 change: 0 additions & 1 deletion crates/astria-sequencer-relayer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod metrics_init;
pub(crate) mod relayer;
pub mod sequencer_relayer;
pub(crate) mod utils;
pub(crate) mod validator;

pub use build_info::BUILD_INFO;
pub use config::{
Expand Down
13 changes: 1 addition & 12 deletions crates/astria-sequencer-relayer/src/relayer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ use tracing::{
Span,
};

use crate::{
validator::Validator,
IncludeRollup,
};
use crate::IncludeRollup;

mod builder;
mod celestia_client;
Expand Down Expand Up @@ -370,11 +367,3 @@ fn spawn_submitter(
);
(tokio::spawn(submitter.run()), handle)
}

struct ReportValidator<'a>(&'a Validator);

impl<'a> std::fmt::Display for ReportValidator<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("{}", self.0.address))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,15 @@ where
.serialize(serializer)
}

fn serialize_sequencer_heights<'a, I: 'a, S>(heights: I, serializer: S) -> Result<S::Ok, S::Error>
fn serialize_sequencer_heights<'a, I, S>(heights: I, serializer: S) -> Result<S::Ok, S::Error>
where
I: IntoIterator<Item = &'a SequencerHeight>,
S: serde::ser::Serializer,
{
serializer.collect_seq(heights.into_iter().map(tendermint::block::Height::value))
}

fn serialize_included_rollups<'a, I: 'a, S>(rollups: I, serializer: S) -> Result<S::Ok, S::Error>
fn serialize_included_rollups<'a, I, S>(rollups: I, serializer: S) -> Result<S::Ok, S::Error>
where
I: IntoIterator<Item = (&'a RollupId, &'a Namespace)>,
S: serde::ser::Serializer,
Expand Down
59 changes: 0 additions & 59 deletions crates/astria-sequencer-relayer/src/validator.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const GET_TX_GRPC_NAME: &str = "get_tx";
const BROADCAST_TX_GRPC_NAME: &str = "broadcast_tx";

pub struct MockCelestiaAppServer {
pub _server: JoinHandle<eyre::Result<()>>,
_server: JoinHandle<eyre::Result<()>>,
pub mock_server: MockServer,
pub local_addr: SocketAddr,
pub namespaces: Arc<Mutex<Vec<Namespace>>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const GET_SEQUENCER_BLOCK_GRPC_NAME: &str = "get_sequencer_block";
const GET_FILTERED_SEQUENCER_BLOCK_GRPC_NAME: &str = "get_filtered_sequencer_block";

pub struct MockSequencerServer {
pub _server: JoinHandle<eyre::Result<()>>,
_server: JoinHandle<eyre::Result<()>>,
pub mock_server: MockServer,
pub local_addr: SocketAddr,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "astria-sequencer"
version = "0.13.0"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.73"
rust-version = "1.76"
readme = "README.md"
repository = "https://github.com/astriaorg/astria"
homepage = "https://astria.org"
Expand Down

0 comments on commit 6902ef3

Please sign in to comment.