mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Realized unrealized experimentation (#3322)
## Issue Addressed Add a flag that optionally enables unrealized vote tracking. Would like to test out on testnets and benchmark differences in methods of vote tracking. This PR includes a DB schema upgrade to enable to new vote tracking style. Co-authored-by: realbigsean <sean@sigmaprime.io> Co-authored-by: Paul Hauner <paul@paulhauner.com> Co-authored-by: sean <seananderson33@gmail.com> Co-authored-by: Mac L <mjladson@pm.me>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use clap::ArgMatches;
|
||||
use clap_utils::parse_required;
|
||||
use serde::Serialize;
|
||||
use snap::raw::Decoder;
|
||||
use ssz::Decode;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::str::FromStr;
|
||||
@@ -29,11 +31,18 @@ pub fn run_parse_ssz<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
||||
let filename = matches.value_of("ssz-file").ok_or("No file supplied")?;
|
||||
let format = parse_required(matches, "format")?;
|
||||
|
||||
let mut bytes = vec![];
|
||||
let mut file =
|
||||
File::open(filename).map_err(|e| format!("Unable to open {}: {}", filename, e))?;
|
||||
file.read_to_end(&mut bytes)
|
||||
.map_err(|e| format!("Unable to read {}: {}", filename, e))?;
|
||||
let bytes = if filename.ends_with("ssz_snappy") {
|
||||
let bytes = fs::read(filename).unwrap();
|
||||
let mut decoder = Decoder::new();
|
||||
decoder.decompress_vec(&bytes).unwrap()
|
||||
} else {
|
||||
let mut bytes = vec![];
|
||||
let mut file =
|
||||
File::open(filename).map_err(|e| format!("Unable to open {}: {}", filename, e))?;
|
||||
file.read_to_end(&mut bytes)
|
||||
.map_err(|e| format!("Unable to read {}: {}", filename, e))?;
|
||||
bytes
|
||||
};
|
||||
|
||||
info!("Using {} spec", T::spec_name());
|
||||
info!("Type: {:?}", type_str);
|
||||
|
||||
Reference in New Issue
Block a user