Address Michael's comments

This commit is contained in:
Paul Hauner
2019-09-26 13:00:31 +10:00
parent b4806d27eb
commit 97a45cdcb8
3 changed files with 4 additions and 51 deletions

View File

@@ -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

View File

@@ -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(())
}