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)]
mod tests {
use std::collections::{BTreeMap, HashMap};
use revm::{
db::{
states::{
bundle_state::BundleRetention, changes::PlainStorageRevert, PlainStorageChangeset,
},
BundleState, EmptyDB,
},
primitives::{
Account as RevmAccount, AccountInfo as RevmAccountInfo, AccountStatus, StorageSlot,
},
DatabaseCommit, State,
};
use super::*;
use crate::{test_utils::create_test_provider_factory, AccountReader};
use reth_db::{
cursor::DbDupCursorRO,
database::Database,
@ -92,10 +79,19 @@ mod tests {
Account, Address, Receipt, Receipts, StorageEntry, B256, U256,
};
use reth_trie::{test_utils::state_root, StateRoot};
use crate::{test_utils::create_test_provider_factory, AccountReader};
use super::*;
use revm::{
db::{
states::{
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]
fn write_to_db_account_info() {

View File

@ -1,6 +1,6 @@
use crate::{
BlockIdReader, BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt,
RequestsProvider, TransactionsProvider, WithdrawalsProvider,
RequestsProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use reth_db::models::StoredBlockBodyIndices;
use reth_primitives::{
@ -10,16 +10,6 @@ use reth_primitives::{
use reth_storage_errors::provider::ProviderResult;
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.
///
/// 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 reth_primitives::{
Address, BlockHashOrNumber, BlockNumber, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, TxHash, TxNumber,
};
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.
#[auto_impl::auto_impl(&, Arc)]