mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 04:31:51 +00:00
* Start extracting freezer changes for tree-states * Remove unused config args * Add comments * Remove unwraps * Subjective more clear implementation * Clean up hdiff * Update xdelta3 * Tree states archive metrics (#6040) * Add store cache size metrics * Add compress timer metrics * Add diff apply compute timer metrics * Add diff buffer cache hit metrics * Add hdiff buffer load times * Add blocks replayed metric * Move metrics to store * Future proof some metrics --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Port and clean up forwards iterator changes * Add and polish hierarchy-config flag * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Cleaner errors * Fix beacon_chain test compilation * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Patch a few more freezer block roots * Fix genesis block root bug * Fix test failing due to pending updates * Beacon chain tests passing * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix doc lint * Implement DB schema upgrade for hierarchical state diffs (#6193) * DB upgrade * Add flag * Delete RestorePointHash * Update docs * Update docs * Implement hierarchical state diffs config migration (#6245) * Implement hierarchical state diffs config migration * Review PR * Remove TODO * Set CURRENT_SCHEMA_VERSION correctly * Fix genesis state loading * Re-delete some PartialBeaconState stuff --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix test compilation * Update schema downgrade test * Fix tests * Fix null anchor migration * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix tree states upgrade migration (#6328) * Towards crash safety * Fix compilation * Move cold summaries and state roots to new columns * Rename StateRoots chunked field * Update prune states * Clean hdiff CLI flag and metrics * Fix "staged reconstruction" * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Fix alloy issues * Fix staged reconstruction logic * Prevent weird slot drift * Remove "allow" flag * Update CLI help * Remove FIXME about downgrade * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Remove some unnecessary error variants * Fix new test * Tree states archive - review comments and metrics (#6386) * Review PR comments and metrics * Comments * Add anchor metrics * drop prev comment * Update metadata.rs * Apply suggestions from code review --------- Co-authored-by: Michael Sproul <micsproul@gmail.com> * Update beacon_node/store/src/hot_cold_store.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Clarify comment and remove anchor_slot garbage * Simplify database anchor (#6397) * Simplify database anchor * Update beacon_node/store/src/reconstruct.rs * Add migration for anchor * Fix and simplify light_client store tests * Fix incompatible config test * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * More metrics * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * New historic state cache (#6475) * New historic state cache * Add more metrics * State cache hit rate metrics * Fix store metrics * More logs and metrics * Fix logger * Ensure cached states have built caches :O * Replay blocks in preference to diffing * Two separate caches * Distribute cache build time to next slot * Re-plumb historic-state-cache flag * Clean up metrics * Update book * Update beacon_node/store/src/hdiff.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Update beacon_node/store/src/historic_state_cache.rs Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> * Update database docs * Update diagram * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Update lockbud to work with bindgen/etc * Correct pkg name for Debian * Remove vestigial epochs_per_state_diff * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Markdown lint * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Address Jimmy's review comments * Simplify ReplayFrom case * Fix and document genesis_state_root * Typo Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * Merge branch 'unstable' into tree-states-archive * Compute diff of validators list manually (#6556) * Split hdiff computation * Dedicated logic for historical roots and summaries * Benchmark against real states * Mutated source? * Version the hdiff * Add lighthouse DB config for hierarchy exponents * Tidy up hierarchy exponents flag * Apply suggestions from code review Co-authored-by: Michael Sproul <micsproul@gmail.com> * Address PR review * Remove hardcoded paths in benchmarks * Delete unused function in benches * lint --------- Co-authored-by: Michael Sproul <michael@sigmaprime.io> * Test hdiff binary format stability (#6585) * Merge remote-tracking branch 'origin/unstable' into tree-states-archive * Add deprecation warning for SPRP * Update xdelta to get rid of duplicate deps * Document test
232 lines
5.9 KiB
Rust
232 lines
5.9 KiB
Rust
pub use clap::{Arg, ArgAction, Args, Command, FromArgMatches, Parser};
|
|
use clap_utils::get_color_style;
|
|
use clap_utils::FLAG_HEADER;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::path::PathBuf;
|
|
use store::hdiff::HierarchyConfig;
|
|
|
|
use crate::InspectTarget;
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(
|
|
name = "database_manager",
|
|
visible_alias = "db",
|
|
about = "Manage a beacon node database.",
|
|
styles = get_color_style(),
|
|
next_line_help = true,
|
|
term_width = 80,
|
|
disable_help_flag = true,
|
|
disable_help_subcommand = true,
|
|
display_order = 0,
|
|
)]
|
|
pub struct DatabaseManager {
|
|
#[clap(
|
|
long,
|
|
global = true,
|
|
value_name = "N0,N1,N2,...",
|
|
help = "Specifies the frequency for storing full state snapshots and hierarchical \
|
|
diffs in the freezer DB.",
|
|
default_value_t = HierarchyConfig::default(),
|
|
display_order = 0
|
|
)]
|
|
pub hierarchy_exponents: HierarchyConfig,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "DIR",
|
|
help = "Data directory for the freezer database.",
|
|
display_order = 0
|
|
)]
|
|
pub freezer_dir: Option<PathBuf>,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "EPOCHS",
|
|
default_value_t = 0,
|
|
help = "The margin for blob pruning in epochs. The oldest blobs are pruned \
|
|
up until data_availability_boundary - blob_prune_margin_epochs.",
|
|
display_order = 0
|
|
)]
|
|
pub blob_prune_margin_epochs: u64,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "DIR",
|
|
help = "Data directory for the blobs database.",
|
|
display_order = 0
|
|
)]
|
|
pub blobs_dir: Option<PathBuf>,
|
|
|
|
#[clap(
|
|
long,
|
|
global = true,
|
|
help = "Prints help information",
|
|
action = clap::ArgAction::HelpLong,
|
|
display_order = 0,
|
|
help_heading = FLAG_HEADER
|
|
)]
|
|
help: Option<bool>,
|
|
|
|
#[clap(subcommand)]
|
|
pub subcommand: DatabaseManagerSubcommand,
|
|
}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(rename_all = "kebab-case")]
|
|
pub enum DatabaseManagerSubcommand {
|
|
Migrate(Migrate),
|
|
Inspect(Inspect),
|
|
Version(Version),
|
|
PrunePayloads(PrunePayloads),
|
|
PruneBlobs(PruneBlobs),
|
|
PruneStates(PruneStates),
|
|
Compact(Compact),
|
|
}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(about = "Migrate the database to a specific schema version.")]
|
|
pub struct Migrate {
|
|
#[clap(
|
|
long,
|
|
value_name = "VERSION",
|
|
help = "Schema version to migrate to",
|
|
display_order = 0
|
|
)]
|
|
pub to: u64,
|
|
}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(about = "Inspect raw database values.")]
|
|
pub struct Inspect {
|
|
#[clap(
|
|
long,
|
|
value_name = "TAG",
|
|
help = "3-byte column ID (see `DBColumn`)",
|
|
display_order = 0
|
|
)]
|
|
pub column: String,
|
|
|
|
#[clap(
|
|
long,
|
|
value_enum,
|
|
value_name = "TARGET",
|
|
default_value_t = InspectTarget::ValueSizes,
|
|
help = "Select the type of output to show",
|
|
display_order = 0,
|
|
)]
|
|
pub output: InspectTarget,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "N",
|
|
help = "Skip over the first N keys",
|
|
display_order = 0
|
|
)]
|
|
pub skip: Option<usize>,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "N",
|
|
help = "Output at most N keys",
|
|
display_order = 0
|
|
)]
|
|
pub limit: Option<usize>,
|
|
|
|
#[clap(
|
|
long,
|
|
conflicts_with = "blobs_db",
|
|
help = "Inspect the freezer DB rather than the hot DB",
|
|
display_order = 0,
|
|
help_heading = FLAG_HEADER
|
|
)]
|
|
pub freezer: bool,
|
|
|
|
#[clap(
|
|
long,
|
|
conflicts_with = "freezer",
|
|
help = "Inspect the blobs DB rather than the hot DB",
|
|
display_order = 0,
|
|
help_heading = FLAG_HEADER
|
|
)]
|
|
pub blobs_db: bool,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "DIR",
|
|
help = "Base directory for the output files. Defaults to the current directory",
|
|
display_order = 0
|
|
)]
|
|
pub output_dir: Option<PathBuf>,
|
|
}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(about = "Display database schema version.", visible_aliases = &["v"])]
|
|
pub struct Version {}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(
|
|
about = "Prune finalized execution payloads.",
|
|
alias = "prune_payloads"
|
|
)]
|
|
pub struct PrunePayloads {}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(
|
|
about = "Prune blobs older than data availability boundary.",
|
|
alias = "prune_blobs"
|
|
)]
|
|
pub struct PruneBlobs {}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(
|
|
about = "Prune all beacon states from the freezer database.",
|
|
alias = "prune_states"
|
|
)]
|
|
pub struct PruneStates {
|
|
#[clap(
|
|
long,
|
|
help = "Commit to pruning states irreversably. Without this flag the command will \
|
|
just check that the database is capable of being pruned.",
|
|
help_heading = FLAG_HEADER,
|
|
)]
|
|
pub confirm: bool,
|
|
}
|
|
|
|
#[derive(Parser, Clone, Deserialize, Serialize, Debug)]
|
|
#[clap(about = "Compact database manually.")]
|
|
pub struct Compact {
|
|
#[clap(
|
|
long,
|
|
value_name = "TAG",
|
|
help = "3-byte column ID (see `DBColumn`)",
|
|
display_order = 0
|
|
)]
|
|
pub column: String,
|
|
|
|
#[clap(
|
|
long,
|
|
conflicts_with = "blobs_db",
|
|
help = "Inspect the freezer DB rather than the hot DB",
|
|
display_order = 0,
|
|
help_heading = FLAG_HEADER
|
|
)]
|
|
pub freezer: bool,
|
|
|
|
#[clap(
|
|
long,
|
|
conflicts_with = "freezer",
|
|
help = "Inspect the blobs DB rather than the hot DB",
|
|
display_order = 0,
|
|
help_heading = FLAG_HEADER
|
|
)]
|
|
pub blobs_db: bool,
|
|
|
|
#[clap(
|
|
long,
|
|
value_name = "DIR",
|
|
help = "Base directory for the output files. Defaults to the current directory",
|
|
display_order = 0
|
|
)]
|
|
pub output_dir: Option<PathBuf>,
|
|
}
|