Skip to content

Commit

Permalink
fix ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Sep 10, 2024
1 parent 08db562 commit e40b8da
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion crates/chain-state/src/cached_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct CachedStateProvider {
}

impl CachedStateProvider {
/// Create a new CachedStateProvider
/// Create a new `CachedStateProvider`
pub fn new(
underlying: Box<dyn StateProvider>,
state_cache: &'static dyn StateCache<
Expand Down
8 changes: 4 additions & 4 deletions crates/engine/tree/src/cache/plain_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ lazy_static! {
static ref CONTRACT_CACHE: Cache<B256, Bytecode> = Cache::new(CONTRACT_CACHE_SIZE);

/// Cached plain states
#[allow(clippy::type_complexity)]
pub static ref CACHED_PLAIN_STATES: (&'static Cache<Address, Account>, &'static Cache<AddressStorageKey, StorageValue>, &'static Cache<B256, Bytecode>) = (&ACCOUNT_CACHE, &STORAGE_CACHE, &CONTRACT_CACHE);
}

Expand Down Expand Up @@ -115,10 +116,9 @@ pub(crate) fn write_plain_state(bundle: BundleState) {
if storage.wipe_storage {
to_wipe = true;
break;
} else {
for (k, v) in storage.storage.clone() {
STORAGE_CACHE.insert((storage.address, StorageKey::from(k)), v);
}
}
for (k, v) in storage.storage.clone() {
STORAGE_CACHE.insert((storage.address, StorageKey::from(k)), v);
}
}
if to_wipe {
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/tree/src/tree/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub(crate) use metrics::histogram;
use reth_metrics::{
metrics::{Counter, Gauge, Histogram},
Metrics,
};
pub(crate) use metrics::histogram as histogram;

/// Metrics for the `EngineApi`.
#[derive(Metrics)]
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ where
let elapsed = exec_time.elapsed();
debug!(target: "engine", elapsed=?elapsed, ?block_number, "Executed block");
metrics::histogram!("execution.total").record(elapsed.as_nanos() as f64);

self.consensus.validate_block_post_execution(
&block,
PostExecutionInput::new(&output.receipts, &output.requests),
Expand All @@ -1802,7 +1802,7 @@ where
)
.into())
}
let elapsed=root_time.elapsed();
let elapsed = root_time.elapsed();
debug!(target: "engine", elapsed=?elapsed, ?block_number, "Calculated state root");
metrics::histogram!("state-root.total").record(elapsed.as_nanos() as f64);

Expand Down
10 changes: 5 additions & 5 deletions crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,11 @@ impl StateRootProvider for MockEthProvider {

fn state_root_from_nodes_caches_with_updates(
&self,
nodes: TrieUpdates,
hashed_state: HashedPostState,
prefix_sets: TriePrefixSetsMut,
hashed_cache: &'static dyn TrieCache<B256, Account, (B256, B256), U256>,
trie_cache: &'static dyn TrieCache<
_nodes: TrieUpdates,
_hashed_state: HashedPostState,
_prefix_sets: TriePrefixSetsMut,
_hashed_cache: &'static dyn TrieCache<B256, Account, (B256, B256), U256>,
_trie_cache: &'static dyn TrieCache<
Nibbles,
BranchNodeCompact,
(B256, Nibbles),
Expand Down
10 changes: 5 additions & 5 deletions crates/storage/provider/src/test_utils/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ impl StateRootProvider for NoopProvider {

fn state_root_from_nodes_caches_with_updates(
&self,
nodes: TrieUpdates,
hashed_state: HashedPostState,
prefix_sets: TriePrefixSetsMut,
hashed_cache: &'static dyn TrieCache<B256, Account, (B256, B256), U256>,
trie_cache: &'static dyn TrieCache<
_nodes: TrieUpdates,
_hashed_state: HashedPostState,
_prefix_sets: TriePrefixSetsMut,
_hashed_cache: &'static dyn TrieCache<B256, Account, (B256, B256), U256>,
_trie_cache: &'static dyn TrieCache<
Nibbles,
BranchNodeCompact,
(B256, Nibbles),
Expand Down
17 changes: 7 additions & 10 deletions crates/trie/db/src/cached_trie_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,22 @@ where
return Ok(Some((key, result)))
};

return match self.cursor.seek(StoredNibbles(key))? {
match self.cursor.seek(StoredNibbles(key))? {
Some(value) => {
self.trie_cache.insert_account(value.0 .0.clone(), value.1.clone());

Ok(Some((value.0 .0, value.1)))
}
None => Ok(None),
};
}
}

/// Move the cursor to the next entry in the account trie.
fn next_inner(
&mut self,
last: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
let _ = self.cursor.seek(StoredNibbles(last.clone()))?;
let _ = self.cursor.seek(StoredNibbles(last))?;
match self.cursor.next()? {
Some(value) => {
self.trie_cache.insert_account(value.0 .0.clone(), value.1.clone());
Expand Down Expand Up @@ -236,7 +236,7 @@ where
return Ok(Some((key, result)))
};

return match self
match self
.cursor
.seek_by_key_subkey(self.hashed_address, StoredNibblesSubKey(key.clone()))?
{
Expand All @@ -251,7 +251,7 @@ where
}
}
None => Ok(None),
};
}
}

/// Seek a key in the storage trie that matches or is greater than the provided key.
Expand All @@ -264,18 +264,15 @@ where
return Ok(Some((key, result)))
};

return match self
.cursor
.seek_by_key_subkey(self.hashed_address, StoredNibblesSubKey(key))?
{
match self.cursor.seek_by_key_subkey(self.hashed_address, StoredNibblesSubKey(key))? {
Some(value) => {
let key = (self.hashed_address, value.nibbles.0.clone());
self.trie_cache.insert_storage(key, value.node.clone());

Ok(Some((value.nibbles.0, value.node)))
}
None => Ok(None),
};
}
}

/// Move the cursor to the next entry in the storage trie.
Expand Down

0 comments on commit e40b8da

Please sign in to comment.