Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Files #6444

Merged
merged 71 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
02d01ac
feat: add `HeadersTD` static file segment (#6118)
joshieDo Jan 18, 2024
8394742
Revert "feat: add `HeadersTD` static file segment" (#6210)
shekhirin Jan 24, 2024
9acc7d4
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Jan 25, 2024
3dcb835
feat(snapshots): write to snapshots during `BodyStage` (#5733)
joshieDo Jan 26, 2024
bd26c69
feat: add ETL and use it on `HeaderStage` (#6154)
joshieDo Jan 26, 2024
f64d7ab
fix(stages): division by zero in headers progress (#6262)
shekhirin Jan 29, 2024
5b080eb
feat(nippy-jar): use `reth_primitives::fs` to preserve path in errors…
shekhirin Jan 29, 2024
17d94cf
feat(snapshots): write `Receipt` to snapshots during `ExecutionStage…
joshieDo Jan 29, 2024
674c8e0
fix(snapshot): block increment for Transactions segment (#6274)
shekhirin Jan 29, 2024
4384c78
feat(snapshot, prune): receipts (#6241)
shekhirin Jan 29, 2024
d1c3edb
feat(snapshot, prune): headers (#6230)
shekhirin Jan 29, 2024
9c0838e
feat(snapshot, stages): snapshot stage (#6248)
shekhirin Jan 30, 2024
d1abb98
feat(stages): recover senders for both DB and static file transaction…
shekhirin Jan 31, 2024
e4dd02f
feat(primitives): remove snapshot block interval from chain spec (#6312)
shekhirin Feb 1, 2024
87476e0
feat(bin): use snapshots in `stage run` and `stage unwind` (#6322)
shekhirin Feb 1, 2024
b499acc
feat(bin): delete snapshot jars in `stage drop` (#6307)
shekhirin Feb 2, 2024
3ac6a7d
feat(bin): delete snapshot jars in `db clear` (#6311)
shekhirin Feb 2, 2024
333bc2c
feat(bin): show snapshots in `db stats` (#6285)
shekhirin Feb 2, 2024
af32e85
feat(storage): make snapshots non-optional in provider factory (#6344)
shekhirin Feb 2, 2024
1a67329
feat(snapshots): write Headers to snapshots during `HeaderStage` (#6273)
joshieDo Feb 5, 2024
0b264e4
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 6, 2024
b68288c
remove unused imports
shekhirin Feb 7, 2024
07e9c6e
fix(blockchain-tree): query latest canonical hashes from both db and …
shekhirin Feb 8, 2024
ffa64ec
feat: replace `RangeInclusive` with `SegmentRangeInclusive` on `Segme…
joshieDo Feb 8, 2024
d9e0634
feat: use `BufWriter` on `NippyJarWriter` (#6482)
joshieDo Feb 8, 2024
ad56b98
feat(primitives): implement `Display` for `SegmentRangeInclusive` (#6…
shekhirin Feb 8, 2024
613f319
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 8, 2024
1238e14
feat(bin, snapshot, engine): emit and log snapshotter events (#6490)
shekhirin Feb 8, 2024
8535568
fix(bin): add snapshot hook to list of hooks (#6492)
shekhirin Feb 8, 2024
802e7ec
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 8, 2024
c15e487
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 9, 2024
1cddeda
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 10, 2024
902e603
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 12, 2024
123fc2f
feat(bin): `db get` for snapshots (#6465)
shekhirin Feb 12, 2024
71f0793
feat(bin): `db stats --summary` to display totals for snapshots (#6584)
shekhirin Feb 13, 2024
cd3a035
feat(bin): support headers in `stage drop` (#6582)
shekhirin Feb 14, 2024
1eb9181
feat: add `lz4` to `SnapshotSegment::Headers` (#6487)
joshieDo Feb 14, 2024
dfb8c61
feat: check snapshot range on `ProviderFactory` (#6608)
joshieDo Feb 15, 2024
f1c4a8e
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 16, 2024
0ddf4c8
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 17, 2024
d58ed04
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 19, 2024
043f07d
fix lint
shekhirin Feb 19, 2024
4cdec90
feat: add `debug!` log on static file commit times (#6692)
joshieDo Feb 20, 2024
64ddcc5
feat(snapshot, stages): pass snapshot target per segment (#6673)
shekhirin Feb 20, 2024
ce97ef5
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 20, 2024
2a77e14
Merge branch 'feat/static-files' of github.com:paradigmxyz/reth into …
joshieDo Feb 20, 2024
acecfd3
feat: adds parallelization to `SenderRecovery` and `TxLookup` using `…
joshieDo Feb 20, 2024
56ea6d5
fix: `SnapshotProvider` edge case scenarios on insertion and query (…
joshieDo Feb 21, 2024
0986681
feat(book): update CLI section (#6720)
shekhirin Feb 21, 2024
5a871d5
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 22, 2024
b0eda75
chore: remove static file `commit()` from inside the stage (#6717)
joshieDo Feb 22, 2024
3d8c2b0
feat(storage): static files metrics (#6736)
shekhirin Feb 22, 2024
537dac8
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 22, 2024
cedd896
chore: remove `TotalDifficulty` stage configurations and docs (#6744)
joshieDo Feb 22, 2024
1431568
fix: `SegmentHeader` block range is now an `Option<_>` (#6738)
joshieDo Feb 22, 2024
aeaabfb
feat: add `ETL` to `TxLookup` stage (#6655)
joshieDo Feb 22, 2024
0a6e95c
chore: rename from `snapshot` to `static file` terminology (#6758)
joshieDo Feb 23, 2024
b896380
feat(pruner, static-file, node-core): add Started events (#6769)
shekhirin Feb 26, 2024
5ebff60
Merge remote-tracking branch 'origin/main' into feat/static-files
shekhirin Feb 26, 2024
81c10b4
feat(stages): remove static files stage, run before loop (#6763)
shekhirin Feb 26, 2024
17ad869
fix: make sure we only prune unfinalized data (wrt hive) (#6788)
joshieDo Feb 26, 2024
b9d55c2
Merge remote-tracking branch 'origin/main' into feat/static-files
joshieDo Feb 27, 2024
40ac848
change hive workflow to fork branch
joshieDo Feb 27, 2024
ea4a4c7
change hive workflow to fork branch part 2
joshieDo Feb 27, 2024
7249fff
only start the pruner once the tip block has crossed the min block in…
joshieDo Feb 27, 2024
9b81c22
feat(pruner): do not prune on first run if not needed (#6823)
shekhirin Feb 27, 2024
54ab1fc
Merge remote-tracking branch 'origin/breaking-changes' into feat/stat…
joshieDo Feb 27, 2024
a0780a9
rename missing tables
joshieDo Feb 27, 2024
3fbb837
missing random_eoa_accounts rename
joshieDo Feb 27, 2024
ce86a03
fix some merge issues on bin db get & acc hashing bench
joshieDo Feb 27, 2024
4937c00
fix(static-files): break `Arc` reference cycle (#6795)
shekhirin Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ slow-timeout = { period = "30s", terminate-after = 4 }

[[profile.default.overrides]]
filter = "test(general_state_tests)"
slow-timeout = { period = "1m", terminate-after = 4 }
slow-timeout = { period = "1m", terminate-after = 10 }
8 changes: 4 additions & 4 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Checkout hive tests
uses: actions/checkout@v4
with:
repository: ethereum/hive
ref: master
repository: joshiedo/hive
ref: reth/disable-pruner
path: hivetests

- uses: actions/setup-go@v3
Expand Down Expand Up @@ -182,8 +182,8 @@ jobs:
- name: Checkout hive tests
uses: actions/checkout@v4
with:
repository: ethereum/hive
ref: master
repository: joshiedo/hive
ref: reth/disable-pruner
path: hivetests

- name: Run ${{ matrix.sim }} simulator
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ crates/metrics @onbjerg
crates/tracing @onbjerg
crates/tasks @mattsse
crates/prune @shekhirin @joshieDo
crates/snapshot @joshieDo
crates/static-file @joshieDo @shekhirin
.github/ @onbjerg @gakonst @DaniPopes
68 changes: 45 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"crates/consensus/beacon-core/",
"crates/consensus/common/",
"crates/ethereum-forks/",
"crates/etl",
"crates/interfaces/",
"crates/metrics/",
"crates/metrics/metrics-derive/",
Expand Down Expand Up @@ -41,8 +42,8 @@ members = [
"crates/node-optimism/",
"crates/node-core/",
"crates/node-api/",
"crates/snapshot/",
"crates/stages/",
"crates/static-file/",
"crates/storage/codecs/",
"crates/storage/codecs/derive/",
"crates/storage/db/",
Expand Down Expand Up @@ -136,6 +137,7 @@ reth-ecies = { path = "crates/net/ecies" }
reth-eth-wire = { path = "crates/net/eth-wire" }
reth-ethereum-forks = { path = "crates/ethereum-forks" }
reth-ethereum-payload-builder = { path = "crates/payload/ethereum" }
reth-etl = { path = "crates/etl" }
reth-optimism-payload-builder = { path = "crates/payload/optimism" }
reth-interfaces = { path = "crates/interfaces" }
reth-ipc = { path = "crates/rpc/ipc" }
Expand All @@ -161,8 +163,8 @@ reth-rpc-builder = { path = "crates/rpc/rpc-builder" }
reth-rpc-engine-api = { path = "crates/rpc/rpc-engine-api" }
reth-rpc-types = { path = "crates/rpc/rpc-types" }
reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" }
reth-snapshot = { path = "crates/snapshot" }
reth-stages = { path = "crates/stages" }
reth-static-file = { path = "crates/static-file" }
reth-tasks = { path = "crates/tasks" }
reth-tokio-util = { path = "crates/tokio-util" }
reth-tracing = { path = "crates/tracing" }
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ reth-payload-validator.workspace = true
reth-basic-payload-builder.workspace = true
reth-discv4.workspace = true
reth-prune.workspace = true
reth-snapshot = { workspace = true, features = ["clap"] }
reth-static-file = { workspace = true, features = ["clap"] }
reth-trie.workspace = true
reth-nippy-jar.workspace = true
reth-node-api.workspace = true
Expand Down
63 changes: 32 additions & 31 deletions bin/reth/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use fdlimit::raise_fd_limit;
use futures::{future::Either, stream, stream_select, StreamExt};
use reth_auto_seal_consensus::AutoSealBuilder;
use reth_beacon_consensus::{
hooks::{EngineHooks, PruneHook},
hooks::{EngineHooks, PruneHook, StaticFileHook},
BeaconConsensusEngine, MIN_BLOCKS_FOR_PIPELINE_RUN,
};
use reth_blockchain_tree::{config::BlockchainTreeConfig, ShareableBlockchainTree};
Expand Down Expand Up @@ -40,6 +40,7 @@ use reth_primitives::format_ether;
use reth_provider::{providers::BlockchainProvider, ProviderFactory};
use reth_prune::PrunerBuilder;
use reth_rpc_engine_api::EngineApi;
use reth_static_file::StaticFileProducer;
use reth_tasks::{TaskExecutor, TaskManager};
use reth_transaction_pool::TransactionPool;
use std::{path::PathBuf, sync::Arc};
Expand Down Expand Up @@ -127,26 +128,18 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit

let prometheus_handle = self.config.install_prometheus_recorder()?;

let mut provider_factory =
ProviderFactory::new(Arc::clone(&self.db), Arc::clone(&self.config.chain));

// configure snapshotter
let snapshotter = reth_snapshot::Snapshotter::new(
provider_factory.clone(),
self.data_dir.snapshots_path(),
self.config.chain.snapshot_block_interval,
)?;

provider_factory = provider_factory.with_snapshots(
self.data_dir.snapshots_path(),
snapshotter.highest_snapshot_receiver(),
)?;
let provider_factory = ProviderFactory::new(
Arc::clone(&self.db),
Arc::clone(&self.config.chain),
self.data_dir.static_files_path(),
)?
.with_static_files_metrics();

self.config.start_metrics_endpoint(prometheus_handle, Arc::clone(&self.db)).await?;

debug!(target: "reth::cli", chain=%self.config.chain.chain, genesis=?self.config.chain.genesis_hash(), "Initializing genesis");

let genesis_hash = init_genesis(Arc::clone(&self.db), self.config.chain.clone())?;
let genesis_hash = init_genesis(provider_factory.clone())?;

info!(target: "reth::cli", "{}", self.config.chain.display_hardforks());

Expand Down Expand Up @@ -270,6 +263,17 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
};
let max_block = self.config.max_block(&network_client, provider_factory.clone()).await?;

let mut hooks = EngineHooks::new();

let mut static_file_producer = StaticFileProducer::new(
provider_factory.clone(),
provider_factory.static_file_provider(),
prune_config.clone().unwrap_or_default().segments,
);
let static_file_producer_events = static_file_producer.events();
hooks.add(StaticFileHook::new(static_file_producer.clone(), Box::new(executor.clone())));
info!(target: "reth::cli", "StaticFileProducer initialized");

// Configure the pipeline
let (mut pipeline, client) = if self.config.dev.dev {
info!(target: "reth::cli", "Starting Reth in dev mode");
Expand Down Expand Up @@ -301,6 +305,7 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
sync_metrics_tx,
prune_config.clone(),
max_block,
static_file_producer,
evm_config,
)
.await?;
Expand All @@ -323,6 +328,7 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
sync_metrics_tx,
prune_config.clone(),
max_block,
static_file_producer,
evm_config,
)
.await?;
Expand All @@ -333,22 +339,16 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
let pipeline_events = pipeline.events();

let initial_target = self.config.initial_pipeline_target(genesis_hash);
let mut hooks = EngineHooks::new();

let pruner_events = if let Some(prune_config) = prune_config {
let mut pruner = PrunerBuilder::new(prune_config.clone())
.max_reorg_depth(tree_config.max_reorg_depth() as usize)
.prune_delete_limit(self.config.chain.prune_delete_limit)
.build(provider_factory, snapshotter.highest_snapshot_receiver());
let prune_config = prune_config.unwrap_or_default();
let mut pruner = PrunerBuilder::new(prune_config.clone())
.max_reorg_depth(tree_config.max_reorg_depth() as usize)
.prune_delete_limit(self.config.chain.prune_delete_limit)
.build(provider_factory.clone());

let events = pruner.events();
hooks.add(PruneHook::new(pruner, Box::new(executor.clone())));

info!(target: "reth::cli", ?prune_config, "Pruner initialized");
Either::Left(events)
} else {
Either::Right(stream::empty())
};
let pruner_events = pruner.events();
hooks.add(PruneHook::new(pruner, Box::new(executor.clone())));
info!(target: "reth::cli", ?prune_config, "Pruner initialized");

// Configure the consensus engine
let (beacon_consensus_engine, beacon_engine_handle) = BeaconConsensusEngine::with_channel(
Expand Down Expand Up @@ -380,7 +380,8 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
} else {
Either::Right(stream::empty())
},
pruner_events.map(Into::into)
pruner_events.map(Into::into),
static_file_producer_events.map(Into::into),
);
executor.spawn_critical(
"events task",
Expand Down
Loading
Loading