Skip to content

Commit

Permalink
Stage circuit configs for tests (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltea authored Jan 24, 2024
1 parent e36705a commit 4ff89e9
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 13 deletions.
21 changes: 21 additions & 0 deletions lightclient-circuits/config/committee_update_20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"params": {
"k": 20,
"num_advice_per_phase": [
2
],
"num_fixed": 1,
"num_lookup_advice_per_phase": [
1,
0,
0
],
"lookup_bits": 19,
"num_instance_columns": 1
},
"break_points": [
[
1048566
]
]
}
12 changes: 12 additions & 0 deletions lightclient-circuits/config/committee_update_verifier_24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"params": {
"degree": 24,
"num_advice": 1,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 23
},
"break_points": [
[]
]
}
31 changes: 31 additions & 0 deletions lightclient-circuits/config/sync_step_20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"params": {
"k": 20,
"num_advice_per_phase": [
12
],
"num_fixed": 1,
"num_lookup_advice_per_phase": [
2,
0,
0
],
"lookup_bits": 19,
"num_instance_columns": 1
},
"break_points": [
[
1048566,
1048564,
1048566,
1048566,
1048565,
1048566,
1048566,
1048566,
1048564,
1048566,
1048566
]
]
}
12 changes: 12 additions & 0 deletions lightclient-circuits/config/sync_step_verifier_23.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"params": {
"degree": 23,
"num_advice": 1,
"num_lookup_advice": 1,
"num_fixed": 1,
"lookup_bits": 19
},
"break_points": [
[]
]
}
10 changes: 5 additions & 5 deletions lightclient-circuits/src/committee_update_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ mod tests {

#[test]
fn test_committee_update_circuit() {
const K: u32 = 18;
const K: u32 = 20;
let witness = load_circuit_args();
let params: ParamsKZG<Bn256> = gen_srs(K);

Expand All @@ -330,11 +330,11 @@ mod tests {

#[test]
fn test_committee_update_proofgen() {
const K: u32 = 18;
const K: u32 = 20;
let params = gen_srs(K);

const PINNING_PATH: &str = "./config/committee_update_18.json";
const PKEY_PATH: &str = "../build/committee_update_18.pkey";
const PINNING_PATH: &str = "./config/committee_update_20.json";
const PKEY_PATH: &str = "../build/committee_update_20.pkey";

let pk = CommitteeUpdateCircuit::<Testnet, Fr>::create_pk(
&params,
Expand All @@ -360,7 +360,7 @@ mod tests {
const APP_K: u32 = 20;
const APP_PK_PATH: &str = "../build/committee_update_20.pkey";
const APP_PINNING_PATH: &str = "./config/committee_update_20.json";
const AGG_K: u32 = 25;
const AGG_K: u32 = 24;
const AGG_PK_PATH: &str = "../build/committee_update_verifier_24.pkey";
const AGG_CONFIG_PATH: &str = "./config/committee_update_verifier_24.json";
let params_app = gen_srs(APP_K);
Expand Down
16 changes: 8 additions & 8 deletions lightclient-circuits/src/sync_step_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,13 @@ mod tests {

#[test]
fn test_step_proofgen() {
const K: u32 = 22;
const K: u32 = 20;
let params = gen_srs(K);

let pk = StepCircuit::<Testnet, Fr>::create_pk(
&params,
"../build/sync_step_22.pkey",
"./config/sync_step_22.json",
"../build/sync_step_20.pkey",
"./config/sync_step_20.json",
&SyncStepArgs::<Testnet>::default(),
None,
);
Expand All @@ -501,28 +501,28 @@ mod tests {
let _ = StepCircuit::<Testnet, Fr>::gen_proof_shplonk(
&params,
&pk,
"./config/sync_step_22.json",
"./config/sync_step_20.json",
&witness,
)
.expect("proof generation & verification should not fail");
}

#[test]
fn test_step_evm_verify() {
const K: u32 = 22;
const K: u32 = 20;
let params = gen_srs(K);

let pk = StepCircuit::<Testnet, Fr>::create_pk(
&params,
"../build/sync_step_22.pkey",
"./config/sync_step_22.json",
"../build/sync_step_20.pkey",
"./config/sync_step_20.json",
&SyncStepArgs::<Testnet>::default(),
None,
);

let witness = load_circuit_args();

let pinning = Eth2ConfigPinning::from_path("./config/sync_step_22.json");
let pinning = Eth2ConfigPinning::from_path("./config/sync_step_20.json");

let circuit = StepCircuit::<Testnet, Fr>::create_circuit(
CircuitBuilderStage::Prover,
Expand Down

0 comments on commit 4ff89e9

Please sign in to comment.