diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4388d2e707..2f676e8cd6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,10 +70,10 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-09-15 + toolchain: nightly-2024-10-11 components: rustfmt - name: run rustfmt - run: cargo +nightly-2024-09-15 fmt --all -- --check + run: cargo +nightly-2024-10-11 fmt --all -- --check toml: runs-on: ubuntu-22.04 diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 3d4c52c6d9..fedbd889ca 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -14,7 +14,7 @@ env: REGISTRY: ghcr.io FULL_REF: ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || github.ref }} # This must match the entry in rust-toolchain.toml at the repository root - RUSTUP_TOOLCHAIN: "1.81.0" + RUSTUP_TOOLCHAIN: "1.83.0" jobs: upload-binaries: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ebe04560b..12aa27d1bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ env: RUSTFLAGS: "-D warnings -D unreachable-pub --cfg tokio_unstable" # This must match the entry in rust-toolchain.toml at the repository root - RUSTUP_TOOLCHAIN: "1.81.0" + RUSTUP_TOOLCHAIN: "1.83.0" on: pull_request: merge_group: diff --git a/crates/astria-bridge-contracts/Cargo.toml b/crates/astria-bridge-contracts/Cargo.toml index a398dc9d2a..ec539e6189 100644 --- a/crates/astria-bridge-contracts/Cargo.toml +++ b/crates/astria-bridge-contracts/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-bridge-contracts" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/astria-bridge-withdrawer/CHANGELOG.md b/crates/astria-bridge-withdrawer/CHANGELOG.md index 59090f4cd0..792abcab92 100644 --- a/crates/astria-bridge-withdrawer/CHANGELOG.md +++ b/crates/astria-bridge-withdrawer/CHANGELOG.md @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.1] - 2024-11-01 +### Changed + +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). + ### Fixed - Set `batch_total_settled_value` metric to 0 when no withdrawals are settled [#1778](https://github.com/astriaorg/astria/pull/1768) diff --git a/crates/astria-bridge-withdrawer/Cargo.toml b/crates/astria-bridge-withdrawer/Cargo.toml index f5f50a2cc4..103f23ae8e 100644 --- a/crates/astria-bridge-withdrawer/Cargo.toml +++ b/crates/astria-bridge-withdrawer/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-bridge-withdrawer" version = "1.0.1" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-build-info/Cargo.toml b/crates/astria-build-info/Cargo.toml index ceab67fe22..a6b7434702 100644 --- a/crates/astria-build-info/Cargo.toml +++ b/crates/astria-build-info/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-build-info" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/astria-cli/CHANGELOG.md b/crates/astria-cli/CHANGELOG.md index 7cadb8c69a..4d35fa1f0e 100644 --- a/crates/astria-cli/CHANGELOG.md +++ b/crates/astria-cli/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Update `idna` dependency to resolve cargo audit warning [#1869](https://github.com/astriaorg/astria/pull/1869). - Remove default values from `--sequencer.chain-id` and `--sequencer-url` arguments [#1792](https://github.com/astriaorg/astria/pull/1792) diff --git a/crates/astria-cli/Cargo.toml b/crates/astria-cli/Cargo.toml index eabf1c69b2..0dd1fca9fa 100644 --- a/crates/astria-cli/Cargo.toml +++ b/crates/astria-cli/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-cli" version = "0.5.1" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-composer/CHANGELOG.md b/crates/astria-composer/CHANGELOG.md index 52a945378c..5891bd7f5c 100644 --- a/crates/astria-composer/CHANGELOG.md +++ b/crates/astria-composer/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Bump penumbra dependencies [#1740](https://github.com/astriaorg/astria/pull/1740). ## [1.0.0-rc.2] - 2024-10-23 diff --git a/crates/astria-composer/Cargo.toml b/crates/astria-composer/Cargo.toml index 5c62d2de7d..ac17b45de7 100644 --- a/crates/astria-composer/Cargo.toml +++ b/crates/astria-composer/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-composer" version = "1.0.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-composer/src/executor/bundle_factory/mod.rs b/crates/astria-composer/src/executor/bundle_factory/mod.rs index f35eb89d95..81652d86b9 100644 --- a/crates/astria-composer/src/executor/bundle_factory/mod.rs +++ b/crates/astria-composer/src/executor/bundle_factory/mod.rs @@ -36,7 +36,7 @@ enum SizedBundleError { pub(super) struct SizedBundleReport<'a>(pub(super) &'a SizedBundle); -impl<'a> Serialize for SizedBundleReport<'a> { +impl Serialize for SizedBundleReport<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -277,7 +277,7 @@ pub(super) struct NextFinishedBundle<'a> { bundle_factory: &'a mut BundleFactory, } -impl<'a> NextFinishedBundle<'a> { +impl NextFinishedBundle<'_> { pub(super) fn pop(self) -> SizedBundle { self.bundle_factory .finished diff --git a/crates/astria-conductor/CHANGELOG.md b/crates/astria-conductor/CHANGELOG.md index b9de90e6d4..687145fa53 100644 --- a/crates/astria-conductor/CHANGELOG.md +++ b/crates/astria-conductor/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Bump penumbra dependencies [#1740](https://github.com/astriaorg/astria/pull/1740). ## [1.0.0-rc.2] - 2024-10-23 diff --git a/crates/astria-conductor/Cargo.toml b/crates/astria-conductor/Cargo.toml index 8dc3f608a8..7934612df9 100644 --- a/crates/astria-conductor/Cargo.toml +++ b/crates/astria-conductor/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-conductor" version = "1.0.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-conductor/src/block_cache.rs b/crates/astria-conductor/src/block_cache.rs index 344d2bbec5..799b31eb2d 100644 --- a/crates/astria-conductor/src/block_cache.rs +++ b/crates/astria-conductor/src/block_cache.rs @@ -105,7 +105,9 @@ impl BlockCache { pub(crate) enum Error { #[error("block at sequencer height {height} already in cache")] Occupied { height: u64 }, - #[error("block too old: expect sequencer height {current_height} or newer, got {block_height}")] + #[error( + "block too old: expect sequencer height {current_height} or newer, got {block_height}" + )] Old { block_height: u64, current_height: u64, @@ -120,7 +122,7 @@ pin_project! { } } -impl<'a, T> Future for NextBlock<'a, T> { +impl Future for NextBlock<'_, T> { type Output = Option; fn poll( diff --git a/crates/astria-conductor/src/celestia/block_verifier.rs b/crates/astria-conductor/src/celestia/block_verifier.rs index 7b580b954e..b7d9e206ea 100644 --- a/crates/astria-conductor/src/celestia/block_verifier.rs +++ b/crates/astria-conductor/src/celestia/block_verifier.rs @@ -529,11 +529,9 @@ mod tests { &tendermint::chain::Id::try_from("test-chain-g3ejvw").unwrap(), ); assert!(result.is_err()); - assert!( - result - .unwrap_err() - .to_string() - .contains("commit voting power is less than 2/3 of total voting power") - ); + assert!(result + .unwrap_err() + .to_string() + .contains("commit voting power is less than 2/3 of total voting power")); } } diff --git a/crates/astria-conductor/src/celestia/reporting.rs b/crates/astria-conductor/src/celestia/reporting.rs index cd16454b6f..684be8a326 100644 --- a/crates/astria-conductor/src/celestia/reporting.rs +++ b/crates/astria-conductor/src/celestia/reporting.rs @@ -12,7 +12,7 @@ use super::{ }; pub(super) struct ReportReconstructedBlocks<'a>(pub(super) &'a ReconstructedBlocks); -impl<'a> Serialize for ReportReconstructedBlocks<'a> { +impl Serialize for ReportReconstructedBlocks<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -26,7 +26,7 @@ impl<'a> Serialize for ReportReconstructedBlocks<'a> { } struct ReportReconstructedBlocksSeq<'a>(&'a [ReconstructedBlock]); -impl<'a> Serialize for ReportReconstructedBlocksSeq<'a> { +impl Serialize for ReportReconstructedBlocksSeq<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -40,7 +40,7 @@ impl<'a> Serialize for ReportReconstructedBlocksSeq<'a> { } struct ReportReconstructedBlock<'a>(&'a ReconstructedBlock); -impl<'a> Serialize for ReportReconstructedBlock<'a> { +impl Serialize for ReportReconstructedBlock<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crates/astria-conductor/src/executor/mod.rs b/crates/astria-conductor/src/executor/mod.rs index 8c3155ca8b..bbd2ad64ed 100644 --- a/crates/astria-conductor/src/executor/mod.rs +++ b/crates/astria-conductor/src/executor/mod.rs @@ -153,6 +153,8 @@ impl Handle { Ok(()) } + // TODO(https://github.com/astriaorg/astria/issues/1858): box the large variant to avoid large error size + #[expect(clippy::result_large_err, reason = "should be fixed")] pub(crate) fn try_send_firm_block( &self, block: ReconstructedBlock, diff --git a/crates/astria-conductor/src/sequencer/reporting.rs b/crates/astria-conductor/src/sequencer/reporting.rs index 779eb5762e..25dafd3a31 100644 --- a/crates/astria-conductor/src/sequencer/reporting.rs +++ b/crates/astria-conductor/src/sequencer/reporting.rs @@ -13,7 +13,7 @@ use serde::ser::{ }; pub(super) struct ReportFilteredSequencerBlock<'a>(pub(super) &'a FilteredSequencerBlock); -impl<'a> Serialize for ReportFilteredSequencerBlock<'a> { +impl Serialize for ReportFilteredSequencerBlock<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -27,7 +27,7 @@ impl<'a> Serialize for ReportFilteredSequencerBlock<'a> { struct ReportRollups<'a>(&'a IndexMap); -impl<'a> Serialize for ReportRollups<'a> { +impl Serialize for ReportRollups<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crates/astria-config/Cargo.toml b/crates/astria-config/Cargo.toml index 6672b75287..a8642f478b 100644 --- a/crates/astria-config/Cargo.toml +++ b/crates/astria-config/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-config" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-core-address/src/lib.rs b/crates/astria-core-address/src/lib.rs index 3685222d87..43bbe74960 100644 --- a/crates/astria-core-address/src/lib.rs +++ b/crates/astria-core-address/src/lib.rs @@ -214,7 +214,7 @@ impl Builder { } } -impl<'a, 'b, TFormat, TBytesIter> Builder, WithPrefix<'b>> +impl Builder, WithPrefix<'_>> where TBytesIter: IntoIterator, TBytesIter::IntoIter: ExactSizeIterator, diff --git a/crates/astria-core-crypto/Cargo.toml b/crates/astria-core-crypto/Cargo.toml index 4e8b94bf7c..264cff2dfa 100644 --- a/crates/astria-core-crypto/Cargo.toml +++ b/crates/astria-core-crypto/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-core-crypto" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-core/CHANGELOG.md b/crates/astria-core/CHANGELOG.md index b24c5b2855..f2dcb105f5 100644 --- a/crates/astria-core/CHANGELOG.md +++ b/crates/astria-core/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Move `astria_core::crypto` to `astria-core-crypto` and reexport `astria_core_crypto as crypto` (this change is transparent) [#1800](https://github.com/astriaorg/astria/pull/1800/). diff --git a/crates/astria-core/Cargo.toml b/crates/astria-core/Cargo.toml index b816e3fdf5..7003f1d9f6 100644 --- a/crates/astria-core/Cargo.toml +++ b/crates/astria-core/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-core" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-core/src/generated/mod.rs b/crates/astria-core/src/generated/mod.rs index 41e186e2d7..1fef28c5e7 100644 --- a/crates/astria-core/src/generated/mod.rs +++ b/crates/astria-core/src/generated/mod.rs @@ -2,7 +2,8 @@ unreachable_pub, clippy::pedantic, clippy::needless_borrows_for_generic_args, - clippy::arithmetic_side_effects + clippy::arithmetic_side_effects, + clippy::needless_lifetimes )] //! Files generated using [`tonic-build`] and [`buf`] via the [`tools/protobuf-compiler`] //! build tool. diff --git a/crates/astria-core/src/primitive/v1/asset/denom.rs b/crates/astria-core/src/primitive/v1/asset/denom.rs index f85511bd54..0c1ead3558 100644 --- a/crates/astria-core/src/primitive/v1/asset/denom.rs +++ b/crates/astria-core/src/primitive/v1/asset/denom.rs @@ -99,13 +99,13 @@ impl From for Denom { } } -impl<'a> From<&'a IbcPrefixed> for Denom { +impl From<&IbcPrefixed> for Denom { fn from(value: &IbcPrefixed) -> Self { Self::IbcPrefixed(*value) } } -impl<'a> From<&'a TracePrefixed> for Denom { +impl From<&TracePrefixed> for Denom { fn from(value: &TracePrefixed) -> Self { Self::TracePrefixed(value.clone()) } @@ -117,7 +117,7 @@ impl From for IbcPrefixed { } } -impl<'a> From<&'a TracePrefixed> for IbcPrefixed { +impl From<&TracePrefixed> for IbcPrefixed { fn from(value: &TracePrefixed) -> Self { value.to_ibc_prefixed() } @@ -129,13 +129,13 @@ impl From for IbcPrefixed { } } -impl<'a> From<&'a Denom> for IbcPrefixed { +impl From<&Denom> for IbcPrefixed { fn from(value: &Denom) -> Self { value.to_ibc_prefixed() } } -impl<'a> From<&'a IbcPrefixed> for IbcPrefixed { +impl From<&IbcPrefixed> for IbcPrefixed { fn from(value: &IbcPrefixed) -> Self { *value } diff --git a/crates/astria-core/src/primitive/v1/u128.rs b/crates/astria-core/src/primitive/v1/u128.rs index 581f5b5ecc..e6a0edd145 100644 --- a/crates/astria-core/src/primitive/v1/u128.rs +++ b/crates/astria-core/src/primitive/v1/u128.rs @@ -3,24 +3,8 @@ use crate::generated::astria::primitive::v1::Uint128; impl From for Uint128 { fn from(primitive: u128) -> Self { - let [ - h0, - h1, - h2, - h3, - h4, - h5, - h6, - h7, - l0, - l1, - l2, - l3, - l4, - l5, - l6, - l7, - ] = primitive.to_be_bytes(); + let [h0, h1, h2, h3, h4, h5, h6, h7, l0, l1, l2, l3, l4, l5, l6, l7] = + primitive.to_be_bytes(); let lo = u64::from_be_bytes([l0, l1, l2, l3, l4, l5, l6, l7]); let hi = u64::from_be_bytes([h0, h1, h2, h3, h4, h5, h6, h7]); Self { diff --git a/crates/astria-core/src/protocol/genesis/v1.rs b/crates/astria-core/src/protocol/genesis/v1.rs index 2dac7e1aae..d6102f23d3 100644 --- a/crates/astria-core/src/protocol/genesis/v1.rs +++ b/crates/astria-core/src/protocol/genesis/v1.rs @@ -152,12 +152,6 @@ impl Protobuf for GenesisAppState { type Error = GenesisAppStateError; type Raw = raw::GenesisAppState; - // TODO (https://github.com/astriaorg/astria/issues/1580): remove this once Rust is upgraded to/past 1.83 - #[expect( - clippy::allow_attributes, - clippy::allow_attributes_without_reason, - reason = "false positive on `allowed_fee_assets` due to \"allow\" in the name" - )] fn try_from_raw_ref(raw: &Self::Raw) -> Result { let Self::Raw { address_prefixes, diff --git a/crates/astria-eyre/Cargo.toml b/crates/astria-eyre/Cargo.toml index 6ee2bb106a..e0a63967e3 100644 --- a/crates/astria-eyre/Cargo.toml +++ b/crates/astria-eyre/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-eyre" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/astria-grpc-mock-test/Cargo.toml b/crates/astria-grpc-mock-test/Cargo.toml index 1767b42a7f..be5638119d 100644 --- a/crates/astria-grpc-mock-test/Cargo.toml +++ b/crates/astria-grpc-mock-test/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-grpc-mock-test" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/astria-grpc-mock-test/src/lib.rs b/crates/astria-grpc-mock-test/src/lib.rs index 6dad4f20cb..c1f9a2287e 100644 --- a/crates/astria-grpc-mock-test/src/lib.rs +++ b/crates/astria-grpc-mock-test/src/lib.rs @@ -8,7 +8,8 @@ #[expect( clippy::allow_attributes, clippy::allow_attributes_without_reason, - reason = "cannot prevent generated files from having allow attributes" + clippy::needless_lifetimes, + reason = "cannot prevent generated files from having allow attributes or specific lifetimes" )] pub mod health { include!("generated/grpc.health.v1.rs"); diff --git a/crates/astria-grpc-mock/Cargo.toml b/crates/astria-grpc-mock/Cargo.toml index 97f7c6a5b8..cb66c612d8 100644 --- a/crates/astria-grpc-mock/Cargo.toml +++ b/crates/astria-grpc-mock/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-grpc-mock" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/astria-grpc-mock/src/mock_server.rs b/crates/astria-grpc-mock/src/mock_server.rs index dcbad3d806..4f78077e07 100644 --- a/crates/astria-grpc-mock/src/mock_server.rs +++ b/crates/astria-grpc-mock/src/mock_server.rs @@ -178,7 +178,7 @@ impl MockServer { if let VerificationOutcome::Failure(failed_verifications) = self.state.read().await.verify() { let received_requests_message = - received_requests_message(&self.state.read().await.received_requests); + received_requests_message(self.state.read().await.received_requests.as_ref()); let verifications_errors: String = failed_verifications.iter().fold(String::new(), |mut s, m| { @@ -366,7 +366,8 @@ impl Drop for MockGuard { if report.is_satisfied() { state.mock_set.deactivate(*mock_id); } else { - let received_requests_message = received_requests_message(&state.received_requests); + let received_requests_message = + received_requests_message(state.received_requests.as_ref()); let verifications_error = format!("- {}\n", report.error_message()); let error_message = format!( @@ -385,7 +386,7 @@ impl Drop for MockGuard { } fn received_requests_message( - received_requests: &Option>, + received_requests: Option<&Vec<(&'static str, MockRequest)>>, ) -> String { if let Some(received_requests) = received_requests { if received_requests.is_empty() { diff --git a/crates/astria-merkle/Cargo.toml b/crates/astria-merkle/Cargo.toml index 19af2d1aa3..be01e6458c 100644 --- a/crates/astria-merkle/Cargo.toml +++ b/crates/astria-merkle/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-merkle" version = "1.0.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" repository = "https://github.com/astriaorg/astria" homepage = "https://astria.org" diff --git a/crates/astria-merkle/src/audit.rs b/crates/astria-merkle/src/audit.rs index ce524e0a74..0963f72230 100644 --- a/crates/astria-merkle/src/audit.rs +++ b/crates/astria-merkle/src/audit.rs @@ -141,7 +141,7 @@ impl<'a, TLeaf, TRoot> Audit<'a, TLeaf, TRoot> { } } -impl<'a, TRoot> Audit<'a, WithLeafHash, TRoot> { +impl Audit<'_, WithLeafHash, TRoot> { /// Reconstruct the root hash using the leaf hash stored in the [`WithLeafHash`] state. /// /// # Examples @@ -171,7 +171,7 @@ impl<'a, TRoot> Audit<'a, WithLeafHash, TRoot> { } } -impl<'a> Audit<'a, WithLeafHash, WithRoot> { +impl Audit<'_, WithLeafHash, WithRoot> { /// Check if the leaf is included in the tree using the internal proof. /// /// This method reconstructs a Merkle tree root starting from the @@ -189,16 +189,14 @@ impl<'a> Audit<'a, WithLeafHash, WithRoot> { /// tree.build_leaf().write(&[4, 2]).write(b"answer"); /// let root = tree.root(); /// let proof = tree.construct_proof(3).expect("leaf 4 is inside the tree"); - /// assert!( - /// proof - /// .audit() - /// .with_root(root) - /// .with_leaf_builder() - /// .write(&[4, 2]) - /// .write(b"answer") - /// .finish_leaf() - /// .perform() - /// ); + /// assert!(proof + /// .audit() + /// .with_root(root) + /// .with_leaf_builder() + /// .write(&[4, 2]) + /// .write(b"answer") + /// .finish_leaf() + /// .perform()); /// ``` #[must_use = "verify the audit result"] pub fn perform(&self) -> bool { @@ -497,18 +495,16 @@ impl Proof { /// .write(b"42"); /// let root = tree.root(); /// let proof = tree.construct_proof(3).expect("leaf 4 is in the tree"); - /// assert!( - /// proof - /// .audit() - /// .with_root(root) - /// .with_leaf_builder() - /// .write(&[42; 1]) - /// .write(&[1, 1]) - /// .write(&vec![42; 3]) - /// .write(b"42") - /// .finish_leaf() - /// .perform() - /// ); + /// assert!(proof + /// .audit() + /// .with_root(root) + /// .with_leaf_builder() + /// .write(&[42; 1]) + /// .write(&[1, 1]) + /// .write(&vec![42; 3]) + /// .write(b"42") + /// .finish_leaf() + /// .perform()); /// ``` #[must_use = "an audit must be performed to be useful"] pub fn audit(&self) -> Audit { diff --git a/crates/astria-merkle/src/lib.rs b/crates/astria-merkle/src/lib.rs index 9ca82b184a..4d89f12955 100644 --- a/crates/astria-merkle/src/lib.rs +++ b/crates/astria-merkle/src/lib.rs @@ -39,18 +39,16 @@ //! .construct_proof(4) //! .expect("leaf 5 must be inside the tree"); //! -//! assert!( -//! proof -//! .audit() -//! .with_root(root) -//! .with_leaf_builder() -//! .write(&[42; 1]) -//! .write(&[1, 1]) -//! .write(&vec![42; 3]) -//! .write(b"42") -//! .finish_leaf() -//! .perform() -//! ); +//! assert!(proof +//! .audit() +//! .with_root(root) +//! .with_leaf_builder() +//! .write(&[42; 1]) +//! .write(&[1, 1]) +//! .write(&vec![42; 3]) +//! .write(b"42") +//! .finish_leaf() +//! .perform()); //! ``` //! //! # Indexing scheme @@ -184,7 +182,7 @@ pub struct LeafBuilder<'a> { hasher: Option, } -impl<'a> LeafBuilder<'a> { +impl LeafBuilder<'_> { /// Takes ownership of the builder, dropping it. /// /// This method causes the leaf builder to go out of scope, causing it @@ -232,7 +230,7 @@ impl<'a> LeafBuilder<'a> { } } -impl<'a> Drop for LeafBuilder<'a> { +impl Drop for LeafBuilder<'_> { fn drop(&mut self) { let Self { tree, diff --git a/crates/astria-sequencer-client/Cargo.toml b/crates/astria-sequencer-client/Cargo.toml index 1fa879ff12..1807b11c6c 100644 --- a/crates/astria-sequencer-client/Cargo.toml +++ b/crates/astria-sequencer-client/Cargo.toml @@ -3,7 +3,7 @@ name = "astria-sequencer-client" version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" -rust-version = "1.81.0" +rust-version = "1.83.0" repository = "https://github.com/astriaorg/astria" homepage = "https://astria.org" diff --git a/crates/astria-sequencer-client/src/tests/http.rs b/crates/astria-sequencer-client/src/tests/http.rs index 92f02124cd..9f0cca97da 100644 --- a/crates/astria-sequencer-client/src/tests/http.rs +++ b/crates/astria-sequencer-client/src/tests/http.rs @@ -151,15 +151,13 @@ fn create_signed_transaction() -> Transaction { .unwrap(); let alice_key = SigningKey::from(alice_secret_bytes); - let actions = vec![ - Transfer { - to: bob_address(), - amount: 333_333, - asset: "nria".parse().unwrap(), - fee_asset: "nria".parse().unwrap(), - } - .into(), - ]; + let actions = vec![Transfer { + to: bob_address(), + amount: 333_333, + asset: "nria".parse().unwrap(), + fee_asset: "nria".parse().unwrap(), + } + .into()]; TransactionBody::builder() .actions(actions) .chain_id("test") diff --git a/crates/astria-sequencer-relayer/CHANGELOG.md b/crates/astria-sequencer-relayer/CHANGELOG.md index b2afb363c8..0bd6e4fa60 100644 --- a/crates/astria-sequencer-relayer/CHANGELOG.md +++ b/crates/astria-sequencer-relayer/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Bump penumbra dependencies [#1740](https://github.com/astriaorg/astria/pull/1740). ## [1.0.0-rc.2] - 2024-10-23 diff --git a/crates/astria-sequencer-relayer/Cargo.toml b/crates/astria-sequencer-relayer/Cargo.toml index a0eed0eb64..1d0589e932 100644 --- a/crates/astria-sequencer-relayer/Cargo.toml +++ b/crates/astria-sequencer-relayer/Cargo.toml @@ -3,7 +3,7 @@ name = "astria-sequencer-relayer" version = "1.0.0" edition = "2021" license = "MIT OR Apache-2.0" -rust-version = "1.81.0" +rust-version = "1.83.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" homepage = "https://astria.org" diff --git a/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs b/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs index 82d425ff89..ad00a3cbd0 100644 --- a/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs +++ b/crates/astria-sequencer-relayer/src/relayer/write/conversion.rs @@ -387,7 +387,7 @@ pin_project! { } } -impl<'a> Future for TakeSubmission<'a> { +impl Future for TakeSubmission<'_> { type Output = Option; fn poll(self: Pin<&mut Self>, _: &mut std::task::Context<'_>) -> Poll { @@ -441,6 +441,7 @@ fn sequencer_namespace(metadata: &SubmittedMetadata) -> Namespace { ) } +#[expect(clippy::ref_option, reason = "necessary for serde impl")] fn serialize_opt_namespace( namespace: &Option, serializer: S, diff --git a/crates/astria-sequencer-relayer/src/relayer/write/mod.rs b/crates/astria-sequencer-relayer/src/relayer/write/mod.rs index bed9880a20..c967ab5fbe 100644 --- a/crates/astria-sequencer-relayer/src/relayer/write/mod.rs +++ b/crates/astria-sequencer-relayer/src/relayer/write/mod.rs @@ -93,6 +93,8 @@ impl BlobSubmitterHandle { /// Send a block to the blob submitter immediately. /// /// This is a thin wrapper around [`mpsc::Sender::try_send`]. + // TODO(https://github.com/astriaorg/astria/issues/1860) + #[expect(clippy::result_large_err, reason = "should be fixed")] pub(super) fn try_send( &self, block: SequencerBlock, diff --git a/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs b/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs index 33ff34d989..9a1405bc2a 100644 --- a/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs +++ b/crates/astria-sequencer-relayer/tests/blackbox/helpers/mock_sequencer_server.rs @@ -96,6 +96,8 @@ impl MockSequencerServer { } } +// TODO(https://github.com/astriaorg/astria/issues/1859): box enum variants to avoid large sizes +#[expect(clippy::large_enum_variant, reason = "should be fixed")] pub enum SequencerBlockToMount { GoodAtHeight(u32), BadAtHeight(u32), diff --git a/crates/astria-sequencer-utils/Cargo.toml b/crates/astria-sequencer-utils/Cargo.toml index 2c2974577f..992a473948 100644 --- a/crates/astria-sequencer-utils/Cargo.toml +++ b/crates/astria-sequencer-utils/Cargo.toml @@ -3,7 +3,7 @@ name = "astria-sequencer-utils" version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" -rust-version = "1.81.0" +rust-version = "1.83.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" homepage = "https://astria.org" diff --git a/crates/astria-sequencer-utils/src/blob_parser.rs b/crates/astria-sequencer-utils/src/blob_parser.rs index 6fb450ff90..131677019d 100644 --- a/crates/astria-sequencer-utils/src/blob_parser.rs +++ b/crates/astria-sequencer-utils/src/blob_parser.rs @@ -488,17 +488,17 @@ impl Display for RollupTransaction { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { colored_ln(f, "hash", &self.hash)?; colored_ln(f, "nonce", &self.nonce)?; - colored_ln(f, "block hash", none_or_value(&self.block_hash))?; - colored_ln(f, "block number", none_or_value(&self.block_number))?; + colored_ln(f, "block hash", none_or_value(self.block_hash.as_ref()))?; + colored_ln(f, "block number", none_or_value(self.block_number.as_ref()))?; colored_ln( f, "transaction index", - none_or_value(&self.transaction_index), + none_or_value(self.transaction_index.as_ref()), )?; colored_ln(f, "from", &self.from)?; - colored_ln(f, "to", none_or_value(&self.to))?; + colored_ln(f, "to", none_or_value(self.to.as_ref()))?; colored_ln(f, "value", &self.value)?; - colored_ln(f, "gas price", none_or_value(&self.gas_price))?; + colored_ln(f, "gas price", none_or_value(self.gas_price.as_ref()))?; colored_ln(f, "gas", &self.gas)?; colored_ln(f, "input", &self.input)?; colored_ln(f, "v", self.v)?; @@ -788,10 +788,10 @@ fn indent<'a, 'b>(f: &'a mut Formatter<'b>) -> indenter::Indented<'a, Formatter< indented(f).with_str(" ") } -fn none_or_value(maybe_value: &Option) -> String { +fn none_or_value(maybe_value: Option<&T>) -> String { maybe_value .as_ref() - .map_or("none".to_string(), T::to_string) + .map_or("none".to_string(), |o| o.to_string()) } fn colored_label(f: &mut Formatter<'_>, label: &str) -> fmt::Result { diff --git a/crates/astria-sequencer/CHANGELOG.md b/crates/astria-sequencer/CHANGELOG.md index c80e93586f..1a11f3baae 100644 --- a/crates/astria-sequencer/CHANGELOG.md +++ b/crates/astria-sequencer/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump MSRV to 1.83.0 [#1857](https://github.com/astriaorg/astria/pull/1857). - Index all event attributes [#1786](https://github.com/astriaorg/astria/pull/1786). - Consolidate action handling to single module [#1759](https://github.com/astriaorg/astria/pull/1759). - Ensure all deposit assets are trace prefixed [#1807](https://github.com/astriaorg/astria/pull/1807). diff --git a/crates/astria-sequencer/Cargo.toml b/crates/astria-sequencer/Cargo.toml index 56014df011..18458c8907 100644 --- a/crates/astria-sequencer/Cargo.toml +++ b/crates/astria-sequencer/Cargo.toml @@ -3,7 +3,7 @@ name = "astria-sequencer" version = "1.0.0" edition = "2021" license = "MIT OR Apache-2.0" -rust-version = "1.81.0" +rust-version = "1.83.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" homepage = "https://astria.org" diff --git a/crates/astria-sequencer/src/accounts/storage/values.rs b/crates/astria-sequencer/src/accounts/storage/values.rs index ca5f7b3977..9a771823ae 100644 --- a/crates/astria-sequencer/src/accounts/storage/values.rs +++ b/crates/astria-sequencer/src/accounts/storage/values.rs @@ -28,7 +28,7 @@ impl From for u128 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(balance: Balance) -> Self { crate::storage::StoredValue::Accounts(Value(ValueImpl::Balance(balance))) } @@ -61,7 +61,7 @@ impl From for u32 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(nonce: Nonce) -> Self { crate::storage::StoredValue::Accounts(Value(ValueImpl::Nonce(nonce))) } diff --git a/crates/astria-sequencer/src/action_handler/impls/bridge_sudo_change.rs b/crates/astria-sequencer/src/action_handler/impls/bridge_sudo_change.rs index a69775cf5f..ba248e1147 100644 --- a/crates/astria-sequencer/src/action_handler/impls/bridge_sudo_change.rs +++ b/crates/astria-sequencer/src/action_handler/impls/bridge_sudo_change.rs @@ -140,14 +140,12 @@ mod tests { fee_asset: asset.clone(), }; - assert!( - action - .check_and_execute(state) - .await - .unwrap_err() - .to_string() - .contains("unauthorized for bridge sudo change action") - ); + assert!(action + .check_and_execute(state) + .await + .unwrap_err() + .to_string() + .contains("unauthorized for bridge sudo change action")); } #[tokio::test] diff --git a/crates/astria-sequencer/src/action_handler/impls/fee_change.rs b/crates/astria-sequencer/src/action_handler/impls/fee_change.rs index f066ded9ea..842e5bd8dc 100644 --- a/crates/astria-sequencer/src/action_handler/impls/fee_change.rs +++ b/crates/astria-sequencer/src/action_handler/impls/fee_change.rs @@ -197,13 +197,11 @@ mod tests { }); state.put_sudo_address([1; 20]).unwrap(); - assert!( - state - .get_fees::() - .await - .expect("should not error fetching unstored action fees") - .is_none() - ); + assert!(state + .get_fees::() + .await + .expect("should not error fetching unstored action fees") + .is_none()); // Execute an initial fee change tx to store the first version of the fees. let initial_fees = FeeComponents::::new(1, 2); diff --git a/crates/astria-sequencer/src/action_handler/mod.rs b/crates/astria-sequencer/src/action_handler/mod.rs index 09bde22b0e..0921cb82ec 100644 --- a/crates/astria-sequencer/src/action_handler/mod.rs +++ b/crates/astria-sequencer/src/action_handler/mod.rs @@ -45,7 +45,7 @@ pub(crate) trait ActionHandler { async fn check_stateless(&self) -> astria_eyre::eyre::Result<()>; async fn check_and_execute(&self, mut state: S) - -> astria_eyre::eyre::Result<()>; + -> astria_eyre::eyre::Result<()>; } async fn execute_transfer( diff --git a/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs b/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs index 7171bce58d..8890823454 100644 --- a/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs +++ b/crates/astria-sequencer/src/app/benchmark_and_test_utils.rs @@ -89,8 +89,8 @@ pub(crate) fn default_fees() -> astria_core::protocol::genesis::v1::GenesisFees } } -pub(crate) fn proto_genesis_state() --> astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { +pub(crate) fn proto_genesis_state( +) -> astria_core::generated::astria::protocol::genesis::v1::GenesisAppState { use astria_core::generated::astria::protocol::genesis::v1::{ GenesisAppState, IbcParameters, diff --git a/crates/astria-sequencer/src/app/storage/values/block_height.rs b/crates/astria-sequencer/src/app/storage/values/block_height.rs index 29b5298a47..c07102a4da 100644 --- a/crates/astria-sequencer/src/app/storage/values/block_height.rs +++ b/crates/astria-sequencer/src/app/storage/values/block_height.rs @@ -24,7 +24,7 @@ impl From for u64 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(block_height: BlockHeight) -> Self { crate::storage::StoredValue::App(Value(ValueImpl::BlockHeight(block_height))) } diff --git a/crates/astria-sequencer/src/app/storage/values/block_timestamp.rs b/crates/astria-sequencer/src/app/storage/values/block_timestamp.rs index 23aa4cddf3..6a28e3d087 100644 --- a/crates/astria-sequencer/src/app/storage/values/block_timestamp.rs +++ b/crates/astria-sequencer/src/app/storage/values/block_timestamp.rs @@ -49,7 +49,7 @@ impl BorshDeserialize for BlockTimestamp { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(block_timestamp: BlockTimestamp) -> Self { crate::storage::StoredValue::App(Value(ValueImpl::BlockTimestamp(block_timestamp))) } diff --git a/crates/astria-sequencer/src/app/storage/values/chain_id.rs b/crates/astria-sequencer/src/app/storage/values/chain_id.rs index 0547029db4..237f204ec8 100644 --- a/crates/astria-sequencer/src/app/storage/values/chain_id.rs +++ b/crates/astria-sequencer/src/app/storage/values/chain_id.rs @@ -30,13 +30,13 @@ impl<'a> From> for tendermint::chain::Id { } } -impl<'a> BorshSerialize for ChainId<'a> { +impl BorshSerialize for ChainId<'_> { fn serialize(&self, writer: &mut W) -> std::io::Result<()> { self.0.as_str().serialize(writer) } } -impl<'a> BorshDeserialize for ChainId<'a> { +impl BorshDeserialize for ChainId<'_> { fn deserialize_reader(reader: &mut R) -> std::io::Result { let chain_id_str = String::deserialize_reader(reader)?; let chain_id = diff --git a/crates/astria-sequencer/src/app/storage/values/revision_number.rs b/crates/astria-sequencer/src/app/storage/values/revision_number.rs index d238b5b5ee..93e5c42a92 100644 --- a/crates/astria-sequencer/src/app/storage/values/revision_number.rs +++ b/crates/astria-sequencer/src/app/storage/values/revision_number.rs @@ -24,7 +24,7 @@ impl From for u64 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(revision_number: RevisionNumber) -> Self { crate::storage::StoredValue::App(Value(ValueImpl::RevisionNumber(revision_number))) } diff --git a/crates/astria-sequencer/src/app/storage/values/storage_version.rs b/crates/astria-sequencer/src/app/storage/values/storage_version.rs index 933f76b8fb..53e7a6f9ab 100644 --- a/crates/astria-sequencer/src/app/storage/values/storage_version.rs +++ b/crates/astria-sequencer/src/app/storage/values/storage_version.rs @@ -24,7 +24,7 @@ impl From for u64 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(storage_version: StorageVersion) -> Self { crate::storage::StoredValue::App(Value(ValueImpl::StorageVersion(storage_version))) } diff --git a/crates/astria-sequencer/src/app/tests_app/mempool.rs b/crates/astria-sequencer/src/app/tests_app/mempool.rs index 4a30b4460b..a0dafc1898 100644 --- a/crates/astria-sequencer/src/app/tests_app/mempool.rs +++ b/crates/astria-sequencer/src/app/tests_app/mempool.rs @@ -54,9 +54,10 @@ async fn trigger_cleaning() { // create tx which will cause mempool cleaning flag to be set let tx_trigger = TransactionBody::builder() - .actions(vec![ - FeeChange::Transfer(FeeComponents::::new(10, 0)).into(), - ]) + .actions(vec![FeeChange::Transfer(FeeComponents::::new( + 10, 0, + )) + .into()]) .chain_id("test") .try_build() .unwrap() @@ -146,9 +147,10 @@ async fn do_not_trigger_cleaning() { // create tx which will fail execution and not trigger flag // (wrong sudo signer) let tx_fail = TransactionBody::builder() - .actions(vec![ - FeeChange::Transfer(FeeComponents::::new(10, 0)).into(), - ]) + .actions(vec![FeeChange::Transfer(FeeComponents::::new( + 10, 0, + )) + .into()]) .chain_id("test") .try_build() .unwrap() @@ -213,15 +215,13 @@ async fn maintenance_recosting_promotes() { // create tx which will not be included in block due to // having insufficient funds (transaction will be recosted to enable) let tx_fail_recost_funds = TransactionBody::builder() - .actions(vec![ - Transfer { - to: astria_address_from_hex_string(CAROL_ADDRESS), - amount: 1u128, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: astria_address_from_hex_string(CAROL_ADDRESS), + amount: 1u128, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() @@ -243,9 +243,10 @@ async fn maintenance_recosting_promotes() { // create tx which will enable recost tx to pass let tx_recost = TransactionBody::builder() - .actions(vec![ - FeeChange::Transfer(FeeComponents::::new(10, 0)).into(), - ]) + .actions(vec![FeeChange::Transfer(FeeComponents::::new( + 10, 0, + )) + .into()]) .chain_id("test") .try_build() .unwrap() @@ -389,15 +390,13 @@ async fn maintenance_funds_added_promotes() { // create tx that will not be included in block due to // having no funds (will be sent transfer to then enable) let tx_fail_transfer_funds = TransactionBody::builder() - .actions(vec![ - Transfer { - to: astria_address_from_hex_string(BOB_ADDRESS), - amount: 10u128, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: astria_address_from_hex_string(BOB_ADDRESS), + amount: 10u128, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() @@ -419,15 +418,13 @@ async fn maintenance_funds_added_promotes() { // create tx which will enable no funds to pass let tx_fund = TransactionBody::builder() - .actions(vec![ - Transfer { - to: astria_address_from_hex_string(CAROL_ADDRESS), - amount: 22u128, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: astria_address_from_hex_string(CAROL_ADDRESS), + amount: 22u128, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() diff --git a/crates/astria-sequencer/src/app/tests_app/mod.rs b/crates/astria-sequencer/src/app/tests_app/mod.rs index c0cd55b1ca..011b2886ff 100644 --- a/crates/astria-sequencer/src/app/tests_app/mod.rs +++ b/crates/astria-sequencer/src/app/tests_app/mod.rs @@ -244,15 +244,13 @@ async fn app_transfer_block_fees_to_sudo() { let bob_address = astria_address_from_hex_string(BOB_ADDRESS); let amount = 333_333; let tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: bob_address, - amount, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: bob_address, + amount, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -589,28 +587,24 @@ async fn app_prepare_proposal_cometbft_max_bytes_overflow_ok() { // create txs which will cause cometBFT overflow let alice = get_alice_signing_key(); let tx_pass = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 100_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 100_000]), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() .sign(&alice); let tx_overflow = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 100_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 100_000]), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .nonce(1) .try_build() @@ -679,27 +673,23 @@ async fn app_prepare_proposal_sequencer_max_bytes_overflow_ok() { // create txs which will cause sequencer overflow (max is currently 256_000 bytes) let alice = get_alice_signing_key(); let tx_pass = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 200_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 200_000]), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() .sign(&alice); let tx_overflow = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 100_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 100_000]), + fee_asset: nria().into(), + } + .into()]) .nonce(1) .chain_id("test") .try_build() @@ -768,27 +758,23 @@ async fn app_process_proposal_sequencer_max_bytes_overflow_fail() { // create txs which will cause sequencer overflow (max is currently 256_000 bytes) let alice = get_alice_signing_key(); let tx_pass = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 200_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 200_000]), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() .sign(&alice); let tx_overflow = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from([1u8; 32]), - data: Bytes::copy_from_slice(&[1u8; 100_000]), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from([1u8; 32]), + data: Bytes::copy_from_slice(&[1u8; 100_000]), + fee_asset: nria().into(), + } + .into()]) .nonce(1) .chain_id("test") .try_build() @@ -834,12 +820,10 @@ async fn app_process_proposal_transaction_fails_to_execute_fails() { // create txs which will cause transaction execution failure let alice = get_alice_signing_key(); let tx_fail = TransactionBody::builder() - .actions(vec![ - SudoAddressChange { - new_address: astria_address_from_hex_string(BOB_ADDRESS), - } - .into(), - ]) + .actions(vec![SudoAddressChange { + new_address: astria_address_from_hex_string(BOB_ADDRESS), + } + .into()]) .chain_id("test") .try_build() .unwrap() diff --git a/crates/astria-sequencer/src/app/tests_breaking_changes.rs b/crates/astria-sequencer/src/app/tests_breaking_changes.rs index 2118d41d4d..9beb72a955 100644 --- a/crates/astria-sequencer/src/app/tests_breaking_changes.rs +++ b/crates/astria-sequencer/src/app/tests_breaking_changes.rs @@ -259,24 +259,20 @@ async fn app_execute_transaction_with_every_action_snapshot() { .unwrap(); let tx_sudo_ibc = TransactionBody::builder() - .actions(vec![ - IbcSudoChange { - new_address: bob_address, - } - .into(), - ]) + .actions(vec![IbcSudoChange { + new_address: bob_address, + } + .into()]) .nonce(2) .chain_id("test") .try_build() .unwrap(); let tx_sudo = TransactionBody::builder() - .actions(vec![ - SudoAddressChange { - new_address: bob_address, - } - .into(), - ]) + .actions(vec![SudoAddressChange { + new_address: bob_address, + } + .into()]) .nonce(3) .chain_id("test") .try_build() @@ -299,16 +295,14 @@ async fn app_execute_transaction_with_every_action_snapshot() { app.execute_transaction(signed_tx_sudo).await.unwrap(); let tx = TransactionBody::builder() - .actions(vec![ - InitBridgeAccount { - rollup_id, - asset: nria().into(), - fee_asset: nria().into(), - sudo_address: None, - withdrawer_address: None, - } - .into(), - ]) + .actions(vec![InitBridgeAccount { + rollup_id, + asset: nria().into(), + fee_asset: nria().into(), + sudo_address: None, + withdrawer_address: None, + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -345,15 +339,13 @@ async fn app_execute_transaction_with_every_action_snapshot() { app.execute_transaction(signed_tx).await.unwrap(); let tx_bridge = TransactionBody::builder() - .actions(vec![ - BridgeSudoChange { - bridge_address, - new_sudo_address: Some(bob_address), - new_withdrawer_address: Some(bob_address), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![BridgeSudoChange { + bridge_address, + new_sudo_address: Some(bob_address), + new_withdrawer_address: Some(bob_address), + fee_asset: nria().into(), + } + .into()]) .nonce(2) .chain_id("test") .try_build() diff --git a/crates/astria-sequencer/src/app/tests_execute_transaction.rs b/crates/astria-sequencer/src/app/tests_execute_transaction.rs index 7f5d778e36..3b30b53acc 100644 --- a/crates/astria-sequencer/src/app/tests_execute_transaction.rs +++ b/crates/astria-sequencer/src/app/tests_execute_transaction.rs @@ -113,15 +113,13 @@ async fn app_execute_transaction_transfer() { let bob_address = astria_address_from_hex_string(BOB_ADDRESS); let value = 333_333; let tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: bob_address, - amount: value, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: bob_address, + amount: value, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -177,15 +175,13 @@ async fn app_execute_transaction_transfer_not_native_token() { // transfer funds from Alice to Bob; use native token for fee payment let bob_address = astria_address_from_hex_string(BOB_ADDRESS); let tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: bob_address, - amount: value, - asset: test_asset(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: bob_address, + amount: value, + asset: test_asset(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -249,15 +245,13 @@ async fn app_execute_transaction_transfer_balance_too_low_for_fee() { // 0-value transfer; only fee is deducted from sender let tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: bob, - amount: 0, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: bob, + amount: 0, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -287,14 +281,12 @@ async fn app_execute_transaction_sequence() { let fee = calculate_rollup_data_submission_fee_from_state(&data, &app.state).await; let tx = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data, - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data, + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -323,14 +315,12 @@ async fn app_execute_transaction_invalid_fee_asset() { let data = Bytes::from_static(b"hello world"); let tx = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data, - fee_asset: test_asset(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data, + fee_asset: test_asset(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); @@ -818,14 +808,12 @@ async fn app_execute_transaction_invalid_nonce() { let data = Bytes::from_static(b"hello world"); let tx = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data, - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data, + fee_asset: nria().into(), + } + .into()]) .nonce(1) .chain_id("test") .try_build() @@ -867,14 +855,12 @@ async fn app_execute_transaction_invalid_chain_id() { // create tx with invalid nonce 1 let data = Bytes::from_static(b"hello world"); let tx = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data, - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data, + fee_asset: nria().into(), + } + .into()]) .chain_id("wrong-chain") .try_build() .unwrap(); @@ -922,15 +908,13 @@ async fn app_stateful_check_fails_insufficient_total_balance() { // transfer just enough to cover single sequence fee with data let signed_tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: keypair_address, - amount: fee, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: keypair_address, + amount: fee, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() @@ -968,14 +952,12 @@ async fn app_stateful_check_fails_insufficient_total_balance() { // build single transfer to see passes let signed_tx_pass = TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data, - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data, + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() @@ -1252,15 +1234,13 @@ async fn transaction_execution_records_fee_event() { let bob_address = astria_address_from_hex_string(BOB_ADDRESS); let value = 333_333; let tx = TransactionBody::builder() - .actions(vec![ - Transfer { - to: bob_address, - amount: value, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]) + .actions(vec![Transfer { + to: bob_address, + amount: value, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap(); diff --git a/crates/astria-sequencer/src/authority/storage/values.rs b/crates/astria-sequencer/src/authority/storage/values.rs index 1c2aaaa4a1..a2e1a30957 100644 --- a/crates/astria-sequencer/src/authority/storage/values.rs +++ b/crates/astria-sequencer/src/authority/storage/values.rs @@ -36,7 +36,7 @@ enum ValueImpl<'a> { #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::authority) struct AddressBytes<'a>(Cow<'a, [u8; ADDRESS_LEN]>); -impl<'a> Debug for AddressBytes<'a> { +impl Debug for AddressBytes<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } @@ -75,7 +75,7 @@ impl<'a> TryFrom> for AddressBytes<'a> { #[derive(BorshSerialize, BorshDeserialize)] struct VerificationKey<'a>(Cow<'a, [u8; 32]>); -impl<'a> Debug for VerificationKey<'a> { +impl Debug for VerificationKey<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/bridge/storage/keys.rs b/crates/astria-sequencer/src/bridge/storage/keys.rs index 358127c92e..53ea216aab 100644 --- a/crates/astria-sequencer/src/bridge/storage/keys.rs +++ b/crates/astria-sequencer/src/bridge/storage/keys.rs @@ -131,10 +131,8 @@ mod tests { fn bridge_account_prefix_should_be_prefix_of_relevant_keys() { assert!(rollup_id(&address()).starts_with(BRIDGE_ACCOUNT_PREFIX)); assert!(asset_id(&address()).starts_with(BRIDGE_ACCOUNT_PREFIX)); - assert!( - bridge_account_withdrawal_event(&address(), "the-event") - .starts_with(BRIDGE_ACCOUNT_PREFIX) - ); + assert!(bridge_account_withdrawal_event(&address(), "the-event") + .starts_with(BRIDGE_ACCOUNT_PREFIX)); assert!( last_transaction_id_for_bridge_account(&address()).starts_with(BRIDGE_ACCOUNT_PREFIX) ); diff --git a/crates/astria-sequencer/src/bridge/storage/values/address_bytes.rs b/crates/astria-sequencer/src/bridge/storage/values/address_bytes.rs index 73d1d016f0..d420cf3336 100644 --- a/crates/astria-sequencer/src/bridge/storage/values/address_bytes.rs +++ b/crates/astria-sequencer/src/bridge/storage/values/address_bytes.rs @@ -24,7 +24,7 @@ use crate::accounts::AddressBytes as DomainAddressBytes; #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::bridge) struct AddressBytes<'a>(Cow<'a, [u8; ADDRESS_LEN]>); -impl<'a> Debug for AddressBytes<'a> { +impl Debug for AddressBytes<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/bridge/storage/values/block_height.rs b/crates/astria-sequencer/src/bridge/storage/values/block_height.rs index 1fe4edf48c..3c88824ac7 100644 --- a/crates/astria-sequencer/src/bridge/storage/values/block_height.rs +++ b/crates/astria-sequencer/src/bridge/storage/values/block_height.rs @@ -36,7 +36,7 @@ impl From for u64 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(block_height: BlockHeight) -> Self { crate::storage::StoredValue::Bridge(Value(ValueImpl::BlockHeight(block_height))) } diff --git a/crates/astria-sequencer/src/bridge/storage/values/ibc_prefixed_denom.rs b/crates/astria-sequencer/src/bridge/storage/values/ibc_prefixed_denom.rs index 725af800d4..db8b23f91d 100644 --- a/crates/astria-sequencer/src/bridge/storage/values/ibc_prefixed_denom.rs +++ b/crates/astria-sequencer/src/bridge/storage/values/ibc_prefixed_denom.rs @@ -23,7 +23,7 @@ use super::{ #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::bridge) struct IbcPrefixedDenom<'a>(Cow<'a, [u8; 32]>); -impl<'a> Debug for IbcPrefixedDenom<'a> { +impl Debug for IbcPrefixedDenom<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/bridge/storage/values/rollup_id.rs b/crates/astria-sequencer/src/bridge/storage/values/rollup_id.rs index 5a67daf7fb..dff8246b16 100644 --- a/crates/astria-sequencer/src/bridge/storage/values/rollup_id.rs +++ b/crates/astria-sequencer/src/bridge/storage/values/rollup_id.rs @@ -23,7 +23,7 @@ use super::{ #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::bridge) struct RollupId<'a>(Cow<'a, [u8; 32]>); -impl<'a> Debug for RollupId<'a> { +impl Debug for RollupId<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/bridge/storage/values/transaction_id.rs b/crates/astria-sequencer/src/bridge/storage/values/transaction_id.rs index fa12a21f43..d752d3c635 100644 --- a/crates/astria-sequencer/src/bridge/storage/values/transaction_id.rs +++ b/crates/astria-sequencer/src/bridge/storage/values/transaction_id.rs @@ -26,7 +26,7 @@ use super::{ #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::bridge) struct TransactionId<'a>(Cow<'a, [u8; TRANSACTION_ID_LEN]>); -impl<'a> Debug for TransactionId<'a> { +impl Debug for TransactionId<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", hex(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/fees/tests.rs b/crates/astria-sequencer/src/fees/tests.rs index 8a6f2202ff..0e52622a93 100644 --- a/crates/astria-sequencer/src/fees/tests.rs +++ b/crates/astria-sequencer/src/fees/tests.rs @@ -79,15 +79,13 @@ async fn ensure_correct_block_fees_transfer() { let alice = get_alice_signing_key(); let bob_address = astria_address_from_hex_string(BOB_ADDRESS); - let actions = vec![ - Transfer { - to: bob_address, - amount: 1000, - asset: nria().into(), - fee_asset: nria().into(), - } - .into(), - ]; + let actions = vec![Transfer { + to: bob_address, + amount: 1000, + asset: nria().into(), + fee_asset: nria().into(), + } + .into()]; let tx = TransactionBody::builder() .actions(actions) @@ -117,14 +115,12 @@ async fn ensure_correct_block_fees_sequence() { let alice = get_alice_signing_key(); let data = b"hello world".to_vec(); - let actions = vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data: data.clone().into(), - fee_asset: nria().into(), - } - .into(), - ]; + let actions = vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data: data.clone().into(), + fee_asset: nria().into(), + } + .into()]; let tx = TransactionBody::builder() .actions(actions) @@ -157,16 +153,14 @@ async fn ensure_correct_block_fees_init_bridge_acct() { let alice = get_alice_signing_key(); - let actions = vec![ - InitBridgeAccount { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - asset: nria().into(), - fee_asset: nria().into(), - sudo_address: None, - withdrawer_address: None, - } - .into(), - ]; + let actions = vec![InitBridgeAccount { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + asset: nria().into(), + fee_asset: nria().into(), + sudo_address: None, + withdrawer_address: None, + } + .into()]; let tx = TransactionBody::builder() .actions(actions) @@ -215,16 +209,14 @@ async fn ensure_correct_block_fees_bridge_lock() { .put_bridge_account_ibc_asset(&bridge_address, nria()) .unwrap(); - let actions = vec![ - BridgeLock { - to: bridge_address, - amount: 1, - asset: nria().into(), - fee_asset: nria().into(), - destination_chain_address: rollup_id.to_string(), - } - .into(), - ]; + let actions = vec![BridgeLock { + to: bridge_address, + amount: 1, + asset: nria().into(), + fee_asset: nria().into(), + destination_chain_address: rollup_id.to_string(), + } + .into()]; let tx = TransactionBody::builder() .actions(actions) @@ -278,15 +270,13 @@ async fn ensure_correct_block_fees_bridge_sudo_change() { .await .unwrap(); - let actions = vec![ - BridgeSudoChange { - bridge_address, - new_sudo_address: None, - new_withdrawer_address: None, - fee_asset: nria().into(), - } - .into(), - ]; + let actions = vec![BridgeSudoChange { + bridge_address, + new_sudo_address: None, + new_withdrawer_address: None, + fee_asset: nria().into(), + } + .into()]; let tx = TransactionBody::builder() .actions(actions) diff --git a/crates/astria-sequencer/src/grpc/storage/values/block_hash.rs b/crates/astria-sequencer/src/grpc/storage/values/block_hash.rs index 4c772091ca..dea59d835a 100644 --- a/crates/astria-sequencer/src/grpc/storage/values/block_hash.rs +++ b/crates/astria-sequencer/src/grpc/storage/values/block_hash.rs @@ -22,7 +22,7 @@ use super::{ #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::grpc) struct BlockHash<'a>(Cow<'a, [u8; 32]>); -impl<'a> Debug for BlockHash<'a> { +impl Debug for BlockHash<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/grpc/storage/values/rollup_ids.rs b/crates/astria-sequencer/src/grpc/storage/values/rollup_ids.rs index 05575132af..d2bb6f6079 100644 --- a/crates/astria-sequencer/src/grpc/storage/values/rollup_ids.rs +++ b/crates/astria-sequencer/src/grpc/storage/values/rollup_ids.rs @@ -23,7 +23,7 @@ use super::{ #[derive(BorshSerialize, BorshDeserialize)] pub(super) struct RollupId<'a>(Cow<'a, [u8; 32]>); -impl<'a> Debug for RollupId<'a> { +impl Debug for RollupId<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/grpc/storage/values/rollup_transactions.rs b/crates/astria-sequencer/src/grpc/storage/values/rollup_transactions.rs index f54947e033..733c6f8be0 100644 --- a/crates/astria-sequencer/src/grpc/storage/values/rollup_transactions.rs +++ b/crates/astria-sequencer/src/grpc/storage/values/rollup_transactions.rs @@ -32,7 +32,7 @@ pub(in crate::grpc) struct RollupTransactions<'a> { proof: Proof<'a>, } -impl<'a> Debug for RollupTransactions<'a> { +impl Debug for RollupTransactions<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("RollupTransactions") .field("rollup_id", &self.rollup_id) diff --git a/crates/astria-sequencer/src/grpc/storage/values/sequencer_block_header.rs b/crates/astria-sequencer/src/grpc/storage/values/sequencer_block_header.rs index 0c53040cca..3c6f6ab622 100644 --- a/crates/astria-sequencer/src/grpc/storage/values/sequencer_block_header.rs +++ b/crates/astria-sequencer/src/grpc/storage/values/sequencer_block_header.rs @@ -45,13 +45,13 @@ impl<'a> From> for tendermint::chain::Id { } } -impl<'a> BorshSerialize for ChainId<'a> { +impl BorshSerialize for ChainId<'_> { fn serialize(&self, writer: &mut W) -> std::io::Result<()> { self.0.as_str().serialize(writer) } } -impl<'a> BorshDeserialize for ChainId<'a> { +impl BorshDeserialize for ChainId<'_> { fn deserialize_reader(reader: &mut R) -> std::io::Result { let chain_id_str = String::deserialize_reader(reader)?; let chain_id = @@ -106,7 +106,7 @@ pub(in crate::grpc) struct SequencerBlockHeader<'a> { proposer_address: [u8; ADDRESS_LEN], } -impl<'a> Debug for SequencerBlockHeader<'a> { +impl Debug for SequencerBlockHeader<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("SequencerBlockHeader") .field("chain_id", &self.chain_id) diff --git a/crates/astria-sequencer/src/ibc/storage/values.rs b/crates/astria-sequencer/src/ibc/storage/values.rs index f1a0783f89..ad35125058 100644 --- a/crates/astria-sequencer/src/ibc/storage/values.rs +++ b/crates/astria-sequencer/src/ibc/storage/values.rs @@ -41,7 +41,7 @@ impl From for u128 { } } -impl<'a> From for crate::storage::StoredValue<'a> { +impl From for crate::storage::StoredValue<'_> { fn from(balance: Balance) -> Self { crate::storage::StoredValue::Ibc(Value(ValueImpl::Balance(balance))) } @@ -61,7 +61,7 @@ impl<'a> TryFrom> for Balance { #[derive(BorshSerialize, BorshDeserialize)] pub(in crate::ibc) struct AddressBytes<'a>(Cow<'a, [u8; ADDRESS_LEN]>); -impl<'a> Debug for AddressBytes<'a> { +impl Debug for AddressBytes<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}", base64(self.0.as_slice())) } diff --git a/crates/astria-sequencer/src/mempool/mod.rs b/crates/astria-sequencer/src/mempool/mod.rs index 68579620f4..c266f7b685 100644 --- a/crates/astria-sequencer/src/mempool/mod.rs +++ b/crates/astria-sequencer/src/mempool/mod.rs @@ -112,7 +112,7 @@ struct ContainedTxLock<'a> { txs: RwLockWriteGuard<'a, HashSet<[u8; 32]>>, } -impl<'a> ContainedTxLock<'a> { +impl ContainedTxLock<'_> { fn add(&mut self, id: [u8; 32]) { if !self.txs.insert(id) { self.mempool.metrics.increment_internal_logic_error(); @@ -1040,12 +1040,10 @@ mod tests { ); // Check the pending nonce for an address with no txs is `None`. - assert!( - mempool - .pending_nonce(astria_address_from_hex_string(CAROL_ADDRESS).as_bytes()) - .await - .is_none() - ); + assert!(mempool + .pending_nonce(astria_address_from_hex_string(CAROL_ADDRESS).as_bytes()) + .await + .is_none()); } #[tokio::test] diff --git a/crates/astria-sequencer/src/mempool/transactions_container.rs b/crates/astria-sequencer/src/mempool/transactions_container.rs index 95d17b00c1..0ffdf5461f 100644 --- a/crates/astria-sequencer/src/mempool/transactions_container.rs +++ b/crates/astria-sequencer/src/mempool/transactions_container.rs @@ -958,12 +958,10 @@ mod tests { let ttx = MockTTXBuilder::new().nonce(0).build(); let priority = ttx.priority(1); - assert!( - priority - .unwrap_err() - .to_string() - .contains("less than current account nonce") - ); + assert!(priority + .unwrap_err() + .to_string() + .contains("less than current account nonce")); } // From https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html diff --git a/crates/astria-sequencer/src/service/consensus.rs b/crates/astria-sequencer/src/service/consensus.rs index a0b6a4a5ae..d46941c1d3 100644 --- a/crates/astria-sequencer/src/service/consensus.rs +++ b/crates/astria-sequencer/src/service/consensus.rs @@ -238,14 +238,12 @@ mod tests { fn make_unsigned_tx() -> TransactionBody { TransactionBody::builder() - .actions(vec![ - RollupDataSubmission { - rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), - data: Bytes::from_static(b"hello world"), - fee_asset: crate::benchmark_and_test_utils::nria().into(), - } - .into(), - ]) + .actions(vec![RollupDataSubmission { + rollup_id: RollupId::from_unhashed_bytes(b"testchainid"), + data: Bytes::from_static(b"hello world"), + fee_asset: crate::benchmark_and_test_utils::nria().into(), + } + .into()]) .chain_id("test") .try_build() .unwrap() @@ -340,30 +338,26 @@ mod tests { async fn process_proposal_fail_missing_action_commitment() { let (mut consensus_service, _) = new_consensus_service(None).await; let process_proposal = new_process_proposal_request(vec![]); - assert!( - consensus_service - .handle_process_proposal(process_proposal) - .await - .err() - .unwrap() - .to_string() - .contains("no transaction commitment in proposal") - ); + assert!(consensus_service + .handle_process_proposal(process_proposal) + .await + .err() + .unwrap() + .to_string() + .contains("no transaction commitment in proposal")); } #[tokio::test] async fn process_proposal_fail_wrong_commitment_length() { let (mut consensus_service, _) = new_consensus_service(None).await; let process_proposal = new_process_proposal_request(vec![[0u8; 16].to_vec().into()]); - assert!( - consensus_service - .handle_process_proposal(process_proposal) - .await - .err() - .unwrap() - .to_string() - .contains("transaction commitment must be 32 bytes") - ); + assert!(consensus_service + .handle_process_proposal(process_proposal) + .await + .err() + .unwrap() + .to_string() + .contains("transaction commitment must be 32 bytes")); } #[tokio::test] @@ -373,15 +367,13 @@ mod tests { [99u8; 32].to_vec().into(), [99u8; 32].to_vec().into(), ]); - assert!( - consensus_service - .handle_process_proposal(process_proposal) - .await - .err() - .unwrap() - .to_string() - .contains("transaction commitment does not match expected") - ); + assert!(consensus_service + .handle_process_proposal(process_proposal) + .await + .err() + .unwrap() + .to_string() + .contains("transaction commitment does not match expected")); } #[tokio::test] diff --git a/crates/astria-sequencer/src/storage/keys.rs b/crates/astria-sequencer/src/storage/keys.rs index edf0333ba8..fba71e6beb 100644 --- a/crates/astria-sequencer/src/storage/keys.rs +++ b/crates/astria-sequencer/src/storage/keys.rs @@ -30,7 +30,7 @@ impl<'a, T> AccountPrefixer<'a, T> { } } -impl<'a, T: AddressBytes> Display for AccountPrefixer<'a, T> { +impl Display for AccountPrefixer<'_, T> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { use base64::{ display::Base64Display, @@ -46,13 +46,13 @@ impl<'a, T: AddressBytes> Display for AccountPrefixer<'a, T> { #[cfg_attr(test, derive(Debug, PartialEq))] pub(crate) struct Asset<'a>(Cow<'a, IbcPrefixed>); -impl<'a> Asset<'a> { +impl Asset<'_> { pub(crate) fn get(self) -> IbcPrefixed { self.0.into_owned() } } -impl<'a> Display for Asset<'a> { +impl Display for Asset<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { self.0.fmt(f) } @@ -67,7 +67,7 @@ where } } -impl<'a> FromStr for Asset<'a> { +impl FromStr for Asset<'_> { type Err = ParseIbcPrefixedError; fn from_str(s: &str) -> Result { diff --git a/crates/astria-sequencer/src/storage/stored_value.rs b/crates/astria-sequencer/src/storage/stored_value.rs index 07164615e7..3fe203521b 100644 --- a/crates/astria-sequencer/src/storage/stored_value.rs +++ b/crates/astria-sequencer/src/storage/stored_value.rs @@ -21,7 +21,7 @@ pub(crate) enum StoredValue<'a> { Grpc(crate::grpc::storage::Value<'a>), } -impl<'a> StoredValue<'a> { +impl StoredValue<'_> { pub(crate) fn serialize(&self) -> Result> { borsh::to_vec(&self).wrap_err("failed to serialize stored value") } diff --git a/crates/astria-sequencer/src/transaction/checks.rs b/crates/astria-sequencer/src/transaction/checks.rs index bff86e838e..3bf22aa418 100644 --- a/crates/astria-sequencer/src/transaction/checks.rs +++ b/crates/astria-sequencer/src/transaction/checks.rs @@ -340,10 +340,9 @@ mod tests { .await .err() .unwrap(); - assert!( - err.root_cause() - .to_string() - .contains(&other_asset.to_ibc_prefixed().to_string()) - ); + assert!(err + .root_cause() + .to_string() + .contains(&other_asset.to_ibc_prefixed().to_string())); } } diff --git a/crates/astria-telemetry/Cargo.toml b/crates/astria-telemetry/Cargo.toml index 7cc30072a5..cb17bdcc92 100644 --- a/crates/astria-telemetry/Cargo.toml +++ b/crates/astria-telemetry/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-telemetry" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-telemetry/src/display.rs b/crates/astria-telemetry/src/display.rs index 3a1c9b98e5..c132f0c516 100644 --- a/crates/astria-telemetry/src/display.rs +++ b/crates/astria-telemetry/src/display.rs @@ -97,7 +97,7 @@ pub struct Json<'a, T>(&'a T); // NOTE: This implementation is lifted straight from serde_json: // https://docs.rs/serde_json/1.0.114/src/serde_json/value/mod.rs.html#197 -impl<'a, T> Display for Json<'a, T> +impl Display for Json<'_, T> where T: serde::Serialize, { @@ -106,7 +106,7 @@ where inner: &'a mut Formatter<'b>, } - impl<'a, 'b> io::Write for WriterFormatter<'a, 'b> { + impl io::Write for WriterFormatter<'_, '_> { fn write(&mut self, buf: &[u8]) -> io::Result { // NOTE: Same argument for safety as in // https://docs.rs/serde_json/1.0.114/src/serde_json/value/mod.rs.html#229 diff --git a/crates/astria-telemetry/src/metrics/factories.rs b/crates/astria-telemetry/src/metrics/factories.rs index a3abc3b85c..bdd1549265 100644 --- a/crates/astria-telemetry/src/metrics/factories.rs +++ b/crates/astria-telemetry/src/metrics/factories.rs @@ -176,7 +176,7 @@ trait RegisterMetric { fn metric_type() -> &'static str; } -impl<'a> RegisterMetric for Factory<'a, Counter> { +impl RegisterMetric for Factory<'_, Counter> { fn register_metric(&self, key: &Key) -> Counter { let ignored_metadata = Metadata::new("", metrics::Level::ERROR, None); Counter::new(self.recorder.register_counter(key, &ignored_metadata)) @@ -187,7 +187,7 @@ impl<'a> RegisterMetric for Factory<'a, Counter> { } } -impl<'a> RegisterMetric for Factory<'a, Gauge> { +impl RegisterMetric for Factory<'_, Gauge> { fn register_metric(&self, key: &Key) -> Gauge { let ignored_metadata = Metadata::new("", metrics::Level::ERROR, None); Gauge::new(self.recorder.register_gauge(key, &ignored_metadata)) @@ -198,7 +198,7 @@ impl<'a> RegisterMetric for Factory<'a, Gauge> { } } -impl<'a> RegisterMetric for Factory<'a, Histogram> { +impl RegisterMetric for Factory<'_, Histogram> { fn register_metric(&self, key: &Key) -> Histogram { let ignored_metadata = Metadata::new("", metrics::Level::ERROR, None); Histogram::new(self.recorder.register_histogram(key, &ignored_metadata)) diff --git a/crates/astria-test-utils/Cargo.toml b/crates/astria-test-utils/Cargo.toml index 854cdd4b03..e7a551c1d6 100644 --- a/crates/astria-test-utils/Cargo.toml +++ b/crates/astria-test-utils/Cargo.toml @@ -2,7 +2,7 @@ name = "astria-test-utils" version = "0.1.0" edition = "2021" -rust-version = "1.81.0" +rust-version = "1.83.0" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/astriaorg/astria" diff --git a/crates/astria-test-utils/src/mock/geth.rs b/crates/astria-test-utils/src/mock/geth.rs index 4551f6e2c7..f82da647f0 100644 --- a/crates/astria-test-utils/src/mock/geth.rs +++ b/crates/astria-test-utils/src/mock/geth.rs @@ -120,7 +120,7 @@ mod __rpc_traits { pub trait Geth { #[subscription(name = "eth_subscribe", item = Transaction, unsubscribe = "eth_unsubscribe")] async fn eth_subscribe(&self, target: String, full_txs: Option) - -> SubscriptionResult; + -> SubscriptionResult; #[method(name = "net_version")] async fn net_version(&self) -> Result; diff --git a/justfile b/justfile index e6ac8d0884..b3cdd49156 100644 --- a/justfile +++ b/justfile @@ -89,11 +89,11 @@ _fmt-all: [no-exit-message] _fmt-rust: - cargo +nightly-2024-09-15 fmt --all + cargo +nightly-2024-10-11 fmt --all [no-exit-message] _lint-rust: - cargo +nightly-2024-09-15 fmt --all -- --check + cargo +nightly-2024-10-11 fmt --all -- --check cargo clippy -- --warn clippy::pedantic cargo dylint --all diff --git a/rust-toolchain.toml b/rust-toolchain.toml index dd2691e044..3a6eabc898 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81.0" +channel = "1.83.0" components = ["cargo", "clippy", "rust-std", "rustc"] diff --git a/rustfmt.toml b/rustfmt.toml index 48a4537a5f..bde71e9a14 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -11,7 +11,7 @@ imports_granularity = "Crate" group_imports = "StdExternalCrate" reorder_impl_items = true edition = "2021" -version = "Two" +style_edition = "2018" use_field_init_shorthand = true condense_wildcard_suffixes = true unstable_features = true