1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00

fix tests

This commit is contained in:
dark64 2021-11-03 19:09:36 +01:00
parent ac68eeff1e
commit 44b4fdde5a
8 changed files with 29 additions and 22 deletions

View file

@ -4,7 +4,7 @@ set -e
bin=$1; stdlib=$2
function zokrates() {
ZOKRATES_STDLIB=$stdlib $bin $*
ZOKRATES_STDLIB=$stdlib $bin "$@"
}
# compile the circuit
@ -27,12 +27,12 @@ zokrates mpc contribute -i bob.params -o charlie.params -e "charlie 3"
zokrates mpc beacon -i charlie.params -o final.params -h b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 -n 10
# verify contributions
zokrates mpc verify -i circuit -p final.params -r ./phase1
zokrates mpc verify -i final.params -c circuit -r ./phase1
# export keys from final parameters (proving and verification key)
zokrates mpc export -i final.params
# use the keys to generate proofs and verify
zokrates compute-witness -a 123456789 987654321 --verbose
zokrates generate-proof
zokrates compute-witness -i circuit -a 123456789 987654321 --verbose
zokrates generate-proof -i circuit
zokrates verify

View file

@ -4,7 +4,7 @@ set -e
bin=$1; stdlib=$2
function zokrates() {
ZOKRATES_STDLIB=$stdlib $bin $*
ZOKRATES_STDLIB=$stdlib $bin "$@"
}
zokrates compile -i get_hash.zok -o get_hash --ztf

View file

@ -4,7 +4,7 @@ set -e
bin=$1; stdlib=$2
function zokrates() {
ZOKRATES_STDLIB=$stdlib $bin $*
ZOKRATES_STDLIB=$stdlib $bin "$@"
}
zokrates compile -i hashexample.zok

View file

@ -140,7 +140,14 @@ mod tests {
continue;
}
if path.extension().expect("extension expected") == "sh" {
let extension = path.extension();
// we can ignore scripts (`*.sh˙) and files with no extension
if ["", "sh"].contains(
&extension
.map(|e| e.to_str().unwrap_or_default())
.unwrap_or_default(),
) {
continue;
}

View file

@ -7,7 +7,7 @@ use std::path::Path;
pub fn subcommand() -> App<'static, 'static> {
SubCommand::with_name("contribute")
.about("Contribute to an MPC ceremony")
.about("Contribute to a MPC ceremony")
.arg(
Arg::with_name("input")
.short("i")

View file

@ -10,7 +10,7 @@ use zokrates_field::Bn128Field;
pub fn subcommand() -> App<'static, 'static> {
SubCommand::with_name("init")
.about("Initialize MPC phase2 ceremony")
.about("Initialize MPC phase 2 ceremony")
.arg(
Arg::with_name("input")
.short("i")

View file

@ -8,7 +8,7 @@ pub mod verify;
pub fn subcommand() -> App<'static, 'static> {
SubCommand::with_name("mpc")
.about("Run a multi-party contribution (MPC) protocol")
.about("Multi-party contribution (MPC) protocol")
.subcommands(vec![
init::subcommand(),
contribute::subcommand(),

View file

@ -16,22 +16,22 @@ pub fn subcommand() -> App<'static, 'static> {
Arg::with_name("input")
.short("i")
.long("input")
.help("Path of the binary")
.value_name("FILE")
.takes_value(true)
.required(false)
.default_value(FLATTENED_CODE_DEFAULT_PATH),
)
.arg(
Arg::with_name("mpc-params")
.short("p")
.long("mpc-params")
.help("Path of the MPC parameters")
.value_name("FILE")
.takes_value(true)
.required(false)
.default_value(MPC_DEFAULT_PATH),
)
.arg(
Arg::with_name("circuit")
.short("c")
.long("circuit")
.help("Path of the circuit binary")
.value_name("FILE")
.takes_value(true)
.required(false)
.default_value(FLATTENED_CODE_DEFAULT_PATH),
)
.arg(
Arg::with_name("radix-dir")
.short("r")
@ -45,7 +45,7 @@ pub fn subcommand() -> App<'static, 'static> {
pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> {
// read compiled program
let path = Path::new(sub_matches.value_of("input").unwrap());
let path = Path::new(sub_matches.value_of("circuit").unwrap());
let file =
File::open(&path).map_err(|why| format!("Could not open `{}`: {}", path.display(), why))?;
@ -60,7 +60,7 @@ pub fn exec(sub_matches: &ArgMatches) -> Result<(), String> {
fn cli_mpc_verify(ir_prog: ir::Prog<Bn128Field>, sub_matches: &ArgMatches) -> Result<(), String> {
println!("Verifying contributions...");
let path = Path::new(sub_matches.value_of("mpc-params").unwrap());
let path = Path::new(sub_matches.value_of("input").unwrap());
let file =
File::open(&path).map_err(|why| format!("Could not open `{}`: {}", path.display(), why))?;