Skip to content

Commit 73408a1

Browse files
authored
Merge pull request #242 from kilic/curves5
update `halo2curves` to 0.6.0
2 parents 687590a + 47e71c8 commit 73408a1

File tree

36 files changed

+269
-781
lines changed

36 files changed

+269
-781
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- feature_set: basic
2020
features: batch,dev-graph,gadget-traces
2121
- feature_set: all
22-
features: batch,dev-graph,gadget-traces,multicore,test-dev-graph,thread-safe-region,sanity-checks,circuit-params
22+
features: batch,dev-graph,gadget-traces,test-dev-graph,thread-safe-region,sanity-checks,circuit-params
2323

2424
steps:
2525
- uses: actions/checkout@v3

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ minor version bump.
1313

1414
## Controlling parallelism
1515

16-
`halo2` currently uses [rayon](https://github.com/rayon-rs/rayon) for parallel computation.
17-
The `RAYON_NUM_THREADS` environment variable can be used to set the number of threads.
16+
`halo2` currently uses [rayon](https://github.com/rayon-rs/rayon) for parallel computation. The `RAYON_NUM_THREADS` environment variable can be used to set the number of threads.
1817

19-
You can disable `rayon` by disabling the `"multicore"` feature.
20-
Warning! Halo2 will lose access to parallelism if you disable the `"multicore"` feature.
21-
This will significantly degrade performance.
18+
When compiling to WASM-targets, notice that since version `1.7`, `rayon` will fallback automatically (with no need to handle features) to require `getrandom` in order to be able to work. For more info related to WASM-compilation.
19+
20+
See: [Rayon: Usage with WebAssembly](https://github.com/rayon-rs/rayon#usage-with-webassembly) for more
2221

2322
## License
2423

halo2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ all-features = true
1919
rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
2020

2121
[dependencies]
22-
halo2_proofs = { version = "0.2", path = "../halo2_proofs", default-features = false }
22+
halo2_proofs = { version = "0.3", path = "../halo2_proofs", default-features = false }
2323

2424
[lib]
2525
bench = false

halo2_proofs/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "halo2_proofs"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = [
55
"Sean Bowe <sean@electriccoin.co>",
66
"Ying Tong Lai <yingtong@electriccoin.co>",
@@ -51,15 +51,15 @@ harness = false
5151
backtrace = { version = "0.3", optional = true }
5252
ff = "0.13"
5353
group = "0.13"
54-
halo2curves = { version = "0.1.0" }
54+
halo2curves = { version = "0.6.0", default-features = false }
5555
rand_core = { version = "0.6", default-features = false }
5656
tracing = "0.1"
5757
blake2b_simd = "1" # MSRV 1.66.0
5858
sha3 = "0.9.1"
5959
rand_chacha = "0.3"
60-
maybe-rayon = { version = "0.1.0", default-features = false }
6160
serde = { version = "1", optional = true, features = ["derive"] }
6261
serde_derive = { version = "1", optional = true}
62+
rayon = "1.8"
6363

6464
# Developer tooling dependencies
6565
plotters = { version = "0.3.0", default-features = false, optional = true }
@@ -80,15 +80,15 @@ serde_json = "1"
8080
getrandom = { version = "0.2", features = ["js"] }
8181

8282
[features]
83-
default = ["batch", "multicore"]
84-
multicore = ["maybe-rayon/threads"]
83+
default = ["batch", "bits"]
8584
dev-graph = ["plotters", "tabbycat"]
8685
test-dev-graph = [
8786
"dev-graph",
8887
"plotters/bitmap_backend",
8988
"plotters/bitmap_encoder",
9089
"plotters/ttf",
9190
]
91+
bits = ["halo2curves/bits"]
9292
gadget-traces = ["backtrace"]
9393
thread-safe-region = []
9494
sanity-checks = []

halo2_proofs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ minor version bump.
1515
computation. The `RAYON_NUM_THREADS` environment variable can be used to set the number of
1616
threads.
1717

18-
You can disable `rayon` by disabling the `"multicore"` feature.
19-
Warning! Halo2 will lose access to parallelism if you disable the `"multicore"` feature.
20-
This will significantly degrade performance.
18+
When compiling to WASM-targets, notice that since version `1.7`, `rayon` will fallback automatically (with no need to handle features) to require `getrandom` in order to be able to work. For more info related to WASM-compilation.
19+
20+
See: [Rayon: Usage with WebAssembly](https://github.com/rayon-rs/rayon#usage-with-webassembly) for more
2121

2222
## License
2323

halo2_proofs/benches/commit_zk.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ use halo2curves::pasta::pallas::Scalar;
77
use rand_chacha::rand_core::RngCore;
88
use rand_chacha::ChaCha20Rng;
99
use rand_core::SeedableRng;
10+
use rayon::current_num_threads;
1011
use std::{collections::HashMap, iter};
1112

12-
#[cfg(feature = "multicore")]
13-
use maybe_rayon::current_num_threads;
14-
15-
#[cfg(not(feature = "multicore"))]
16-
fn current_num_threads() -> usize {
17-
1
18-
}
19-
2013
fn rand_poly_serial(mut rng: ChaCha20Rng, domain: usize) -> Vec<Scalar> {
2114
// Sample a random polynomial of degree n - 1
2215
let mut random_poly = vec![Scalar::zero(); 1 << domain];

halo2_proofs/benches/dev_lookup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn criterion_benchmark(c: &mut Criterion) {
6262
|mut table| {
6363
for row in 0u64..(1 << 8) {
6464
table.assign_cell(
65-
|| format!("row {}", row),
65+
|| format!("row {row}"),
6666
config.table,
6767
row as usize,
6868
|| Value::known(F::from(row + 1)),
@@ -79,7 +79,7 @@ fn criterion_benchmark(c: &mut Criterion) {
7979
for offset in 0u64..(1 << 10) {
8080
config.selector.enable(&mut region, offset as usize)?;
8181
region.assign_advice(
82-
|| format!("offset {}", offset),
82+
|| format!("offset {offset}"),
8383
config.advice,
8484
offset as usize,
8585
|| Value::known(F::from((offset % 256) + 1)),

halo2_proofs/examples/circuit-layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl<F: Field> Circuit<F> for MyCircuit<F> {
245245

246246
for i in 0..10 {
247247
layouter.assign_region(
248-
|| format!("region_{}", i),
248+
|| format!("region_{i}"),
249249
|mut region| {
250250
let a: Value<Assigned<_>> = self.a.into();
251251
let mut a_squared = Value::unknown();

halo2_proofs/examples/proof-size.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Circuit<Fp> for TestCircuit {
5353
|mut table| {
5454
for row in 0u64..(1 << 8) {
5555
table.assign_cell(
56-
|| format!("row {}", row),
56+
|| format!("row {row}"),
5757
config.table,
5858
row as usize,
5959
|| Value::known(Fp::from(row + 1)),
@@ -70,7 +70,7 @@ impl Circuit<Fp> for TestCircuit {
7070
for offset in 0u64..(1 << 10) {
7171
config.selector.enable(&mut region, offset as usize)?;
7272
region.assign_advice(
73-
|| format!("offset {}", offset),
73+
|| format!("offset {offset}"),
7474
config.advice,
7575
offset as usize,
7676
|| Value::known(Fp::from((offset % 256) + 1)),

halo2_proofs/examples/shuffle.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<F: Field, const W: usize, const H: usize> Circuit<F> for MyCircuit<F, W, H>
168168
{
169169
for (offset, &value) in values.transpose_array().iter().enumerate() {
170170
region.assign_advice(
171-
|| format!("original[{}][{}]", idx, offset),
171+
|| format!("original[{idx}][{offset}]"),
172172
column,
173173
offset,
174174
|| value,
@@ -183,7 +183,7 @@ impl<F: Field, const W: usize, const H: usize> Circuit<F> for MyCircuit<F, W, H>
183183
{
184184
for (offset, &value) in values.transpose_array().iter().enumerate() {
185185
region.assign_advice(
186-
|| format!("shuffled[{}][{}]", idx, offset),
186+
|| format!("shuffled[{idx}][{offset}]"),
187187
column,
188188
offset,
189189
|| value,
@@ -233,12 +233,7 @@ impl<F: Field, const W: usize, const H: usize> Circuit<F> for MyCircuit<F, W, H>
233233
},
234234
);
235235
for (offset, value) in z.transpose_vec(H + 1).into_iter().enumerate() {
236-
region.assign_advice(
237-
|| format!("z[{}]", offset),
238-
config.z,
239-
offset,
240-
|| value,
241-
)?;
236+
region.assign_advice(|| format!("z[{offset}]"), config.z, offset, || value)?;
242237
}
243238

244239
Ok(())

0 commit comments

Comments
 (0)