mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-17 02:12:02 -05:00
feat(trie): write sorted hashed state (#9519)
This commit is contained in:
@@ -85,7 +85,7 @@ impl<DB: Database> DatabaseService<DB> {
|
||||
{
|
||||
let trie_updates = block.trie_updates().clone();
|
||||
let hashed_state = block.hashed_state();
|
||||
HashedStateChanges(hashed_state.clone()).write_to_db(&provider_rw)?;
|
||||
HashedStateChanges(hashed_state).write_to_db(&provider_rw)?;
|
||||
trie_updates.write_to_database(provider_rw.tx_ref())?;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use reth_prune_types::PruneModes;
|
||||
use reth_stages::{test_utils::TestStages, ExecOutput, StageError};
|
||||
use reth_stages_api::Pipeline;
|
||||
use reth_static_file::StaticFileProducer;
|
||||
use reth_trie::{updates::TrieUpdates, HashedPostState};
|
||||
use reth_trie::{updates::TrieUpdates, HashedPostStateSorted};
|
||||
use revm::db::BundleState;
|
||||
use std::{collections::VecDeque, ops::Range, sync::Arc};
|
||||
use tokio::sync::watch;
|
||||
@@ -103,7 +103,7 @@ pub(crate) fn get_executed_block_with_number(block_number: BlockNumber) -> Execu
|
||||
block_number,
|
||||
vec![Requests::default()],
|
||||
)),
|
||||
Arc::new(HashedPostState::default()),
|
||||
Arc::new(HashedPostStateSorted::default()),
|
||||
Arc::new(TrieUpdates::default()),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ use reth_rpc_types::{
|
||||
},
|
||||
ExecutionPayload,
|
||||
};
|
||||
use reth_trie::{updates::TrieUpdates, HashedPostState};
|
||||
use reth_trie::{updates::TrieUpdates, HashedPostState, HashedPostStateSorted};
|
||||
use std::{
|
||||
collections::{BTreeMap, HashMap},
|
||||
marker::PhantomData,
|
||||
@@ -53,7 +53,7 @@ pub struct ExecutedBlock {
|
||||
block: Arc<SealedBlock>,
|
||||
senders: Arc<Vec<Address>>,
|
||||
execution_output: Arc<ExecutionOutcome>,
|
||||
hashed_state: Arc<HashedPostState>,
|
||||
hashed_state: Arc<HashedPostStateSorted>,
|
||||
trie: Arc<TrieUpdates>,
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ impl ExecutedBlock {
|
||||
block: Arc<SealedBlock>,
|
||||
senders: Arc<Vec<Address>>,
|
||||
execution_output: Arc<ExecutionOutcome>,
|
||||
hashed_state: Arc<HashedPostState>,
|
||||
hashed_state: Arc<HashedPostStateSorted>,
|
||||
trie: Arc<TrieUpdates>,
|
||||
) -> Self {
|
||||
Self { block, senders, execution_output, hashed_state, trie }
|
||||
@@ -84,7 +84,7 @@ impl ExecutedBlock {
|
||||
}
|
||||
|
||||
/// Returns a reference to the hashed state result of the execution outcome
|
||||
pub(crate) fn hashed_state(&self) -> &HashedPostState {
|
||||
pub(crate) fn hashed_state(&self) -> &HashedPostStateSorted {
|
||||
&self.hashed_state
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ where
|
||||
block_number,
|
||||
vec![Requests::from(output.requests)],
|
||||
)),
|
||||
hashed_state: Arc::new(hashed_state),
|
||||
hashed_state: Arc::new(hashed_state.into_sorted()),
|
||||
trie: Arc::new(trie_output),
|
||||
};
|
||||
self.state.tree_state.insert_executed(executed);
|
||||
|
||||
Reference in New Issue
Block a user