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

Release version 0.6 #457

Merged
merged 91 commits into from
Mar 11, 2021
Merged

Release version 0.6 #457

merged 91 commits into from
Mar 11, 2021

Conversation

CPerezz
Copy link
Contributor

@CPerezz CPerezz commented Mar 11, 2021

[0.6.0] - 11-03-21

Added

  • Implement dusk_bytes::Serializable for all possible structures that need serde. #352
  • Introduced a new type that unifies the Public Inputs PublicInputValue. #416
  • Impl padded_circuit_size for VerifierKey #351
  • Impl a generic method that can verify Proofs of any Circuit. #396

Removed

  • Remove Canon impl for Proof. #450
  • Remove serde support completely from the repo. #353
  • Removed previous implementations attached to PublicInputValues. #416
  • Deprecated anyhow and thiserror. #343
  • Remove serialisation module and use single serialization fn's. #347
  • Remove uncessary match branch for var_c #414
  • Remove legacy fns and move to test modules the only-for-testing ones. #434

Changed

  • Constrained as much as possible the visibility of fns, structs and it's fields #438]
  • Store the sparse repr of the PI and positions in a BTreeMap #427
  • Transcript Init and trim size are associated constants of the Circuit trait #351
  • Replace collections::HashMap by hashbrown::HashMap. #424
  • Circuit trait now only requires padded_circuit_size for trimming. #351
  • Remove verify_proof & build_pi from Circuit. #396
  • Update API naming conventions to be standard across the crate. #354
  • Updated the native errors to all originate from the same enum. #343

Resolves: #458

CPerezz and others added 30 commits March 4, 2021 16:46
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.
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.
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.
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`.
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.
This also allows to test wether the support for the PI handling of the
Circuit trait is correct.
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.
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.
Composer PI handling & Circuit trait refactor
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.
Remove hyperlink from SNARK docs.
CPerezz and others added 17 commits March 9, 2021 10:51
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.
Crate serialization major refactor & standarization
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
- Remove `Canon` impl for `Proof`.
- Make the `std::Error` impl behind `std` flag.

Resolves: #450
Fix Error type used for Serializable impl Proof
Fix canon feature related compilation errors
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
Implement ID associated const for Circuit trait
@CPerezz CPerezz added the team:Core Low Level Core Development Team (Rust) label Mar 11, 2021
@CPerezz CPerezz requested review from ZER0 and vlopes11 March 11, 2021 15:32
@CPerezz CPerezz removed the request for review from vlopes11 March 11, 2021 15:39
Resolves: #458
@ZER0 ZER0 merged commit 8e431bf into master Mar 11, 2021
@ZER0 ZER0 deleted the release-0.6 branch March 11, 2021 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:Core Low Level Core Development Team (Rust)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release plonk v0.6
2 participants