From 5968e9f3dae8ec9ba1e931ab57c85ecaeafe93f9 Mon Sep 17 00:00:00 2001 From: lmittmann <3458786+lmittmann@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:57:29 +0100 Subject: [PATCH] feat(reth_db/mdbx): fix API regression in `DatabaseArguments` (#7323) Co-authored-by: lmittmann --- crates/storage/db/src/implementation/mdbx/mod.rs | 2 +- examples/db-access.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/storage/db/src/implementation/mdbx/mod.rs b/crates/storage/db/src/implementation/mdbx/mod.rs index a85c3dff3..73b0c5353 100644 --- a/crates/storage/db/src/implementation/mdbx/mod.rs +++ b/crates/storage/db/src/implementation/mdbx/mod.rs @@ -58,7 +58,7 @@ impl DatabaseEnvKind { } /// Arguments for database initialization. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub struct DatabaseArguments { /// Client version that accesses the database. client_version: ClientVersion, diff --git a/examples/db-access.rs b/examples/db-access.rs index 9362b7442..41d462204 100644 --- a/examples/db-access.rs +++ b/examples/db-access.rs @@ -1,4 +1,4 @@ -use reth_db::{mdbx::DatabaseArguments, models::client_version::ClientVersion, open_db_read_only}; +use reth_db::open_db_read_only; use reth_primitives::{Address, ChainSpecBuilder, B256}; use reth_provider::{ AccountReader, BlockReader, BlockSource, HeaderProvider, ProviderFactory, ReceiptProvider, @@ -19,10 +19,7 @@ fn main() -> eyre::Result<()> { // doing in 2 steps. let db_path = std::env::var("RETH_DB_PATH")?; let db_path = Path::new(&db_path); - let db = open_db_read_only( - db_path.join("db").as_path(), - DatabaseArguments::new(ClientVersion::default()), - )?; + let db = open_db_read_only(db_path.join("db").as_path(), Default::default())?; // Instantiate a provider factory for Ethereum mainnet using the provided DB. // TODO: Should the DB version include the spec so that you do not need to specify it here?