fixes for test script

This commit is contained in:
poma 2020-01-23 00:35:31 +08:00
parent 21c3c6115e
commit a3f53aec44
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
4 changed files with 17 additions and 2 deletions

1
phase2/.gitignore vendored

@ -7,5 +7,4 @@ phase1radix2m*
/*.json /*.json
/*.bin /*.bin
/*.params /*.params
/*.circom
/verifier.sol /verifier.sol

15
phase2/circuit.circom Normal file

@ -0,0 +1,15 @@
template Num2Bits(n) {
signal input in;
signal output out[n];
var lc1=0;
for (var i = 0; i<n; i++) {
out[i] <-- (in >> i) & 1;
out[i] * (out[i] -1 ) === 0;
lc1 += out[i] * 2**i;
}
lc1 === in;
}
component main = Num2Bits(253);

1
phase2/input.json Normal file

@ -0,0 +1 @@
{"in": 42}

@ -29,7 +29,7 @@ cargo run --release --bin verify_contribution circuit.json circom3.params circom
# generate resulting keys # generate resulting keys
cargo run --release --bin export_keys circom4.params vk.json pk.json cargo run --release --bin export_keys circom4.params vk.json pk.json
# create dummy keys in circom format # create dummy keys in circom format
echo "generating dummy key files..." echo "Generating dummy key files..."
npx snarkjs setup --protocol groth npx snarkjs setup --protocol groth
# patch dummy keys with actual keys params # patch dummy keys with actual keys params
cargo run --release --bin copy_json proving_key.json pk.json transformed_pk.json cargo run --release --bin copy_json proving_key.json pk.json transformed_pk.json