Open shekhirin opened 1 year ago
I'm trying to understand what's going on here. When the cli executes reth node
we're calling init_db
so this seems like a place to use ProviderFactory
.
The issue is we need to use db
on subsequent function calls such as init_genesis
or start_metrics_endpoint
. How can we do that with ProviderFactory
without changing all those function signatures as well? Is that the plan here?
Another thing to keep in mind is that we want MDBX to leak as little as possible so a potential database switch later would just be implementing the database traits, so the solution should still retain the generic DB
param
This issue is stale because it has been open for 14 days with no activity.
Does this still need to work?
Describe the feature
We use a bunch of helpers for initializing/opening a database throughout the codebase: https://github.com/paradigmxyz/reth/blob/9821311585f62ed868b1df2e9516f94d51527f26/crates/storage/db/src/lib.rs#L108 https://github.com/paradigmxyz/reth/blob/9821311585f62ed868b1df2e9516f94d51527f26/crates/storage/db/src/lib.rs#L136 https://github.com/paradigmxyz/reth/blob/9821311585f62ed868b1df2e9516f94d51527f26/crates/storage/db/src/lib.rs#L150
Such free floating functions is not the best experience, so we can migrate to using
ProviderFactory
instead: https://github.com/paradigmxyz/reth/blob/9821311585f62ed868b1df2e9516f94d51527f26/crates/storage/provider/src/providers/database/mod.rs#L59-L73Things to keep in mind:
LogLevel
Database::view
andDatabase::update
which aren't available if initialized throughProviderFactory
. We need to figure it out.Additional context
https://github.com/paradigmxyz/reth/pull/3524#issuecomment-1618116522