mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: add and fix more lints, improve docs (#4765)
This commit is contained in:
@ -12,7 +12,7 @@ use reth_revm_primitives::{
|
||||
};
|
||||
|
||||
/// A change to the state of the world.
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct StateChanges(pub StateChangeset);
|
||||
|
||||
impl From<StateChangeset> for StateChanges {
|
||||
|
||||
@ -14,7 +14,7 @@ use reth_revm_primitives::{
|
||||
use std::iter::Peekable;
|
||||
|
||||
/// Revert of the state.
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct StateReverts(pub PlainStateReverts);
|
||||
|
||||
impl From<PlainStateReverts> for StateReverts {
|
||||
|
||||
@ -235,6 +235,7 @@ impl Chain {
|
||||
}
|
||||
|
||||
/// Wrapper type for `blocks` display in `Chain`
|
||||
#[derive(Debug)]
|
||||
pub struct DisplayBlocksChain<'a>(pub &'a BTreeMap<BlockNumber, SealedBlockWithSenders>);
|
||||
|
||||
impl<'a> fmt::Display for DisplayBlocksChain<'a> {
|
||||
|
||||
@ -1,22 +1,17 @@
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
//! Collection of traits and trait implementations for common database operations.
|
||||
//!
|
||||
//! ## Feature Flags
|
||||
//!
|
||||
//! - `test-utils`: Export utilities for testing
|
||||
|
||||
#![doc(
|
||||
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
|
||||
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
|
||||
issue_tracker_base_url = "https://github.com/paradigmxzy/reth/issues/"
|
||||
)]
|
||||
#![warn(missing_docs, unreachable_pub, unused_crate_dependencies)]
|
||||
#![warn(missing_debug_implementations, missing_docs, unreachable_pub, rustdoc::all)]
|
||||
#![deny(unused_must_use, rust_2018_idioms)]
|
||||
#![doc(test(
|
||||
no_crate_inject,
|
||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
||||
))]
|
||||
|
||||
//! This crate contains a collection of traits and trait implementations for common database
|
||||
//! operations.
|
||||
//!
|
||||
//! ## Feature Flags
|
||||
//!
|
||||
//! - `test-utils`: Export utilities for testing
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
/// Various provider traits.
|
||||
mod traits;
|
||||
|
||||
@ -7,6 +7,7 @@ use reth_primitives::{Account, Address, BlockNumber, Bytecode, Bytes, H256};
|
||||
|
||||
/// A state provider that either resolves to data in a wrapped [`crate::BundleStateWithReceipts`],
|
||||
/// or an underlying state provider.
|
||||
#[derive(Debug)]
|
||||
pub struct BundleStateProvider<SP: StateProvider, BSDP: BundleStateDataProvider> {
|
||||
/// The inner state provider.
|
||||
pub(crate) state_provider: SP,
|
||||
|
||||
@ -49,7 +49,7 @@ use reth_interfaces::blockchain_tree::{
|
||||
/// This type serves as the main entry point for interacting with the blockchain and provides data
|
||||
/// from database storage and from the blockchain tree (pending state etc.) It is a simple wrapper
|
||||
/// type that holds an instance of the database and the blockchain tree.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BlockchainProvider<DB, Tree> {
|
||||
/// Provider type used to access the database.
|
||||
database: ProviderFactory<DB>,
|
||||
|
||||
@ -27,6 +27,7 @@ use std::marker::PhantomData;
|
||||
/// - [tables::StorageHistory]
|
||||
/// - [tables::AccountChangeSet]
|
||||
/// - [tables::StorageChangeSet]
|
||||
#[derive(Debug)]
|
||||
pub struct HistoricalStateProviderRef<'a, 'b, TX: DbTx<'a>> {
|
||||
/// Transaction
|
||||
tx: &'b TX,
|
||||
@ -258,6 +259,7 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for HistoricalStateProviderRef<'a, 'b,
|
||||
|
||||
/// State provider for a given block number.
|
||||
/// For more detailed description, see [HistoricalStateProviderRef].
|
||||
#[derive(Debug)]
|
||||
pub struct HistoricalStateProvider<'a, TX: DbTx<'a>> {
|
||||
/// Database transaction
|
||||
tx: TX,
|
||||
@ -314,7 +316,7 @@ delegate_provider_impls!(HistoricalStateProvider<'a, TX> where [TX: DbTx<'a>]);
|
||||
|
||||
/// Lowest blocks at which different parts of the state are available.
|
||||
/// They may be [Some] if pruning is enabled.
|
||||
#[derive(Default, Copy, Clone)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct LowestAvailableBlocks {
|
||||
/// Lowest block number at which the account history is available. It may not be available if
|
||||
/// [reth_primitives::PrunePart::AccountHistory] was pruned.
|
||||
|
||||
@ -14,6 +14,7 @@ use reth_primitives::{
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// State provider over latest state that takes tx reference.
|
||||
#[derive(Debug)]
|
||||
pub struct LatestStateProviderRef<'a, 'b, TX: DbTx<'a>> {
|
||||
/// database transaction
|
||||
db: &'b TX,
|
||||
@ -105,6 +106,7 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for LatestStateProviderRef<'a, 'b, TX>
|
||||
}
|
||||
|
||||
/// State provider for the latest state.
|
||||
#[derive(Debug)]
|
||||
pub struct LatestStateProvider<'a, TX: DbTx<'a>> {
|
||||
/// database transaction
|
||||
db: TX,
|
||||
|
||||
@ -49,6 +49,7 @@ pub fn assert_genesis_block<DB: Database>(provider: &DatabaseProviderRW<'_, DB>,
|
||||
|
||||
/// Test chain with genesis, blocks, execution results
|
||||
/// that have valid changesets.
|
||||
#[derive(Debug)]
|
||||
pub struct BlockChainTestData {
|
||||
/// Genesis
|
||||
pub genesis: SealedBlock,
|
||||
|
||||
@ -4,7 +4,7 @@ use tokio::sync::broadcast::{self, Sender};
|
||||
use crate::{CanonStateNotification, CanonStateNotifications, CanonStateSubscriptions, Chain};
|
||||
|
||||
/// A test ChainEventSubscriptions
|
||||
#[derive(Clone, Default)]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct TestCanonStateSubscriptions {
|
||||
canon_notif_tx: Arc<Mutex<Vec<Sender<CanonStateNotification>>>>,
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use reth_interfaces::executor::BlockExecutionError;
|
||||
use reth_primitives::{Address, Block, BlockNumber, ChainSpec, PruneModes, U256};
|
||||
use std::sync::Arc;
|
||||
/// Test executor with mocked result.
|
||||
#[derive(Debug)]
|
||||
pub struct TestExecutor(pub Option<BundleStateWithReceipts>);
|
||||
|
||||
impl BlockExecutor for TestExecutor {
|
||||
|
||||
Reference in New Issue
Block a user