From 5028fc20a64b9c27db70c8b5426f53b6bcc47455 Mon Sep 17 00:00:00 2001 From: Ivan Litteri <67517699+ilitteri@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:13:41 -0300 Subject: [PATCH 1/3] fix(l1, l2, levm): do not run reporters on weekend (#1372) --- .github/workflows/hive_coverage.yaml | 2 +- .github/workflows/levm_reporter.yaml | 2 +- .github/workflows/loc.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hive_coverage.yaml b/.github/workflows/hive_coverage.yaml index 7aa36ec2a..d894a754e 100644 --- a/.github/workflows/hive_coverage.yaml +++ b/.github/workflows/hive_coverage.yaml @@ -3,7 +3,7 @@ name: Daily Hive Coverage on: schedule: # Every day at UTC midnight - - cron: "0 0 * * *" + - cron: "0 0 * * 1,2,3,4,5" workflow_dispatch: env: diff --git a/.github/workflows/levm_reporter.yaml b/.github/workflows/levm_reporter.yaml index 5ad8e7699..b4e7c00af 100644 --- a/.github/workflows/levm_reporter.yaml +++ b/.github/workflows/levm_reporter.yaml @@ -3,7 +3,7 @@ name: Daily LEVM Reporter on: schedule: # Every day at midnight - - cron: "0 0 * * *" + - cron: "0 0 * * 1,2,3,4,5" workflow_dispatch: env: diff --git a/.github/workflows/loc.yaml b/.github/workflows/loc.yaml index 44a58b929..40e277781 100644 --- a/.github/workflows/loc.yaml +++ b/.github/workflows/loc.yaml @@ -3,7 +3,7 @@ name: Daily Lines of Code Report on: schedule: # Every day at midnight - - cron: "0 0 * * *" + - cron: "0 0 * * 1,2,3,4,5" workflow_dispatch: env: From 20698262ed22f0de879c554395def338e273b78c Mon Sep 17 00:00:00 2001 From: LeanSerra <46695152+LeanSerra@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:20:56 -0300 Subject: [PATCH 2/3] chore(l2): forbid as conversions (#1347) **Motivation** - This PR aims to remove all `as` conversions from the l2 code **Description** - This PR removes all type conversions using as and changes them to use either into(), try_into() or refactors to avoid having to convert - Some type conversions from enum to numeric types are removed by implementing the trait `From` Closes #1268 --------- Co-authored-by: Federico Borello <156438142+fborello-lambda@users.noreply.github.com> --- crates/common/types/block.rs | 2 +- crates/common/types/transaction.rs | 12 ++++++ crates/l2/Cargo.toml | 2 + crates/l2/contracts/Cargo.toml | 2 + crates/l2/proposer/errors.rs | 4 ++ crates/l2/proposer/l1_committer.rs | 37 ++++++++++------- crates/l2/proposer/prover_server.rs | 7 +++- crates/l2/proposer/state_diff.rs | 48 +++++++++++++++++---- crates/l2/prover/Cargo.toml | 2 + crates/l2/sdk/Cargo.toml | 2 + crates/l2/sdk/src/sdk.rs | 9 +++- crates/l2/utils/eth_client/eth_sender.rs | 6 ++- crates/l2/utils/eth_client/mod.rs | 53 ++++++++++-------------- 13 files changed, 128 insertions(+), 58 deletions(-) diff --git a/crates/common/types/block.rs b/crates/common/types/block.rs index bbd2acd3b..d1b3f0fdb 100644 --- a/crates/common/types/block.rs +++ b/crates/common/types/block.rs @@ -350,7 +350,7 @@ pub fn calculate_base_fee_per_blob_gas(parent_excess_blob_gas: u64) -> u64 { } // Defined in [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) -fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> u64 { +pub fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> u64 { let mut i = 1; let mut output = 0; let mut numerator_accum = factor * denominator; diff --git a/crates/common/types/transaction.rs b/crates/common/types/transaction.rs index 0a81f34f7..33b8872a4 100644 --- a/crates/common/types/transaction.rs +++ b/crates/common/types/transaction.rs @@ -135,6 +135,18 @@ pub enum TxType { Privileged = 0x7e, } +impl From for u8 { + fn from(val: TxType) -> Self { + match val { + TxType::Legacy => 0x00, + TxType::EIP2930 => 0x01, + TxType::EIP1559 => 0x02, + TxType::EIP4844 => 0x03, + TxType::Privileged => 0x7e, + } + } +} + pub trait Signable { fn sign(&self, private_key: &SecretKey) -> Self where diff --git a/crates/l2/Cargo.toml b/crates/l2/Cargo.toml index 6bcb29a5a..aa4637ec3 100644 --- a/crates/l2/Cargo.toml +++ b/crates/l2/Cargo.toml @@ -44,3 +44,5 @@ path = "./l2.rs" unwrap_used = "deny" expect_used = "deny" indexing_slicing = "deny" +as_conversions = "deny" +unnecessary_cast = "warn" diff --git a/crates/l2/contracts/Cargo.toml b/crates/l2/contracts/Cargo.toml index f35455bf8..9609c5fe3 100644 --- a/crates/l2/contracts/Cargo.toml +++ b/crates/l2/contracts/Cargo.toml @@ -29,3 +29,5 @@ path = "./deployer.rs" unwrap_used = "deny" expect_used = "deny" indexing_slicing = "deny" +as_conversions = "deny" +unnecessary_cast = "warn" diff --git a/crates/l2/proposer/errors.rs b/crates/l2/proposer/errors.rs index 2817c0a08..707d4fa37 100644 --- a/crates/l2/proposer/errors.rs +++ b/crates/l2/proposer/errors.rs @@ -103,6 +103,8 @@ pub enum CommitterError { InvalidWithdrawalTransaction, #[error("Blob estimation failed: {0}")] BlobEstimationError(#[from] BlobEstimationError), + #[error("length does not fit in u16")] + TryIntoError(#[from] std::num::TryFromIntError), } #[derive(Debug, thiserror::Error)] @@ -131,4 +133,6 @@ pub enum StateDiffError { BytecodeAndBytecodeHashSet, #[error("Empty account diff")] EmptyAccountDiff, + #[error("The length of the vector is too big to fit in u16: {0}")] + LengthTooBig(#[from] core::num::TryFromIntError), } diff --git a/crates/l2/proposer/l1_committer.rs b/crates/l2/proposer/l1_committer.rs index ea6aa332c..36ef35fb3 100644 --- a/crates/l2/proposer/l1_committer.rs +++ b/crates/l2/proposer/l1_committer.rs @@ -12,8 +12,9 @@ use crate::{ use bytes::Bytes; use ethrex_core::{ types::{ - blobs_bundle, BlobsBundle, Block, PrivilegedL2Transaction, PrivilegedTxType, Transaction, - TxKind, BLOB_BASE_FEE_UPDATE_FRACTION, + blobs_bundle, fake_exponential, BlobsBundle, Block, PrivilegedL2Transaction, + PrivilegedTxType, Transaction, TxKind, BLOB_BASE_FEE_UPDATE_FRACTION, + MIN_BASE_FEE_PER_BLOB_GAS, }, Address, H256, U256, }; @@ -21,7 +22,6 @@ use ethrex_storage::{error::StoreError, Store}; use ethrex_vm::{evm_state, execute_block, get_state_transitions}; use keccak_hash::keccak; use secp256k1::SecretKey; -use std::f64::consts::E; use std::{collections::HashMap, time::Duration}; use tokio::time::sleep; use tracing::{error, info}; @@ -211,9 +211,13 @@ impl Committer { pub fn get_deposit_hash(&self, deposit_hashes: Vec) -> Result { if !deposit_hashes.is_empty() { + let deposit_hashes_len: u16 = deposit_hashes + .len() + .try_into() + .map_err(CommitterError::from)?; Ok(H256::from_slice( [ - &(deposit_hashes.len() as u16).to_be_bytes(), + &deposit_hashes_len.to_be_bytes(), keccak( deposit_hashes .iter() @@ -270,7 +274,9 @@ impl Committer { .clone() .ok_or(CommitterError::FailedToRetrieveDataFromStorage)? .nonce - - prev_nonce) as u16, + - prev_nonce) + .try_into() + .map_err(CommitterError::from)?, storage: account_update.added_storage.clone().into_iter().collect(), bytecode: account_update.code.clone(), bytecode_hash: None, @@ -347,7 +353,7 @@ impl Committer { let le_bytes = estimate_blob_gas( &self.eth_client, self.arbitrary_base_blob_gas_price, - 1.2, // 20% of headroom + 20, // 20% of headroom ) .await? .to_le_bytes(); @@ -393,7 +399,7 @@ impl Committer { /// # Parameters: /// - `eth_client`: The Ethereum client used to fetch the latest block. /// - `arbitrary_base_blob_gas_price`: The base gas price that serves as the minimum price for blob transactions. -/// - `headroom`: A multiplier (as a float) applied to the estimated gas price to provide a buffer against fluctuations. +/// - `headroom`: Percentage applied to the estimated gas price to provide a buffer against fluctuations. /// /// # Formula: /// The gas price is estimated using an exponential function based on the blob gas used in the latest block and the @@ -404,7 +410,7 @@ impl Committer { async fn estimate_blob_gas( eth_client: &EthClient, arbitrary_base_blob_gas_price: u64, - headroom: f64, + headroom: u64, ) -> Result { let latest_block = eth_client .get_block_by_number(BlockByNumber::Latest) @@ -432,15 +438,16 @@ async fn estimate_blob_gas( }; // If the blob's market is in high demand, the equation may give a really big number. - let exponent = (total_blob_gas as f64) / (BLOB_BASE_FEE_UPDATE_FRACTION as f64); - let blob_gas = match E.powf(exponent) { - result if result.is_finite() => result, - _ => return Err(BlobEstimationError::NonFiniteResult.into()), - }; + let blob_gas = fake_exponential( + MIN_BASE_FEE_PER_BLOB_GAS, + total_blob_gas, + BLOB_BASE_FEE_UPDATE_FRACTION, + ); + + let gas_with_headroom = (blob_gas * (100 + headroom)) / 100; // Check if we have an overflow when we take the headroom into account. - let gas_with_headroom = blob_gas * headroom; - let blob_gas = match arbitrary_base_blob_gas_price.checked_add(gas_with_headroom as u64) { + let blob_gas = match arbitrary_base_blob_gas_price.checked_add(gas_with_headroom) { Some(gas) => gas, None => return Err(BlobEstimationError::OverflowError.into()), }; diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index f599fb715..ac2d6e1e0 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -417,7 +417,12 @@ impl ProverServer { calldata.extend(journal_digest.as_bytes()); // extend with size of seal - calldata.extend(H256::from_low_u64_be(seal.len() as u64).as_bytes()); + calldata.extend( + H256::from_low_u64_be(seal.len().try_into().map_err(|err| { + ProverServerError::Custom(format!("Seal length does not fit in u64: {}", err)) + })?) + .as_bytes(), + ); // extend with seal calldata.extend(seal); // extend with zero padding diff --git a/crates/l2/proposer/state_diff.rs b/crates/l2/proposer/state_diff.rs index c246bb285..2433f57a1 100644 --- a/crates/l2/proposer/state_diff.rs +++ b/crates/l2/proposer/state_diff.rs @@ -69,15 +69,32 @@ impl Default for StateDiff { } } +impl From for u8 { + fn from(value: AccountStateDiffType) -> Self { + match value { + AccountStateDiffType::NewBalance => 1, + AccountStateDiffType::NonceDiff => 2, + AccountStateDiffType::Storage => 4, + AccountStateDiffType::Bytecode => 8, + AccountStateDiffType::BytecodeHash => 16, + } + } +} + impl StateDiff { pub fn encode(&self) -> Result { if self.version != 1 { return Err(StateDiffError::UnsupportedVersion(self.version)); } + let modified_accounts_len: u16 = self + .modified_accounts + .len() + .try_into() + .map_err(StateDiffError::from)?; let mut encoded: Vec = Vec::new(); encoded.push(self.version); - encoded.extend((self.modified_accounts.len() as u16).to_be_bytes()); + encoded.extend(modified_accounts_len.to_be_bytes()); for (address, diff) in &self.modified_accounts { let (r#type, diff_encoded) = diff.encode()?; @@ -119,20 +136,28 @@ impl AccountStateDiff { let mut encoded: Vec = Vec::new(); if let Some(new_balance) = self.new_balance { - r#type += AccountStateDiffType::NewBalance as u8; + let r_type: u8 = AccountStateDiffType::NewBalance.into(); + r#type += r_type; let buf = &mut [0u8; 32]; new_balance.to_big_endian(buf); encoded.extend_from_slice(buf); } if self.nonce_diff != 0 { - r#type += AccountStateDiffType::NonceDiff as u8; + let r_type: u8 = AccountStateDiffType::NonceDiff.into(); + r#type += r_type; encoded.extend(self.nonce_diff.to_be_bytes()); } if !self.storage.is_empty() { - r#type += AccountStateDiffType::Storage as u8; - encoded.extend((self.storage.len() as u16).to_be_bytes()); + let r_type: u8 = AccountStateDiffType::Storage.into(); + let storage_len: u16 = self + .storage + .len() + .try_into() + .map_err(StateDiffError::from)?; + r#type += r_type; + encoded.extend(storage_len.to_be_bytes()); for (key, value) in &self.storage { encoded.extend_from_slice(&key.0); let buf = &mut [0u8; 32]; @@ -142,13 +167,20 @@ impl AccountStateDiff { } if let Some(bytecode) = &self.bytecode { - r#type += AccountStateDiffType::Bytecode as u8; - encoded.extend((bytecode.len() as u16).to_be_bytes()); + let r_type: u8 = AccountStateDiffType::Bytecode.into(); + let bytecode_len: u16 = self + .storage + .len() + .try_into() + .map_err(StateDiffError::from)?; + r#type += r_type; + encoded.extend(bytecode_len.to_be_bytes()); encoded.extend(bytecode); } if let Some(bytecode_hash) = &self.bytecode_hash { - r#type += AccountStateDiffType::BytecodeHash as u8; + let r_type: u8 = AccountStateDiffType::BytecodeHash.into(); + r#type += r_type; encoded.extend(&bytecode_hash.0); } diff --git a/crates/l2/prover/Cargo.toml b/crates/l2/prover/Cargo.toml index 2b2616b4c..2309d4186 100644 --- a/crates/l2/prover/Cargo.toml +++ b/crates/l2/prover/Cargo.toml @@ -55,3 +55,5 @@ gpu = ["risc0-zkvm/cuda"] unwrap_used = "deny" expect_used = "deny" indexing_slicing = "deny" +as_conversions = "deny" +unnecessary_cast = "warn" diff --git a/crates/l2/sdk/Cargo.toml b/crates/l2/sdk/Cargo.toml index ee16463f1..9a99559ba 100644 --- a/crates/l2/sdk/Cargo.toml +++ b/crates/l2/sdk/Cargo.toml @@ -24,3 +24,5 @@ path = "src/sdk.rs" unwrap_used = "deny" expect_used = "deny" indexing_slicing = "deny" +as_conversions = "deny" +unnecessary_cast = "warn" diff --git a/crates/l2/sdk/src/sdk.rs b/crates/l2/sdk/src/sdk.rs index b121df616..f67c5622c 100644 --- a/crates/l2/sdk/src/sdk.rs +++ b/crates/l2/sdk/src/sdk.rs @@ -258,7 +258,7 @@ pub async fn get_withdraw_merkle_proof( Transaction::PrivilegedL2Transaction(privileged_l2_transaction) => { privileged_l2_transaction .get_withdrawal_hash() - .map(|withdrawal_hash| (i as u64, (withdrawal_hash))) + .map(|withdrawal_hash| (i, (withdrawal_hash))) } _ => unreachable!(), }) @@ -283,5 +283,10 @@ pub async fn get_withdraw_merkle_proof( "Failed to generate merkle proof, element is not on the tree".to_string(), ))?; - Ok((index, path)) + Ok(( + index + .try_into() + .map_err(|err| EthClientError::Custom(format!("index does not fit in u64: {}", err)))?, + path, + )) } diff --git a/crates/l2/utils/eth_client/eth_sender.rs b/crates/l2/utils/eth_client/eth_sender.rs index 4f2c6e1e8..42520dc6b 100644 --- a/crates/l2/utils/eth_client/eth_sender.rs +++ b/crates/l2/utils/eth_client/eth_sender.rs @@ -90,7 +90,11 @@ impl EthClient { let encoded_from = deployer.encode_to_vec(); // FIXME: We'll probably need to use nonce - 1 since it was updated above. let encoded_nonce = self.get_nonce(deployer).await?.encode_to_vec(); - let mut encoded = vec![(0xc0 + encoded_from.len() + encoded_nonce.len()) as u8]; + let mut encoded = vec![(0xc0 + encoded_from.len() + encoded_nonce.len()) + .try_into() + .map_err(|err| { + EthClientError::Custom(format!("Failed to encode deployed_address {}", err)) + })?]; encoded.extend(encoded_from.clone()); encoded.extend(encoded_nonce.clone()); let deployed_address = Address::from(keccak(encoded)); diff --git a/crates/l2/utils/eth_client/mod.rs b/crates/l2/utils/eth_client/mod.rs index ff59fe5bb..083d13f01 100644 --- a/crates/l2/utils/eth_client/mod.rs +++ b/crates/l2/utils/eth_client/mod.rs @@ -125,7 +125,7 @@ impl EthClient { let signed_tx = tx.sign(private_key); let mut encoded_tx = signed_tx.encode_to_vec(); - encoded_tx.insert(0, TxType::EIP1559 as u8); + encoded_tx.insert(0, TxType::EIP1559.into()); self.send_raw_transaction(encoded_tx.as_slice()).await } @@ -139,7 +139,7 @@ impl EthClient { wrapped_tx.tx.sign_inplace(private_key); let mut encoded_tx = wrapped_tx.encode_to_vec(); - encoded_tx.insert(0, TxType::EIP4844 as u8); + encoded_tx.insert(0, TxType::EIP4844.into()); self.send_raw_transaction(encoded_tx.as_slice()).await } @@ -246,7 +246,7 @@ impl EthClient { })?; // Sometimes the penalty is a 100% // Increase max fee per gas by 110% (set it to 210% of the original) - self.bump_eip1559(tx, 1.1); + self.bump_eip1559(tx, 110); let wrapped_tx = &mut WrappedTransaction::EIP1559(tx.clone()); self.estimate_gas_for_wrapped_tx(wrapped_tx, from).await?; @@ -259,11 +259,9 @@ impl EthClient { } /// Increase max fee per gas by percentage% (set it to (100+percentage)% of the original) - pub fn bump_eip1559(&self, tx: &mut EIP1559Transaction, percentage: f64) { - // TODO: handle as conversions - tx.max_fee_per_gas = (tx.max_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; - tx.max_priority_fee_per_gas += - (tx.max_priority_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; + pub fn bump_eip1559(&self, tx: &mut EIP1559Transaction, percentage: u64) { + tx.max_fee_per_gas = (tx.max_fee_per_gas * (100 + percentage)) / 100; + tx.max_priority_fee_per_gas += (tx.max_priority_fee_per_gas * (100 + percentage)) / 100; } pub async fn bump_and_resend_eip4844( @@ -276,7 +274,7 @@ impl EthClient { })?; // Sometimes the penalty is a 100% // Increase max fee per gas by 110% (set it to 210% of the original) - self.bump_eip4844(wrapped_tx, 1.1); + self.bump_eip4844(wrapped_tx, 110); let wrapped_eip4844 = &mut WrappedTransaction::EIP4844(wrapped_tx.clone()); self.estimate_gas_for_wrapped_tx(wrapped_eip4844, from) .await?; @@ -291,14 +289,11 @@ impl EthClient { } /// Increase max fee per gas by percentage% (set it to (100+percentage)% of the original) - pub fn bump_eip4844(&self, wrapped_tx: &mut WrappedEIP4844Transaction, percentage: f64) { - // TODO: handle as conversions - wrapped_tx.tx.max_fee_per_gas = - (wrapped_tx.tx.max_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; - wrapped_tx.tx.max_priority_fee_per_gas = - (wrapped_tx.tx.max_priority_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; - - let factor = ((1.0 + percentage) * 10.0).ceil() as u64; + pub fn bump_eip4844(&self, wrapped_tx: &mut WrappedEIP4844Transaction, percentage: u64) { + wrapped_tx.tx.max_fee_per_gas = (wrapped_tx.tx.max_fee_per_gas * (100 + percentage)) / 100; + wrapped_tx.tx.max_priority_fee_per_gas += + (wrapped_tx.tx.max_priority_fee_per_gas * (100 + percentage)) / 100; + let factor = 1 + (percentage / 100) * 10; wrapped_tx.tx.max_fee_per_blob_gas = wrapped_tx .tx .max_fee_per_blob_gas @@ -316,7 +311,7 @@ impl EthClient { })?; // Sometimes the penalty is a 100% // Increase max fee per gas by 110% (set it to 210% of the original) - self.bump_privileged_l2(tx, 1.1); + self.bump_privileged_l2(tx, 110); let wrapped_tx = &mut WrappedTransaction::L2(tx.clone()); self.estimate_gas_for_wrapped_tx(wrapped_tx, from).await?; if let WrappedTransaction::L2(l2_tx) = wrapped_tx { @@ -328,11 +323,9 @@ impl EthClient { } /// Increase max fee per gas by percentage% (set it to (100+percentage)% of the original) - pub fn bump_privileged_l2(&self, tx: &mut PrivilegedL2Transaction, percentage: f64) { - // TODO: handle as conversions - tx.max_fee_per_gas = (tx.max_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; - tx.max_priority_fee_per_gas += - (tx.max_priority_fee_per_gas as f64 * (1.0 + percentage)).round() as u64; + pub fn bump_privileged_l2(&self, tx: &mut PrivilegedL2Transaction, percentage: u64) { + tx.max_fee_per_gas = (tx.max_fee_per_gas * (100 + percentage)) / 100; + tx.max_priority_fee_per_gas += (tx.max_priority_fee_per_gas * (100 + percentage)) / 100; } pub async fn send_privileged_l2_transaction( @@ -343,7 +336,7 @@ impl EthClient { let signed_tx = tx.sign(private_key); let mut encoded_tx = signed_tx.encode_to_vec(); - encoded_tx.insert(0, TxType::Privileged as u8); + encoded_tx.insert(0, TxType::Privileged.into()); self.send_raw_transaction(encoded_tx.as_slice()).await } @@ -693,13 +686,13 @@ impl EthClient { if error.contains("transaction underpriced") { match wrapped_tx { WrappedTransaction::EIP4844(wrapped_eip4844_transaction) => { - self.bump_eip4844(wrapped_eip4844_transaction, 1.1); + self.bump_eip4844(wrapped_eip4844_transaction, 110); } WrappedTransaction::EIP1559(eip1559_transaction) => { - self.bump_eip1559(eip1559_transaction, 1.1); + self.bump_eip1559(eip1559_transaction, 110); } WrappedTransaction::L2(privileged_l2_transaction) => { - self.bump_privileged_l2(privileged_l2_transaction, 1.1); + self.bump_privileged_l2(privileged_l2_transaction, 110); } }; continue; @@ -775,7 +768,7 @@ impl EthClient { if error.contains("replacement transaction underpriced") { warn!("Bumping gas while building: already known"); retry += 1; - self.bump_eip1559(&mut tx, 1.1); + self.bump_eip1559(&mut tx, 110); continue; } return Err(e); @@ -861,7 +854,7 @@ impl EthClient { if error.contains("already known") { warn!("Bumping gas while building: already known"); retry += 1; - self.bump_eip4844(&mut wrapped_eip4844, 1.1); + self.bump_eip4844(&mut wrapped_eip4844, 110); continue; } return Err(e); @@ -943,7 +936,7 @@ impl EthClient { if error.contains("already known") { warn!("Bumping gas while building: already known"); retry += 1; - self.bump_privileged_l2(&mut tx, 1.1); + self.bump_privileged_l2(&mut tx, 110); continue; } return Err(e); From 7f72d73fab92dabdeb8ab59c22b7e20afb3b0d63 Mon Sep 17 00:00:00 2001 From: Ivan Litteri <67517699+ilitteri@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:48:05 -0300 Subject: [PATCH 3/3] fix(levm): lint (#1370) LEVM Linter is failing. This fixes should be enough to make it pass. --- crates/storage/trie/db/utils.rs | 1 + crates/vm/levm/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/storage/trie/db/utils.rs b/crates/storage/trie/db/utils.rs index e6178bad0..c1ab27e82 100644 --- a/crates/storage/trie/db/utils.rs +++ b/crates/storage/trie/db/utils.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "libmdbx")] // In order to use NodeHash as key in a dupsort table we must encode it into a fixed size type pub fn node_hash_to_fixed_size(node_hash: Vec) -> [u8; 33] { // keep original len so we can re-construct it later diff --git a/crates/vm/levm/Cargo.toml b/crates/vm/levm/Cargo.toml index 3635db593..0628b0bb4 100644 --- a/crates/vm/levm/Cargo.toml +++ b/crates/vm/levm/Cargo.toml @@ -41,7 +41,7 @@ unwrap_used = "deny" expect_used = "deny" arithmetic_side_effects = "deny" -overflow_check_conditional = "warn" +panicking_overflow_checks = "warn" manual_saturating_arithmetic = "warn" [lib]