From 92fa6be7c1dd3db237f6b6ae297c36d9b54c7e1b Mon Sep 17 00:00:00 2001 From: ceciliaz030 Date: Thu, 25 Jan 2024 04:42:52 +0800 Subject: [PATCH] update checksum fmt & clippy fix util import #![feature(build_hasher_simple_hash_one)] clear comments fmt --- Cargo.lock | 4 ++-- guests/eth-block/Cargo.lock | 4 ++-- guests/op-block/Cargo.lock | 4 ++-- guests/op-derive/Cargo.lock | 4 ++-- host/src/bin/op-derive.rs | 1 - host/src/main.rs | 1 - host/src/util/mpt.rs | 2 +- lib/src/builder/execute/ethereum.rs | 6 +++--- lib/src/builder/execute/optimism.rs | 4 ++-- lib/src/input.rs | 2 +- lib/src/lib.rs | 4 ---- lib/src/optimism/batcher.rs | 4 ++-- lib/src/optimism/batcher_channel.rs | 7 ++++--- primitives/src/access_list.rs | 2 -- primitives/src/batch.rs | 2 +- primitives/src/ethers.rs | 2 -- primitives/src/receipt.rs | 2 -- primitives/src/revm.rs | 2 -- primitives/src/transactions/ethereum.rs | 2 -- primitives/src/trie/mpt.rs | 2 -- testing/ef-tests/src/lib.rs | 2 +- testing/ef-tests/testguest/Cargo.lock | 4 ++-- 22 files changed, 25 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70ad130d..1b5701b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,9 +42,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell", diff --git a/guests/eth-block/Cargo.lock b/guests/eth-block/Cargo.lock index ef5a3864..6c238573 100644 --- a/guests/eth-block/Cargo.lock +++ b/guests/eth-block/Cargo.lock @@ -25,9 +25,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell", diff --git a/guests/op-block/Cargo.lock b/guests/op-block/Cargo.lock index 7107df48..72e93e46 100644 --- a/guests/op-block/Cargo.lock +++ b/guests/op-block/Cargo.lock @@ -25,9 +25,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell", diff --git a/guests/op-derive/Cargo.lock b/guests/op-derive/Cargo.lock index e7f4db3c..8d63e6d5 100644 --- a/guests/op-derive/Cargo.lock +++ b/guests/op-derive/Cargo.lock @@ -25,9 +25,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell", diff --git a/host/src/bin/op-derive.rs b/host/src/bin/op-derive.rs index 888a7972..b9eeac4a 100644 --- a/host/src/bin/op-derive.rs +++ b/host/src/bin/op-derive.rs @@ -20,7 +20,6 @@ // --cache \ // --op-block-no=109279674 \ // --op-blocks=6 - use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; diff --git a/host/src/main.rs b/host/src/main.rs index 99b51d2a..ca54210e 100644 --- a/host/src/main.rs +++ b/host/src/main.rs @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - extern crate core; use std::{ diff --git a/host/src/util/mpt.rs b/host/src/util/mpt.rs index 516595f8..91117918 100644 --- a/host/src/util/mpt.rs +++ b/host/src/util/mpt.rs @@ -75,7 +75,7 @@ pub fn is_not_included(key: &[u8], proof_nodes: &[MptNode]) -> Result { // for valid proofs, the get must not fail let value = proof_trie .get(key) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("invalid trie")?; Ok(value.is_none()) diff --git a/lib/src/builder/execute/ethereum.rs b/lib/src/builder/execute/ethereum.rs index b1b9df4a..eab3f3c3 100644 --- a/lib/src/builder/execute/ethereum.rs +++ b/lib/src/builder/execute/ethereum.rs @@ -163,11 +163,11 @@ impl TxExecStrategy for EthTxExecStrategy { let trie_key = tx_no.to_rlp(); tx_trie .insert_rlp(&trie_key, tx) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("failed to insert transaction")?; receipt_trie .insert_rlp(&trie_key, receipt) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("failed to insert receipt")?; // update account states @@ -225,7 +225,7 @@ impl TxExecStrategy for EthTxExecStrategy { // Add withdrawal to trie withdrawals_trie .insert_rlp(&i.to_rlp(), withdrawal) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("failed to insert withdrawal")?; } diff --git a/lib/src/builder/execute/optimism.rs b/lib/src/builder/execute/optimism.rs index 222419d5..873a910e 100644 --- a/lib/src/builder/execute/optimism.rs +++ b/lib/src/builder/execute/optimism.rs @@ -212,11 +212,11 @@ impl TxExecStrategy for OpTxExecStrategy { let trie_key = tx_no.to_rlp(); tx_trie .insert_rlp(&trie_key, tx) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("failed to insert transaction")?; receipt_trie .insert_rlp(&trie_key, receipt) - .map_err(|e| Into::::into(e)) + .map_err(Into::::into) .context("failed to insert receipt")?; } diff --git a/lib/src/input.rs b/lib/src/input.rs index 2cc10331..4ac6c2ba 100644 --- a/lib/src/input.rs +++ b/lib/src/input.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use alloc::vec::Vec; +use alloc::{vec, vec::Vec}; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 841da4d1..ea1dfc93 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -11,14 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; extern crate core; -// #[cfg(any(not(target_os = "zkvm"), not(feature = "std")))] -// pub mod host; - pub mod builder; pub mod consts; pub mod input; diff --git a/lib/src/optimism/batcher.rs b/lib/src/optimism/batcher.rs index 5b0d2ab8..6d95e59a 100644 --- a/lib/src/optimism/batcher.rs +++ b/lib/src/optimism/batcher.rs @@ -13,10 +13,10 @@ // limitations under the License. use alloc::{ - collections::{BinaryHeap, VecDeque, BTreeMap}, + collections::{BTreeMap, VecDeque}, vec::Vec, }; -use core::cmp::{Ordering, Reverse}; +use core::cmp::Ordering; use anyhow::{bail, ensure, Context, Result}; use zeth_primitives::{ diff --git a/lib/src/optimism/batcher_channel.rs b/lib/src/optimism/batcher_channel.rs index 72dc47ea..82203219 100644 --- a/lib/src/optimism/batcher_channel.rs +++ b/lib/src/optimism/batcher_channel.rs @@ -15,8 +15,8 @@ // use std::io::Read; use alloc::{ - format, collections::{BTreeMap, VecDeque}, + format, vec, vec::Vec, }; @@ -314,6 +314,7 @@ impl Channel { let mut channel_data = decompressed.as_slice(); while !channel_data.is_empty() { let batch = Batch::decode(&mut channel_data) + .map_err(|e| anyhow!(AlloyRlpError::from(e))) .with_context(|| format!("failed to decode batch {}", batches.len()))?; batches.push(BatchWithInclusion { @@ -584,10 +585,10 @@ mod tests { let mut channel = new_channel(); channel.add_frame(frame_a).unwrap(); assert_eq!(channel.size, 209); - assert_eq!(channel.is_ready(), false); + assert!(!channel.is_ready()); channel.add_frame(frame_b).unwrap(); assert_eq!(channel.size, 420); - assert_eq!(channel.is_ready(), true); + assert!(channel.is_ready()); assert_eq!(channel.decompress().unwrap(), b"Hello World!"); } } diff --git a/primitives/src/access_list.rs b/primitives/src/access_list.rs index a27f6627..e4e141b8 100644 --- a/primitives/src/access_list.rs +++ b/primitives/src/access_list.rs @@ -11,8 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// #[cfg(not(feature = "std"))] -// use crate::no_std_preflight::*; extern crate alloc; extern crate core; diff --git a/primitives/src/batch.rs b/primitives/src/batch.rs index 1f17c300..020e1465 100644 --- a/primitives/src/batch.rs +++ b/primitives/src/batch.rs @@ -30,7 +30,7 @@ pub use core::{ result::{Result, Result::*}, }; -use alloy_primitives::{BlockNumber, Bytes, B256}; +use alloy_primitives::{Bytes, B256}; use alloy_rlp::{Decodable, Encodable}; use alloy_rlp_derive::{RlpDecodable, RlpEncodable}; use serde::{Deserialize, Serialize}; diff --git a/primitives/src/ethers.rs b/primitives/src/ethers.rs index eb50a3de..d6d15afb 100644 --- a/primitives/src/ethers.rs +++ b/primitives/src/ethers.rs @@ -13,8 +13,6 @@ // limitations under the License. //! Convert from Ethers types. -// #[cfg(not(feature = "std"))] -// use crate::no_std_preflight::*; extern crate alloc; extern crate core; diff --git a/primitives/src/receipt.rs b/primitives/src/receipt.rs index 9168a261..175de22d 100644 --- a/primitives/src/receipt.rs +++ b/primitives/src/receipt.rs @@ -11,8 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// #[cfg(not(feature = "std"))] -// use crate::no_std_preflight::*; extern crate alloc; extern crate core; diff --git a/primitives/src/revm.rs b/primitives/src/revm.rs index d684742b..2cee7a4e 100644 --- a/primitives/src/revm.rs +++ b/primitives/src/revm.rs @@ -13,8 +13,6 @@ // limitations under the License. //! Convert to revm types. -// #[cfg(not(feature = "std"))] -// use crate::no_std_preflight::*; extern crate alloc; extern crate core; diff --git a/primitives/src/transactions/ethereum.rs b/primitives/src/transactions/ethereum.rs index 65e8fde5..cef6a187 100644 --- a/primitives/src/transactions/ethereum.rs +++ b/primitives/src/transactions/ethereum.rs @@ -11,8 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// #[cfg(not(feature = "std"))] -// use crate::no_std_preflight::*; extern crate alloc; extern crate core; diff --git a/primitives/src/trie/mpt.rs b/primitives/src/trie/mpt.rs index ad5b0a4a..10d1cde0 100644 --- a/primitives/src/trie/mpt.rs +++ b/primitives/src/trie/mpt.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// use crate::no_std_preflight::*; - extern crate alloc; extern crate core; diff --git a/testing/ef-tests/src/lib.rs b/testing/ef-tests/src/lib.rs index 73e1f3c2..d27771a0 100644 --- a/testing/ef-tests/src/lib.rs +++ b/testing/ef-tests/src/lib.rs @@ -18,7 +18,7 @@ use anyhow::bail; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use serde_with::{serde_as, NoneAsEmptyString}; -use zeth::util::{ +use util::{ preflight::Data, provider::{AccountQuery, BlockQuery, ProofQuery, Provider, StorageQuery}, provider_db::ProviderDb, diff --git a/testing/ef-tests/testguest/Cargo.lock b/testing/ef-tests/testguest/Cargo.lock index d17f96bb..6216b3c1 100644 --- a/testing/ef-tests/testguest/Cargo.lock +++ b/testing/ef-tests/testguest/Cargo.lock @@ -25,9 +25,9 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell",