Commit 8e431bf
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
File tree
67 files changed
+2904
-2388
lines changed- docs
- src
- commitment_scheme
- kzg10
- constraint_system
- ecc
- curve_addition
- scalar_mul
- fixed_base
- variable_base
- fft
- permutation
- proof_system
- widget
- arithmetic
- ecc
- curve_addition
- scalar_mul
- fixed_base
- variable_base
- logic
- permutation
- range
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| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
11 | 26 | | |
| 27 | + | |
| 28 | + | |
12 | 29 | | |
13 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
14 | 39 | | |
15 | 40 | | |
| 41 | + | |
16 | 42 | | |
| 43 | + | |
17 | 44 | | |
18 | 45 | | |
19 | 46 | | |
| 47 | + | |
20 | 48 | | |
| 49 | + | |
21 | 50 | | |
22 | 51 | | |
23 | 52 | | |
24 | 53 | | |
25 | 54 | | |
| 55 | + | |
26 | 56 | | |
| 57 | + | |
27 | 58 | | |
| 59 | + | |
28 | 60 | | |
| 61 | + | |
29 | 62 | | |
30 | 63 | | |
31 | 64 | | |
32 | 65 | | |
33 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
34 | 69 | | |
| 70 | + | |
35 | 71 | | |
| 72 | + | |
36 | 73 | | |
37 | 74 | | |
38 | 75 | | |
| 76 | + | |
39 | 77 | | |
| 78 | + | |
40 | 79 | | |
| 80 | + | |
41 | 81 | | |
| 82 | + | |
42 | 83 | | |
43 | 84 | | |
44 | 85 | | |
| 86 | + | |
45 | 87 | | |
| 88 | + | |
46 | 89 | | |
47 | 90 | | |
48 | 91 | | |
49 | 92 | | |
| 93 | + | |
50 | 94 | | |
| 95 | + | |
51 | 96 | | |
| 97 | + | |
52 | 98 | | |
| 99 | + | |
53 | 100 | | |
54 | 101 | | |
55 | 102 | | |
56 | 103 | | |
| 104 | + | |
57 | 105 | | |
| 106 | + | |
58 | 107 | | |
59 | 108 | | |
60 | 109 | | |
61 | 110 | | |
62 | 111 | | |
| 112 | + | |
63 | 113 | | |
| 114 | + | |
64 | 115 | | |
65 | 116 | | |
66 | 117 | | |
| 118 | + | |
67 | 119 | | |
| 120 | + | |
68 | 121 | | |
69 | 122 | | |
70 | 123 | | |
| 124 | + | |
71 | 125 | | |
| 126 | + | |
72 | 127 | | |
73 | 128 | | |
74 | 129 | | |
75 | 130 | | |
76 | | - | |
| 131 | + | |
77 | 132 | | |
78 | 133 | | |
| 134 | + | |
79 | 135 | | |
80 | 136 | | |
81 | 137 | | |
| 138 | + | |
82 | 139 | | |
83 | | - | |
| 140 | + | |
| 141 | + | |
84 | 142 | | |
85 | 143 | | |
| 144 | + | |
86 | 145 | | |
| 146 | + | |
87 | 147 | | |
88 | 148 | | |
89 | 149 | | |
90 | | - | |
91 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
92 | 153 | | |
93 | 154 | | |
| 155 | + | |
94 | 156 | | |
| 157 | + | |
95 | 158 | | |
96 | 159 | | |
97 | 160 | | |
98 | | - | |
99 | 161 | | |
| 162 | + | |
100 | 163 | | |
101 | 164 | | |
| 165 | + | |
102 | 166 | | |
| 167 | + | |
103 | 168 | | |
104 | 169 | | |
105 | | - | |
| 170 | + | |
106 | 171 | | |
| 172 | + | |
107 | 173 | | |
| 174 | + | |
108 | 175 | | |
109 | 176 | | |
110 | 177 | | |
| 178 | + | |
111 | 179 | | |
112 | | - | |
| 180 | + | |
113 | 181 | | |
114 | 182 | | |
115 | 183 | | |
116 | 184 | | |
117 | 185 | | |
| 186 | + | |
118 | 187 | | |
| 188 | + | |
119 | 189 | | |
120 | 190 | | |
121 | 191 | | |
| 192 | + | |
122 | 193 | | |
| 194 | + | |
123 | 195 | | |
124 | 196 | | |
125 | 197 | | |
| 198 | + | |
126 | 199 | | |
| 200 | + | |
127 | 201 | | |
128 | 202 | | |
129 | 203 | | |
| 204 | + | |
130 | 205 | | |
| 206 | + | |
131 | 207 | | |
132 | 208 | | |
133 | 209 | | |
| 210 | + | |
134 | 211 | | |
| 212 | + | |
135 | 213 | | |
136 | 214 | | |
137 | 215 | | |
| 216 | + | |
138 | 217 | | |
139 | 218 | | |
140 | 219 | | |
141 | 220 | | |
| 221 | + | |
142 | 222 | | |
| 223 | + | |
143 | 224 | | |
144 | 225 | | |
145 | 226 | | |
| 227 | + | |
146 | 228 | | |
147 | | - | |
148 | 229 | | |
149 | 230 | | |
| 231 | + | |
150 | 232 | | |
| 233 | + | |
151 | 234 | | |
152 | 235 | | |
153 | 236 | | |
| |||
159 | 242 | | |
160 | 243 | | |
161 | 244 | | |
| 245 | + | |
162 | 246 | | |
163 | 247 | | |
164 | 248 | | |
| 249 | + | |
165 | 250 | | |
166 | 251 | | |
167 | 252 | | |
168 | 253 | | |
169 | | - | |
170 | 254 | | |
| 255 | + | |
171 | 256 | | |
172 | 257 | | |
| 258 | + | |
173 | 259 | | |
174 | 260 | | |
175 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
0 commit comments