-
Notifications
You must be signed in to change notification settings - Fork 200
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
chore(perf): Simplify poseidon2 algorithm #5811
chore(perf): Simplify poseidon2 algorithm #5811
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I wondered whether this could cause issues if someone manually cloned the Poseidon2Hasher
struct to provide both the hash of a prefix and the hash of the whole collection efficiently, i.e. hash([a, b, c])
and hash([a, b, c, d, ..])
, but the following test both executes w/o error and prints the same results as before:
use std::hash::poseidon2;
fn main() {
let mut hasher_1 = poseidon2::Poseidon2Hasher::default();
for _ in 0..128 {
hasher_1.write(42);
}
hasher_1.write(1);
let mut hasher_2 = poseidon2::Poseidon2Hasher { _state: hasher_1._state };
for _ in 0..128 {
hasher_2.write(42);
}
let result_1 = hasher_1.finish();
hasher_2.write(2);
let result_2 = hasher_2.finish();
let mut hasher_3 = poseidon2::Poseidon2Hasher::default();
for _ in 0..128 {
hasher_3.write(42);
}
hasher_3.write(1);
for _ in 0..128 {
hasher_3.write(42);
}
hasher_3.write(2);
let result_3 = hasher_3.finish();
assert(result_2 == result_3);
println(result_1);
println(result_2);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I just wonder why the code was like this, as if it was done to work also in other 'mode'
Looks like it. But we never use the other "mode" so I figured we should delete it. If we want it back, we can bring it back. |
chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
* master: (35 commits) fix!: Check unused generics are bound (#5840) chore(perf): Simplify poseidon2 algorithm (#5811) chore: redo typo PR by nnsW3 (#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (#5827) chore: crypto blackbox tests (#5614) feat: Improve "type annotations needed" errors (#5830) chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (#5421) chore: delete wip fuzzing files that got accidentally added (#5829) chore: test ACVM `BigInt` (#5559) fix(docs): Fix file paths for metaprogramming docs (#5826) fix: bit shifting type checking (#5824) feat: add Expr::as_method_call (#5822) chore: Fix docs typo (#5821) feat: add `UnresolvedType::is_field` and `Expr::as_assign` (#5804) chore: Add docs for each comptime method (#5802) chore: Add comptime docs (#5800) fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (#5788) fix(acir_gen): Nested dynamic array initialization (#5810) fix: honor function visibility in LSP completion (#5809) ...
* master: (29 commits) fix!: Check unused generics are bound (#5840) chore(perf): Simplify poseidon2 algorithm (#5811) chore: redo typo PR by nnsW3 (#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (#5827) chore: crypto blackbox tests (#5614) feat: Improve "type annotations needed" errors (#5830) chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (#5421) chore: delete wip fuzzing files that got accidentally added (#5829) chore: test ACVM `BigInt` (#5559) fix(docs): Fix file paths for metaprogramming docs (#5826) fix: bit shifting type checking (#5824) feat: add Expr::as_method_call (#5822) chore: Fix docs typo (#5821) feat: add `UnresolvedType::is_field` and `Expr::as_assign` (#5804) chore: Add docs for each comptime method (#5802) chore: Add comptime docs (#5800) fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (#5788) fix(acir_gen): Nested dynamic array initialization (#5810) fix: honor function visibility in LSP completion (#5809) ...
…g/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
…inition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
…ir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
* master: (21 commits) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (#5859) feat: LSP signature help for assert and assert_eq (#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (#5861) feat: show backtrace on comptime assertion failures (#5842) feat: add `Expr::as_assert` (#5857) chore: underconstrained check in parallel (#5848) feat(meta): Comptime keccak (#5854) feat(optimization): Avoid merging identical (by ID) arrays (#5853) feat: add `FunctionDef::body` (#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (#5838) feat: remove unnecessary copying of vector size during reversal (#5852) chore: Add missing cases to arithmetic generics (#5841) feat: warn on unused imports (#5847) chore: add documentation to `to_be_bytes`, etc. (#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (#5845) fix!: Check unused generics are bound (#5840) chore(perf): Simplify poseidon2 algorithm (#5811) chore: redo typo PR by nnsW3 (#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (#5760) ...
feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: add `Type::as_string` (noir-lang/noir#5871) feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827) END_COMMIT_OVERRIDE --------- Co-authored-by: Tom French <tom@tomfren.ch> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.52.0</summary> ## [0.52.0](aztec-package-v0.51.1...aztec-package-v0.52.0) (2024-09-01) ### Miscellaneous * **aztec-package:** Synchronize aztec-packages versions </details> <details><summary>barretenberg.js: 0.52.0</summary> ## [0.52.0](barretenberg.js-v0.51.1...barretenberg.js-v0.52.0) (2024-09-01) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.52.0</summary> ## [0.52.0](aztec-packages-v0.51.1...aztec-packages-v0.52.0) (2024-09-01) ### ⚠ BREAKING CHANGES * Check unused generics are bound (noir-lang/noir#5840) ### Features * Add `Expr::as_assert` (noir-lang/noir#5857) ([cf5b667](cf5b667)) * Add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) ([cf5b667](cf5b667)) * Add `FunctionDef::body` (noir-lang/noir#5825) ([cf5b667](cf5b667)) * Add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) ([cf5b667](cf5b667)) * Add `Type::as_string` (noir-lang/noir#5871) ([cf5b667](cf5b667)) * Clarify state in Protogalaxy 3 ([#8181](#8181)) ([4a9bb9d](4a9bb9d)) * LSP signature help for assert and assert_eq (noir-lang/noir#5862) ([cf5b667](cf5b667)) * **meta:** Comptime keccak (noir-lang/noir#5854) ([cf5b667](cf5b667)) * **optimization:** Avoid merging identical (by ID) arrays (noir-lang/noir#5853) ([cf5b667](cf5b667)) * **perf:** Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) ([cf5b667](cf5b667)) * Populate epoch 0 from initial validator set ([#8286](#8286)) ([cbdec54](cbdec54)) * Remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) ([cf5b667](cf5b667)) * Removing `is_dev_net` flag ([#8275](#8275)) ([fc1f307](fc1f307)) * Show backtrace on comptime assertion failures (noir-lang/noir#5842) ([cf5b667](cf5b667)) * Simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) ([cf5b667](cf5b667)) * Sync from aztec-packages (noir-lang/noir#5790) ([cf5b667](cf5b667)) * Warn on unused imports (noir-lang/noir#5847) ([cf5b667](cf5b667)) ### Bug Fixes * Check unused generics are bound (noir-lang/noir#5840) ([cf5b667](cf5b667)) * Enforce parity of sequencer tx validation and node tx validation ([#7951](#7951)) ([c7eaf92](c7eaf92)) * Make simulations validate resulting tx by default ([#8157](#8157)) ([f5e388d](f5e388d)) * **nargo:** Resolve Brillig assertion payloads (noir-lang/noir#5872) ([cf5b667](cf5b667)) * Prevent honk proof from getting stale inputs on syncs ([#8293](#8293)) ([2598108](2598108)) * Remove fee juice mint public ([#8260](#8260)) ([2395af3](2395af3)) * **sha256:** Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) ([cf5b667](cf5b667)) * **sha256:** Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) ([cf5b667](cf5b667)) * **sha256:** Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) ([cf5b667](cf5b667)) ### Miscellaneous * Add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) ([cf5b667](cf5b667)) * Add missing cases to arithmetic generics (noir-lang/noir#5841) ([cf5b667](cf5b667)) * Add test to reproduce [#8306](#8306) ([41d418c](41d418c)) * Alert slack on Sepolia test ([#8263](#8263)) ([6194b94](6194b94)) * **bb:** Make compile on stock mac clang ([#8278](#8278)) ([7af80ff](7af80ff)) * **bb:** More graceful pippenger on non-powers-of-2 ([#8279](#8279)) ([104ea85](104ea85)) * Bump noir-bignum to 0.3.2 ([#8276](#8276)) ([4c6fe1a](4c6fe1a)) * **ci:** Try to debug 'command brotli not found' ([#8305](#8305)) ([9ee8dd6](9ee8dd6)) * Don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) ([cf5b667](cf5b667)) * Fix a bunch of generics issues in aztec-nr ([#8295](#8295)) ([6e84970](6e84970)) * Fix more issues with generics ([#8302](#8302)) ([4e2ce80](4e2ce80)) * Fix warnings in `avm-transpiler` ([#8307](#8307)) ([359fe05](359fe05)) * Introduce the Visitor pattern (noir-lang/noir#5868) ([cf5b667](cf5b667)) * **perf:** Simplify poseidon2 algorithm (noir-lang/noir#5811) ([cf5b667](cf5b667)) * **perf:** Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827) ([cf5b667](cf5b667)) * Redo typo PR by nnsW3 (noir-lang/noir#5834) ([cf5b667](cf5b667)) * Renaming around Protogalaxy Prover ([#8272](#8272)) ([be2169d](be2169d)) * Replace relative paths to noir-protocol-circuits ([56e3fbf](56e3fbf)) * Replace relative paths to noir-protocol-circuits ([1b245c4](1b245c4)) * Replace relative paths to noir-protocol-circuits ([9c3bc43](9c3bc43)) * **revert:** Earthfile accidental change ([#8309](#8309)) ([2d3e0b6](2d3e0b6)) * Underconstrained check in parallel (noir-lang/noir#5848) ([cf5b667](cf5b667)) ### Documentation * **bb:** Transcript spec ([#8301](#8301)) ([18abf37](18abf37)) </details> <details><summary>barretenberg: 0.52.0</summary> ## [0.52.0](barretenberg-v0.51.1...barretenberg-v0.52.0) (2024-09-01) ### Features * Clarify state in Protogalaxy 3 ([#8181](#8181)) ([4a9bb9d](4a9bb9d)) ### Bug Fixes * Prevent honk proof from getting stale inputs on syncs ([#8293](#8293)) ([2598108](2598108)) ### Miscellaneous * **bb:** Make compile on stock mac clang ([#8278](#8278)) ([7af80ff](7af80ff)) * **bb:** More graceful pippenger on non-powers-of-2 ([#8279](#8279)) ([104ea85](104ea85)) * Renaming around Protogalaxy Prover ([#8272](#8272)) ([be2169d](be2169d)) * **revert:** Earthfile accidental change ([#8309](#8309)) ([2d3e0b6](2d3e0b6)) ### Documentation * **bb:** Transcript spec ([#8301](#8301)) ([18abf37](18abf37)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.52.0</summary> ## [0.52.0](AztecProtocol/aztec-packages@aztec-package-v0.51.1...aztec-package-v0.52.0) (2024-09-01) ### Miscellaneous * **aztec-package:** Synchronize aztec-packages versions </details> <details><summary>barretenberg.js: 0.52.0</summary> ## [0.52.0](AztecProtocol/aztec-packages@barretenberg.js-v0.51.1...barretenberg.js-v0.52.0) (2024-09-01) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.52.0</summary> ## [0.52.0](AztecProtocol/aztec-packages@aztec-packages-v0.51.1...aztec-packages-v0.52.0) (2024-09-01) ### ⚠ BREAKING CHANGES * Check unused generics are bound (noir-lang/noir#5840) ### Features * Add `Expr::as_assert` (noir-lang/noir#5857) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add `FunctionDef::body` (noir-lang/noir#5825) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add `Type::as_string` (noir-lang/noir#5871) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Clarify state in Protogalaxy 3 ([#8181](AztecProtocol/aztec-packages#8181)) ([4a9bb9d](AztecProtocol/aztec-packages@4a9bb9d)) * LSP signature help for assert and assert_eq (noir-lang/noir#5862) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **meta:** Comptime keccak (noir-lang/noir#5854) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **optimization:** Avoid merging identical (by ID) arrays (noir-lang/noir#5853) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **perf:** Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Populate epoch 0 from initial validator set ([#8286](AztecProtocol/aztec-packages#8286)) ([cbdec54](AztecProtocol/aztec-packages@cbdec54)) * Remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Removing `is_dev_net` flag ([#8275](AztecProtocol/aztec-packages#8275)) ([fc1f307](AztecProtocol/aztec-packages@fc1f307)) * Show backtrace on comptime assertion failures (noir-lang/noir#5842) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Sync from aztec-packages (noir-lang/noir#5790) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Warn on unused imports (noir-lang/noir#5847) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) ### Bug Fixes * Check unused generics are bound (noir-lang/noir#5840) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Enforce parity of sequencer tx validation and node tx validation ([#7951](AztecProtocol/aztec-packages#7951)) ([c7eaf92](AztecProtocol/aztec-packages@c7eaf92)) * Make simulations validate resulting tx by default ([#8157](AztecProtocol/aztec-packages#8157)) ([f5e388d](AztecProtocol/aztec-packages@f5e388d)) * **nargo:** Resolve Brillig assertion payloads (noir-lang/noir#5872) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Prevent honk proof from getting stale inputs on syncs ([#8293](AztecProtocol/aztec-packages#8293)) ([2598108](AztecProtocol/aztec-packages@2598108)) * Remove fee juice mint public ([#8260](AztecProtocol/aztec-packages#8260)) ([2395af3](AztecProtocol/aztec-packages@2395af3)) * **sha256:** Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **sha256:** Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **sha256:** Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) ### Miscellaneous * Add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add missing cases to arithmetic generics (noir-lang/noir#5841) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Add test to reproduce [#8306](AztecProtocol/aztec-packages#8306) ([41d418c](AztecProtocol/aztec-packages@41d418c)) * Alert slack on Sepolia test ([#8263](AztecProtocol/aztec-packages#8263)) ([6194b94](AztecProtocol/aztec-packages@6194b94)) * **bb:** Make compile on stock mac clang ([#8278](AztecProtocol/aztec-packages#8278)) ([7af80ff](AztecProtocol/aztec-packages@7af80ff)) * **bb:** More graceful pippenger on non-powers-of-2 ([#8279](AztecProtocol/aztec-packages#8279)) ([104ea85](AztecProtocol/aztec-packages@104ea85)) * Bump noir-bignum to 0.3.2 ([#8276](AztecProtocol/aztec-packages#8276)) ([4c6fe1a](AztecProtocol/aztec-packages@4c6fe1a)) * **ci:** Try to debug 'command brotli not found' ([#8305](AztecProtocol/aztec-packages#8305)) ([9ee8dd6](AztecProtocol/aztec-packages@9ee8dd6)) * Don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Fix a bunch of generics issues in aztec-nr ([#8295](AztecProtocol/aztec-packages#8295)) ([6e84970](AztecProtocol/aztec-packages@6e84970)) * Fix more issues with generics ([#8302](AztecProtocol/aztec-packages#8302)) ([4e2ce80](AztecProtocol/aztec-packages@4e2ce80)) * Fix warnings in `avm-transpiler` ([#8307](AztecProtocol/aztec-packages#8307)) ([359fe05](AztecProtocol/aztec-packages@359fe05)) * Introduce the Visitor pattern (noir-lang/noir#5868) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **perf:** Simplify poseidon2 algorithm (noir-lang/noir#5811) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * **perf:** Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Redo typo PR by nnsW3 (noir-lang/noir#5834) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) * Renaming around Protogalaxy Prover ([#8272](AztecProtocol/aztec-packages#8272)) ([be2169d](AztecProtocol/aztec-packages@be2169d)) * Replace relative paths to noir-protocol-circuits ([56e3fbf](AztecProtocol/aztec-packages@56e3fbf)) * Replace relative paths to noir-protocol-circuits ([1b245c4](AztecProtocol/aztec-packages@1b245c4)) * Replace relative paths to noir-protocol-circuits ([9c3bc43](AztecProtocol/aztec-packages@9c3bc43)) * **revert:** Earthfile accidental change ([#8309](AztecProtocol/aztec-packages#8309)) ([2d3e0b6](AztecProtocol/aztec-packages@2d3e0b6)) * Underconstrained check in parallel (noir-lang/noir#5848) ([cf5b667](AztecProtocol/aztec-packages@cf5b667)) ### Documentation * **bb:** Transcript spec ([#8301](AztecProtocol/aztec-packages#8301)) ([18abf37](AztecProtocol/aztec-packages@18abf37)) </details> <details><summary>barretenberg: 0.52.0</summary> ## [0.52.0](AztecProtocol/aztec-packages@barretenberg-v0.51.1...barretenberg-v0.52.0) (2024-09-01) ### Features * Clarify state in Protogalaxy 3 ([#8181](AztecProtocol/aztec-packages#8181)) ([4a9bb9d](AztecProtocol/aztec-packages@4a9bb9d)) ### Bug Fixes * Prevent honk proof from getting stale inputs on syncs ([#8293](AztecProtocol/aztec-packages#8293)) ([2598108](AztecProtocol/aztec-packages@2598108)) ### Miscellaneous * **bb:** Make compile on stock mac clang ([#8278](AztecProtocol/aztec-packages#8278)) ([7af80ff](AztecProtocol/aztec-packages@7af80ff)) * **bb:** More graceful pippenger on non-powers-of-2 ([#8279](AztecProtocol/aztec-packages#8279)) ([104ea85](AztecProtocol/aztec-packages@104ea85)) * Renaming around Protogalaxy Prover ([#8272](AztecProtocol/aztec-packages#8272)) ([be2169d](AztecProtocol/aztec-packages@be2169d)) * **revert:** Earthfile accidental change ([#8309](AztecProtocol/aztec-packages#8309)) ([2d3e0b6](AztecProtocol/aztec-packages@2d3e0b6)) ### Documentation * **bb:** Transcript spec ([#8301](AztecProtocol/aztec-packages#8301)) ([18abf37](AztecProtocol/aztec-packages@18abf37)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: add `Type::as_string` (noir-lang/noir#5871) feat: add `FunctionDef::has_named_attribute` (noir-lang/noir#5870) chore: introduce the Visitor pattern (noir-lang/noir#5868) fix(nargo): Resolve Brillig assertion payloads (noir-lang/noir#5872) feat(perf): Simplify poseidon2 cache zero-pad (noir-lang/noir#5869) feat: Sync from aztec-packages (noir-lang/noir#5790) feat: add `Expr::resolve` and `TypedExpr::as_function_definition` (noir-lang/noir#5859) feat: LSP signature help for assert and assert_eq (noir-lang/noir#5862) fix(sha256): Add extra checks against message size when constructing msg blocks (noir-lang/noir#5861) feat: show backtrace on comptime assertion failures (noir-lang/noir#5842) feat: add `Expr::as_assert` (noir-lang/noir#5857) chore: underconstrained check in parallel (noir-lang/noir#5848) feat(meta): Comptime keccak (noir-lang/noir#5854) feat(optimization): Avoid merging identical (by ID) arrays (noir-lang/noir#5853) feat: add `FunctionDef::body` (noir-lang/noir#5825) fix(sha256): Fix upper bound when building msg block and delay final block compression under certain cases (noir-lang/noir#5838) feat: remove unnecessary copying of vector size during reversal (noir-lang/noir#5852) chore: Add missing cases to arithmetic generics (noir-lang/noir#5841) feat: warn on unused imports (noir-lang/noir#5847) chore: add documentation to `to_be_bytes`, etc. (noir-lang/noir#5843) feat: simplify constant calls to `poseidon2_permutation`, `schnorr_verify` and `embedded_curve_add` (noir-lang/noir#5140) chore: don't require empty `Prover.toml` for programs with zero arguments but a return value (noir-lang/noir#5845) fix!: Check unused generics are bound (noir-lang/noir#5840) chore(perf): Simplify poseidon2 algorithm (noir-lang/noir#5811) chore: redo typo PR by nnsW3 (noir-lang/noir#5834) fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (noir-lang/noir#5760) chore(perf): Update to stdlib keccak for reduced Brillig code size (noir-lang/noir#5827) END_COMMIT_OVERRIDE --------- Co-authored-by: Tom French <tom@tomfren.ch> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Description
Problem*
Resolves
Optimizations found while looking exploring other Brillig opts.
Summary*
There are a couple optimizations here:
squeeze
ofPoseidon2
. However, we ourHasher
always creates a fresh Poseidon2 object so it seems unnecessary to reset the cache in this way. In Brillig this leads to an extra loop that is essentially unused and blows up the code size of any programs using poseidon in an unconstrained environment.result
array and returning it fromperform_duplex
. This result was unused inside ofabsorb
and we can directly accessself.state
inside ofsqueeze
. I no longer return anything fromperform_duplex
.Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.