Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wollac committed Feb 4, 2024
1 parent a91897f commit dc1ef51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions testing/ef-tests/src/ethtests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn read_eth_test(path: PathBuf) -> Vec<EthTestCase> {
root.as_object_mut()
.unwrap()
.into_iter()
.map(|(name, test)| {
.filter_map(|(name, test)| {
println!("test '{}'", name);
let json: TestJson = serde_json::from_value(test.take()).unwrap();

Expand All @@ -56,6 +56,5 @@ pub fn read_eth_test(path: PathBuf) -> Vec<EthTestCase> {
chain_spec,
})
})
.flatten()
.collect()
}
13 changes: 7 additions & 6 deletions testing/ef-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use zeth_lib::{
};
use zeth_primitives::{
access_list::{AccessList, AccessListItem},
alloy_rlp,
block::Header,
ethers::from_ethers_h160,
keccak::keccak,
Expand All @@ -43,7 +44,7 @@ use zeth_primitives::{
},
trie::{self, MptNode, MptNodeData, StateAccount},
withdrawal::Withdrawal,
Address, Bloom, Bytes, RlpBytes, StorageKey, B256, B64, U256, U64,
Address, Bloom, Bytes, StorageKey, B256, B64, U256, U64,
};

use crate::ethers::TestProvider;
Expand Down Expand Up @@ -96,8 +97,8 @@ impl From<DbAccount> for TestAccount {
TestAccount {
balance: account.info.balance,
nonce: U64::from(account.info.nonce),
code: account.info.code.unwrap().bytecode.into(),
storage: account.storage.into_iter().map(|(k, v)| (k, v)).collect(),
code: account.info.code.unwrap().bytecode,
storage: account.storage.into_iter().collect(),
}
}
}
Expand Down Expand Up @@ -278,7 +279,7 @@ pub fn mpt_proof(root: &MptNode, key: impl AsRef<[u8]>) -> Result<Vec<Vec<u8>>,

fn proof_internal(node: &MptNode, key_nibs: &[u8]) -> Result<Vec<Vec<u8>>, anyhow::Error> {
if key_nibs.is_empty() {
return Ok(vec![node.to_rlp()]);
return Ok(vec![alloy_rlp::encode(node)]);
}

let mut path: Vec<Vec<u8>> = match node.as_data() {
Expand All @@ -299,7 +300,7 @@ fn proof_internal(node: &MptNode, key_nibs: &[u8]) -> Result<Vec<Vec<u8>>, anyho
}
MptNodeData::Digest(_) => bail!("Cannot descend pointer!"),
};
path.push(node.to_rlp());
path.push(alloy_rlp::encode(node));

Ok(path)
}
Expand Down Expand Up @@ -349,7 +350,7 @@ pub fn create_input(
};

// create and run the block builder once to create the initial DB
let mut builder = BlockBuilder::new(&chain_spec, input, None)
let mut builder = BlockBuilder::new(chain_spec, input, None)
.with_db(provider_db)
.prepare_header::<<EthereumStrategy as BlockBuilderStrategy>::HeaderPrepStrategy>()
.unwrap()
Expand Down

0 comments on commit dc1ef51

Please sign in to comment.