mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move MemoryOverlayStateProvider to chain-state crate (#9779)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -6481,8 +6481,10 @@ dependencies = [
|
||||
"pin-project",
|
||||
"rand 0.8.5",
|
||||
"reth-chainspec",
|
||||
"reth-errors",
|
||||
"reth-execution-types",
|
||||
"reth-primitives",
|
||||
"reth-storage-api",
|
||||
"reth-trie",
|
||||
"revm",
|
||||
"tokio",
|
||||
|
||||
@ -14,8 +14,10 @@ workspace = true
|
||||
[dependencies]
|
||||
# reth
|
||||
reth-chainspec.workspace = true
|
||||
reth-errors.workspace = true
|
||||
reth-execution-types.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-storage-api.workspace = true
|
||||
reth-trie.workspace = true
|
||||
|
||||
revm = { workspace = true, optional = true}
|
||||
|
||||
@ -21,6 +21,9 @@ pub use notifications::{
|
||||
ForkChoiceSubscriptions,
|
||||
};
|
||||
|
||||
mod memory_overlay;
|
||||
pub use memory_overlay::MemoryOverlayStateProvider;
|
||||
|
||||
#[cfg(any(test, feature = "test-utils"))]
|
||||
/// Common test helpers
|
||||
pub mod test_utils;
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
use super::ExecutedBlock;
|
||||
use reth_errors::ProviderResult;
|
||||
use reth_primitives::{Account, Address, BlockNumber, Bytecode, StorageKey, StorageValue, B256};
|
||||
use reth_provider::{
|
||||
use reth_storage_api::{
|
||||
AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider,
|
||||
};
|
||||
use reth_trie::{updates::TrieUpdates, AccountProof, HashedPostState};
|
||||
|
||||
/// A state provider that stores references to in-memory blocks along with their state as well as
|
||||
/// the historical state provider for fallback lookups.
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct MemoryOverlayStateProvider {
|
||||
/// The collection of executed parent blocks.
|
||||
in_memory: Vec<ExecutedBlock>,
|
||||
@ -4,7 +4,6 @@ use crate::{
|
||||
engine::{DownloadRequest, EngineApiEvent, FromEngine},
|
||||
persistence::PersistenceHandle,
|
||||
};
|
||||
pub use memory_overlay::MemoryOverlayStateProvider;
|
||||
use reth_beacon_consensus::{
|
||||
BeaconConsensusEngineEvent, BeaconEngineMessage, ForkchoiceStateTracker, InvalidHeaderCache,
|
||||
OnForkChoiceUpdated, MIN_BLOCKS_FOR_PIPELINE_RUN,
|
||||
@ -13,7 +12,9 @@ use reth_blockchain_tree::{
|
||||
error::InsertBlockErrorKind, BlockAttachment, BlockBuffer, BlockStatus,
|
||||
};
|
||||
use reth_blockchain_tree_api::{error::InsertBlockError, InsertPayloadOk};
|
||||
use reth_chain_state::{CanonicalInMemoryState, ExecutedBlock, NewCanonicalChain};
|
||||
use reth_chain_state::{
|
||||
CanonicalInMemoryState, ExecutedBlock, MemoryOverlayStateProvider, NewCanonicalChain,
|
||||
};
|
||||
use reth_consensus::{Consensus, PostExecutionInput};
|
||||
use reth_engine_primitives::EngineTypes;
|
||||
use reth_errors::{ConsensusError, ProviderResult};
|
||||
@ -48,8 +49,6 @@ use tokio::sync::{
|
||||
};
|
||||
use tracing::*;
|
||||
|
||||
mod memory_overlay;
|
||||
|
||||
/// Maximum number of blocks to be kept only in memory without triggering persistence.
|
||||
const PERSISTENCE_THRESHOLD: u64 = 256;
|
||||
/// Number of pending blocks that cannot be executed due to missing parent and
|
||||
|
||||
Reference in New Issue
Block a user