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

refactor(prune): segment trait, receipts impl #4887

Merged
merged 23 commits into from
Oct 5, 2023
Merged

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Oct 3, 2023

Problem

pruner.rs became a huge file with different pruning segments sharing a similar structure and logic. With the addition of headers and transactions pruning for snapshots, it will become even bigger.

Solution

Introduce a Segment trait in segments/mod.rs which will be used to call a collection of prune segments from Pruner, abstracting the common logic. Each segment (such as headers, transactions, receipts, etc.) will implement this trait in a separate file, starting with Receipts in segments/receipts.rs as a demonstration.

@shekhirin shekhirin added C-debt Refactor of code section that is hard to understand or maintain A-pruning Related to pruning or full node labels Oct 3, 2023
@shekhirin shekhirin requested a review from mattsse October 3, 2023 12:09
@shekhirin shekhirin marked this pull request as ready for review October 3, 2023 12:09
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #4887 (d78e03c) into main (4dceabf) will decrease coverage by 0.04%.
The diff coverage is 65.59%.

Impacted file tree graph

Files Coverage Δ
crates/config/src/config.rs 84.38% <100.00%> (+3.81%) ⬆️
crates/consensus/beacon/src/engine/hooks/prune.rs 75.00% <ø> (ø)
...ates/consensus/beacon/src/engine/hooks/snapshot.rs 0.00% <ø> (ø)
crates/interfaces/src/executor.rs 40.00% <ø> (ø)
crates/primitives/src/prune/checkpoint.rs 100.00% <ø> (ø)
crates/primitives/src/prune/mode.rs 96.39% <100.00%> (ø)
crates/primitives/src/prune/segment.rs 100.00% <100.00%> (ø)
crates/prune/src/error.rs 0.00% <ø> (ø)
crates/prune/src/event.rs 0.00% <ø> (ø)
crates/revm/src/processor.rs 83.93% <100.00%> (ø)
... and 27 more

... and 10 files with indirect coverage changes

Flag Coverage Δ
integration-tests 15.46% <0.00%> (-0.04%) ⬇️
unit-tests 62.62% <65.59%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 32.95% <78.94%> (+0.35%) ⬆️
blockchain tree 80.64% <ø> (ø)
pipeline 88.45% <100.00%> (ø)
storage (db) 73.30% <54.54%> (ø)
trie 94.48% <ø> (ø)
txpool 48.90% <ø> (-0.47%) ⬇️
networking 76.08% <ø> (-0.07%) ⬇️
rpc 57.71% <ø> (ø)
consensus 61.05% <ø> (ø)
revm 28.47% <100.00%> (ø)
payload builder 8.14% <ø> (ø)
primitives 85.42% <70.96%> (+<0.01%) ⬆️

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea, to split all of these,

only doc nits + naming bikeshed

crates/prune/src/parts/mod.rs Outdated Show resolved Hide resolved
crates/prune/src/parts/mod.rs Outdated Show resolved Hide resolved
crates/prune/src/parts/mod.rs Outdated Show resolved Hide resolved
crates/prune/src/parts/mod.rs Outdated Show resolved Hide resolved
crates/prune/src/parts/receipts.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, pending @joshieDo

@joshieDo
Copy link
Collaborator

joshieDo commented Oct 3, 2023

apart from the comment, lgtm and fully supportive

Base automatically changed from alexey/pruner-deletion-limit to main October 4, 2023 18:23
@shekhirin shekhirin changed the title refactor(prune): part trait, receipts impl refactor(prune): segment trait, receipts impl Oct 5, 2023
@shekhirin shekhirin added this pull request to the merge queue Oct 5, 2023
Merged via the queue into main with commit 1e7d028 Oct 5, 2023
23 checks passed
@shekhirin shekhirin deleted the alexey/pruner-part-trait branch October 5, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pruning Related to pruning or full node C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants