Skip to content

Commit

Permalink
0.1.6-rc -> 0.1.7-rc (#37)
Browse files Browse the repository at this point in the history
* chore: try pragma solidity 0.8.20 with CI

* chore: make `transcript_initial_state` public

So we can read transcript initial state from `VerifyingKey`

* test: edit range_check example to trigger selector compression

* [feat] add `aggregate_snarks` function (#34)

* feat: add `aggregate_snarks` function

- Previously you could only create a new `builder` pre-populated with
  the witnesses for snark aggregation.
- This is a bad design pattern if you want to make a circuit that
  aggregates and also does other stuff.
- This function will use whatever `SinglePhaseCoreManager` and
  `RangeChip` you provide to prove the snark aggregation.

* chore: add comment

* chore: fix comment

* [feat(sdk)] `aggregate_snarks` returns loaded proof witnesses (#36)

* feat(sdk): `aggregate_snarks` returns loaded proof witnesses

* feat: add `TranscriptObject` to track assigned proof transcript

* chore: Bump version to 0.1.7
  • Loading branch information
jonathanpwang committed Nov 4, 2023
1 parent 1cf2986 commit 18a1dd5
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 103 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions snark-verifier-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snark-verifier-sdk"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
autobenches = false

Expand All @@ -18,7 +18,7 @@ serde_json = "1.0"
serde_with = { version = "2.2", optional = true }
bincode = "1.3.3"
ark-std = { version = "0.3.0", features = ["print-trace"], optional = true }
halo2-base = { git = "https://github.com/axiom-crypto/halo2-lib.git", branch = "release-0.4.0-rc", default-features = false }
halo2-base = { git = "https://github.com/axiom-crypto/halo2-lib.git", branch = "release-0.4.1-rc", default-features = false }
snark-verifier = { path = "../snark-verifier", default-features = false }
getset = "0.1.2"

Expand Down Expand Up @@ -46,13 +46,7 @@ crossterm = { version = "0.25" }
ratatui = { version = "0.24", default-features = false, features = ["crossterm"] }

[features]
default = [
"loader_halo2",
"loader_evm",
"halo2-axiom",
"halo2-base/jemallocator",
"display",
]
default = ["loader_halo2", "loader_evm", "halo2-axiom", "halo2-base/jemallocator", "display"]
display = ["snark-verifier/display", "dep:ark-std"]
loader_halo2 = ["snark-verifier/loader_halo2"]
loader_evm = ["snark-verifier/loader_evm", "dep:ethereum-types"]
Expand Down
27 changes: 21 additions & 6 deletions snark-verifier-sdk/examples/range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use snark_verifier_sdk::{
Snark,
};

fn generate_circuit(k: u32) -> Snark {
fn generate_circuit(k: u32, fill: bool) -> Snark {
let lookup_bits = k as usize - 1;
let circuit_params = BaseCircuitParams {
k: k as usize,
Expand All @@ -30,20 +30,31 @@ fn generate_circuit(k: u32) -> Snark {
let ctx = builder.main(0);

let x = ctx.load_witness(Fr::from(14));
range.range_check(ctx, x, 2 * lookup_bits + 1);
range.gate().add(ctx, x, x);
if fill {
for _ in 0..2 << k {
range.gate().add(ctx, x, x);
}
}

let params = gen_srs(k);
// do not call calculate_params, we want to use fixed params
let pk = gen_pk(&params, &builder, None);
// std::fs::remove_file(Path::new("examples/app.pk")).ok();
// let _pk = gen_pk(&params, &builder, Some(Path::new("examples/app.pk")));
// let pk = read_pk::<BaseCircuitBuilder<_>>(
// Path::new("examples/app.pk"),
// builder.config_params.clone(),
// )
// .unwrap();
// std::fs::remove_file(Path::new("examples/app.pk")).ok();
// builder now has break_point set
gen_snark_shplonk(&params, &pk, builder, None::<&str>)
}

fn main() {
let dummy_snark = generate_circuit(9);
let dummy_snark = generate_circuit(9, false);

let k = 14u32;
let k = 16u32;
let lookup_bits = k as usize - 1;
let params = gen_srs(k);
let mut agg_circuit = AggregationCircuit::new::<SHPLONK>(
Expand All @@ -57,10 +68,14 @@ fn main() {

let start0 = start_timer!(|| "gen vk & pk");
let pk = gen_pk(&params, &agg_circuit, None);
// std::fs::remove_file(Path::new("examples/agg.pk")).ok();
// let _pk = gen_pk(&params, &agg_circuit, Some(Path::new("examples/agg.pk")));
end_timer!(start0);
// let pk = read_pk::<AggregationCircuit>(Path::new("examples/agg.pk"), agg_config).unwrap();
// std::fs::remove_file(Path::new("examples/agg.pk")).ok();
let break_points = agg_circuit.break_points();

let snarks = (10..16).map(generate_circuit).collect_vec();
let snarks = (10..16).map(|k| generate_circuit(k, true)).collect_vec();
for (i, snark) in snarks.into_iter().enumerate() {
let agg_circuit = AggregationCircuit::new::<SHPLONK>(
CircuitBuilderStage::Prover,
Expand Down
Loading

0 comments on commit 18a1dd5

Please sign in to comment.