Skip to content

Commit 8e431bf

Browse files
CPerezzLuke Pearson
andauthored
Release version 0.6 (#457)
* Move PI to separated file * Include TRANSCRIPT_INIT & TRIM_SIZE consts for trait * Add PiPositionsHolder trait as Circuit supertrait * Remove `gadget` call from Circuit::verify() fn It wasted a lot of time and also was useless to call the `gadget` fn again for the verify fn in the Circuit trait. Thanks to the refactor done to the PublicInputs and how they're handled now we no longer need to call it. * Use extend instead of append to reduce allocations * Declare zeros array only once * Refactor Public Inputs handling in Composer Previously we were storing the dense representation of the public inputs that were used with the `Composer` instance. This was constly, since most of the public inputs were zero and therefore storing them was useless but also we needed to collect the position information in the Circuit trait in such difficult ways. With this refactor we currently have: - Public Inputs are now passed to gate-functions as `Option<BlsScalar>`. - The `Composer` no longer stores the dense public input vector. Instead we store two sparse vectors which contain the values and the positions. - We include a function that allows the `Composer` to construct the dense PI vector from it's sparse ones. - We've added ways for the consumer to get access to the positions vector. This will allow to simplify the public input management on the `Circuit` trait. * Implement bytes-PI conversion trait * Use simple PublicInputValue struct for PI handling After discussions with @ZER0 we realized there's not a need to have a really big trait to handle the public inputs and all we need is a simple structure that implements the conversions from the different PI types that we can have in PLONK circuits into the format that PLONK requires which is `&[BlsScalar]`. - Created `PublicInputValue` which is implemented for `BlsScalar`, `JubJubScalar` and `JubJubAffine`. - Forced the `Circuit` trait to use this struct as source of the public input values needed in the verification step. * Impl HashMap for PublicInputs storage Instead of storing the sparse representation of the non-zero PublicInputs as two different `Vec` which are logically connected but not tecnollogically(code-wise). With this change we can have them strictly correlated since they're stored linked in the `HashMap`. * Use BTreeMap instead of HashMap We need to return the PI positons(and store them) in order since otherways when consumers ask for these data, it would be returned wrongly if we don't return it ordered. * Extend circuit tests to use ECC ops This also allows to test wether the support for the PI handling of the Circuit trait is correct. * Remove prints * Make Circuit::TRIM_SIZE auto impl from const_gen To allow (although it's not recommended to do) variable-size circuits, we need a way to express different circuit sizes (TRIM_SIZE) for the same circuit. By setting the `Circuit::TRIM_SIZE` inherit the value from the const generic parameter N, we enable this behaviour leaving an API that is not bad. * Address reveiw comments * Use copied() in iters instead of * * Update README.md with code examples * Change circuit module name * Check invariants for pi BTreeMap insertion * Impl `padded_circuit_size` for `VerifierKey` * Remove verify_proof & build_pi from Circuit Since these two functions didn't need `Self` or `self` and also were independent, we've been able to remove them from the trait. This closes #396 and also allows us to have a generic method that can verify Proofs of any `Circuit` without needing to have access to the type of it. * Update CHANGELOG * Address @ZER0's PR suggestions * Add canonical_derive as dep behind `canon` feature * Remove hyperlink from SNARK docs. The docs file had a faulty hyperlink. This is because within files it is not possible to connect to mod level markdowns. This is now removed. * Add rust-toolchain file using `nightly` * Add default Dusk config for rustfmt.toml * Fix "broken links" lint warning Resolves: #443 * Replace collections::HashMap for hashbrown::HashMap Resolves: #424 * Update CHANGELOG * Apply cargo fmt --all to crate * Remove unused code from the lib During the refactors that we've done, some functions became legacy code and were not removed. That's a problem since it makes the codebase harder to navigate and mantain. Resolves: #439 * Update CHANGELOG * Move to test mod test-only fns for CKey & VKey * Cut visibility of crate structures & fn's Currently, we expose a way too much things when indeed we should try to expose publicly in the API only the necessary stuff. We have modules as fft or transcript_protocol which shouldn't be pub. Also there are quite some structures which are pub but never meant to be used by the lib consumers. The idea is that with this PR we're able to make more clear which are the things that the consumer is suposed to call or do. Closes #438 * Update CHANGELOG * Move rand_core import to test mod * Use `match` instead of double `if` as @ZER0 suggest * Fix typo * Move rand fn inside impl block under tests mod * Fix test fn public visibility * Remove Polynomial & Evaluations asscoc unused fns * Fix typo * Use crate:: route instead of `super::super::..` * Add dusk-bytes Error as BytesError in plonk We've added an enum variant for it as well as a conversion from dusk_bytes::Error to dusk_plonk::Error so that we can use `?` * Impl Serializable for OpeningKey * Remove the usage of read_g2_affine The goal is to remove the serialization module at the end by implementing the `dusk_bytes` trait. This is one step forward. * Impl Serializable + tests for Commitment * Remove serde support * Impl Serializable for ProofEvaluations & tests * Fix PubParams serialization API naming conventions * Impl Serializable & tests for ProofEvaluations * Impl Serializable & testst for VerifierKey * Impl Serializable & tests for VerifierKey * Impl Serializable & tests for Proof * Remove serialisation module from crate Since we had here a lot of duplicated read/write impls for data structures that already have this behaviour implemented, this simply removes the entire module and all of it's functions. Closes #437 * mend * Update serialization API conventions ProverKey The implementations were using the `serialization` module instead of the `dusk_bytes` trait functions. - Updated the implementations to no longer use the `serialisation` module functions and use the `dusk-bytes` ones. - Updated the fn docs to be more specific and clear about the differences of using raw/unchecked vs. to/from bytes. * Update PublicParameters to_bytes to use new ck serde * Impl dusk_bytes::Serializable for EvaluationDomain * Impl to/from bytes for Evaluations * Impl to/from bytes for Polynomial * Refactor ProverKey serialization ProverKey was pulling all of the serde from the `serialisation` module that is no longer supported and removed. Therefore, a refactor was needed so that we use the canonical implementation done for the dusk_bytes traits for the structures contained inside the ProverKey. - Updated the serialization-related fn docs to be more explicit. - Refactored `to_bytes()` and `from_bytes()` to use `dusk_bytes` trait functions in order to remove duplicity. * Remove legacy unused code for poly_iter_sum * This seems to be a leftover from #285 * Fix absent polys writing inside ProverKey When we want to convert into bytes a `ProverKey` there are some of it's internal widget ProverKeys that contain empty polynomials because they haven't been used during the circuit building process. The serialization now is fixed and this structures are serialized correctly consuming no space when they're null. * Set correct capacity for bytes buffer * Update CHANGELOG * Address @ZER0's nits * Consolidate API renaming consistently Resolves: #354 * Fix PublicParameters serialization issues * Address rebase errors * Make proof_system module private * Fix Error type used for Serializable impl Proof In order to impl the propper `BadLenght` trait & others we need to set the associated error for the `Serializable` trait impl for `Proof` as `dusk_bytes::Error` and take profit of the conversion with `?` to convert the error into a `plonk::Error` when needed. Resolves: #447 * Fix canon feature related compilation errors - Remove `Canon` impl for `Proof`. - Make the `std::Error` impl behind `std` flag. Resolves: #450 * Update CHANGELOG.md * Implement ID associated const for Circuit trait As discussed with the core team, this would enable features like circuit versioning with techniqes like: > You could generate the ID by hashing the `gadget()` fn code in a proc_macro with something like Blake3. Resolves: #417 * Address @ZER0's nits * Apply fmt * Bump to 0.6.0 Resolves: #458 Co-authored-by: Luke Pearson <[email protected]>
1 parent 11366f5 commit 8e431bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2904
-2388
lines changed

CHANGELOG.md

Lines changed: 98 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,148 +6,231 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
10+
## [0.6.0] - 11-03-21
11+
12+
### Added
13+
14+
- Implement `dusk_bytes::Serializable` for all possible structures that need serde. [#352](https://github.com/dusk-network/plonk/issues/352)
15+
- Introduced a new type that unifies the Public Inputs `PublicInputValue`. [#416](https://github.com/dusk-network/plonk/issues/416)
16+
- Impl `padded_circuit_size` for `VerifierKey` [#351](https://github.com/dusk-network/plonk/issues/351)
17+
- Impl a generic method that can verify Proofs of any `Circuit`. [#396](https://github.com/dusk-network/plonk/issues/396)
18+
919
### Removed
10-
- Deprecated `anyhow` and `thiserror` [#343](https://github.com/dusk-network/plonk/issues/343)
20+
21+
- Remove `Canon` impl for `Proof`. [#450](https://github.com/dusk-network/plonk/issues/450)
22+
- Remove serde support completely from the repo. [#353](https://github.com/dusk-network/plonk/issues/353)
23+
- Removed previous implementations attached to `PublicInputValues`. [#416](https://github.com/dusk-network/plonk/issues/416)
24+
- Deprecated `anyhow` and `thiserror`. [#343](https://github.com/dusk-network/plonk/issues/343)
25+
- Remove `serialisation` module and use single serialization fn's. [#347](https://github.com/dusk-network/plonk/issues/347)
1126
- Remove uncessary `match` branch for `var_c` [#414](https://github.com/dusk-network/plonk/issues/414)
27+
- Remove legacy fns and move to test modules the only-for-testing ones. [#434](https://github.com/dusk-network/plonk/issues/434)
28+
1229
### Changed
13-
- Updated the native errors to all originate from the same enum
30+
31+
- Constrained as much as possible the visibility of fns, structs and it's fields [#438](https://github.com/dusk-network/plonk/issues/438)]
32+
- Store the sparse repr of the PI and positions in a `BTreeMap` [#427](https://github.com/dusk-network/plonk/issues/427)
33+
- Transcript Init and trim size are associated constants of the Circuit trait [#351](https://github.com/dusk-network/plonk/issues/351)
34+
- Replace `collections::HashMap` by `hashbrown::HashMap`. [#424](https://github.com/dusk-network/plonk/issues/424)
35+
- `Circuit` trait now only requires `padded_circuit_size` for trimming. [#351](https://github.com/dusk-network/plonk/issues/351)
36+
- Remove `verify_proof` & `build_pi` from `Circuit`. [#396](https://github.com/dusk-network/plonk/issues/396)
37+
- Update API naming conventions to be standard across the crate. [#354](https://github.com/dusk-network/plonk/issues/354)
38+
- Updated the native errors to all originate from the same enum. [#343](https://github.com/dusk-network/plonk/issues/343)
1439

1540
## [0.5.1] - 02-02-21
41+
1642
### Changed
43+
1744
- Implement `Clone` for `PublicParameters` [#383](https://github.com/dusk-network/plonk/issues/383)
1845

1946
## [0.5.0] - 27-01-21
47+
2048
### Changed
49+
2150
- Upgrade canonical to v0.5 (#371)
2251
- Upgrade dusk-bls12_381 to v0.6
2352
- Upgrade dusk-jubjub to v0.8
2453

2554
## [0.4.0] - 26-01-21
55+
2656
### Fixed
57+
2758
- Heavy data structures from unchecked [#332](https://github.com/dusk-network/plonk/issues/332)
59+
2860
### Changed
61+
2962
- Refactored to/from_bytes criteria for some structs (#333)
3063
- API breaking - Implement to/from unchecked bytes for public parameters (#332)
3164

3265
## [0.3.6] - 17-12-20
33-
### Added
66+
67+
### Added
68+
3469
- To/From bytes impl for `PublicInput`.
70+
3571
### Changed
72+
3673
- Changed `compute_permutation_poly` to simpler version.
3774

3875
## [0.3.5] - 25-11-20
76+
3977
### Changed
78+
4079
- Changed `Proof` & `ProofEvaluations` byte conversion fn signatures.
80+
4181
### Added
82+
4283
- Implemented `Canon` for `Proof`.
4384

4485
## [0.3.4] - 02-11-20
86+
4587
### Changed
88+
4689
- dusk-jubjub update to `v0.5.0` with API renaming
4790
- dusk-bls12_381 update to `v0.3.0` with API renaming
4891

4992
## [0.3.3] - 02-11-20
93+
5094
### Added
95+
5196
- `canon` feature to manage `Canon` derivations usage in ecc libs.
97+
5298
### Changed
99+
53100
- dusk-jubjub update to `v0.4.0`
54101
- dusk-bls12_381 update to `v0.2.0`
55102

56103
## [0.3.2] - 29-10-20
104+
57105
### Changed
106+
58107
- dusk-bls12_381 update to `v0.1.5`
59108
- dusk-jubjub update to `v0.3.10`
60109
- Fixes #311 - big_mul and big_mul_gate documentation nit.
61110

62111
## [0.3.1] - 05-10-20
112+
63113
### Added
114+
64115
- Method to change the `trim_params_size` for the `Circuit` trait.
65116

66117
## [0.3.0] - 05-10-20
118+
67119
### Changed
120+
68121
- `Circuit` trait API & usability improvements (#313)
69122

70123
## [0.2.11] - 29-09-20
124+
71125
### Changed
126+
72127
- Now `Circuit` inputs are set in the circuit structure as `Option<T>`.
73128
- Make `PublicInput::value()` fn public.
74129
- Make pi_builder return `Result<T>`
75130
- Refactored examples for the `Circuit` trait impl
76-
according to the new changes.
131+
according to the new changes.
77132

78133
### Removed
134+
79135
- Removed `CircuitInputs` from the crate.
80136

81137
## [0.2.10] - 23-09-20
138+
82139
### Added
83-
- Added `CircuitBuilder` trait and a example for it.
140+
141+
- Added `CircuitBuilder` trait and a example for it.
84142

85143
## [0.2.9] - 11-09-20
144+
86145
### Added
146+
87147
- Added `ProverKey` & `Verifierkey` to the public API as exported types.
88148

89149
### Changed
90-
- Use `dusk-bls12_381 v0.1.4`.
91-
- Use `dusk-jubjub v0.3.8`.
150+
151+
- Use `dusk-bls12_381 v0.1.4`.
152+
- Use `dusk-jubjub v0.3.8`.
92153

93154
## [0.2.8] - 25-08-20
155+
94156
### Added
157+
95158
- Add a `variable_base_scalar_mul` method using a variable base curve add gate.
96159

97160
### Changed
98-
- `ecc::scalar_mul` now named fixed_base_scalar_mul
99161

162+
- `ecc::scalar_mul` now named fixed_base_scalar_mul
100163

101164
## [0.2.7] - 13-08-20
165+
102166
### Added
167+
103168
- `Anyhow` & `thiserror` for error handling support.
104169
- Serialisation methods for the crate public structures &
105-
`serde` support.
170+
`serde` support.
106171
- Add a `variable_base_scalar_mul` method using a variable base curve add gate.
172+
107173
### Removed
174+
108175
- `failure` for error support since has been deprecated.
109176

110177
### Changed
178+
111179
- `add_witness_to_circuit_description` requires now just to send
112-
a `Scalar` and returns a constant & constrained witness `Variable`.
180+
a `Scalar` and returns a constant & constrained witness `Variable`.
113181
- Update `add_witness_to_circuit_description` fn sig (#282, #284)
114182
- dusk-jubjub version updated to 0.3.6
115183
- `ecc::scalar_mul` now named fixed_base_scalar_mul
116184

117185
## [0.2.6] - 03-08-20
186+
118187
### Changed
188+
119189
- Make public inputs vector publicly accessible.
120190

121191
## [0.2.5] - 31-07-20
192+
122193
### Changed
194+
123195
- ECC Point from `ecc:scalar_mul` should have its attributes exposed.
124196

125197
## [0.2.4] - 29-07-20
198+
126199
### Changed
200+
127201
- Changed `dusk-jubjub` version to `v0.3.5` to fix Fr random gen.
128202

129203
## [0.2.3] - 28-07-20
204+
130205
### Changed
206+
131207
- Changed `dusk-jubjub` version to `v0.3.4` to update dhke generation.
132208

133209
## [0.2.2] - 25-07-20
210+
134211
### Added
212+
135213
- Method to create constrained witness values. @CPerezz
136214

137215
### Changed
216+
138217
- Visibility of the `Proof::verify()` fn to `pub(crate)`. @CPerezz
139218
- Changed `dusk-jubjub` version to `v0.3.3` since `v0.3.2` was yanked.
140219

141220
## [0.2.1] - 24-07-20 [yanked]
221+
142222
### Added
223+
143224
- Method to create constrained witness values. @CPerezz
144225

145226
### Changed
227+
146228
- Visibility of the `Proof::verify()` fn to `pub(crate)`. @CPerezz
147-
148229

149230
## [0.2.0] - 20-07-20
231+
150232
### Added
233+
151234
- Prover and Verifier abstraction @kevaundray
152235
- Error handling and custom errors @CPerezz
153236
- Add prelude file @CPerezz
@@ -159,17 +242,20 @@ a `Scalar` and returns a constant & constrained witness `Variable`.
159242
- Add identity separation challenge to each identity @kevaundray
160243

161244
### Changed
245+
162246
- Widget splitting to modularize the codebase @kevaundray
163247

164248
### Fixed
249+
165250
- Bug in "front-end" assertions in logic_constraint gates @CPerezz
166251
- Broken links in the docs @CPerezz
167252

168253
### Removed
169-
- Serde support for the time being.
170254

255+
- Serde support for the time being.
171256

172257
## [0.1.0] - 25-04-20
258+
173259
### Added
174260

175261
- PLONK algorithm implementation.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dusk-plonk"
3-
version = "0.5.1"
3+
version = "0.6.0"
44
authors = ["Kevaundray Wedderburn <[email protected]>",
55
"Luke Pearson <[email protected]>",
66
"CPerezz <[email protected]>"]
@@ -25,15 +25,15 @@ merlin = "2.0.0"
2525
rand = "0.7"
2626
rand_core = {version="0.5", default-features=false}
2727
dusk-bytes = "0.1"
28-
# Built by default with "std", "alloc", "pairing", "groups" and "endo" features.
2928
dusk-bls12_381 = "0.6"
3029
dusk-jubjub = "0.8"
3130
itertools = "0.9.0"
3231
rand_chacha = "0.2"
3332
rayon = "1.3.0"
34-
serde = "1.0"
33+
hashbrown = "0.9"
3534
# Dusk related deps for WASMI serde
3635
canonical = {version = "0.5", optional = true}
36+
canonical_derive = {version = "0.5", optional = true}
3737

3838
[dev-dependencies]
3939
tempdir = "0.3"
@@ -47,4 +47,4 @@ std = []
4747
nightly = []
4848
trace = []
4949
trace-print = ["trace"]
50-
canon = ["dusk-bls12_381/canon", "dusk-jubjub/canon", "canonical"]
50+
canon = ["dusk-bls12_381/canon", "dusk-jubjub/canon", "canonical", "canonical_derive"]

0 commit comments

Comments
 (0)