From c47c7f934c48ab37c13ca7b40fd7482aff638bf4 Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Jan 2025 13:51:15 +0100 Subject: [PATCH 1/4] Update toolchain to 1.84 and fixes clippy --- engine-hashchain/src/lib.rs | 1 + engine-hashchain/src/wrapped_io.rs | 2 +- engine-modexp/src/lib.rs | 1 + engine-precompiles/src/account_ids.rs | 2 +- engine-precompiles/src/hash.rs | 4 ++-- engine-precompiles/src/identity.rs | 2 +- engine-precompiles/src/lib.rs | 7 ++++--- engine-precompiles/src/prepaid_gas.rs | 2 +- engine-sdk/src/lib.rs | 1 + engine-types/src/lib.rs | 1 + engine-types/src/public_key.rs | 2 +- rust-toolchain | 2 +- 12 files changed, 16 insertions(+), 11 deletions(-) diff --git a/engine-hashchain/src/lib.rs b/engine-hashchain/src/lib.rs index 39084c4f1..087e75314 100644 --- a/engine-hashchain/src/lib.rs +++ b/engine-hashchain/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::too_long_first_doc_paragraph)] pub mod bloom; pub mod error; diff --git a/engine-hashchain/src/wrapped_io.rs b/engine-hashchain/src/wrapped_io.rs index 7f7a1e52c..843b5438b 100644 --- a/engine-hashchain/src/wrapped_io.rs +++ b/engine-hashchain/src/wrapped_io.rs @@ -65,7 +65,7 @@ impl StorageIntermediate for WrappedInput { } } -impl<'cache, I: IO> IO for CachedIO<'cache, I> { +impl IO for CachedIO<'_, I> { type StorageValue = WrappedInput; fn read_input(&self) -> Self::StorageValue { diff --git a/engine-modexp/src/lib.rs b/engine-modexp/src/lib.rs index 31278a89d..5dd8d8bcc 100644 --- a/engine-modexp/src/lib.rs +++ b/engine-modexp/src/lib.rs @@ -8,6 +8,7 @@ clippy::cast_lossless, clippy::many_single_char_names )] +#![allow(clippy::too_long_first_doc_paragraph)] mod arith; mod maybe_std; diff --git a/engine-precompiles/src/account_ids.rs b/engine-precompiles/src/account_ids.rs index 77f7524ae..da3d84224 100644 --- a/engine-precompiles/src/account_ids.rs +++ b/engine-precompiles/src/account_ids.rs @@ -35,7 +35,7 @@ impl<'a, E> PredecessorAccount<'a, E> { } } -impl<'a, E: Env> Precompile for PredecessorAccount<'a, E> { +impl Precompile for PredecessorAccount<'_, E> { fn required_gas(_input: &[u8]) -> Result { Ok(costs::PREDECESSOR_ACCOUNT_GAS) } diff --git a/engine-precompiles/src/hash.rs b/engine-precompiles/src/hash.rs index 22385caf6..3921c474c 100644 --- a/engine-precompiles/src/hash.rs +++ b/engine-precompiles/src/hash.rs @@ -34,7 +34,7 @@ impl Precompile for SHA256 { fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::SHA256_WORD_LEN - 1) / consts::SHA256_WORD_LEN + (input_len + consts::SHA256_WORD_LEN - 1).div_ceil(consts::SHA256_WORD_LEN) * costs::SHA256_PER_WORD + costs::SHA256_BASE, ) @@ -108,7 +108,7 @@ impl Precompile for RIPEMD160 { fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::RIPEMD_WORD_LEN - 1) / consts::RIPEMD_WORD_LEN + (input_len + consts::RIPEMD_WORD_LEN - 1).div_ceil(consts::RIPEMD_WORD_LEN) * costs::RIPEMD160_PER_WORD + costs::RIPEMD160_BASE, ) diff --git a/engine-precompiles/src/identity.rs b/engine-precompiles/src/identity.rs index bb203f5aa..a6d5f7fe5 100644 --- a/engine-precompiles/src/identity.rs +++ b/engine-precompiles/src/identity.rs @@ -28,7 +28,7 @@ impl Precompile for Identity { fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::IDENTITY_WORD_LEN - 1) / consts::IDENTITY_WORD_LEN + (input_len + consts::IDENTITY_WORD_LEN - 1).div_ceil(consts::IDENTITY_WORD_LEN) * costs::IDENTITY_PER_WORD + costs::IDENTITY_BASE, ) diff --git a/engine-precompiles/src/lib.rs b/engine-precompiles/src/lib.rs index a3732b054..7485c0bc8 100644 --- a/engine-precompiles/src/lib.rs +++ b/engine-precompiles/src/lib.rs @@ -1,5 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![forbid(unsafe_code)] +#![allow(clippy::too_long_first_doc_paragraph)] pub mod account_ids; pub mod alt_bn256; pub mod blake2; @@ -114,14 +115,14 @@ pub struct Precompiles<'a, I, E, H> { pub paused_precompiles: BTreeSet
, } -impl<'a, I, E, H> Precompiles<'a, I, E, H> { +impl Precompiles<'_, I, E, H> { fn is_paused(&self, address: &Address) -> bool { self.paused_precompiles.contains(address) } } -impl<'a, I: IO + Copy, E: Env, H: ReadOnlyPromiseHandler> executor::stack::PrecompileSet - for Precompiles<'a, I, E, H> +impl executor::stack::PrecompileSet + for Precompiles<'_, I, E, H> { fn execute( &self, diff --git a/engine-precompiles/src/prepaid_gas.rs b/engine-precompiles/src/prepaid_gas.rs index 6ae2bc429..15a2cbbd0 100644 --- a/engine-precompiles/src/prepaid_gas.rs +++ b/engine-precompiles/src/prepaid_gas.rs @@ -28,7 +28,7 @@ impl<'a, E> PrepaidGas<'a, E> { } } -impl<'a, E: Env> Precompile for PrepaidGas<'a, E> { +impl Precompile for PrepaidGas<'_, E> { fn required_gas(_input: &[u8]) -> Result { Ok(costs::PREPAID_GAS_COST) } diff --git a/engine-sdk/src/lib.rs b/engine-sdk/src/lib.rs index 06793eab0..112be02d3 100644 --- a/engine-sdk/src/lib.rs +++ b/engine-sdk/src/lib.rs @@ -1,6 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std)] // All `as` conversions in this code base have been carefully reviewed and are safe. #![allow(clippy::as_conversions)] +#![allow(clippy::too_long_first_doc_paragraph)] #[cfg(feature = "contract")] use crate::prelude::{Address, Vec, U256}; diff --git a/engine-types/src/lib.rs b/engine-types/src/lib.rs index e25862e7d..accb915fb 100644 --- a/engine-types/src/lib.rs +++ b/engine-types/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(any(feature = "std", feature = "contracts-std")), no_std)] +#![allow(clippy::too_long_first_doc_paragraph)] pub mod account_id; pub mod parameters; diff --git a/engine-types/src/public_key.rs b/engine-types/src/public_key.rs index 0af5693cc..6ebd5e662 100644 --- a/engine-types/src/public_key.rs +++ b/engine-types/src/public_key.rs @@ -159,7 +159,7 @@ fn split_key_type_data(value: &str) -> Result<(KeyType, &str), DecodeBs58Error> // for that: https://github.com/Nullus157/bs58-rs/pull/97 struct Bs58<'a>(&'a [u8]); -impl<'a> fmt::Display for Bs58<'a> { +impl fmt::Display for Bs58<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { debug_assert!(self.0.len() <= 65); // The largest buffer we’re ever encoding is 65-byte long. Base58 diff --git a/rust-toolchain b/rust-toolchain index 184dfb58f..c1d61e3d5 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81.0" +channel = "1.84.0" targets = ["wasm32-unknown-unknown"] From 7ee3a746a8ce85ab4fb5efca4c28580e5dcee8de Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Jan 2025 14:41:10 +0100 Subject: [PATCH 2/4] Update clippy --- engine-standalone-tracing/src/lib.rs | 1 + engine-standalone-tracing/src/types/mod.rs | 2 +- engine-test-doubles/src/io.rs | 2 +- engine-transactions/src/lib.rs | 1 + engine-types/src/account_id.rs | 4 ++-- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/engine-standalone-tracing/src/lib.rs b/engine-standalone-tracing/src/lib.rs index da3f130ae..3f597c012 100644 --- a/engine-standalone-tracing/src/lib.rs +++ b/engine-standalone-tracing/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::too_long_first_doc_paragraph)] pub mod sputnik; pub mod types; diff --git a/engine-standalone-tracing/src/types/mod.rs b/engine-standalone-tracing/src/types/mod.rs index ac1686480..01a360341 100644 --- a/engine-standalone-tracing/src/types/mod.rs +++ b/engine-standalone-tracing/src/types/mod.rs @@ -344,7 +344,7 @@ mod opcode_serde { struct U8Visitor; - impl<'de> serde::de::Visitor<'de> for U8Visitor { + impl serde::de::Visitor<'_> for U8Visitor { type Value = u8; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/engine-test-doubles/src/io.rs b/engine-test-doubles/src/io.rs index 284398fb2..459fe7325 100644 --- a/engine-test-doubles/src/io.rs +++ b/engine-test-doubles/src/io.rs @@ -29,7 +29,7 @@ pub struct Storage { #[derive(Debug, Clone, Copy)] pub struct StoragePointer<'a>(pub &'a RefCell); -impl<'a> IO for StoragePointer<'a> { +impl IO for StoragePointer<'_> { type StorageValue = Value; fn read_input(&self) -> Self::StorageValue { diff --git a/engine-transactions/src/lib.rs b/engine-transactions/src/lib.rs index 05dbdf526..77a6b98b4 100644 --- a/engine-transactions/src/lib.rs +++ b/engine-transactions/src/lib.rs @@ -1,5 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![forbid(unsafe_code)] +#![allow(clippy::too_long_first_doc_paragraph)] use aurora_engine_types::types::{Address, Wei}; use aurora_engine_types::{vec, Vec, H160, U256}; diff --git a/engine-types/src/account_id.rs b/engine-types/src/account_id.rs index f196a7daf..2a4c040e7 100644 --- a/engine-types/src/account_id.rs +++ b/engine-types/src/account_id.rs @@ -318,7 +318,7 @@ mod tests { assert!( account_id .parse::() - .map_or(false, |account_id| account_id.is_top_level_account_id()), + .is_ok_and(|account_id| account_id.is_top_level_account_id()), "Valid top level account id {account_id:?} marked invalid", ); } @@ -364,7 +364,7 @@ mod tests { assert!( !account_id .parse::() - .map_or(false, |account_id| account_id.is_top_level_account_id()), + .is_ok_and(|account_id| account_id.is_top_level_account_id()), "Invalid top level account id {account_id:?} marked valid", ); } From f799f1b0257788cc67328911989e28c593b97a77 Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Jan 2025 20:06:33 +0100 Subject: [PATCH 3/4] Clippy fixes --- Cargo.toml | 1 + engine-hashchain/src/bloom.rs | 2 ++ engine-hashchain/src/lib.rs | 1 - engine-modexp/src/lib.rs | 1 - engine-precompiles/src/hash.rs | 6 ++++-- engine-precompiles/src/identity.rs | 3 ++- engine-precompiles/src/lib.rs | 2 +- engine-sdk/src/lib.rs | 1 - engine-standalone-storage/src/engine_state.rs | 4 ++-- engine-standalone-storage/src/lib.rs | 2 +- engine-standalone-storage/src/promise.rs | 2 +- engine-standalone-tracing/src/lib.rs | 1 - engine-tests/src/utils/mod.rs | 2 +- engine-tests/src/utils/one_inch/liquidity_protocol.rs | 2 +- engine-transactions/src/lib.rs | 1 - engine-types/src/lib.rs | 1 - engine/src/engine.rs | 10 +++++----- engine/src/pausables.rs | 2 +- engine/src/xcc.rs | 2 +- rust-toolchain | 2 +- 20 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b2831f0bd..9f444572f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ missing_panics_doc = "allow" module_name_repetitions = "allow" unreadable_literal = "allow" similar_names = "allow" +too_long_first_doc_paragraph = "allow" [workspace] resolver = "2" diff --git a/engine-hashchain/src/bloom.rs b/engine-hashchain/src/bloom.rs index e527bd2e2..ef3b131e7 100644 --- a/engine-hashchain/src/bloom.rs +++ b/engine-hashchain/src/bloom.rs @@ -3,6 +3,8 @@ //! //! Reimplemented here since there is a large mismatch in types and dependencies. #![allow(clippy::expl_impl_clone_on_copy, clippy::non_canonical_clone_impl)] +// NOTE: `fixed_hash` crate has clippy issue +#![allow(unexpected_cfgs)] use aurora_engine_sdk::keccak; use aurora_engine_types::borsh::{BorshDeserialize, BorshSerialize}; diff --git a/engine-hashchain/src/lib.rs b/engine-hashchain/src/lib.rs index 087e75314..39084c4f1 100644 --- a/engine-hashchain/src/lib.rs +++ b/engine-hashchain/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![allow(clippy::too_long_first_doc_paragraph)] pub mod bloom; pub mod error; diff --git a/engine-modexp/src/lib.rs b/engine-modexp/src/lib.rs index 5dd8d8bcc..31278a89d 100644 --- a/engine-modexp/src/lib.rs +++ b/engine-modexp/src/lib.rs @@ -8,7 +8,6 @@ clippy::cast_lossless, clippy::many_single_char_names )] -#![allow(clippy::too_long_first_doc_paragraph)] mod arith; mod maybe_std; diff --git a/engine-precompiles/src/hash.rs b/engine-precompiles/src/hash.rs index 3921c474c..4bb05ab53 100644 --- a/engine-precompiles/src/hash.rs +++ b/engine-precompiles/src/hash.rs @@ -31,10 +31,11 @@ impl SHA256 { } impl Precompile for SHA256 { + #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::SHA256_WORD_LEN - 1).div_ceil(consts::SHA256_WORD_LEN) + (input_len + consts::SHA256_WORD_LEN - 1) / consts::SHA256_WORD_LEN * costs::SHA256_PER_WORD + costs::SHA256_BASE, ) @@ -105,10 +106,11 @@ impl RIPEMD160 { } impl Precompile for RIPEMD160 { + #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::RIPEMD_WORD_LEN - 1).div_ceil(consts::RIPEMD_WORD_LEN) + (input_len + consts::RIPEMD_WORD_LEN - 1) / consts::RIPEMD_WORD_LEN * costs::RIPEMD160_PER_WORD + costs::RIPEMD160_BASE, ) diff --git a/engine-precompiles/src/identity.rs b/engine-precompiles/src/identity.rs index a6d5f7fe5..cc2f5fc20 100644 --- a/engine-precompiles/src/identity.rs +++ b/engine-precompiles/src/identity.rs @@ -25,10 +25,11 @@ impl Identity { } impl Precompile for Identity { + #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( - (input_len + consts::IDENTITY_WORD_LEN - 1).div_ceil(consts::IDENTITY_WORD_LEN) + (input_len + consts::IDENTITY_WORD_LEN - 1) / consts::IDENTITY_WORD_LEN * costs::IDENTITY_PER_WORD + costs::IDENTITY_BASE, ) diff --git a/engine-precompiles/src/lib.rs b/engine-precompiles/src/lib.rs index 7485c0bc8..8853a56b2 100644 --- a/engine-precompiles/src/lib.rs +++ b/engine-precompiles/src/lib.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![forbid(unsafe_code)] -#![allow(clippy::too_long_first_doc_paragraph)] + pub mod account_ids; pub mod alt_bn256; pub mod blake2; diff --git a/engine-sdk/src/lib.rs b/engine-sdk/src/lib.rs index 112be02d3..06793eab0 100644 --- a/engine-sdk/src/lib.rs +++ b/engine-sdk/src/lib.rs @@ -1,7 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] // All `as` conversions in this code base have been carefully reviewed and are safe. #![allow(clippy::as_conversions)] -#![allow(clippy::too_long_first_doc_paragraph)] #[cfg(feature = "contract")] use crate::prelude::{Address, Vec, U256}; diff --git a/engine-standalone-storage/src/engine_state.rs b/engine-standalone-storage/src/engine_state.rs index 8306df036..b9d3bcef1 100644 --- a/engine-standalone-storage/src/engine_state.rs +++ b/engine-standalone-storage/src/engine_state.rs @@ -11,7 +11,7 @@ pub enum EngineStorageValue<'a> { Vec(Vec), } -impl<'a> AsRef<[u8]> for EngineStorageValue<'a> { +impl AsRef<[u8]> for EngineStorageValue<'_> { fn as_ref(&self) -> &[u8] { match self { Self::Slice(slice) => slice, @@ -20,7 +20,7 @@ impl<'a> AsRef<[u8]> for EngineStorageValue<'a> { } } -impl<'a> StorageIntermediate for EngineStorageValue<'a> { +impl StorageIntermediate for EngineStorageValue<'_> { fn len(&self) -> usize { self.as_ref().len() } diff --git a/engine-standalone-storage/src/lib.rs b/engine-standalone-storage/src/lib.rs index dff8da4e2..a508301e9 100644 --- a/engine-standalone-storage/src/lib.rs +++ b/engine-standalone-storage/src/lib.rs @@ -349,7 +349,7 @@ impl Storage { // move to the next key by skipping all other DB keys corresponding to the same engine key while iter.valid() - && iter.key().map_or(false, |db_key| { + && iter.key().is_some_and(|db_key| { db_key[0..engine_prefix_len] == engine_prefix && &db_key[engine_prefix_len..(db_key.len() - ENGINE_KEY_SUFFIX_LEN)] == *engine_key diff --git a/engine-standalone-storage/src/promise.rs b/engine-standalone-storage/src/promise.rs index c76c512d6..64c17240c 100644 --- a/engine-standalone-storage/src/promise.rs +++ b/engine-standalone-storage/src/promise.rs @@ -13,7 +13,7 @@ pub struct NoScheduler<'a> { pub promise_data: &'a [Option>], } -impl<'a> PromiseHandler for NoScheduler<'a> { +impl PromiseHandler for NoScheduler<'_> { type ReadOnly = Self; fn promise_results_count(&self) -> u64 { diff --git a/engine-standalone-tracing/src/lib.rs b/engine-standalone-tracing/src/lib.rs index 3f597c012..da3f130ae 100644 --- a/engine-standalone-tracing/src/lib.rs +++ b/engine-standalone-tracing/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(clippy::too_long_first_doc_paragraph)] pub mod sputnik; pub mod types; diff --git a/engine-tests/src/utils/mod.rs b/engine-tests/src/utils/mod.rs index a1c1ec6b5..7bc624324 100644 --- a/engine-tests/src/utils/mod.rs +++ b/engine-tests/src/utils/mod.rs @@ -111,7 +111,7 @@ pub struct OneShotAuroraRunner<'a> { pub context: VMContext, } -impl<'a> OneShotAuroraRunner<'a> { +impl OneShotAuroraRunner<'_> { pub fn profiled_call( self, method_name: &str, diff --git a/engine-tests/src/utils/one_inch/liquidity_protocol.rs b/engine-tests/src/utils/one_inch/liquidity_protocol.rs index 1137d21b7..55a3189fb 100644 --- a/engine-tests/src/utils/one_inch/liquidity_protocol.rs +++ b/engine-tests/src/utils/one_inch/liquidity_protocol.rs @@ -10,7 +10,7 @@ pub struct Helper<'a> { pub signer: &'a mut utils::Signer, } -impl<'a> Helper<'a> { +impl Helper<'_> { pub(crate) fn create_mooniswap_deployer( &mut self, ) -> (SubmitResult, ExecutionProfile, PoolDeployer) { diff --git a/engine-transactions/src/lib.rs b/engine-transactions/src/lib.rs index 77a6b98b4..05dbdf526 100644 --- a/engine-transactions/src/lib.rs +++ b/engine-transactions/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] #![forbid(unsafe_code)] -#![allow(clippy::too_long_first_doc_paragraph)] use aurora_engine_types::types::{Address, Wei}; use aurora_engine_types::{vec, Vec, H160, U256}; diff --git a/engine-types/src/lib.rs b/engine-types/src/lib.rs index accb915fb..e25862e7d 100644 --- a/engine-types/src/lib.rs +++ b/engine-types/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(not(any(feature = "std", feature = "contracts-std")), no_std)] -#![allow(clippy::too_long_first_doc_paragraph)] pub mod account_id; pub mod parameters; diff --git a/engine/src/engine.rs b/engine/src/engine.rs index f0197ca37..b0104b6d6 100644 --- a/engine/src/engine.rs +++ b/engine/src/engine.rs @@ -1036,7 +1036,7 @@ pub fn submit_with_alt_modexp< let fixed_gas = silo::get_fixed_gas(&io); // Check if the sender has rights to submit transactions or deploy code on SILO mode. - assert_access(&io, env, &fixed_gas, &transaction)?; + assert_access(&io, env, fixed_gas, &transaction)?; // Validate the chain ID, if provided inside the signature: if let Some(chain_id) = transaction.chain_id { @@ -1050,7 +1050,7 @@ pub fn submit_with_alt_modexp< check_nonce(&io, &sender, &transaction.nonce)?; // Check that fixed gas is not greater than gasLimit from the transaction. - if fixed_gas.map_or(false, |gas| gas.as_u256() > transaction.gas_limit) { + if fixed_gas.is_some_and(|gas| gas.as_u256() > transaction.gas_limit) { return Err(EngineErrorKind::FixedGasOverflow.into()); } @@ -1739,7 +1739,7 @@ unsafe fn schedule_promise_callback( fn assert_access( io: &I, env: &E, - fixed_gas: &Option, + fixed_gas: Option, transaction: &NormalizedEthTransaction, ) -> Result<(), EngineError> { if fixed_gas.is_some() { @@ -1760,7 +1760,7 @@ fn assert_access( Ok(()) } -impl<'env, I: IO + Copy, E: Env, M: ModExpAlgorithm> Backend for Engine<'env, I, E, M> { +impl Backend for Engine<'_, I, E, M> { /// Returns the "effective" gas price (as defined by EIP-1559) fn gas_price(&self) -> U256 { self.gas_price @@ -1958,7 +1958,7 @@ impl<'env, I: IO + Copy, E: Env, M: ModExpAlgorithm> Backend for Engine<'env, I, } } -impl<'env, J: IO + Copy, E: Env, M: ModExpAlgorithm> ApplyBackend for Engine<'env, J, E, M> { +impl ApplyBackend for Engine<'_, J, E, M> { fn apply(&mut self, values: A, _logs: L, delete_empty: bool) where A: IntoIterator>, diff --git a/engine/src/pausables.rs b/engine/src/pausables.rs index 4ec61c32b..3906de11e 100644 --- a/engine/src/pausables.rs +++ b/engine/src/pausables.rs @@ -30,7 +30,7 @@ impl PrecompileFlags { /// Checks if the precompile belonging to the `address` is marked as paused. #[must_use] pub fn is_paused_by_address(&self, address: &Address) -> bool { - Self::from_address(address).map_or(false, |precompile_flag| self.contains(precompile_flag)) + Self::from_address(address).is_some_and(|precompile_flag| self.contains(precompile_flag)) } } diff --git a/engine/src/xcc.rs b/engine/src/xcc.rs index 5b8e9a55a..cbe31c9c7 100644 --- a/engine/src/xcc.rs +++ b/engine/src/xcc.rs @@ -509,7 +509,7 @@ impl<'a, H> PromiseInterceptor<'a, H> { } } -impl<'a, H: PromiseHandler> PromiseHandler for PromiseInterceptor<'a, H> { +impl PromiseHandler for PromiseInterceptor<'_, H> { type ReadOnly = H::ReadOnly; fn promise_results_count(&self) -> u64 { diff --git a/rust-toolchain b/rust-toolchain index c1d61e3d5..184dfb58f 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "1.84.0" +channel = "1.81.0" targets = ["wasm32-unknown-unknown"] From 683bb637190209e5eec4b755dc5d12dc99e194b6 Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Jan 2025 20:36:22 +0100 Subject: [PATCH 4/4] Relax clippy rules for rust-v1.81 --- engine-precompiles/src/hash.rs | 6 ++++-- engine-precompiles/src/identity.rs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/engine-precompiles/src/hash.rs b/engine-precompiles/src/hash.rs index 4bb05ab53..63be235f3 100644 --- a/engine-precompiles/src/hash.rs +++ b/engine-precompiles/src/hash.rs @@ -31,7 +31,8 @@ impl SHA256 { } impl Precompile for SHA256 { - #[allow(clippy::manual_div_ceil)] + // TODO: should be enable from `RUst 1.84` + // #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( @@ -106,7 +107,8 @@ impl RIPEMD160 { } impl Precompile for RIPEMD160 { - #[allow(clippy::manual_div_ceil)] + // TODO: should be enable from `RUst 1.84` + // #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok( diff --git a/engine-precompiles/src/identity.rs b/engine-precompiles/src/identity.rs index cc2f5fc20..7d4f5a983 100644 --- a/engine-precompiles/src/identity.rs +++ b/engine-precompiles/src/identity.rs @@ -25,7 +25,8 @@ impl Identity { } impl Precompile for Identity { - #[allow(clippy::manual_div_ceil)] + // TODO: should be enable from `RUst 1.84` + // #[allow(clippy::manual_div_ceil)] fn required_gas(input: &[u8]) -> Result { let input_len = u64::try_from(input.len()).map_err(utils::err_usize_conv)?; Ok(