Skip to content

Commit ae6620e

Browse files
Delete lighthouse db diff (sigp#5171)
* Delete `lighthouse db diff` * Fix help text
1 parent 25bcd2a commit ae6620e

File tree

2 files changed

+2
-80
lines changed

2 files changed

+2
-80
lines changed

book/src/help_bn.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,7 @@ OPTIONS:
482482
--slasher-validator-chunk-size <NUM_VALIDATORS>
483483
Number of validators per chunk stored on disk.
484484
485-
--slots-per-restore-point <SLOT_COUNT>
486-
Specifies how often a freezer DB restore point should be stored. Cannot be changed after initialization.
487-
[default: 8192 (mainnet) or 64 (minimal)]
485+
--slots-per-restore-point <SLOT_COUNT> Deprecated.
488486
--state-cache-size <SIZE>
489487
Specifies how many states the database should cache in memory [default: 128]
490488

database_manager/src/lib.rs

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use store::{
1616
DBColumn, HotColdDB, KeyValueStore, LevelDB,
1717
};
1818
use strum::{EnumString, EnumVariantNames, VariantNames};
19-
use types::{BeaconState, EthSpec, Slot, VList};
19+
use types::{BeaconState, EthSpec, Slot};
2020

2121
pub const CMD: &str = "database_manager";
2222

@@ -131,26 +131,6 @@ pub fn prune_payloads_app<'a, 'b>() -> App<'a, 'b> {
131131
.about("Prune finalized execution payloads")
132132
}
133133

134-
pub fn diff_app<'a, 'b>() -> App<'a, 'b> {
135-
App::new("diff")
136-
.setting(clap::AppSettings::ColoredHelp)
137-
.about("Diff SSZ balances")
138-
.arg(
139-
Arg::with_name("first")
140-
.long("first")
141-
.value_name("PATH")
142-
.takes_value(true)
143-
.required(true),
144-
)
145-
.arg(
146-
Arg::with_name("second")
147-
.long("second")
148-
.value_name("PATH")
149-
.takes_value(true)
150-
.required(true),
151-
)
152-
}
153-
154134
pub fn prune_blobs_app<'a, 'b>() -> App<'a, 'b> {
155135
App::new("prune-blobs")
156136
.alias("prune_blobs")
@@ -225,7 +205,6 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
225205
.subcommand(compact_cli_app())
226206
.subcommand(prune_payloads_app())
227207
.subcommand(prune_blobs_app())
228-
.subcommand(diff_app())
229208
.subcommand(prune_states_app())
230209
}
231210

@@ -534,57 +513,6 @@ pub fn migrate_db<E: EthSpec>(
534513
)
535514
}
536515

537-
pub struct DiffConfig {
538-
first: PathBuf,
539-
second: PathBuf,
540-
}
541-
542-
fn parse_diff_config(cli_args: &ArgMatches) -> Result<DiffConfig, String> {
543-
let first = clap_utils::parse_required(cli_args, "first")?;
544-
let second = clap_utils::parse_required(cli_args, "second")?;
545-
546-
Ok(DiffConfig { first, second })
547-
}
548-
549-
pub fn diff<E: EthSpec>(diff_config: &DiffConfig, log: Logger) -> Result<(), Error> {
550-
use ssz::{Decode, Encode};
551-
use std::fs::File;
552-
use std::io::Read;
553-
use store::StoreConfig;
554-
555-
let mut first_file = File::open(&diff_config.first).unwrap();
556-
let mut second_file = File::open(&diff_config.second).unwrap();
557-
558-
let mut first_bytes = vec![];
559-
first_file.read_to_end(&mut first_bytes).unwrap();
560-
let first: VList<u64, E::ValidatorRegistryLimit> = VList::from_ssz_bytes(&first_bytes).unwrap();
561-
562-
let mut second_bytes = vec![];
563-
second_file.read_to_end(&mut second_bytes).unwrap();
564-
let second: VList<u64, E::ValidatorRegistryLimit> =
565-
VList::from_ssz_bytes(&second_bytes).unwrap();
566-
567-
let mut diff_balances = Vec::with_capacity(second.len());
568-
569-
for (i, new_balance) in second.iter().enumerate() {
570-
let old_balance = first.get(i).copied().unwrap_or(0);
571-
let diff = new_balance.wrapping_sub(old_balance);
572-
diff_balances.push(diff);
573-
}
574-
575-
let diff_ssz_bytes = diff_balances.as_ssz_bytes();
576-
let config = StoreConfig::default();
577-
let compressed_diff_bytes = config.compress_bytes(&diff_ssz_bytes).unwrap();
578-
579-
info!(
580-
log,
581-
"Compressed diff to {} bytes (from {})",
582-
compressed_diff_bytes.len(),
583-
diff_ssz_bytes.len()
584-
);
585-
Ok(())
586-
}
587-
588516
pub fn prune_payloads<E: EthSpec>(
589517
client_config: ClientConfig,
590518
runtime_context: &RuntimeContext<E>,
@@ -745,10 +673,6 @@ pub fn run<T: EthSpec>(cli_args: &ArgMatches<'_>, env: Environment<T>) -> Result
745673
("prune-payloads", Some(_)) => {
746674
prune_payloads(client_config, &context, log).map_err(format_err)
747675
}
748-
("diff", Some(cli_args)) => {
749-
let diff_config = parse_diff_config(cli_args)?;
750-
diff::<T>(&diff_config, log).map_err(format_err)
751-
}
752676
("prune-blobs", Some(_)) => prune_blobs(client_config, &context, log).map_err(format_err),
753677
("prune-states", Some(cli_args)) => {
754678
let executor = env.core_context().executor;

0 commit comments

Comments
 (0)