diff --git a/eth2/utils/ssz/src/encode.rs b/eth2/utils/ssz/src/encode.rs index 5113fb71a..52b3d9bfd 100644 --- a/eth2/utils/ssz/src/encode.rs +++ b/eth2/utils/ssz/src/encode.rs @@ -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. diff --git a/lcli/src/pycli.rs b/lcli/src/pycli.rs index 4b1b32828..dda61dd72 100644 --- a/lcli/src/pycli.rs +++ b/lcli/src/pycli.rs @@ -22,50 +22,6 @@ pub fn run_pycli(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 { - pre: Option>, - post: Option>, - block: Option>, -} - -fn get_sets(dir: PathBuf) -> Result<(), String> { - let map: HashMap> = 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 diff --git a/lcli/src/transition_blocks.rs b/lcli/src/transition_blocks.rs index d8b0974b4..01e639db8 100644 --- a/lcli/src/transition_blocks.rs +++ b/lcli/src/transition_blocks.rs @@ -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(()) }