Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream commits #92

Closed
wants to merge 221 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
10c0e59
book: Fix typo
3for Sep 18, 2021
9c945b9
book: Fix typo
3for Sep 19, 2021
e1a4be5
book: Fix typo
3for Sep 21, 2021
45a2515
book: Fix typo
3for Sep 22, 2021
c89ef70
book: Fix typo
3for Sep 22, 2021
bcc9d58
book: Fix typo
3for Sep 26, 2021
70ec164
Merge branch 'zcash:main' into main
3for Sep 26, 2021
536279d
book: Fix typo
3for Sep 26, 2021
c09344a
book: Fix typo
3for Sep 26, 2021
b12d03e
book: Fix typo
3for Oct 2, 2021
bac1aa4
book: Fix typo
3for Oct 6, 2021
e5f4732
Merge branch 'zcash:main' into main
3for Oct 6, 2021
8cfff30
Apply suggestions from code review
nuttycom Oct 26, 2021
93ee714
`impl From<&Assigned<F>> for Assigned<F>`
str4d Dec 8, 2021
9d0e0b7
Add `AssignedCell<Assigned<F>, F>::evaluate()` method
str4d Dec 8, 2021
927463f
Add `Assigned::is_zero_vartime` method
str4d Dec 8, 2021
8d00aca
`impl<F: Field> Eq for Assigned<F>`
str4d Dec 8, 2021
50b8e05
Add other `Add*, Sub*, Mul*` variant impls to `Assigned<F>`
str4d Dec 11, 2021
a7e4549
Add `Assigned::{double, square, cube}` methods
str4d Dec 11, 2021
05a4d26
Add unary operators to `Assigned` proptest
str4d Dec 11, 2021
b7944e5
Make `Assigned::Zero` slightly less likely in `Assigned` proptest
str4d Dec 11, 2021
c4bdab5
Improve the explanation of incomplete addition:
daira Feb 3, 2022
a4d3c32
halo2_proofs: rename variables for consistency
ebfull Feb 9, 2022
a129490
Minor changes
ebfull Feb 10, 2022
289f24b
Improvements due to @daira's code review.
ebfull Feb 11, 2022
90bebdf
halo2_proofs: add hardcoded proof to plonk_api test for backwards com…
ebfull Feb 14, 2022
552c5be
Merge pull request #501 from zcash/hardcoded-proof
str4d Feb 14, 2022
8c0deb1
Merge pull request #495 from zcash/book-consistency
ebfull Feb 14, 2022
f2daf91
halo2_proofs: change IPA check equation to match the book
ebfull Feb 14, 2022
0b73c74
Address comments brought up by @str4d.
ebfull Feb 14, 2022
247cd62
Merge pull request #502 from zcash/simplify-ipa-equation
ebfull Feb 14, 2022
e0cc7b3
Update changelogs
str4d Feb 14, 2022
1d2f698
Update license dates and links
str4d Feb 14, 2022
f642727
halo2_proofs 0.1.0-beta.2
str4d Feb 14, 2022
c9852c6
halo2_gadgets 0.1.0-beta.1
str4d Feb 14, 2022
80953d0
halo2 0.1.0-beta.2
str4d Feb 14, 2022
7107b83
MockProver: Use a sorted scan to check that lookup inputs
daira Feb 14, 2022
e7ffefd
MockProver: Optimize repetitions of the last usable row, not the zero…
daira Feb 15, 2022
c5cdea1
Merge pull request #487 from daira/book-improve-incomplete-addition
daira Feb 15, 2022
c63828b
Merge pull request #504 from zcash/release-0.1.0-beta.2
str4d Feb 15, 2022
e293242
CI: Update `codecov/codecov-action` to v2.1.0
str4d Feb 15, 2022
82bb4e6
CI: Test against Windows and macOS in addition to Ubuntu
str4d Feb 15, 2022
c12620c
Merge pull request #505 from zcash/ci-updates
str4d Feb 16, 2022
0e08903
dev: Move `VerifyFailure` and `FailureLocation` into submodule
str4d Feb 1, 2022
5cdc029
dev: Add `MockProver::assert_satisfied`
str4d Feb 1, 2022
8e1fb87
dev: Add a custom `VerifyFailure::ConstraintNotSatisfied` emitter
str4d Feb 1, 2022
212e3d0
dev: Move cell layout emitter into a submodule
str4d Feb 2, 2022
44e3cf8
dev: Move expression stringifier into `dev::failure::emitter`
str4d Feb 2, 2022
62eea4c
dev: Move cell loaders into `dev::util`
str4d Feb 2, 2022
c19a1ad
dev: Add a custom `VerifyFailure::Lookup` emitter
str4d Feb 2, 2022
369ff52
dev: Store gate offset in `VerifyFailure::CellNotAssigned`
str4d Feb 2, 2022
57596ca
dev: Add a custom `VerifyFailure::CellNotAssigned` emitter
str4d Feb 2, 2022
b48b032
Minor simplification
daira Feb 16, 2022
e10f4e1
Add mechanism for generating a new proof in test.
ebfull Mar 16, 2022
819bc3c
Stop placing the selector_map (which is an internal API detail) in th…
ebfull Mar 16, 2022
f46d777
Remove logic for reading and writing VerificationKey to/from buffers.
ebfull Mar 16, 2022
2194973
[book] Correct typo in protocol description.
therealyingtong Mar 17, 2022
d3f2980
Remove VerifyingKey serialization from sha256 gadget benchmark
str4d Mar 17, 2022
c6b4fca
Fix docs.rs build
str4d Mar 17, 2022
31b68fa
Merge pull request #524 from zcash/fix-docs-rs-build
str4d Mar 17, 2022
642efc1
Merge pull request #521 from zcash/reconstruct-selectors
str4d Mar 18, 2022
084ecf1
Merge pull request #523 from zcash/therealyingtong-patch-1
therealyingtong Mar 18, 2022
8abd7b7
Merge pull request #417 from zcash/fix-assigned-usage
str4d Mar 22, 2022
e39c8e9
Update changelogs
str4d Mar 22, 2022
8acd4ab
halo2_proofs 0.1.0-beta.3
str4d Mar 22, 2022
11dcfb8
halo2_gadgets 0.1.0-beta.2
str4d Mar 22, 2022
406f622
Merge pull request #531 from zcash/release-0.1.0-beta.3
str4d Mar 22, 2022
51d34c1
Bench heavily padded lookup in MockProver.
therealyingtong Mar 24, 2022
0946bdb
dev: Enable `VerifyFailure::Permutation` to point to region offsets
str4d Mar 30, 2022
4163b87
Reduce depth of AST by special casing the application of Horner's rule.
ebfull Apr 2, 2022
fd7e9dd
rustfmt
ebfull Apr 2, 2022
fa069a7
Use unwrap_or_default() instead of unwrap_or(HashMap::new())
ebfull Apr 3, 2022
6a31a0e
Apply @str4d's review suggestions.
ebfull Apr 4, 2022
95df0af
Merge pull request #537 from zcash/fix-stack-overflow
str4d Apr 4, 2022
a11cb97
halo2_proofs 0.1.0-beta.4
therealyingtong Apr 6, 2022
75b5c1e
halo2_gadgets 0.1.0-beta.3
therealyingtong Apr 6, 2022
1e6bb51
Merge pull request #540 from zcash/release-0.1.0-beta.4
str4d Apr 6, 2022
90e671e
Relicense Halo 2 crates as MIT OR Apache 2.0
str4d Apr 7, 2022
0c50500
Add an umbrella copyright line to cover future contributors
str4d Apr 7, 2022
8cb9226
[book] Use more intuitive expression for vanishing poly degree
therealyingtong Apr 10, 2022
066bd15
cost-model.rs: Correct lookup required degree calculation.
therealyingtong Apr 14, 2022
dc2e454
Merge pull request #549 from zcash/patch-cost-model-lookup
str4d Apr 18, 2022
19b2b3b
Fix clippy lints
str4d Apr 18, 2022
2217669
Merge pull request #532 from zcash/bench-lookup-mockprover
str4d Apr 18, 2022
84f5c26
[book] Add description of selector combining optimization.
daira Apr 18, 2022
424a274
Clarify a comment
daira Apr 19, 2022
606afb8
Merge pull request #445 from daira/mockprover-regression
str4d Apr 19, 2022
69c138c
Clarify some comments and messages
str4d Apr 19, 2022
a307bc4
Merge pull request #551 from daira/daira-book-combining
daira Apr 19, 2022
46ba444
Merge pull request #480 from zcash/477-mockprover-pretty-failures
str4d Apr 20, 2022
78de8a5
Add a `Constraints` helper
str4d Dec 3, 2021
d93846f
Note that `Constraints::with_selector` accepts arrays from 1.53
str4d Dec 7, 2021
a02b9e2
Add benchmark for various FFT sizes.
ebfull Apr 20, 2022
f49f4d1
Merge pull request #552 from zcash/benchmark-fft
str4d Apr 20, 2022
66b2b3b
Merge pull request #414 from zcash/constraints-helper
str4d Apr 22, 2022
f52d477
Bump codecov/codecov-action from 2.1.0 to 3.1.0
dependabot[bot] Apr 22, 2022
66827f3
Merge pull request #544 from zcash/book-patch-vanishing
daira Apr 22, 2022
b028004
halo2_gadgets: Migrate chip gates to `Constraints::with_selector`
str4d Apr 24, 2022
d43c861
CI: Use `ubuntu-latest` runner for book workflow
str4d Apr 24, 2022
b866548
Revert "CI: Pin nightly version in book workflow"
str4d Apr 24, 2022
34b467b
Merge pull request #557 from zcash/fix-mdbook-deploy
str4d Apr 24, 2022
2cf0125
CI: Pass the correct `katex-header.html` path to rustdoc
str4d Apr 24, 2022
5d99f7d
Merge pull request #558 from zcash/fix-rustdoc-deploy
str4d Apr 24, 2022
8e58245
Add draft of halo2 security proof to the formal protocol description
ebfull Apr 25, 2022
2498d65
Merge pull request #560 from ebfull/soundness
ebfull Apr 25, 2022
b46848e
Fix upper bound of \epsilon.
ebfull Apr 25, 2022
d420b78
Remove redundant mention of blinding factors
ebfull Apr 25, 2022
05b8b77
x -> x_3 rename in zero knowledge section.
ebfull Apr 25, 2022
1ea7aa1
Fix order of \epsilon bound.
ebfull Apr 25, 2022
26c604d
Merge pull request #561 from ebfull/proof-fixups
ebfull Apr 25, 2022
a6d7785
plonk: Derive Clone for VerifyingKey and ProvingKey.
parazyd Apr 26, 2022
5f86733
Merge pull request #556 from zcash/migrate-chip-gates-to-constraints-…
ebfull Apr 26, 2022
7688c37
Bump MSRV to 1.56.1
str4d Apr 27, 2022
bb1ed82
Set edition to 2021
str4d Apr 27, 2022
f830c6f
Remove pins for dependencies with MSRV-incompatible point releases
str4d Apr 27, 2022
e3f1bf6
halo2_gadgets: Remove usage of `array::IntoIter::new`
str4d Apr 27, 2022
f467599
Fix some clippy lints
str4d Apr 27, 2022
fdc6c9d
halo2_gadgets: pprof 0.8
str4d Apr 27, 2022
aa4639e
Temporarily revert `resolver = "2"`
str4d Apr 27, 2022
0c33fa4
Merge pull request #564 from zcash/482-msrv-1.56.1
ebfull Apr 27, 2022
f2d1f1d
sha256: Add `InitialRound` and `MainRoundIdx` structs
str4d Dec 3, 2021
7d15fa3
sha256: Simplify single-constraint gates
str4d Dec 3, 2021
9a9873a
optimize fft
ashWhiteHat Apr 28, 2022
32ed927
Apply @daira's review suggestion
ashWhiteHat Apr 28, 2022
6ff065c
CI: Fix Rust version used for benchmarks
str4d Apr 29, 2022
c736951
Merge pull request #565 from zcash/ci-fix-bench
str4d Apr 29, 2022
1d9ca93
Bump actions/checkout from 2 to 3
dependabot[bot] Apr 29, 2022
f0168cf
halo2: Disable default benchmark harness
str4d Apr 29, 2022
1ccef3b
Merge pull request #566 from zcash/ci-2-fix-2-bench
str4d May 1, 2022
97864d7
halo2_gadgets: Add `MessagePiece::from_subpieces`
str4d May 2, 2022
e04c8bf
Migrate to `ff 0.12`
str4d May 4, 2022
3800de5
Rename `RangeConstrained::subset_of` to `bitrange_of`
str4d May 4, 2022
506e310
Merge pull request #570 from zcash/ff-0.12
str4d May 5, 2022
b2e2b9b
Merge pull request #568 from zcash/circuit-review
str4d May 5, 2022
377de39
Merge pull request #554 from zcash/dependabot/github_actions/codecov/…
str4d May 5, 2022
72ff677
Merge pull request #511 from zcash/dependabot/github_actions/actions/…
str4d May 5, 2022
6d83db7
EccInstructions::mul: take Self::ScalarVar instead of Chip::Var.
therealyingtong Mar 22, 2022
cbf3d6a
EccInstructions: introduce witness_scalar_var() instruction.
therealyingtong Mar 22, 2022
5ebfe91
Introduce ecc::BaseFitsInScalarInstructions trait.
therealyingtong Mar 22, 2022
6f2fc57
Rename FixedPoint::ScalarKind -> FixedPoint::FixedScalarKind.
therealyingtong Mar 22, 2022
1c877f3
ecc::chip: Introduce ScalarVar enum.
therealyingtong Mar 22, 2022
5fd0834
Introduce ScalarVar::new and ScalarVar::from_base gadget APIs.
therealyingtong May 5, 2022
fdf5169
Update changelog.
therealyingtong May 5, 2022
64e7efb
Merge pull request #542 from zcash/relicense-mit-or-apache-2.0
defuse May 5, 2022
a1d1371
Merge pull request #563 from parazyd/clone-impls-keys
ebfull May 5, 2022
6fb622a
Merge pull request #543 from NoCtrlZ/feat/fft-optimization
ebfull May 5, 2022
1791e69
Merge branch 'main' into main
nuttycom May 5, 2022
6e762bd
Merge pull request #380 from 3for/main
nuttycom May 6, 2022
3c6ffb6
Address comments from code review.
therealyingtong May 6, 2022
5a543f9
Move `EccInstructions::ScalarVar` changelog entry to "Changed"
str4d May 6, 2022
30f92f3
Merge pull request #522 from zcash/full-width-var-base-mul
str4d May 6, 2022
0d978f0
halo2_gadgets: Generalise `MerklePath` beyond two `MerkleChip`s
str4d May 5, 2022
3bed572
Use `MessagePiece::from_subpieces` in `MerkleChip::hash_layer`
str4d May 5, 2022
7ea240d
book: Rewrite `MerkleCRH` gadget page
str4d May 6, 2022
6444ccc
halo2_gadgets: Tidy up and document MerkleCRH implementation
str4d May 6, 2022
dc2ec03
halo2_gadgets: Deduplicate some Sinsemilla chip expressions
str4d May 7, 2022
03697e2
book: Rewrite Sinsemilla gadget page
str4d May 8, 2022
96d4a31
halo2_gadgets: Batch inversions in `SinsemillaChip::hash_to_point`
str4d May 8, 2022
6145b14
halo2_gadgets: Move `primitives::*` to `*::primitives`
str4d May 9, 2022
3486703
halo2_gadgets: Refactor fixed-base scalar mul gadget APIs
str4d May 9, 2022
342ebdd
halo2_gadgets: Fix return type of `ecc::chip::FixedPoint::u`
str4d May 9, 2022
144d082
halo2_gadgets: Refactor complete addition constraints
str4d May 9, 2022
17cd222
book: Add explicit constraints table for incomplete addition
str4d May 9, 2022
88e189e
book: Add page for witnessing ECC points
str4d May 10, 2022
e4e7821
[book] Add 'Selector combining' to SUMMARY.md
therealyingtong May 10, 2022
bdf84a5
Merge pull request #580 from zcash/book-patch-summary
daira May 10, 2022
56fc896
halo2_gadgets: Extract a common `DoubleAndAdd` helper struct
str4d May 10, 2022
18edad5
halo2_gadgets: Use separate field names for var-mul incomplete selectors
str4d May 10, 2022
85b0b7c
halo2_gadgets: Refactor `ecc::chip::mul_fixed::Config` word assignmen…
str4d May 10, 2022
692fee0
halo2_gadgets: Clean up `ecc::chip::mul_fixed::Config` logic
str4d May 10, 2022
ff01e4a
halo2_gadgets: Refactor `ScalarFixed::windows_usize`
str4d May 10, 2022
f57b93f
book: Fix various small bugs and add some missing constraints
str4d May 10, 2022
ad51e4a
book: Document var-mul constraints for complete addition and LSB
str4d May 10, 2022
a94a2bc
halo2_gadgets: Various small code cleanups
str4d May 10, 2022
ac67b11
book: Document `EccChip` assumptions and general layout
str4d May 10, 2022
4b802a7
halo2_gadgets: Documentation fixes
str4d May 10, 2022
91e1106
halo2_gadgets: Address review comments
str4d May 10, 2022
50921f9
Merge pull request #573 from zcash/str4d/chip-review
str4d May 10, 2022
3bc0c59
halo2_proofs 0.1.0
str4d May 10, 2022
e36041d
halo2_gadgets 0.1.0
str4d May 10, 2022
bf45980
Merge pull request #581 from zcash/release-0.1.0
str4d May 10, 2022
076fa24
remove .DS_Store
trel May 13, 2022
8075b21
Merge pull request #584 from trel/remove_dsstore
str4d May 13, 2022
34b2e77
Merge pull request #467 from zcash/sha256-tweaks
therealyingtong May 25, 2022
c1007d8
halo2_gadgets: Add protocol rule links for the chip constraints
str4d May 9, 2022
c0db68a
Merge pull request #589 from zcash/protocol-rule-links
str4d May 27, 2022
5f1fb16
halo2_gadgets: Reduce allocations during var-mul synthesis
str4d May 12, 2022
515f977
halo2_gadgets: Enable more inversions to be batched during synthesis
str4d May 12, 2022
c17d52e
halo2_proofs: Add `halo2_proofs::circuit::Value<V>`
str4d Jun 7, 2022
47f25ad
halo2_proofs: Replace `Option<V>` with `Value<V>`
str4d Jun 7, 2022
5ed3d25
halo2_gadgets: Replace `Option<V>` with `Value<V>`
str4d Jun 8, 2022
521d6ed
halo2_proofs: Make `Value::{known, unknown}` const
str4d Jun 9, 2022
5752adf
halo2_proofs: `impl {Add, Sub, Mul} for &Value<V>`
str4d Jun 9, 2022
1cf376e
Merge pull request #597 from zcash/small-perf-improvements
str4d Jun 9, 2022
7cb71b4
Update halo2_proofs/src/circuit/value.rs
str4d Jun 13, 2022
a898d65
Merge pull request #598 from zcash/circuit-value-type
str4d Jun 13, 2022
69a980f
[book] Add `U` to `BCMS` comparison table
therealyingtong Jun 15, 2022
c9fc4c6
Merge pull request #601 from zcash/book/update-comparison
str4d Jun 21, 2022
22ec369
Add `BatchVerifier::finalize_and_return_rng`
str4d Jun 21, 2022
f6efecc
Merge pull request #603 from zcash/batch-verifier-return-rng
str4d Jun 22, 2022
4802936
Cache the representative of `VerifyingKey` used in transcripts
str4d Jun 22, 2022
05f37ee
Cache the constraint system degree in `VerifyingKey`
str4d Jun 22, 2022
6939ac4
Remove parallelism from within MSM scalar operations.
ebfull Jun 22, 2022
6b4af24
Deduplicate the extra (scalar, base) pairs in MSMs.
ebfull Jun 22, 2022
745f5d1
Merge pull request #607 from zcash/caching
str4d Jun 22, 2022
2ed70a3
Reduce memory overhead of MSM by 64 bytes per "other" base, and add t…
daira Jun 23, 2022
c1159bd
Merge pull request #1 from daira/msm-optimization-daira
ebfull Jun 23, 2022
7087c33
Merge pull request #608 from ebfull/msm-optimization
ebfull Jun 23, 2022
dd94fb9
Rework `halo2_proofs::plonk::BatchVerifier`
str4d Jun 23, 2022
dac6cfb
Merge pull request #610 from zcash/rework-batch-verifier
str4d Jun 23, 2022
f0861db
halo2_gadgets: Silence clippy lints
str4d Jun 23, 2022
5641a64
halo2_proofs: Fix clippy lints
str4d Jun 23, 2022
7a22f3c
halo2_proofs 0.2.0
str4d Jun 23, 2022
2c06d83
halo2_gadgets 0.2.0
str4d Jun 23, 2022
9120031
Merge pull request #611 from zcash/release-0.2.0
ebfull Jun 23, 2022
deef0e1
Place `halo2_proofs::plonk::BatchVerifier` behind a (default enabled)…
ebfull Jun 23, 2022
96d9bde
Merge pull request #612 from zcash/batch-crate-feature
str4d Jun 23, 2022
104101d
[Book] Make the permutation diagram stand out against dark backgrounds.
daira Jul 1, 2022
5af2bd3
[Book] Rename "polynomial degree bound" to "maximum constraint degree".
daira Jul 1, 2022
8ff5b1e
feat: make `Expression::{Fixed,Advice,Instance}` to wrap their own `Q…
han0110 Jun 28, 2022
eb340d4
Merge branch 'pse-main' into upstream-messy
ChihChengLiang Aug 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# We don't need to test across multiple platforms yet
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand All @@ -33,7 +31,7 @@ jobs:
- wasm32-wasi

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand All @@ -50,7 +48,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand All @@ -66,7 +64,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Use stable for this to ensure that cargo-tarpaulin can be built.
- uses: actions-rs/toolchain@v1
with:
Expand All @@ -82,16 +80,14 @@ jobs:
command: tarpaulin
args: --all-features --timeout 600 --out Xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
uses: codecov/codecov-action@v3.1.0

doc-links:
name: Intra-doc links
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand All @@ -113,7 +109,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ on: pull_request

jobs:
clippy:
name: Clippy (1.51.0)
name: Clippy (1.56.1)
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
components: clippy
override: false
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.51.0)
name: Clippy (1.56.1)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
Cargo.lock
.vscode
**/*.html
.DS_Store
35 changes: 0 additions & 35 deletions COPYING

This file was deleted.

16 changes: 16 additions & 0 deletions COPYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

# Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.

25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# halo2 [![Crates.io](https://img.shields.io/crates/v/halo2.svg)](https://crates.io/crates/halo2) #

**IMPORTANT**: This library is in beta, and should not be used in production software.

## [Documentation](https://docs.rs/halo2)

## Minimum Supported Rust Version

Requires Rust **1.51** or higher.
Requires Rust **1.56.1** or higher.

Minimum supported Rust version can be changed in the future, but it will be done with a
minor version bump.
Expand All @@ -18,14 +16,17 @@ The `RAYON_NUM_THREADS` environment variable can be used to set the number of th

## License

Copyright 2020-2021 The Electric Coin Company.
Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

You may use this package under the Bootstrap Open Source Licence, version 1.0,
or at your option, any later version. See the file [`COPYING`](COPYING) for
more details, and [`LICENSE-BOSL`](LICENSE-BOSL) for the terms of the Bootstrap
Open Source Licence, version 1.0.
### Contribution

The purpose of the BOSL is to allow commercial improvements to the package
while ensuring that all improvements are open source. See
[here](https://electriccoin.co/blog/introducing-tgppl-a-radically-new-type-of-open-source-license/)
for why the BOSL exists.
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
16 changes: 14 additions & 2 deletions book/macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Circuit constraint helper methods

\BoolCheck:{\texttt{bool\_check}({#1})}
\Ternary:{\texttt{ternary}({{#1}, {#2}, {#3}})}
\RangeCheck:{\texttt{range\_check}({#1, #2})}
\ShortLookupRangeCheck:{\texttt{short\_lookup\_range\_check}({#1})}

Expand Down Expand Up @@ -51,7 +52,7 @@
\bottom:{\perp}
\alg:{#1_\textnormal{alg}}
\zero:{\mathcal{O}}
\dlrel:{\mathsf{dl-rel}}
\dlrel:{\textsf{dl-rel}}
\game:{\mathsf{G}}
\innerprod:{\langle{#1},{#2}\rangle}
\dlgame:{\mathsf{G}^\dlrel_{\group,n}}
Expand All @@ -61,4 +62,15 @@
\halo:{\textsf{Halo}}
\lo:{\textnormal{lo}}
\hi:{\textnormal{hi}}
\protocol:{\halo}
\protocol:{\halo}
\extractwitness:{\textnormal{ExtractWitness}}
\pfail:{p_\textnormal{fail}}
\repr:\{\kern-0.1em {#1} \kern-0.1em\}^{#2}
\rep:{\repr{#1}{}}
\repv:{\repr{#1}{\mathbf{#2}}_{#3}}
\dlreladv:{\mathcal{H}}
\mr:{\mathcal{M}^{#1}_{#2}({#3})}
\mv:{\mr{\mathbf{#1}}{#2}{#3}}
\m:{\mr{#1}{}{#2}}
\z:{\mathcal{Z}_{#1}({#2}, {#3})}
\trprefix:{{#1}|_{#2}}
25 changes: 25 additions & 0 deletions book/src/IDENTIFIERS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"decompose-combined-lookup": "design/gadgets/decomposition.html#combined-lookup-expression",
"decompose-short-lookup": "design/gadgets/decomposition.html#short-range-check",
"decompose-short-range": "design/gadgets/decomposition.html#short-range-decomposition",
"ecc-complete-addition": "design/gadgets/ecc/addition.html#complete-addition-constraints",
"ecc-incomplete-addition": "design/gadgets/ecc/addition.html#incomplete-addition-constraints",
"ecc-fixed-mul-base-canonicity": "design/gadgets/ecc/fixed-base-scalar-mul.html#base-field-element",
"ecc-fixed-mul-coordinates": "design/gadgets/ecc/fixed-base-scalar-mul.html#constrain-coordinates",
"ecc-fixed-mul-full-word": "design/gadgets/ecc/fixed-base-scalar-mul.html#full-width-scalar",
"ecc-fixed-mul-load-base": "design/gadgets/ecc/fixed-base-scalar-mul.html#load-fixed-base",
"ecc-fixed-mul-short-msb": "design/gadgets/ecc/fixed-base-scalar-mul.html#constrain-short-signed-msb",
"ecc-fixed-mul-short-conditional-neg": "design/gadgets/ecc/fixed-base-scalar-mul.html#constrain-short-signed-conditional-neg",
"ecc-var-mul-complete-gate": "design/gadgets/ecc/var-base-scalar-mul.html#complete-gate",
"ecc-var-mul-incomplete-first-row": "design/gadgets/ecc/var-base-scalar-mul.html#incomplete-first-row-gate",
"ecc-var-mul-incomplete-last-row": "design/gadgets/ecc/var-base-scalar-mul.html#incomplete-last-row-gate",
"ecc-var-mul-incomplete-main-loop": "design/gadgets/ecc/var-base-scalar-mul.html#incomplete-main-loop-gate",
"ecc-var-mul-lsb-gate": "design/gadgets/ecc/var-base-scalar-mul.html#lsb-gate",
"ecc-var-mul-overflow": "design/gadgets/ecc/var-base-scalar-mul.html#overflow-check-constraints",
"ecc-var-mul-witness-scalar": "design/gadgets/ecc/var-base-scalar-mul.html#witness-scalar",
"ecc-witness-point": "design/gadgets/ecc/witnessing-points.html#points-including-the-identity",
"ecc-witness-non-identity-point": "design/gadgets/ecc/witnessing-points.html#non-identity-points",
"sinsemilla-constraints": "design/gadgets/sinsemilla.html#optimized-sinsemilla-gate",
"sinsemilla-merkle-crh-bit-lengths": "design/gadgets/sinsemilla/merkle-crh.html#bit-length-constraints",
"sinsemilla-merkle-crh-decomposition": "design/gadgets/sinsemilla/merkle-crh.html#decomposition-constraints"
}
2 changes: 2 additions & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
- [Implementation](design/implementation.md)
- [Proofs](design/implementation/proofs.md)
- [Fields](design/implementation/fields.md)
- [Selector combining](design/implementation/selector-combining.md)
- [Gadgets](design/gadgets.md)
- [Elliptic curve cryptography](design/gadgets/ecc.md)
- [Witnessing points](design/gadgets/ecc/witnessing-points.md)
- [Incomplete and complete addition](design/gadgets/ecc/addition.md)
- [Fixed-base scalar multiplication](design/gadgets/ecc/fixed-base-scalar-mul.md)
- [Variable-base scalar multiplication](design/gadgets/ecc/var-base-scalar-mul.md)
Expand Down
6 changes: 3 additions & 3 deletions book/src/background/curves.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ when adding two distinct points.
### Point addition
We now add two points with distinct $x$-coordinates, $P = (x_0, y_0)$ and $Q = (x_1, y_1),$
where $x_0 \neq x_1,$ to obtain $R = P + Q = (x_2, y_2).$ The line $\overline{PQ}$ has slope
$$\lambda = frac{y_1 - y_0}{x_1 - x_0} \implies y - y_0 = \lambda \cdot (x - x_0).$$
$$\lambda = \frac{y_1 - y_0}{x_1 - x_0} \implies y - y_0 = \lambda \cdot (x - x_0).$$

Using the expression for $\overline{PQ}$, we compute $y$-coordinate $-y_2$ of $-R$ as:
$$-y_2 - y_0 = \lambda \cdot (x_2 - x_0) \implies \boxed{y_2 = (x_0 - x_2) - y_0}.$$
$$-y_2 - y_0 = \lambda \cdot (x_2 - x_0) \implies \boxed{y_2 =\lambda (x_0 - x_2) - y_0}.$$

Plugging the expression for $\overline{PQ}$ into the curve equation $y^2 = x^3 + b$ yields
$$
Expand Down Expand Up @@ -193,7 +193,7 @@ Important notes:
Imagine that $\mathbb{F}_p$ has a primitive cube root of unity, or in other words that
$3 | p - 1$ and so an element $\zeta_p$ generates a $3$-order multiplicative subgroup.
Notice that a point $(x, y)$ on our example elliptic curve $y^2 = x^3 + b$ has two cousin
points: $(\zeta_p x, \zeta_p^2 x)$, because the computation $x^3$ effectively kills the
points: $(\zeta_p x,y), (\zeta_p^2 x,y)$, because the computation $x^3$ effectively kills the
$\zeta$ component of the $x$-coordinate. Applying the map $(x, y) \mapsto (\zeta_p x, y)$
is an application of an endomorphism over the curve. The exact mechanics involved are
complicated, but when the curve has a prime $q$ number of points (and thus a prime
Expand Down
2 changes: 1 addition & 1 deletion book/src/background/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ odd, and so half of all elements are squares.
In order to compute the square root, we can first raise the element
$a = \alpha^i \cdot \beta^j$ to the power $t$ to "kill" the $t$-order component, giving

$$a^t = \alpha^{it \pmod 2^k} \cdot \beta^{jt \pmod t} = \alpha^{it \pmod 2^k}$$
$$a^t = \alpha^{it \pmod {2^k}} \cdot \beta^{jt \pmod t} = \alpha^{it \pmod {2^k}}$$

and then raise this result to the power $t^{-1} \pmod{2^k}$ to undo the effect of the
original exponentiation on the $2^k$-order component:
Expand Down
12 changes: 6 additions & 6 deletions book/src/background/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Assuming the discrete log assumption holds, Pedersen commitments are also perfec
and computationally binding:

* **hiding**: the adversary chooses messages $m_0, m_1.$ The committer commits to one of
these messages $c = \text{Commit}(m_b;r), b \in \{0,1\}.$ Given $c,$ the probability of
these messages $c = \text{Commit}(m_b,r), b \in \{0,1\}.$ Given $c,$ the probability of
the adversary guessing the correct $b$ is no more than $\frac{1}{2}$.
* **binding**: the adversary cannot pick two different messages $m_0 \neq m_1,$ and
randomness $r_0, r_1,$ such that $\text{Commit}(m_0,r_0) = \text{Commit}(m_1,r_1).$

### Vector Pedersen commitment
We can use a variant of the Pedersen commitment scheme to commit to multiple messages at
once, $\mathbf{m} = (m_1, \cdots, m_n)$. This time, we'll have to sample a corresponding
once, $\mathbf{m} = (m_0, \cdots, m_{n-1})$. This time, we'll have to sample a corresponding
number of random public generators $\mathbf{G} = (G_0, \cdots, G_{n-1}),$ along with a
single random generator $H$ as before (for use in hiding). Then, our commitment scheme is:

Expand All @@ -57,10 +57,10 @@ $$

> TODO: is this positionally binding?

## Diffie--Hellman
## DiffieHellman

An example of a protocol that uses cryptographic groups is Diffie--Hellman key agreement
[[DH1976]]. The Diffie--Hellman protocol is a method for two users, Alice and Bob, to
An example of a protocol that uses cryptographic groups is DiffieHellman key agreement
[[DH1976]]. The DiffieHellman protocol is a method for two users, Alice and Bob, to
generate a shared private key. It proceeds as follows:

1. Alice and Bob publicly agree on two prime numbers, $p$ and $G,$ where $p$ is large and
Expand All @@ -83,7 +83,7 @@ $g, p, A = [a]G,$ and $B = [b]G$: in other words, they would need to either get
discrete logarithm $a$ from $A = [a]G$ or $b$ from $B = [b]G,$ which we assume to be
computationally infeasible in $\mathbb{F}_p^\times.$

More generally, protocols that use similar ideas to Diffie--Hellman are used throughout
More generally, protocols that use similar ideas to DiffieHellman are used throughout
cryptography. One way of instantiating a cryptographic group is as an
[elliptic curve](curves.md). Before we go into detail on elliptic curves, we'll describe
some algorithms that can be used for any group.
Expand Down
2 changes: 1 addition & 1 deletion book/src/background/pc-ipa.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $\mathbf{b}^{(k)} := \mathbf{b}.$ In each round $j = k, k-1, \cdots, 1$:
$$
\begin{aligned}
L_j &= \langle\mathbf{a_{lo}^{(j)}}, \mathbf{G_{hi}^{(j)}}\rangle + [l_j]H + [\langle\mathbf{a_{lo}^{(j)}}, \mathbf{b_{hi}^{(j)}}\rangle] U\\
R_j &= \langle\mathbf{a_{hi}^{(j)}}, \mathbf{G_{lo}^{(j)}}\rangle + [l_j]H + [\langle\mathbf{a_{hi}^{(j)}}, \mathbf{b_{lo}^{(j)}}\rangle] U\\
R_j &= \langle\mathbf{a_{hi}^{(j)}}, \mathbf{G_{lo}^{(j)}}\rangle + [r_j]H + [\langle\mathbf{a_{hi}^{(j)}}, \mathbf{b_{lo}^{(j)}}\rangle] U\\
\end{aligned}
$$

Expand Down
4 changes: 2 additions & 2 deletions book/src/background/polynomials.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ most points." Formally, it can be written as follows:

> Let $p(x_1, x_2, \cdots, x_n)$ be a nonzero polynomial of $n$ variables with degree $d$.
> Let $S$ be a finite set of numbers with at least $d$ elements in it. If we choose random
> $\alpha_1, \alpha_1, \cdots, \alpha_n$ from $S$,
> $\alpha_1, \alpha_2, \cdots, \alpha_n$ from $S$,
> $$\text{Pr}[p(\alpha_1, \alpha_2, \cdots, \alpha_n) = 0] \leq \frac{d}{|S|}.$$

In the familiar univariate case $p(X)$, this reduces to saying that a nonzero polynomial
Expand Down Expand Up @@ -279,7 +279,7 @@ we can reconstruct its coefficient form in the Lagrange basis:

$$A(X) = \sum_{i = 0}^{n-1} A(x_i)\mathcal{L_i}(X), $$

where $X \in \{x_0, x_1,\cdots, x_{1-n}\}.$
where $X \in \{x_0, x_1,\cdots, x_{n-1}\}.$

## References
[^master-thm]: [Dasgupta, S., Papadimitriou, C. H., & Vazirani, U. V. (2008). "Algorithms" (ch. 2). New York: McGraw-Hill Higher Education.](https://people.eecs.berkeley.edu/~vazirani/algorithms/chap2.pdf)
Expand Down
2 changes: 1 addition & 1 deletion book/src/background/recursion.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ polynomial with degree $2^k - 1.$

| | |
| -------- | -------- |
| <img src="https://i.imgur.com/vMXKFDV.png" width=1900> | Since $G$ is a commitment, it can be checked in an inner product argument. The verifier circuit witnesses $G$ and brings $G, u_1, \cdots, u_k$ out as public inputs to the proof $\pi.$ The next verifier instance checks $\pi$ using the inner product argument; this includes checking that $G = \text{Commit}(g(X, u_1, \cdots, u_k))$ evaluates at some random point to the expected value for the given challenges $u_1, \cdots, u_k.$ Recall from the [previous section](#Polynomial-commitment-using-inner-product-argument) that this check only requires $\log d$ work. <br><br> At the end of checking $\pi$ and $G,$ the circuit is left with a new $G',$ along with the $u_1', \cdots, u_k'$ challenges sampled for the check. To fully accept $\pi$ as valid, we should perform a linear-time computation of $G' = \langle\mathbf{G}, \mathbf{s}'\rangle$. Once again, we delay this computation by witnessing $G'$ and bringing $G, u_1, \cdots, u_k$ out as public inputs to the proof $\pi.$ <br><br> This goes on from one proof instance to the next, until we are satisfied with the size of our batch of proofs. We finally perform a single linear-time computation, thus deciding the validity of the whole batch. |
| <img src="https://i.imgur.com/vMXKFDV.png" width=1900> | Since $G$ is a commitment, it can be checked in an inner product argument. The verifier circuit witnesses $G$ and brings $G, u_1, \cdots, u_k$ out as public inputs to the proof $\pi.$ The next verifier instance checks $\pi$ using the inner product argument; this includes checking that $G = \text{Commit}(g(X, u_1, \cdots, u_k))$ evaluates at some random point to the expected value for the given challenges $u_1, \cdots, u_k.$ Recall from the [previous section](#Polynomial-commitment-using-inner-product-argument) that this check only requires $\log d$ work. <br><br> At the end of checking $\pi$ and $G,$ the circuit is left with a new $G',$ along with the $u_1', \cdots, u_k'$ challenges sampled for the check. To fully accept $\pi$ as valid, we should perform a linear-time computation of $G' = \langle\mathbf{G}, \mathbf{s}'\rangle$. Once again, we delay this computation by witnessing $G'$ and bringing $G', u_1', \cdots, u_k'$ out as public inputs to the proof $\pi'.$ <br><br> This goes on from one proof instance to the next, until we are satisfied with the size of our batch of proofs. We finally perform a single linear-time computation, thus deciding the validity of the whole batch. |

We recall from the section [Cycles of curves](curves.md#cycles-of-curves) that we can
instantiate this protocol over a two-cycle, where a proof produced by one curve is
Expand Down
Loading