mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix: fix clippy and broken code (#1761)
This commit is contained in:
@ -739,7 +739,7 @@ mod tests {
|
||||
assert!(res.is_ok());
|
||||
|
||||
// Withdrawal index should be the last withdrawal index + 1
|
||||
let mut provider = Provider::new(Some(parent.clone()));
|
||||
let mut provider = Provider::new(Some(parent));
|
||||
let block = create_block_with_withdrawals(&[4, 5, 6]);
|
||||
provider
|
||||
.withdrawals_provider
|
||||
|
||||
@ -4,12 +4,13 @@ use criterion::{
|
||||
};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_db::mdbx::{Env, WriteMap};
|
||||
use reth_interfaces::test_utils::TestConsensus;
|
||||
use reth_stages::{
|
||||
stages::{MerkleStage, SenderRecoveryStage, TotalDifficultyStage, TransactionLookupStage},
|
||||
test_utils::TestTransaction,
|
||||
ExecInput, Stage, StageId, UnwindInput,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
mod setup;
|
||||
use setup::StageRange;
|
||||
@ -76,7 +77,7 @@ fn total_difficulty(c: &mut Criterion) {
|
||||
group.warm_up_time(std::time::Duration::from_millis(2000));
|
||||
// don't need to run each stage for that many times
|
||||
group.sample_size(10);
|
||||
let stage = TotalDifficultyStage::default();
|
||||
let stage = TotalDifficultyStage::new(Arc::new(TestConsensus::default()));
|
||||
|
||||
measure_stage(
|
||||
&mut group,
|
||||
|
||||
@ -18,6 +18,7 @@ use reth_stages::{
|
||||
};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
ops::Deref,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
@ -124,7 +125,7 @@ pub(crate) fn txs_testdata(num_blocks: u64) -> PathBuf {
|
||||
|
||||
// make first block after genesis have valid state root
|
||||
let root =
|
||||
DBTrieLoader::default().calculate_root(&tx.inner()).and_then(|e| e.root()).unwrap();
|
||||
DBTrieLoader::new(tx.inner().deref()).calculate_root().and_then(|e| e.root()).unwrap();
|
||||
let second_block = blocks.get_mut(1).unwrap();
|
||||
let cloned_second = second_block.clone();
|
||||
let mut updated_header = cloned_second.header.unseal();
|
||||
@ -146,7 +147,7 @@ pub(crate) fn txs_testdata(num_blocks: u64) -> PathBuf {
|
||||
let root = {
|
||||
let mut tx_mut = tx.inner();
|
||||
let root =
|
||||
DBTrieLoader::default().calculate_root(&tx_mut).and_then(|e| e.root()).unwrap();
|
||||
DBTrieLoader::new(tx_mut.deref()).calculate_root().and_then(|e| e.root()).unwrap();
|
||||
tx_mut.commit().unwrap();
|
||||
root
|
||||
};
|
||||
|
||||
@ -134,6 +134,7 @@ where
|
||||
|
||||
/// Generates two batches. The first is to be inserted into the database before running the
|
||||
/// benchmark. The second is to be benchmarked with.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn generate_batches<T>(size: usize) -> (Vec<(T::Key, T::Value)>, Vec<(T::Key, T::Value)>)
|
||||
where
|
||||
T: Table + Default,
|
||||
|
||||
@ -1605,7 +1605,7 @@ mod test {
|
||||
insert_canonical_block(tx.deref_mut(), data.genesis.clone(), None, false).unwrap();
|
||||
|
||||
tx.put::<tables::AccountsTrie>(EMPTY_ROOT, vec![0x80]).unwrap();
|
||||
assert_genesis_block(&tx, data.genesis.clone());
|
||||
assert_genesis_block(&tx, data.genesis);
|
||||
|
||||
tx.insert_block(block1.clone(), &chain_spec, exec_res1.clone()).unwrap();
|
||||
|
||||
@ -1634,10 +1634,7 @@ mod test {
|
||||
|
||||
// take two blocks
|
||||
let get = tx.take_block_and_execution_range(&chain_spec, 1..=2).unwrap();
|
||||
assert_eq!(
|
||||
get,
|
||||
vec![(block1.clone(), exec_res1.clone()), (block2.clone(), exec_res2.clone())]
|
||||
);
|
||||
assert_eq!(get, vec![(block1, exec_res1), (block2, exec_res2)]);
|
||||
|
||||
// assert genesis state
|
||||
assert_genesis_block(&tx, genesis);
|
||||
|
||||
@ -1173,7 +1173,7 @@ mod tests {
|
||||
};
|
||||
tx.put::<tables::HashedAccount>(hashed_address, account).unwrap();
|
||||
|
||||
for (k, v) in storage.clone() {
|
||||
for (k, v) in storage {
|
||||
tx.put::<tables::HashedStorage>(
|
||||
hashed_address,
|
||||
StorageEntry { key: keccak256(k), value: v },
|
||||
|
||||
Reference in New Issue
Block a user