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

Turn Composer trait into a struct #803

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Improve InvalidCircuitSize error [#792]
- Hide all modules except 'prelude' [#782]
- Turn `Composer` trait into a struct [#802]
- Rename `Arithmetization` to `Gate` [#802]

### Removed

- Remove `Builder` struct with introduction of `Composer` struct [#802]

## [0.18.0] - 2023-12-13

Expand Down Expand Up @@ -542,6 +548,7 @@ is necessary since `rkyv/validation` was required as a bound.
- Proof system module.

<!-- ISSUES -->
[#802]: https://github.com/dusk-network/plonk/issues/802
[#797]: https://github.com/dusk-network/plonk/issues/797
[#796]: https://github.com/dusk-network/plonk/issues/796
[#792]: https://github.com/dusk-network/plonk/issues/792
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ pub struct TestCircuit {
}

impl Circuit for TestCircuit {
fn circuit<C>(&self, composer: &mut C) -> Result<(), Error>
where
C: Composer,
fn circuit(&self, composer: &mut Composer) -> Result<(), Error>
{
let a = composer.append_witness(self.a);
let b = composer.append_witness(self.b);
Expand Down
17 changes: 7 additions & 10 deletions benches/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ impl<const DEGREE: usize> Default for BenchCircuit<DEGREE> {
}

impl<const DEGREE: usize> Circuit for BenchCircuit<DEGREE> {
fn circuit<C>(&self, composer: &mut C) -> Result<(), Error>
where
C: Composer,
{
fn circuit(&self, composer: &mut Composer) -> Result<(), Error> {
let w_a = composer.append_witness(self.a);
let w_b = composer.append_witness(self.b);
let w_x = composer.append_witness(self.x);
Expand All @@ -59,19 +56,19 @@ impl<const DEGREE: usize> Circuit for BenchCircuit<DEGREE> {
composer.component_add_point(w_z, w_z);
composer.append_logic_and::<128>(w_a, w_b);
composer.append_logic_xor::<128>(w_a, w_b);
composer.component_boolean(C::ONE);
composer.component_boolean(Composer::ONE);
composer.component_decomposition::<254>(w_a);
composer.component_mul_generator(
w_y,
dusk_jubjub::GENERATOR_EXTENDED,
)?;
composer.component_mul_point(w_y, w_z);
composer.component_range::<128>(w_a);
composer.component_select(C::ONE, w_a, w_b);
composer.component_select_identity(C::ONE, w_z);
composer.component_select_one(C::ONE, w_a);
composer.component_select_point(C::ONE, w_z, w_z);
composer.component_select_zero(C::ONE, w_a);
composer.component_select(Composer::ONE, w_a, w_b);
composer.component_select_identity(Composer::ONE, w_z);
composer.component_select_one(Composer::ONE, w_a);
composer.component_select_point(Composer::ONE, w_z, w_z);
composer.component_select_zero(Composer::ONE, w_a);

diff = composer.constraints() - prev;
prev = composer.constraints();
Expand Down
Loading
Loading