chore: misc storage api (#8432)

This commit is contained in:
Matthias Seitz
2024-05-28 17:25:19 +02:00
committed by GitHub
parent b4a1b733c9
commit c54276e740
3 changed files with 30 additions and 32 deletions

View File

@ -65,21 +65,8 @@ impl StateWriter for BundleStateWithReceipts {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::collections::{BTreeMap, HashMap}; use super::*;
use crate::{test_utils::create_test_provider_factory, AccountReader};
use revm::{
db::{
states::{
bundle_state::BundleRetention, changes::PlainStorageRevert, PlainStorageChangeset,
},
BundleState, EmptyDB,
},
primitives::{
Account as RevmAccount, AccountInfo as RevmAccountInfo, AccountStatus, StorageSlot,
},
DatabaseCommit, State,
};
use reth_db::{ use reth_db::{
cursor::DbDupCursorRO, cursor::DbDupCursorRO,
database::Database, database::Database,
@ -92,10 +79,19 @@ mod tests {
Account, Address, Receipt, Receipts, StorageEntry, B256, U256, Account, Address, Receipt, Receipts, StorageEntry, B256, U256,
}; };
use reth_trie::{test_utils::state_root, StateRoot}; use reth_trie::{test_utils::state_root, StateRoot};
use revm::{
use crate::{test_utils::create_test_provider_factory, AccountReader}; db::{
states::{
use super::*; bundle_state::BundleRetention, changes::PlainStorageRevert, PlainStorageChangeset,
},
BundleState, EmptyDB,
},
primitives::{
Account as RevmAccount, AccountInfo as RevmAccountInfo, AccountStatus, StorageSlot,
},
DatabaseCommit, State,
};
use std::collections::{BTreeMap, HashMap};
#[test] #[test]
fn write_to_db_account_info() { fn write_to_db_account_info() {

View File

@ -1,6 +1,6 @@
use crate::{ use crate::{
BlockIdReader, BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, BlockIdReader, BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt,
RequestsProvider, TransactionsProvider, WithdrawalsProvider, RequestsProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
}; };
use reth_db::models::StoredBlockBodyIndices; use reth_db::models::StoredBlockBodyIndices;
use reth_primitives::{ use reth_primitives::{
@ -10,16 +10,6 @@ use reth_primitives::{
use reth_storage_errors::provider::ProviderResult; use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeInclusive; use std::ops::RangeInclusive;
/// Enum to control transaction hash inclusion.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum TransactionVariant {
/// Indicates that transactions should be processed without including their hashes.
NoHash,
/// Indicates that transactions should be processed along with their hashes.
#[default]
WithHash,
}
/// A helper enum that represents the origin of the requested block. /// A helper enum that represents the origin of the requested block.
/// ///
/// This helper type's sole purpose is to give the caller more control over from where blocks can be /// This helper type's sole purpose is to give the caller more control over from where blocks can be

View File

@ -1,11 +1,23 @@
use std::ops::{Range, RangeBounds, RangeInclusive};
use crate::{BlockNumReader, BlockReader}; use crate::{BlockNumReader, BlockReader};
use reth_primitives::{ use reth_primitives::{
Address, BlockHashOrNumber, BlockNumber, TransactionMeta, TransactionSigned, Address, BlockHashOrNumber, BlockNumber, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, TxHash, TxNumber, TransactionSignedNoHash, TxHash, TxNumber,
}; };
use reth_storage_errors::provider::{ProviderError, ProviderResult}; use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::ops::{Range, RangeBounds, RangeInclusive};
/// Enum to control transaction hash inclusion.
///
/// This serves as a hint to the provider to include or omit exclude hashes because hashes are
/// stored separately and are not always needed.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum TransactionVariant {
/// Indicates that transactions should be processed without including their hashes.
NoHash,
/// Indicates that transactions should be processed along with their hashes.
#[default]
WithHash,
}
/// Client trait for fetching [TransactionSigned] related data. /// Client trait for fetching [TransactionSigned] related data.
#[auto_impl::auto_impl(&, Arc)] #[auto_impl::auto_impl(&, Arc)]