Skip to content

Commit

Permalink
test: add setup_2^10.key and proof.bin/vk.bin of simple test circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
lispc committed Aug 18, 2021
1 parent 36f1474 commit 06150cf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Binary file added keys/setup/setup_2^10.key
Binary file not shown.
8 changes: 5 additions & 3 deletions src/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ use franklin_crypto::rescue::RescueEngine;

pub const AUX_OFFSET: usize = 1;

const SETUP_MIN_POW2: u32 = 20;
const SETUP_MIN_POW2: u32 = 10;
const SETUP_MAX_POW2: u32 = 26;

pub fn gen_key_monomial_form(power: u32) -> Result<Crs<E, CrsForMonomialForm>, anyhow::Error> {
anyhow::ensure!(
(SETUP_MIN_POW2..=SETUP_MAX_POW2).contains(&power),
"setup power of two is not in the correct range"
);
{
// run a small setup to estimate time

// run a small setup to estimate time
if power > 15 {
use std::time::Instant;
let t = Instant::now();
let small_power = 12;
Expand All @@ -41,6 +42,7 @@ pub fn gen_key_monomial_form(power: u32) -> Result<Crs<E, CrsForMonomialForm>, a
let estimated_time = elapsed * (1 << (power - small_power)) as f64;
log::info!("estimated run time: {} secs", estimated_time);
}

Ok(Crs::<E, CrsForMonomialForm>::crs_42(1 << power, &Worker::new()))
}

Expand Down
Binary file added test/circuits/simple/proof.bin
Binary file not shown.
10 changes: 6 additions & 4 deletions test/circuits/simple/test_circuit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
REPO_DIR="${DIR}/../../.."
CIRCUIT_DIR="${REPO_DIR}/test/circuits/simple"
POWER=10
SETUP_DIR=$REPO_DIR"/keys/setup"
SETUP_MK=$SETUP_DIR"/setup_2^20.key"
SETUP_LK=$SETUP_DIR"/setup_2^20_lagrange.key"
SETUP_MK=$SETUP_DIR"/setup_2^${POWER}.key"
# TODO: lagrange key should be put into circuit dir later
SETUP_LK=$SETUP_DIR"/setup_2^${POWER}_lagrange.key"
DOWNLOAD_SETUP_FROM_REMOTE=false
PLONKIT_BIN=$REPO_DIR"/target/release/plonkit"
#PLONKIT_BIN="plonkit"
Expand Down Expand Up @@ -42,9 +44,9 @@ echo "Step2: universal setup"
pushd $SETUP_DIR
if ([ ! -f $SETUP_MK ] & $DOWNLOAD_SETUP_FROM_REMOTE); then
# It is the aztec ignition trusted setup key file. Thanks to matter-labs/zksync/infrastructure/zk/src/run/run.ts
axel -ac https://universal-setup.ams3.digitaloceanspaces.com/setup_2^20.key -o $SETUP_MK || true
axel -ac https://universal-setup.ams3.digitaloceanspaces.com/setup_2^${POWER}.key -o $SETUP_MK || true
elif [ ! -f $SETUP_MK ] ; then
$PLONKIT_BIN setup --power 20 --srs_monomial_form $SETUP_MK
$PLONKIT_BIN setup --power ${POWER} --srs_monomial_form $SETUP_MK
fi
popd

Expand Down
Binary file added test/circuits/simple/vk.bin
Binary file not shown.

0 comments on commit 06150cf

Please sign in to comment.