mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
Breaking changes (#5191)
Co-authored-by: Bjerg <onbjerg@users.noreply.github.com> Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com> Co-authored-by: joshieDo <ranriver@protonmail.com> Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me> Co-authored-by: Thomas Coratger <thomas.coratger@gmail.com>
This commit is contained in:
@@ -27,6 +27,8 @@ futures.workspace = true
|
||||
async-trait.workspace = true
|
||||
tokio.workspace = true
|
||||
|
||||
jemallocator = { version = "0.5.0", features = ["profiling"] }
|
||||
|
||||
[[example]]
|
||||
name = "db-access"
|
||||
path = "db-access.rs"
|
||||
@@ -38,3 +40,4 @@ path = "network.rs"
|
||||
[[example]]
|
||||
name = "network-txpool"
|
||||
path = "network-txpool.rs"
|
||||
|
||||
|
||||
@@ -18,12 +18,14 @@ fn main() -> eyre::Result<()> {
|
||||
// Opens a RO handle to the database file.
|
||||
// TODO: Should be able to do `ProviderFactory::new_with_db_path_ro(...)` instead of
|
||||
// doing in 2 steps.
|
||||
let db = open_db_read_only(Path::new(&std::env::var("RETH_DB_PATH")?), Default::default())?;
|
||||
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(), 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?
|
||||
let spec = ChainSpecBuilder::mainnet().build();
|
||||
let factory = ProviderFactory::new(db, spec.into());
|
||||
let factory = ProviderFactory::new(db, spec.into(), db_path.join("static_files"))?;
|
||||
|
||||
// This call opens a RO transaction on the database. To write to the DB you'd need to call
|
||||
// the `provider_rw` function and look for the `Writer` variants of the traits.
|
||||
|
||||
@@ -27,7 +27,6 @@ pub(crate) fn polygon_chain_spec() -> Arc<ChainSpec> {
|
||||
]),
|
||||
deposit_contract: None,
|
||||
base_fee_params: reth_primitives::BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
|
||||
snapshot_block_interval: 500_000,
|
||||
prune_delete_limit: 0,
|
||||
}
|
||||
.into()
|
||||
|
||||
@@ -36,12 +36,11 @@ pub mod myrpc_ext;
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
// 1. Setup the DB
|
||||
let db = Arc::new(open_db_read_only(
|
||||
Path::new(&std::env::var("RETH_DB_PATH")?),
|
||||
Default::default(),
|
||||
)?);
|
||||
let db_path = std::env::var("RETH_DB_PATH")?;
|
||||
let db_path = Path::new(&db_path);
|
||||
let db = Arc::new(open_db_read_only(db_path.join("db").as_path(), Default::default())?);
|
||||
let spec = Arc::new(ChainSpecBuilder::mainnet().build());
|
||||
let factory = ProviderFactory::new(db.clone(), spec.clone());
|
||||
let factory = ProviderFactory::new(db.clone(), spec.clone(), db_path.join("static_files"))?;
|
||||
|
||||
// 2. Setup the blockchain provider using only the database provider and a noop for the tree to
|
||||
// satisfy trait bounds. Tree is not used in this example since we are only operating on the
|
||||
|
||||
Reference in New Issue
Block a user