mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 14:48:08 -05:00
bench: correct paths and add missing EcNiPoint to import_witness_json()
This commit is contained in:
@@ -36,93 +36,96 @@ fn zk_from_json(c: &mut Criterion) {
|
||||
let tests = [
|
||||
(
|
||||
"Opcodes",
|
||||
"../proof/opcodes.zk",
|
||||
"../proof/witness/opcodes.json"
|
||||
"proof/opcodes.zk.bin",
|
||||
"proof/witness/opcodes.json"
|
||||
),
|
||||
(
|
||||
"Arithmetic",
|
||||
"../proof/arithmetic.zk",
|
||||
"../proof/witness/arithmetic.json"
|
||||
"proof/arithmetic.zk.bin",
|
||||
"proof/witness/arithmetic.json"
|
||||
),
|
||||
(
|
||||
"SMT",
|
||||
"../proof/smt.zk",
|
||||
"../proof/witness/smt.json"
|
||||
"proof/smt.zk.bin",
|
||||
"proof/witness/smt.json"
|
||||
),
|
||||
(
|
||||
"DAO::mint",
|
||||
"../src/contract/dao/proof/mint.zk",
|
||||
"../src/contract/dao/proof/witness/mint.json"
|
||||
"src/contract/dao/proof/mint.zk.bin",
|
||||
"src/contract/dao/proof/witness/mint.json"
|
||||
),
|
||||
(
|
||||
"DAO::propose-input",
|
||||
"../src/contract/dao/proof/propose-input.zk",
|
||||
"../src/contract/dao/proof/witness/propose-input.json"
|
||||
"src/contract/dao/proof/propose-input.zk.bin",
|
||||
"src/contract/dao/proof/witness/propose-input.json"
|
||||
),
|
||||
(
|
||||
"DAO::propose",
|
||||
"../src/contract/dao/proof/propose-main.zk",
|
||||
"../src/contract/dao/proof/witness/propose-main.json"
|
||||
"src/contract/dao/proof/propose-main.zk.bin",
|
||||
"src/contract/dao/proof/witness/propose-main.json"
|
||||
),
|
||||
(
|
||||
"DAO::vote-input",
|
||||
"../src/contract/dao/proof/vote-input.zk",
|
||||
"../src/contract/dao/proof/witness/vote-input.json"
|
||||
"src/contract/dao/proof/vote-input.zk.bin",
|
||||
"src/contract/dao/proof/witness/vote-input.json"
|
||||
),
|
||||
(
|
||||
"DAO::vote",
|
||||
"../src/contract/dao/proof/vote-main.zk",
|
||||
"../src/contract/dao/proof/witness/vote-main.json"
|
||||
"src/contract/dao/proof/vote-main.zk.bin",
|
||||
"src/contract/dao/proof/witness/vote-main.json"
|
||||
),
|
||||
(
|
||||
"DAO::exec",
|
||||
"../src/contract/dao/proof/exec.zk",
|
||||
"../src/contract/dao/proof/witness/exec.json"
|
||||
"src/contract/dao/proof/exec.zk.bin",
|
||||
"src/contract/dao/proof/witness/exec.json"
|
||||
),
|
||||
(
|
||||
"DAO::auth_xfer-coin",
|
||||
"../src/contract/dao/proof/auth-money-transfer-enc-coin.zk",
|
||||
"../src/contract/dao/proof/witness/auth-money-transfer-enc-coin.json"
|
||||
"src/contract/dao/proof/auth-money-transfer-enc-coin.zk.bin",
|
||||
"src/contract/dao/proof/witness/auth-money-transfer-enc-coin.json"
|
||||
),
|
||||
(
|
||||
"DAO::auth_xfer",
|
||||
"../src/contract/dao/proof/auth-money-transfer.zk",
|
||||
"../src/contract/dao/proof/witness/auth-money-transfer.json"
|
||||
"src/contract/dao/proof/auth-money-transfer.zk.bin",
|
||||
"src/contract/dao/proof/witness/auth-money-transfer.json"
|
||||
),
|
||||
(
|
||||
"Money::xfer-mint",
|
||||
"../src/contract/money/proof/mint_v1.zk",
|
||||
"../src/contract/money/proof/witness/mint_v1.json"
|
||||
"src/contract/money/proof/mint_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/mint_v1.json"
|
||||
),
|
||||
(
|
||||
"Money::xfer-burn",
|
||||
"../src/contract/money/proof/burn_v1.zk",
|
||||
"../src/contract/money/proof/witness/burn_v1.json"
|
||||
"src/contract/money/proof/burn_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/burn_v1.json"
|
||||
),
|
||||
(
|
||||
"Money::fee",
|
||||
"../src/contract/money/proof/fee_v1.zk",
|
||||
"../src/contract/money/proof/witness/fee_v1.json"
|
||||
"src/contract/money/proof/fee_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/fee_v1.json"
|
||||
),
|
||||
(
|
||||
"Money::auth_token-mint",
|
||||
"../src/contract/money/proof/auth_token_mint_v1.zk",
|
||||
"../src/contract/money/proof/witness/auth_token_mint_v1.json"
|
||||
"src/contract/money/proof/auth_token_mint_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/auth_token_mint_v1.json"
|
||||
),
|
||||
(
|
||||
"Money::token-mint",
|
||||
"../src/contract/money/proof/token_mint_v1.zk",
|
||||
"../src/contract/money/proof/witness/token_mint_v1.json"
|
||||
"src/contract/money/proof/token_mint_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/token_mint_v1.json"
|
||||
),
|
||||
(
|
||||
"Money::token-freeze",
|
||||
"../src/contract/money/proof/token_freeze_v1.zk",
|
||||
"../src/contract/money/proof/witness/token_freeze_v1.json"
|
||||
"src/contract/money/proof/token_freeze_v1.zk.bin",
|
||||
"src/contract/money/proof/witness/token_freeze_v1.json"
|
||||
),
|
||||
];
|
||||
|
||||
println!("Running ZK Json benchmarks");
|
||||
for (name, proof, witness) in &tests {
|
||||
println!("Benchmarking '{}': {} {}", name, proof, witness);
|
||||
run_benchmark(c, name, proof, witness);
|
||||
println!("Done!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ pub mod pasta_prelude {
|
||||
arithmetic::{CurveAffine, CurveExt},
|
||||
group::{
|
||||
ff::{Field, FromUniformBytes, PrimeField},
|
||||
prime::PrimeCurveAffine,
|
||||
Curve, Group,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -179,8 +179,9 @@ pub fn import_witness_json<P: AsRef<Path>>(input_path: P) -> (Vec<Witness>, Vec<
|
||||
"EcNiPoint" => {
|
||||
let vals = jval_as_vecfp(j_val);
|
||||
assert_eq!(vals.len(), 2);
|
||||
let (_x, _y) = (vals[0], vals[1]);
|
||||
todo!();
|
||||
let (x, y) = (vals[0], vals[1]);
|
||||
let point: pallas::Point = pallas::Affine::from_xy(x, y).unwrap().to_curve();
|
||||
witnesses.push(Witness::EcNiPoint(Value::known(point)));
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user