mirror of https://github.com/zcash/halo2.git
78de8a5c94
There are two existing patterns for constructing a gate from a set of constraints with a common selector: - Create an iterator of constraints, where each constraint includes the selector: ``` vec![ ("foo", selector.clone() * foo), ("bar", selector.clone() * bar), ("baz", selector * bar), ] ``` This requires the user to write O(n) `selector.clone()` calls. - Create an iterator of constraints, and then map the selector in: ``` vec![ ("foo", foo), ("bar", bar), ("baz", bar), ].into_iter().map(move |(name, poly)| (name, selector.clone() * poly)) ``` This looks cleaner overall, but the API is not as intuitive, and it is messier when the constraints are named. The `Constraints` struct provides a third, clearer API: ``` Constraints::with_selector( selector, vec![ ("foo", foo), ("bar", bar), ("baz", bar), ], ) ``` This focuses on the structure of the constraints, and handles the selector application for the user. |
||
---|---|---|
.. | ||
benches | ||
proptest-regressions/constants | ||
src | ||
CHANGELOG.md | ||
Cargo.toml | ||
README.md | ||
katex-header.html | ||
rust-toolchain |
README.md
halo2_gadgets
IMPORTANT: This library is in beta, and should not be used in production software.
Requires Rust 1.51+.
Documentation
License
Copyright 2020-2022 The Electric Coin Company.
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
for
more details, and LICENSE-BOSL
for the terms of the Bootstrap
Open Source Licence, version 1.0.
The purpose of the BOSL is to allow commercial improvements to the package while ensuring that all improvements are open source. See here for why the BOSL exists.