feat(storage): read headers and transactions only from static files#18788
feat(storage): read headers and transactions only from static files#18788
Conversation
6ae5738 to
4e33cd6
Compare
4e33cd6 to
ba3f65d
Compare
68f2450 to
36d3a7c
Compare
36d3a7c to
2e509c9
Compare
b80665d to
de869c2
Compare
de869c2 to
35c4984
Compare
| "reth-db-api", | ||
| "reth-db/test-utils", |
There was a problem hiding this comment.
curious why do we no longer need this?
There was a problem hiding this comment.
checking static files instead of the database now
| }, | ||
| |_| true, | ||
| ) | ||
| self.static_file_provider.transaction_hashes_by_range(tx_range) |
There was a problem hiding this comment.
with this we can basically do the same thing but without the db?
this seems great, curious why did we not do this before?
There was a problem hiding this comment.
no good reason tbh, we were writing to both locations for a while now...
c1a44f3 to
1322bdd
Compare
1322bdd to
39623de
Compare
Rjected
left a comment
There was a problem hiding this comment.
lgtm, I just have one question
| warn!( | ||
| target: "provider::static_file", | ||
| ?segment, | ||
| ?number, | ||
| "Could not find block or tx number on a range request" | ||
| ); |
There was a problem hiding this comment.
why do we go from warning and returning an err, to returning an Ok(result) now?
There was a problem hiding this comment.
we never hit this error because we always query only what we know is inside static files
reth/crates/storage/provider/src/providers/static_file/manager.rs
Lines 1288 to 1294 in 3338eb7
but now we're querying methods such as self.static_file_provider.headers_range directly without checking the ranges first, so I mirror the behaviour of database range querying
* main: (280 commits) refactor: remove needless collect() calls in trie tests (paradigmxyz#18937) chore(grafana): use precompile address as legend (paradigmxyz#18913) perf(tree): worker pooling for storage in multiproof generation (paradigmxyz#18887) feat: wait for new blocks when build is in progress (paradigmxyz#18831) chore: align node_config threshold constant (paradigmxyz#18914) docs: duplicate comment in Eip4844PoolTransactionError (paradigmxyz#18858) ci: cache hive simulator images to reduce prepare-hive job time (paradigmxyz#18899) refactor: replace collect().is_empty() with next().is_none() in tests (paradigmxyz#18902) feat(provider): add get_account_before_block to ChangesetReader (paradigmxyz#18898) refactor(engine): separate concerns in on_forkchoice_updated for better maintainability (paradigmxyz#18661) chore(node): simplify EngineApiExt bounds by removing redundant constraints (paradigmxyz#18905) fix(trie): Reveal extension child when extension is last remaining child of a branch (paradigmxyz#18891) chore: make clippy happy (paradigmxyz#18900) chore: relax `ChainSpec` impls (paradigmxyz#18894) refactor: eliminate redundant allocation in precompile cache example (paradigmxyz#18886) fix(era-utils): fix off-by-one for Excluded end bound in process_iter (paradigmxyz#18731) docs: yellowpaper sections in consensus implementation (paradigmxyz#18881) feat(storage): read headers and transactions only from static files (paradigmxyz#18788) feat: Use generic `HeaderTy` for `reth db get static-file headers` (paradigmxyz#18870) fix: streamline payload conversion in custom engine API (paradigmxyz#18864) ...
Closes #18684
This PR makes all provider methods that read headers or transactions to read only from static files, and never make a lookup in the database. Receipts are not touched yet, as they still can be written to the database.
This doesn't break existing nodes, because on startup we always copy to static files
reth/crates/node/builder/src/launch/engine.rs
Lines 159 to 160 in aa192c2
Hive passes https://github.com/paradigmxyz/reth/actions/runs/18220958085