mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
docs(provider): More context about Stateprovider (#1124)
This commit is contained in:
@ -4,7 +4,7 @@ use auto_impl::auto_impl;
|
||||
use reth_interfaces::Result;
|
||||
use reth_primitives::{Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, H256};
|
||||
|
||||
/// Function needed for executor.
|
||||
/// An abstraction for a type that provides state data.
|
||||
#[auto_impl(&)]
|
||||
pub trait StateProvider: BlockHashProvider + AccountProvider + Send + Sync {
|
||||
/// Get storage.
|
||||
@ -14,7 +14,8 @@ pub trait StateProvider: BlockHashProvider + AccountProvider + Send + Sync {
|
||||
fn bytecode_by_hash(&self, code_hash: H256) -> Result<Option<Bytes>>;
|
||||
}
|
||||
|
||||
/// Light wrapper that creates StateProvider.
|
||||
/// Light wrapper that returns `StateProvider` implementations that correspond to the given
|
||||
/// `BlockNumber` or the latest state.
|
||||
pub trait StateProviderFactory: Send + Sync {
|
||||
/// History State provider.
|
||||
type HistorySP<'a>: StateProvider
|
||||
@ -24,12 +25,13 @@ pub trait StateProviderFactory: Send + Sync {
|
||||
type LatestSP<'a>: StateProvider
|
||||
where
|
||||
Self: 'a;
|
||||
/// Storage provider for latest block
|
||||
|
||||
/// Storage provider for latest block.
|
||||
fn latest(&self) -> Result<Self::LatestSP<'_>>;
|
||||
|
||||
/// History provider indexed by block number
|
||||
/// Returns a [StateProvider] indexed by the given block number.
|
||||
fn history_by_block_number(&self, block: BlockNumber) -> Result<Self::HistorySP<'_>>;
|
||||
|
||||
/// History provider indexed by block hash
|
||||
/// Returns a [StateProvider] indexed by the given block hash.
|
||||
fn history_by_block_hash(&self, block: BlockHash) -> Result<Self::HistorySP<'_>>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user