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

chore: expose PruneConfig in CLI args #10639

Merged
merged 13 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

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

55 changes: 54 additions & 1 deletion book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,60 @@ Dev testnet:

Pruning:
--full
Run full node. Only the most recent [`MINIMUM_PRUNING_DISTANCE`] block states are stored. This flag takes priority over pruning configuration in reth.toml
Run full node. Only the most recent [`MINIMUM_PRUNING_DISTANCE`] block states are stored

--block-interval <BLOCK_INTERVAL>
Minimum pruning interval measured in blocks

[default: 0]

--prune.senderrecovery.full
Prunes all sender recovery data

--prune.senderrecovery.distance <BLOCKS>
Prune sender recovery data before the `head-N` block number. In other words, keep last N + 1 blocks

--prune.senderrecovery.before <BLOCK_NUMBER>
Prune sender recovery data before the specified block number. The specified block number is not pruned

--prune.transactionlookup.full
Prunes all transaction lookup data

--prune.transactionlookup.distance <BLOCKS>
Prune transaction lookup data before the `head-N` block number. In other words, keep last N + 1 blocks

--prune.transactionlookup.before <BLOCK_NUMBER>
Prune transaction lookup data before the specified block number. The specified block number is not pruned

--prune.receipts.full
Prunes all receipt data

--prune.receipts.distance <BLOCKS>
Prune receipts before the `head-N` block number. In other words, keep last N + 1 blocks

--prune.receipts.before <BLOCK_NUMBER>
Prune receipts before the specified block number. The specified block number is not pruned

--prune.accounthistory.full
Prunes all account history

--prune.accounthistory.distance <BLOCKS>
Prune account before the `head-N` block number. In other words, keep last N + 1 blocks

--prune.accounthistory.before <BLOCK_NUMBER>
Prune account history before the specified block number. The specified block number is not pruned

--prune.storagehistory.full
Prunes all storage history data

--prune.storagehistory.distance <BLOCKS>
Prune storage history before the `head-N` block number. In other words, keep last N + 1 blocks

--prune.storagehistory.before <BLOCK_NUMBER>
Prune storage history before the specified block number. The specified block number is not pruned

--prune.receiptslogfilter <FILTER_CONFIG>
Configure receipts log filter. Format: <`address`>:<`prune_mode`>[,<`address`>:<`prune_mode`>...] Where <`prune_mode`> can be 'full', 'distance:<`blocks`>', or 'before:<`block_number`>'

Engine:
--engine.experimental
Expand Down
25 changes: 23 additions & 2 deletions crates/node/builder/src/launch/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,29 @@ mod tests {
fn test_save_prune_config() {
with_tempdir("prune-store-test", |config_path| {
let mut reth_config = Config::default();
let node_config =
NodeConfig { pruning: PruningArgs { full: true }, ..NodeConfig::test() };
let node_config = NodeConfig {
pruning: PruningArgs {
full: true,
block_interval: 0,
sender_recovery_full: false,
sender_recovery_distance: None,
sender_recovery_before: None,
transaction_lookup_full: false,
transaction_lookup_distance: None,
transaction_lookup_before: None,
receipts_full: false,
receipts_distance: None,
receipts_before: None,
account_history_full: false,
account_history_distance: None,
account_history_before: None,
storage_history_full: false,
storage_history_distance: None,
storage_history_before: None,
receipts_log_filter: vec![],
},
..NodeConfig::test()
};
LaunchContext::save_pruning_config_if_full_node(
&mut reth_config,
&node_config,
Expand Down
1 change: 1 addition & 0 deletions crates/node/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ derive_more.workspace = true
toml.workspace = true
serde.workspace = true
strum = { workspace = true, features = ["derive"] }
thiserror.workspace = true

# io
dirs-next = "2.0.0"
Expand Down
22 changes: 22 additions & 0 deletions crates/node/core/src/args/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use std::num::ParseIntError;

/// Error while parsing a `ReceiptsLogPruneConfig`
#[derive(thiserror::Error, Debug)]
#[allow(clippy::enum_variant_names)]
pub(crate) enum ReceiptsLogError {
/// The format of the filter is invalid.
#[error("invalid filter format: {0}")]
InvalidFilterFormat(String),
/// Address is invalid.
#[error("address is invalid: {0}")]
InvalidAddress(String),
/// The prune mode is not one of full, distance, before.
#[error("prune mode is invalid: {0}")]
InvalidPruneMode(String),
/// The distance value supplied is invalid.
#[error("distance is invalid: {0}")]
InvalidDistance(ParseIntError),
/// The block number supplied is invalid.
#[error("block number is invalid: {0}")]
InvalidBlockNumber(ParseIntError),
}
1 change: 1 addition & 0 deletions crates/node/core/src/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ pub use benchmark_args::BenchmarkArgs;

pub mod utils;

mod error;
pub mod types;
Loading
Loading