Struct reth_provider::providers::DatabaseProvider

source ·
pub struct DatabaseProvider<TX> { /* private fields */ }
Expand description

A provider struct that fetches data from the database. Wrapper around [DbTx] and [DbTxMut]. Example: HeaderProvider BlockHashReader

Implementations§

source§

impl<TX> DatabaseProvider<TX>

source

pub const fn static_file_provider(&self) -> &StaticFileProvider

Returns a static file provider

source

pub const fn prune_modes_ref(&self) -> &PruneModes

Returns reference to prune modes.

source§

impl<TX: DbTxMut> DatabaseProvider<TX>

source

pub const fn new_rw( tx: TX, chain_spec: Arc<ChainSpec>, static_file_provider: StaticFileProvider, prune_modes: PruneModes, ) -> Self

Creates a provider with an inner read-write transaction.

source§

impl<TX: DbTx> DatabaseProvider<TX>

source

pub const fn new( tx: TX, chain_spec: Arc<ChainSpec>, static_file_provider: StaticFileProvider, prune_modes: PruneModes, ) -> Self

Creates a provider with an inner read-only transaction.

source

pub fn into_tx(self) -> TX

Consume DbTx or DbTxMut.

source

pub fn tx_mut(&mut self) -> &mut TX

Pass DbTx or DbTxMut mutable reference.

source

pub const fn tx_ref(&self) -> &TX

Pass DbTx or DbTxMut immutable reference.

source

pub fn chain_spec(&self) -> &ChainSpec

Returns a reference to the [ChainSpec].

source

pub fn disable_long_read_transaction_safety(self) -> Self

Disables long-lived read transaction safety guarantees for leaks prevention and observability improvements.

CAUTION: In most of the cases, you want the safety guarantees for long read transactions enabled. Use this only if you’re sure that no write transaction is open in parallel, meaning that Reth as a node is offline and not progressing.

source

pub fn table<T: Table>(&self) -> Result<Vec<KeyValue<T>>, DatabaseError>
where T::Key: Default + Ord,

Return full table as Vec

source

pub fn get<T: Table>( &self, range: impl RangeBounds<T::Key>, ) -> Result<Vec<KeyValue<T>>, DatabaseError>

Return a list of entries from the table, based on the given range.

source

pub fn get_block_range( &self, range: impl RangeBounds<BlockNumber> + Clone, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Get the given range of blocks.

source

pub fn get_state( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Option<ExecutionOutcome>>

Return the last N blocks of state, recreating the ExecutionOutcome.

  1. Iterate over the BlockBodyIndices table to get all the transaction ids.
  2. Iterate over the StorageChangeSets table and the AccountChangeSets tables in reverse order to reconstruct the changesets.
    • In order to have both the old and new values in the changesets, we also access the plain state tables.
  3. While iterating over the changeset tables, if we encounter a new account or storage slot, we:
    1. Take the old value from the changeset
    2. Take the new value from the plain state
    3. Save the old value to the local state
  4. While iterating over the changeset tables, if we encounter an account/storage slot we have seen before we:
    1. Take the old value from the changeset
    2. Take the new value from the local state
    3. Set the local state to the value in the changeset

If the range is empty, or there are no blocks for the given range, then this returns None.

source§

impl<TX: DbTxMut + DbTx> DatabaseProvider<TX>

source

pub fn commit(self) -> ProviderResult<bool>

Commit database transaction.

source

pub fn remove_state( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<()>

Remove the last N blocks of state.

The latest state will be unwound

  1. Iterate over the BlockBodyIndices table to get all the transaction ids.
  2. Iterate over the StorageChangeSets table and the AccountChangeSets tables in reverse order to reconstruct the changesets.
    • In order to have both the old and new values in the changesets, we also access the plain state tables.
  3. While iterating over the changeset tables, if we encounter a new account or storage slot, we:
    1. Take the old value from the changeset
    2. Take the new value from the plain state
    3. Save the old value to the local state
  4. While iterating over the changeset tables, if we encounter an account/storage slot we have seen before we:
    1. Take the old value from the changeset
    2. Take the new value from the local state
    3. Set the local state to the value in the changeset
source

pub fn take_state( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<ExecutionOutcome>

Take the last N blocks of state, recreating the ExecutionOutcome.

The latest state will be unwound and returned back with all the blocks

  1. Iterate over the BlockBodyIndices table to get all the transaction ids.
  2. Iterate over the StorageChangeSets table and the AccountChangeSets tables in reverse order to reconstruct the changesets.
    • In order to have both the old and new values in the changesets, we also access the plain state tables.
  3. While iterating over the changeset tables, if we encounter a new account or storage slot, we:
    1. Take the old value from the changeset
    2. Take the new value from the plain state
    3. Save the old value to the local state
  4. While iterating over the changeset tables, if we encounter an account/storage slot we have seen before we:
    1. Take the old value from the changeset
    2. Take the new value from the local state
    3. Set the local state to the value in the changeset
source

pub fn remove<T: Table>( &self, range: impl RangeBounds<T::Key>, ) -> Result<usize, DatabaseError>

Remove list of entries from the table. Returns the number of entries removed.

source

pub fn take<T: Table>( &self, range: impl RangeBounds<T::Key>, ) -> Result<Vec<KeyValue<T>>, DatabaseError>

Return a list of entries from the table, and remove them, based on the given range.

source

pub fn remove_block_transaction_range( &self, range: impl RangeBounds<BlockNumber> + Clone, ) -> ProviderResult<()>

Remove requested block transactions, without returning them.

This will remove block data for the given range from the following tables:

source

pub fn take_block_transaction_range( &self, range: impl RangeBounds<BlockNumber> + Clone, ) -> ProviderResult<Vec<(BlockNumber, Vec<TransactionSignedEcRecovered>)>>

Get requested blocks transaction with senders, also removing them from the database

This will remove block data for the given range from the following tables:

source

pub fn remove_block_range( &self, range: impl RangeBounds<BlockNumber> + Clone, ) -> ProviderResult<()>

Remove the given range of blocks, without returning any of the blocks.

This will remove block data for the given range from the following tables:

This will also remove transaction data according to remove_block_transaction_range.

source

pub fn take_block_range( &self, range: impl RangeBounds<BlockNumber> + Clone, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Remove the given range of blocks, and return them.

This will remove block data for the given range from the following tables:

This will also remove transaction data according to take_block_transaction_range.

source

pub fn unwind_table_by_num<T>(&self, num: u64) -> Result<usize, DatabaseError>
where T: Table<Key = u64>,

Unwind table by some number key. Returns number of rows unwound.

Note: Key is not inclusive and specified key would stay in db.

source

pub fn unwind_table_by_walker<T1, T2>( &self, range: impl RangeBounds<T1::Key>, ) -> Result<(), DatabaseError>
where T1: Table, T2: Table<Key = T1::Value>,

Unwind a table forward by a [Walker][reth_db_api::cursor::Walker] on another table.

Note: Range is inclusive and first key in the range is removed.

Trait Implementations§

source§

impl<TX: DbTx> AccountExtReader for DatabaseProvider<TX>

source§

fn changed_accounts_with_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<BTreeSet<Address>>

Iterate over account changesets and return all account address that were changed.
source§

fn basic_accounts( &self, iter: impl IntoIterator<Item = Address>, ) -> ProviderResult<Vec<(Address, Option<Account>)>>

Get basic account information for multiple accounts. A more efficient version than calling AccountReader::basic_account repeatedly. Read more
source§

fn changed_accounts_and_blocks_with_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<BTreeMap<Address, Vec<u64>>>

Iterate over account changesets and return all account addresses that were changed alongside each specific set of blocks. Read more
source§

impl<TX: DbTx> AccountReader for DatabaseProvider<TX>

source§

fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>>

Get basic account information. Read more
source§

impl<DB: Database> AsRef<DatabaseProvider<<DB as Database>::TXMut>> for DatabaseProviderRW<DB>

source§

fn as_ref(&self) -> &DatabaseProvider<<DB as Database>::TXMut>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<TX> AsRef<DatabaseProvider<TX>> for DatabaseProvider<TX>

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<TX: DbTx> BlockExecutionReader for DatabaseProvider<TX>

source§

fn get_block_and_execution_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Chain>

Get range of blocks and its execution result
source§

impl<TX: DbTxMut + DbTx + 'static> BlockExecutionWriter for DatabaseProvider<TX>

source§

fn take_block_and_execution_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Chain>

Take range of blocks and its execution result
source§

fn remove_block_and_execution_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<()>

Remove range of blocks and its execution result
source§

impl<TX: DbTx> BlockHashReader for DatabaseProvider<TX>

source§

fn block_hash(&self, number: u64) -> ProviderResult<Option<B256>>

Get the hash of the block with the given number. Returns None if no block with this number exists.
source§

fn canonical_hashes_range( &self, start: BlockNumber, end: BlockNumber, ) -> ProviderResult<Vec<B256>>

Get headers in range of block hashes or numbers Read more
§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.
source§

impl<TX: DbTx> BlockNumReader for DatabaseProvider<TX>

source§

fn chain_info(&self) -> ProviderResult<ChainInfo>

Returns the current info for the chain.
source§

fn best_block_number(&self) -> ProviderResult<BlockNumber>

Returns the best block number in the chain.
source§

fn last_block_number(&self) -> ProviderResult<BlockNumber>

Returns the last block number associated with the last canonical header in the database.
source§

fn block_number(&self, hash: B256) -> ProviderResult<Option<BlockNumber>>

Gets the BlockNumber for the given hash. Returns None if no block with this hash exists.
§

fn convert_hash_or_number( &self, id: HashOrNumber, ) -> Result<Option<u64>, ProviderError>

Gets the block number for the given BlockHashOrNumber. Returns None if no block with this hash exists. If the BlockHashOrNumber is a Number, it is returned as is.
§

fn convert_number( &self, id: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Gets the block hash for the given BlockHashOrNumber. Returns None if no block with this number exists. If the BlockHashOrNumber is a Hash, it is returned as is.
source§

impl<TX: DbTx> BlockReader for DatabaseProvider<TX>

source§

fn block(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Block>>

Returns the block with matching number from database.

If the header for this block is not found, this returns None. If the header is found, but the transactions either do not exist, or are not indexed, this will return None.

source§

fn ommers(&self, id: BlockHashOrNumber) -> ProviderResult<Option<Vec<Header>>>

Returns the ommers for the block with matching id from the database.

If the block is not found, this returns None. If the block exists, but doesn’t contain ommers, this returns None.

source§

fn block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<BlockWithSenders>>

Returns the block with senders with matching number or hash from database.

NOTE: The transactions have invalid hashes, since they would need to be calculated on the spot, and we want fast querying.

If the header for this block is not found, this returns None. If the header is found, but the transactions either do not exist, or are not indexed, this will return None.

source§

fn find_block_by_hash( &self, hash: B256, source: BlockSource, ) -> ProviderResult<Option<Block>>

Tries to find in the given block source. Read more
source§

fn pending_block(&self) -> ProviderResult<Option<SealedBlock>>

Returns the pending block if available Read more
source§

fn pending_block_with_senders( &self, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Returns the pending block if available Read more
source§

fn pending_block_and_receipts( &self, ) -> ProviderResult<Option<(SealedBlock, Vec<Receipt>)>>

Returns the pending block and receipts if available.
source§

fn block_body_indices( &self, num: u64, ) -> ProviderResult<Option<StoredBlockBodyIndices>>

Returns the block body indices with matching number from database. Read more
source§

fn sealed_block_with_senders( &self, id: BlockHashOrNumber, transaction_kind: TransactionVariant, ) -> ProviderResult<Option<SealedBlockWithSenders>>

Returns the sealed block with senders with matching number or hash from database. Read more
source§

fn block_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<Block>>

Returns all blocks in the given inclusive range. Read more
source§

fn block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<BlockWithSenders>>

Returns a range of blocks from the database, along with the senders of each transaction in the blocks.
source§

fn sealed_block_with_senders_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<Vec<SealedBlockWithSenders>>

Returns a range of sealed blocks from the database, along with the senders of each transaction in the blocks.
§

fn block_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Block>, ProviderError>

Returns the block with matching hash from the database. Read more
§

fn block_by_number(&self, num: u64) -> Result<Option<Block>, ProviderError>

Returns the block with matching number from database. Read more
source§

impl<TX: DbTxMut + DbTx + 'static> BlockWriter for DatabaseProvider<TX>

source§

fn insert_block( &self, block: SealedBlockWithSenders, ) -> ProviderResult<StoredBlockBodyIndices>

Inserts the block into the database, always modifying the following tables:

If there are transactions in the block, the following tables will be modified:

If ommers are not empty, this will modify BlockOmmers. If withdrawals are not empty, this will modify BlockWithdrawals. If requests are not empty, this will modify BlockRequests.

If the provider has not configured full sender pruning, this will modify TransactionSenders.

If the provider has not configured full transaction lookup pruning, this will modify TransactionHashNumbers.

source§

fn append_blocks_with_state( &self, blocks: Vec<SealedBlockWithSenders>, execution_outcome: ExecutionOutcome, hashed_state: HashedPostStateSorted, trie_updates: TrieUpdates, ) -> ProviderResult<()>

TODO(joshie): this fn should be moved to UnifiedStorageWriter eventually

source§

impl<TX: DbTx> ChangeSetReader for DatabaseProvider<TX>

source§

fn account_block_changeset( &self, block_number: BlockNumber, ) -> ProviderResult<Vec<AccountBeforeTx>>

Iterate over account changesets and return the account state from before this block.
source§

impl<TX: DbTx + 'static> DBProvider for DatabaseProvider<TX>

source§

type Tx = TX

Underlying database transaction held by the provider.
source§

fn tx_ref(&self) -> &Self::Tx

Returns a reference to the underlying transaction.
source§

fn tx_mut(&mut self) -> &mut Self::Tx

Returns a mutable reference to the underlying transaction.
source§

fn into_tx(self) -> Self::Tx

Consumes the provider and returns the underlying transaction.
source§

fn prune_modes_ref(&self) -> &PruneModes

Returns a reference to prune modes.
§

fn disable_long_read_transaction_safety(self) -> Self

Disables long-lived read transaction safety guarantees for leaks prevention and observability improvements. Read more
§

fn commit(self) -> Result<bool, ProviderError>

Commit database transaction
source§

impl<TX: Debug> Debug for DatabaseProvider<TX>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<TX: DbTx> EvmEnvProvider for DatabaseProvider<TX>

source§

fn fill_env_at<EvmConfig>( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, at: BlockHashOrNumber, evm_config: EvmConfig, ) -> ProviderResult<()>
where EvmConfig: ConfigureEvmEnv,

Fills the [CfgEnvWithHandlerCfg] and [BlockEnv] fields with values specific to the given [BlockHashOrNumber].
source§

fn fill_env_with_header<EvmConfig>( &self, cfg: &mut CfgEnvWithHandlerCfg, block_env: &mut BlockEnv, header: &Header, evm_config: EvmConfig, ) -> ProviderResult<()>
where EvmConfig: ConfigureEvmEnv,

Fills the [CfgEnvWithHandlerCfg] and [BlockEnv] fields with values specific to the given [Header].
source§

fn fill_cfg_env_at<EvmConfig>( &self, cfg: &mut CfgEnvWithHandlerCfg, at: BlockHashOrNumber, evm_config: EvmConfig, ) -> ProviderResult<()>
where EvmConfig: ConfigureEvmEnv,

Fills the [CfgEnvWithHandlerCfg] fields with values specific to the given [BlockHashOrNumber].
source§

fn fill_cfg_env_with_header<EvmConfig>( &self, cfg: &mut CfgEnvWithHandlerCfg, header: &Header, evm_config: EvmConfig, ) -> ProviderResult<()>
where EvmConfig: ConfigureEvmEnv,

Fills the [CfgEnvWithHandlerCfg] fields with values specific to the given [Header].
§

fn env_with_header<EvmConfig>( &self, header: &Header, evm_config: EvmConfig, ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), ProviderError>
where EvmConfig: ConfigureEvmEnv,

Fills the default [CfgEnvWithHandlerCfg] and [BlockEnv] fields with values specific to the given [Header].
source§

impl<TX: DbTx> FinalizedBlockReader for DatabaseProvider<TX>

source§

fn last_finalized_block_number(&self) -> ProviderResult<Option<BlockNumber>>

Returns the last finalized block number. Read more
source§

impl<TX: DbTxMut> FinalizedBlockWriter for DatabaseProvider<TX>

source§

fn save_finalized_block_number( &self, block_number: BlockNumber, ) -> ProviderResult<()>

Saves the given finalized block number in the DB.
source§

impl<DB: Database> From<DatabaseProviderRW<DB>> for DatabaseProvider<<DB as Database>::TXMut>

source§

fn from(provider: DatabaseProviderRW<DB>) -> Self

Converts to this type from the input type.
source§

impl<TX: DbTxMut + DbTx> HashingWriter for DatabaseProvider<TX>

source§

fn unwind_account_hashing( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Unwind and clear account hashing. Read more
source§

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Inserts all accounts into reth_db::tables::AccountsHistory table. Read more
source§

fn unwind_storage_hashing( &self, range: Range<BlockNumberAddress>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Unwind and clear storage hashing Read more
source§

fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Iterates over storages and inserts them to hashing table. Read more
source§

fn insert_hashes( &self, range: RangeInclusive<BlockNumber>, end_block_hash: B256, expected_state_root: B256, ) -> ProviderResult<()>

Calculate the hashes of all changed accounts and storages, and finally calculate the state root. Read more
source§

impl<TX: DbTx> HeaderProvider for DatabaseProvider<TX>

source§

fn header(&self, block_hash: &BlockHash) -> ProviderResult<Option<Header>>

Get header by block hash
source§

fn header_by_number(&self, num: BlockNumber) -> ProviderResult<Option<Header>>

Get header by block number
source§

fn header_td(&self, block_hash: &BlockHash) -> ProviderResult<Option<U256>>

Get total difficulty by block hash.
source§

fn header_td_by_number( &self, number: BlockNumber, ) -> ProviderResult<Option<U256>>

Get total difficulty by block number.
source§

fn headers_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<Vec<Header>>

Get headers in range of block numbers
source§

fn sealed_header( &self, number: BlockNumber, ) -> ProviderResult<Option<SealedHeader>>

Get a single sealed header by block number.
source§

fn sealed_headers_while( &self, range: impl RangeBounds<BlockNumber>, predicate: impl FnMut(&SealedHeader) -> bool, ) -> ProviderResult<Vec<SealedHeader>>

Get sealed headers while predicate returns true or the range is exhausted.
§

fn is_known(&self, block_hash: &FixedBytes<32>) -> Result<bool, ProviderError>

Check if block is known
§

fn header_by_hash_or_number( &self, hash_or_num: HashOrNumber, ) -> Result<Option<Header>, ProviderError>

Get header by block number or hash
§

fn sealed_headers_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<SealedHeader>, ProviderError>

Get headers in range of block numbers.
source§

impl<TX: DbTx> HeaderSyncGapProvider for DatabaseProvider<TX>

source§

fn sync_gap( &self, tip: Receiver<B256>, highest_uninterrupted_block: BlockNumber, ) -> ProviderResult<HeaderSyncGap>

Find a current sync gap for the headers depending on the last uninterrupted block number. Last uninterrupted block represents the block number before which there are no gaps. It’s up to the caller to ensure that last uninterrupted block is determined correctly.
source§

impl<TX: DbTxMut + DbTx> HistoryWriter for DatabaseProvider<TX>

source§

fn unwind_account_history_indices( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<usize>

Unwind and clear account history indices. Read more
source§

fn insert_account_history_index( &self, account_transitions: impl IntoIterator<Item = (Address, impl IntoIterator<Item = u64>)>, ) -> ProviderResult<()>

Insert account change index to database. Used inside AccountHistoryIndex stage
source§

fn unwind_storage_history_indices( &self, range: Range<BlockNumberAddress>, ) -> ProviderResult<usize>

Unwind and clear storage history indices. Read more
source§

fn insert_storage_history_index( &self, storage_transitions: impl IntoIterator<Item = ((Address, B256), impl IntoIterator<Item = u64>)>, ) -> ProviderResult<()>

Insert storage change index to database. Used inside StorageHistoryIndex stage
source§

fn update_history_indices( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<()>

Read account/storage changesets and update account/storage history indices.
source§

impl<TX: DbTx> PruneCheckpointReader for DatabaseProvider<TX>

source§

fn get_prune_checkpoint( &self, segment: PruneSegment, ) -> ProviderResult<Option<PruneCheckpoint>>

Fetch the prune checkpoint for the given segment.
source§

fn get_prune_checkpoints( &self, ) -> ProviderResult<Vec<(PruneSegment, PruneCheckpoint)>>

Fetch all the prune checkpoints.
source§

impl<TX: DbTxMut> PruneCheckpointWriter for DatabaseProvider<TX>

source§

fn save_prune_checkpoint( &self, segment: PruneSegment, checkpoint: PruneCheckpoint, ) -> ProviderResult<()>

Save prune checkpoint.
source§

impl<TX: DbTx> ReceiptProvider for DatabaseProvider<TX>

source§

fn receipt(&self, id: TxNumber) -> ProviderResult<Option<Receipt>>

Get receipt by transaction number Read more
source§

fn receipt_by_hash(&self, hash: TxHash) -> ProviderResult<Option<Receipt>>

Get receipt by transaction hash. Read more
source§

fn receipts_by_block( &self, block: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<Receipt>>>

Get receipts by block num or hash. Read more
source§

fn receipts_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Receipt>>

Get receipts by tx range.
source§

impl<TX: DbTx> RequestsProvider for DatabaseProvider<TX>

source§

fn requests_by_block( &self, id: BlockHashOrNumber, timestamp: u64, ) -> ProviderResult<Option<Requests>>

Get withdrawals by block id.
source§

impl<TX: DbTx> StageCheckpointReader for DatabaseProvider<TX>

source§

fn get_stage_checkpoint_progress( &self, id: StageId, ) -> ProviderResult<Option<Vec<u8>>>

Get stage checkpoint progress.

source§

fn get_stage_checkpoint( &self, id: StageId, ) -> ProviderResult<Option<StageCheckpoint>>

Fetch the checkpoint for the given stage.
source§

fn get_all_checkpoints(&self) -> ProviderResult<Vec<(String, StageCheckpoint)>>

Reads all stage checkpoints and returns a list with the name of the stage and the checkpoint data.
source§

impl<TX: DbTxMut> StageCheckpointWriter for DatabaseProvider<TX>

source§

fn save_stage_checkpoint( &self, id: StageId, checkpoint: StageCheckpoint, ) -> ProviderResult<()>

Save stage checkpoint.

source§

fn save_stage_checkpoint_progress( &self, id: StageId, checkpoint: Vec<u8>, ) -> ProviderResult<()>

Save stage checkpoint progress.

source§

fn update_pipeline_stages( &self, block_number: BlockNumber, drop_stage_checkpoint: bool, ) -> ProviderResult<()>

Update all pipeline sync stage progress.
source§

impl<TX: DbTxMut + DbTx> StateChangeWriter for DatabaseProvider<TX>

source§

fn write_state_reverts( &self, reverts: PlainStateReverts, first_block: BlockNumber, ) -> ProviderResult<()>

Write state reverts to the database. Read more
source§

fn write_state_changes(&self, changes: StateChangeset) -> ProviderResult<()>

Write state changes to the database.
source§

fn write_hashed_state( &self, hashed_state: &HashedPostStateSorted, ) -> ProviderResult<()>

Writes the hashed state changes to the database
source§

impl<TX: DbTx> StateReader for DatabaseProvider<TX>

source§

fn get_state( &self, block: BlockNumber, ) -> ProviderResult<Option<ExecutionOutcome>>

Get the ExecutionOutcome for the given block
source§

impl<TX: DbTx> StatsReader for DatabaseProvider<TX>

source§

fn count_entries<T: Table>(&self) -> ProviderResult<usize>

Fetch the number of entries in the corresponding [Table]. Depending on the provider, it may route to different data sources other than [Table].
source§

impl<TX: DbTx> StorageReader for DatabaseProvider<TX>

source§

fn plain_state_storages( &self, addresses_with_keys: impl IntoIterator<Item = (Address, impl IntoIterator<Item = B256>)>, ) -> ProviderResult<Vec<(Address, Vec<StorageEntry>)>>

Get plainstate storages for addresses and storage keys.
source§

fn changed_storages_with_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<BTreeMap<Address, BTreeSet<B256>>>

Iterate over storage changesets and return all storage slots that were changed.
source§

fn changed_storages_and_blocks_with_range( &self, range: RangeInclusive<BlockNumber>, ) -> ProviderResult<BTreeMap<(Address, B256), Vec<u64>>>

Iterate over storage changesets and return all storage slots that were changed alongside each specific set of blocks. Read more
source§

impl<TX: DbTxMut + DbTx> StorageTrieWriter for DatabaseProvider<TX>

source§

fn write_storage_trie_updates( &self, storage_tries: &HashMap<B256, StorageTrieUpdates>, ) -> ProviderResult<usize>

Writes storage trie updates from the given storage trie map. First sorts the storage trie updates by the hashed address, writing in sorted order.

source§

fn write_individual_storage_trie_updates( &self, hashed_address: B256, updates: &StorageTrieUpdates, ) -> ProviderResult<usize>

Writes storage trie updates for the given hashed address.
source§

impl<TX: DbTx> TransactionsProvider for DatabaseProvider<TX>

source§

fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>>

Get internal transaction identifier by transaction hash. Read more
source§

fn transaction_by_id( &self, id: TxNumber, ) -> ProviderResult<Option<TransactionSigned>>

Get transaction by id, computes hash every time so more expensive.
source§

fn transaction_by_id_no_hash( &self, id: TxNumber, ) -> ProviderResult<Option<TransactionSignedNoHash>>

Get transaction by id without computing the hash.
source§

fn transaction_by_hash( &self, hash: TxHash, ) -> ProviderResult<Option<TransactionSigned>>

Get transaction by transaction hash.
source§

fn transaction_by_hash_with_meta( &self, tx_hash: TxHash, ) -> ProviderResult<Option<(TransactionSigned, TransactionMeta)>>

Get transaction by transaction hash and additional metadata of the block the transaction was mined in
source§

fn transaction_block(&self, id: TxNumber) -> ProviderResult<Option<BlockNumber>>

Get transaction block number
source§

fn transactions_by_block( &self, id: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<TransactionSigned>>>

Get transactions by block id.
source§

fn transactions_by_block_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<Vec<Vec<TransactionSigned>>>

Get transactions by block range.
source§

fn transactions_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<TransactionSignedNoHash>>

Get transactions by tx range.
source§

fn senders_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Address>>

Get Senders from a tx range.
source§

fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>>

Get transaction sender. Read more
source§

impl<TX: DbTx> TransactionsProviderExt for DatabaseProvider<TX>

source§

fn transaction_hashes_by_range( &self, tx_range: Range<TxNumber>, ) -> ProviderResult<Vec<(TxHash, TxNumber)>>

Recovers transaction hashes by walking through Transactions table and calculating them in a parallel manner. Returned unsorted.

§

fn transaction_range_by_block_range( &self, block_range: RangeInclusive<u64>, ) -> Result<RangeInclusive<u64>, ProviderError>

Get transactions range by block range.
source§

impl<TX: DbTxMut + DbTx> TrieWriter for DatabaseProvider<TX>

source§

fn write_trie_updates( &self, trie_updates: &TrieUpdates, ) -> ProviderResult<usize>

Writes trie updates. Returns the number of entries modified.

source§

impl<TX: DbTx + 'static> TryIntoHistoricalStateProvider for DatabaseProvider<TX>

source§

fn try_into_history_at_block( self, block_number: BlockNumber, ) -> ProviderResult<StateProviderBox>

Returns a historical StateProvider indexed by the given historic block number.
source§

impl<TX: DbTx> WithdrawalsProvider for DatabaseProvider<TX>

source§

fn withdrawals_by_block( &self, id: BlockHashOrNumber, timestamp: u64, ) -> ProviderResult<Option<Withdrawals>>

Get withdrawals by block id.
source§

fn latest_withdrawal(&self) -> ProviderResult<Option<Withdrawal>>

Get latest withdrawal from this block or earlier .

Auto Trait Implementations§

§

impl<TX> Freeze for DatabaseProvider<TX>
where TX: Freeze,

§

impl<TX> !RefUnwindSafe for DatabaseProvider<TX>

§

impl<TX> Send for DatabaseProvider<TX>
where TX: Send,

§

impl<TX> Sync for DatabaseProvider<TX>
where TX: Sync,

§

impl<TX> Unpin for DatabaseProvider<TX>
where TX: Unpin,

§

impl<TX> !UnwindSafe for DatabaseProvider<TX>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> MaybeDebug for T
where T: Debug,

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.