-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `dusk-bls12_381` -> v0.12 - `dusk-jubjub` -> v0.13 Notable changes in the new versions: - jubjub point getters renamed - BlsScalar::random changed slightly
- Loading branch information
Showing
23 changed files
with
445 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Matteo's suggestion of restructuring the `Circuit` trait. | ||
|
||
1. Without the need to retain the private or public input values: | ||
```rust | ||
fn op<F>(f: F, a: u32, b: u32) -> u32 where F: Fn(u32, u32) -> u32 { | ||
f(a, b) | ||
} | ||
|
||
fn add(a: u32, b: u32) -> u32 { | ||
a + b | ||
} | ||
|
||
fn mul(a: u32, b: u32) -> u32 { | ||
a * b | ||
} | ||
``` | ||
|
||
2. With the option of retaining the private and public input values: | ||
```rust | ||
struct Foo<F> where F: Fn(u32, u32) -> u32 { | ||
a: u32, | ||
b: u32, | ||
callback: F | ||
} | ||
|
||
impl<F> Foo<F> where F: Fn(u32, u32) -> u32 { | ||
fn calc(&self) -> u32 { | ||
(self.callback)(self.a, self.b) | ||
} | ||
} | ||
|
||
fn main() { | ||
|
||
let foo = Foo { | ||
a: 10, | ||
b: 20, | ||
callback: add, | ||
}; | ||
|
||
println!("add: {}", op(add, 10, 20)); | ||
println!("mul: {}", op(mul, 10, 20)); | ||
|
||
println!("foo add: {}", foo.calc()); | ||
} | ||
``` | ||
|
||
Notes: | ||
- The funcitons `add` and `mul` would be different circuit implementation, returning the size of the circuit. | ||
- I wouldn't know how to search for the circuit implementation in the AST though. | ||
|
||
3. Another approach is the restructuring of the `Circuit` trait as proposed by Ed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.