diff --git a/crates/optimism/trie/src/api.rs b/crates/optimism/trie/src/api.rs index 9da403ed7d7..2a9453007c3 100644 --- a/crates/optimism/trie/src/api.rs +++ b/crates/optimism/trie/src/api.rs @@ -197,7 +197,7 @@ pub trait OpProofsStore: Send + Sync + Debug { block_number: u64, ) -> impl Future> + Send; - /// Applies `BlockStateDiff` to the earliest state (updating/deleting nodes) and updates the + /// Applies [`BlockStateDiff`] to the earliest state (updating/deleting nodes) and updates the /// earliest block number. fn prune_earliest_state( &self, diff --git a/crates/optimism/trie/src/db/cursor.rs b/crates/optimism/trie/src/db/cursor.rs index c336a913b5a..fd7c094b635 100644 --- a/crates/optimism/trie/src/db/cursor.rs +++ b/crates/optimism/trie/src/db/cursor.rs @@ -34,7 +34,7 @@ where T: Table> + DupSort, Cursor: DbCursorRO + DbDupCursorRO, { - /// Initializes new `BlockNumberVersionedCursor` + /// Initializes new [`BlockNumberVersionedCursor`]. pub const fn new(cursor: Cursor, max_block_number: u64) -> Self { Self { _table: PhantomData, cursor, max_block_number } } @@ -161,7 +161,7 @@ where } } -/// MDBX implementation of `OpProofsTrieCursor`. +/// MDBX implementation of [`OpProofsTrieCursor`]. #[derive(Debug)] pub struct MdbxTrieCursor { inner: BlockNumberVersionedCursor, @@ -174,7 +174,7 @@ impl< Cursor: DbCursorRO + DbDupCursorRO, > MdbxTrieCursor { - /// Initializes new `MdbxTrieCursor` + /// Initializes new [`MdbxTrieCursor`]. pub const fn new(cursor: Cursor, max_block_number: u64, hashed_address: Option) -> Self { Self { inner: BlockNumberVersionedCursor::new(cursor, max_block_number), hashed_address } } @@ -261,7 +261,7 @@ where } } -/// MDBX implementation of `OpProofsHashedCursor` for storage state. +/// MDBX implementation of [`OpProofsHashedCursor`] for storage state. #[derive(Debug)] pub struct MdbxStorageCursor { inner: BlockNumberVersionedCursor, @@ -294,7 +294,7 @@ where } } -/// MDBX implementation of `OpProofsHashedCursor` for account state. +/// MDBX implementation of [`OpProofsHashedCursor`] for account state. #[derive(Debug)] pub struct MdbxAccountCursor { inner: BlockNumberVersionedCursor, diff --git a/crates/optimism/trie/src/db/models/version.rs b/crates/optimism/trie/src/db/models/version.rs index bdcbe377386..2387d7ca600 100644 --- a/crates/optimism/trie/src/db/models/version.rs +++ b/crates/optimism/trie/src/db/models/version.rs @@ -5,7 +5,7 @@ use reth_db::{ }; use serde::{Deserialize, Serialize}; -/// Wrapper type for `Option` that implements `Compress` and `Decompress` +/// Wrapper type for `Option` that implements [`Compress`] and [`Decompress`] /// /// Encoding: /// - `None` => empty byte array (length 0) @@ -56,13 +56,21 @@ impl Decompress for MaybeDeleted { } } -/// Versioned value wrapper for `DupSort` tables +/// Versioned value wrapper for [`DupSort`] tables /// -/// For `DupSort` tables in MDBX, the Value type must contain the `SubKey` as a field. -/// This wrapper combines a `block_number` (the `SubKey`) with the actual value. +/// For [`DupSort`] tables in MDBX, the Value type must contain the [`DupSort::SubKey`] as a field. +/// This wrapper combines a [`block_number`] (the [`DupSort::SubKey`]) with +/// the actual value. +/// +/// [`DupSort`]: reth_db::table::DupSort +/// [`DupSort::SubKey`]: reth_db::table::DupSort::SubKey +/// [`block_number`]: Self::block_number #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct VersionedValue { - /// Block number (`SubKey` for `DupSort`) + /// Block number ([`DupSort::SubKey`] for [`DupSort`]) + /// + /// [`DupSort`]: reth_db::table::DupSort + /// [`DupSort::SubKey`]: reth_db::table::DupSort::SubKey pub block_number: u64, /// The actual value (may be deleted) pub value: MaybeDeleted, diff --git a/crates/optimism/trie/src/db/store.rs b/crates/optimism/trie/src/db/store.rs index 82463252fa3..b771c0804db 100644 --- a/crates/optimism/trie/src/db/store.rs +++ b/crates/optimism/trie/src/db/store.rs @@ -22,14 +22,14 @@ use reth_primitives_traits::Account; use reth_trie::{BranchNodeCompact, Nibbles, StoredNibbles}; use std::path::Path; -/// MDBX implementation of `OpProofsStorage`. +/// MDBX implementation of [`OpProofsStorage`]. #[derive(Debug)] pub struct MdbxProofsStorage { env: DatabaseEnv, } impl MdbxProofsStorage { - /// Creates a new `MdbxProofsStorage` instance with the given path. + /// Creates a new [`MdbxProofsStorage`] instance with the given path. pub fn new(path: &Path) -> Result { let env = init_db_for::<_, super::models::Tables>(path, DatabaseArguments::default()) .map_err(OpProofsStorageError::Other)?; diff --git a/crates/optimism/trie/src/in_memory.rs b/crates/optimism/trie/src/in_memory.rs index ef37b3e03b2..c8ec8275f42 100644 --- a/crates/optimism/trie/src/in_memory.rs +++ b/crates/optimism/trie/src/in_memory.rs @@ -140,7 +140,7 @@ impl InMemoryProofsStorage { } } -/// In-memory implementation of `OpProofsTrieCursor` +/// In-memory implementation of [`OpProofsTrieCursor`]. #[derive(Debug)] pub struct InMemoryTrieCursor { /// Current position in the iteration (-1 means not positioned yet) @@ -250,7 +250,7 @@ impl OpProofsTrieCursorRO for InMemoryTrieCursor { } } -/// In-memory implementation of `OpProofsHashedCursor` for storage slots +/// In-memory implementation of [`OpProofsHashedCursor`] for storage slots #[derive(Debug)] pub struct InMemoryStorageCursor { /// Current position in the iteration (-1 means not positioned yet) diff --git a/crates/optimism/trie/tests/lib.rs b/crates/optimism/trie/tests/lib.rs index a15bc0b5ed1..c2f4d37fe2f 100644 --- a/crates/optimism/trie/tests/lib.rs +++ b/crates/optimism/trie/tests/lib.rs @@ -1,4 +1,4 @@ -//! Common test suite for `OpProofsStorage` implementations. +//! Common test suite for [`OpProofsStorage`] implementations. use alloy_primitives::{map::HashMap, B256, U256}; use reth_optimism_trie::{ @@ -1103,9 +1103,9 @@ async fn test_large_batch_operations( Ok(()) } -/// Test wiped storage in `HashedPostState` +/// Test wiped storage in [`HashedPostState`] /// -/// When `store_trie_updates` receives a `HashedPostState` with wiped=true for a storage entry, +/// When `store_trie_updates` receives a [`HashedPostState`] with wiped=true for a storage entry, /// it should iterate all existing values for that address and create deletion entries for them. #[test_case(InMemoryProofsStorage::new(); "InMemory")] #[tokio::test]