Skip to content

Commit

Permalink
minor readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gibson authored and Adam Gibson committed Sep 22, 2024
1 parent 3645ecb commit b24a90f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ An initial draft of a workable protocol for "receive tokens in exchange for prov

# Caveat

**Everything here is completely experimental and not safe in any way** (not helped by the fact I am a neophyte in Rust!). Importantly, even the underlying Curve Trees code was *only* written as a benchmarking tool, and therefore even that is not safe to use in anything remotely resembling a production environment.
**Everything here is completely experimental and not safe in any way**. Importantly, even the underlying Curve Trees code was *only* written as a benchmarking tool, and therefore even that is not safe to use in anything remotely resembling a production environment.

If you choose to play around with this stuff for Bitcoin projects I suggest using signet for now.

Expand Down
2 changes: 1 addition & 1 deletion src/rpcserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub async fn do_serve(autctcfg: AutctConfig) -> Result<(), Box<dyn Error>>{
convert_keys::<SecpBase,
SecpConfig,
SecqConfig>(fl.to_string(),
autctcfg.generators_length_log_2.unwrap()).unwrap();
autctcfg.generators_length_log_2.unwrap())?;
let leaf_commitments = get_leaf_commitments(
&(fl.to_string() + ".p"));

Expand Down
9 changes: 5 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ pub fn read_file_string(filepath: &str) -> Result<String, Box<dyn Error>> {
Ok(resp.trim_end().to_string())
}

pub fn write_file_string(filepath: &str, mut buf: Vec<u8>) -> () {
fs::write(filepath, &mut buf).expect("Failed to write to file");
pub fn write_file_string(filepath: &str, buf: Vec<u8>) -> () {
fs::write(filepath, buf).expect("Failed to write to file");
}

pub fn write_file_string2(loc: PathBuf, mut buf: Vec<u8>) ->Result<(), std::io::Error> {
Expand Down Expand Up @@ -225,12 +225,13 @@ pub fn get_pubkey_leaves_hex<F: PrimeField,
-> Vec<Affine<P0>>{
// TODO return errors for failed reading
let filestr:String = read_file_string(pubkey_file_path)
.expect("my failure message");
.expect("Failed to read pubkey file");

let hex_keys_vec = filestr.split_whitespace().collect::<Vec<_>>();
if pubkey_file_path.ends_with(".aks"){
get_correct_pubkeys_from_bip340_hex_list(hex_keys_vec).unwrap()
}
else {
else { // current convention is ".pks", but not enforced for now
get_correct_pubkeys_from_ark_hex_list::<F, P0>(hex_keys_vec).unwrap()
}
}
Expand Down

0 comments on commit b24a90f

Please sign in to comment.