From 7069efc75133f1cd497e864796eced98313dc77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Hodul=C3=A1k?= Date: Fri, 2 Aug 2024 00:53:40 +0200 Subject: [PATCH] refactor(trie): remove dependency on `reth-db` and `reth-db-api` (#10008) --- Cargo.lock | 2 -- crates/trie/trie/Cargo.toml | 3 --- crates/trie/trie/src/hashed_cursor/mod.rs | 11 ++++++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66e863237f..81b806f818 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8797,8 +8797,6 @@ dependencies = [ "proptest-arbitrary-interop", "rayon", "reth-chainspec", - "reth-db", - "reth-db-api", "reth-execution-errors", "reth-metrics", "reth-primitives", diff --git a/crates/trie/trie/Cargo.toml b/crates/trie/trie/Cargo.toml index 45bd4a2ecd..f77a5d9712 100644 --- a/crates/trie/trie/Cargo.toml +++ b/crates/trie/trie/Cargo.toml @@ -13,8 +13,6 @@ workspace = true [dependencies] # reth -reth-db-api.workspace = true -reth-db.workspace = true reth-execution-errors.workspace = true reth-primitives.workspace = true reth-stages-types.workspace = true @@ -49,7 +47,6 @@ serde = { workspace = true, optional = true } # reth reth-chainspec.workspace = true reth-primitives = { workspace = true, features = ["test-utils", "arbitrary"] } -reth-db = { workspace = true, features = ["test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-trie-common = { workspace = true, features = ["test-utils", "arbitrary"] } diff --git a/crates/trie/trie/src/hashed_cursor/mod.rs b/crates/trie/trie/src/hashed_cursor/mod.rs index 435b8a9ce7..b4961deae3 100644 --- a/crates/trie/trie/src/hashed_cursor/mod.rs +++ b/crates/trie/trie/src/hashed_cursor/mod.rs @@ -1,4 +1,5 @@ use reth_primitives::{Account, B256, U256}; +use reth_storage_errors::db::DatabaseError; /// Implementation of hashed state cursor traits for the post state. mod post_state; @@ -12,13 +13,13 @@ pub trait HashedCursorFactory { type StorageCursor: HashedStorageCursor; /// Returns a cursor for iterating over all hashed accounts in the state. - fn hashed_account_cursor(&self) -> Result; + fn hashed_account_cursor(&self) -> Result; /// Returns a cursor for iterating over all hashed storage entries in the state. fn hashed_storage_cursor( &self, hashed_address: B256, - ) -> Result; + ) -> Result; } /// The cursor for iterating over hashed entries. @@ -28,14 +29,14 @@ pub trait HashedCursor { /// Seek an entry greater or equal to the given key and position the cursor there. /// Returns the first entry with the key greater or equal to the sought key. - fn seek(&mut self, key: B256) -> Result, reth_db::DatabaseError>; + fn seek(&mut self, key: B256) -> Result, DatabaseError>; /// Move the cursor to the next entry and return it. - fn next(&mut self) -> Result, reth_db::DatabaseError>; + fn next(&mut self) -> Result, DatabaseError>; } /// The cursor for iterating over hashed storage entries. pub trait HashedStorageCursor: HashedCursor { /// Returns `true` if there are no entries for a given key. - fn is_storage_empty(&mut self) -> Result; + fn is_storage_empty(&mut self) -> Result; }