mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-25 13:07:18 +00:00
Address Michael's comments
This commit is contained in:
parent
b4806d27eb
commit
97a45cdcb8
@ -27,6 +27,10 @@ pub trait Encode {
|
||||
BYTES_PER_LENGTH_OFFSET
|
||||
}
|
||||
|
||||
/// Returns the size (in bytes) when `self` is serialized.
|
||||
///
|
||||
/// Returns the same value as `self.as_ssz_bytes().len()` but this method is significantly more
|
||||
/// efficient.
|
||||
fn ssz_bytes_len(&self) -> usize;
|
||||
|
||||
/// Returns the full-form encoding of this object.
|
||||
|
@ -22,50 +22,6 @@ pub fn run_pycli<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: loading from file.
|
||||
*
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsString;
|
||||
|
||||
const BLOCK_PREFIX: &str = "block_";
|
||||
const PRE_PREFIX: &str = "state_pre_";
|
||||
const POST_PREFIX: &str = "state_post_";
|
||||
|
||||
struct Case<T: EthSpec> {
|
||||
pre: Option<BeaconState<T>>,
|
||||
post: Option<BeaconState<T>>,
|
||||
block: Option<BeaconBlock<T>>,
|
||||
}
|
||||
|
||||
fn get_sets<T: EthSpec>(dir: PathBuf) -> Result<(), String> {
|
||||
let map: HashMap<String, Case<T>> = HashMap::new();
|
||||
|
||||
fs::read_dir(dir)
|
||||
.map_err(|e| format!("Unable to read source directory: {:?}", e))?
|
||||
.filter_map(Result::ok)
|
||||
.map(|f| f.file_name().into_string())
|
||||
.filter_map(Result::ok)
|
||||
.try_for_each(|filename| {
|
||||
if filename.starts_with(BLOCK_PREFIX) {
|
||||
let regex = Regex::new(r".*root0x(.........)")
|
||||
.map_err(|e| format!("Failed to compile block regex: {:?}", e))?;
|
||||
let captures = regex.captures(&filename).
|
||||
// block
|
||||
} else if filename.starts_with(PRE_PREFIX) {
|
||||
dbg!("pre state");
|
||||
} else if filename.starts_with(POST_PREFIX) {
|
||||
dbg!("post state");
|
||||
} else {
|
||||
dbg!("unknown file");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
/// A wrapper around Danny Ryan's `pycli` utility:
|
||||
///
|
||||
/// https://github.com/djrtwo/pycli
|
||||
|
@ -41,13 +41,6 @@ pub fn run_transition_blocks(matches: &ArgMatches) -> Result<(), String> {
|
||||
.write_all(&post_state.as_ssz_bytes())
|
||||
.map_err(|e| format!("Unable to write to output file: {:?}", e))?;
|
||||
|
||||
/*
|
||||
println!(
|
||||
"{}",
|
||||
serde_yaml::to_string(&post_state).expect("Should serialize state")
|
||||
);
|
||||
*/
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user