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

feat: Sha256 refactoring and benchmark with longer input #6318

Merged
merged 20 commits into from
Oct 23, 2024

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Oct 22, 2024

Description

Problem*

Preparation for #6304

Summary*

Preparation for changing the message block type in sha256.nr:

  • Added some type aliases and extra comments, rearranged some functions
  • Added a new benchmark program with longer input so that we exercise the iteration and the last partial block as well
  • Running the criterion benchmarks with and without the --force-brillig option, to cover what the AVM would do
  • Added an option to the stdlib-tests.rs to pass a filter for test names

This is purely to make it a bit easier to see what is going on and to establish some baseline before trying to make changes.

Tried to rationalise the code a bit:

  • Removed pad_msg_block: based on the constraints put on its results it looked like it's forbidden from doing anything. This allows the removal of some constraints because for example msg_block and last_block are equal by definition. Here's just that diff.
  • Moved the verification of padding with zeroes after the input into the verify_block_msg_padding function. This is only called for the last (partially filled) block.

According to the Circuit Size report below 👇 there is a 33% reduction in the number of ACIR opcodes in some of the SHA256 benchmarks.

Testing

cargo test -p nargo_cli --test stdlib-tests -- run_stdlib_tests sha256
cargo test -p nargo_cli --test stdlib-props fuzz_sha256

Benchmarking

cargo bench -p nargo_cli --bench criterion sha256_long

The baseline benchmarks on my machine as of c600000 were as follows:

cargo bench -p nargo_cli --bench criterion sha256_long
...
bench_sha256_long_execute
                        time:   [1.3613 ms 1.3688 ms 1.3782 ms]
bench_sha256_long_execute_brillig
                        time:   [286.64 µs 287.67 µs 288.96 µs]

For some reason after merging master into the PR the performance is worse in 636c9e9

cargo bench -p nargo_cli --bench criterion sha256_long
...
bench_sha256_long_execute
                        time:   [1.7297 ms 1.7918 ms 1.8675 ms]
                        change: [+27.365% +29.911% +32.673%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 2 outliers among 20 measurements (10.00%)
  2 (10.00%) high severe

bench_sha256_long_execute_brillig
                        time:   [354.12 µs 360.31 µs 368.45 µs]
                        change: [+22.390% +24.264% +27.161%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 1 outliers among 20 measurements (5.00%)
  1 (5.00%) high severe

Maxim: We did just sync aztec packages which now conditionally inlines functions (we previously used to always inline functions). This may be the cause of some execution time increases.

Here's the diff between those commits.

Additional Context

In a follow-up PR I'll try to change the type of msg_block from [u8; 64] to [u32; 16] to avoid having to call msg_u8_to_u32. This should at least have the benefit of copying the array fewer times: at the moment an array copy is made every time an item in it is written to; with 16 items instead of 64 we get up to 4x less copies.

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

github-actions bot commented Oct 22, 2024

Changes to Brillig bytecode sizes

Generated at commit: b0554a626ba85b9ca92ce09024a59f2ea5bd6ec7, compared to commit: 8dec84793d200dcb524aa5c397d0a84d38974e7e

🧾 Summary (10% most significant diffs)

Program Brillig opcodes (+/-) %
conditional_regression_short_circuit -101 ✅ -7.61%
sha256_var_witness_const_regression -101 ✅ -7.88%
sha256 -151 ✅ -8.08%

Full diff report 👇
Program Brillig opcodes (+/-) %
sha2_byte 3,105 (-51) -1.62%
brillig_cow_regression 2,209 (-51) -2.26%
conditional_1 1,207 (-51) -4.05%
sha256_regression 6,609 (-301) -4.36%
array_dynamic_blackbox_input 1,106 (-51) -4.41%
sha256_var_size_regression 1,812 (-101) -5.28%
ecdsa_secp256k1 911 (-51) -5.30%
array_dynamic_nested_blackbox_input 887 (-51) -5.44%
6 1,656 (-101) -5.75%
sha256_var_padding_regression 4,735 (-301) -5.98%
regression_4449 757 (-51) -6.31%
brillig_sha256 698 (-51) -6.81%
conditional_regression_short_circuit 1,227 (-101) -7.61%
sha256_var_witness_const_regression 1,180 (-101) -7.88%
sha256 1,717 (-151) -8.08%

@aakoshh aakoshh marked this pull request as ready for review October 22, 2024 20:23
@aakoshh aakoshh requested a review from vezenovm October 22, 2024 20:30
Copy link
Contributor

github-actions bot commented Oct 22, 2024

Changes to circuit sizes

Generated at commit: b0554a626ba85b9ca92ce09024a59f2ea5bd6ec7, compared to commit: 8dec84793d200dcb524aa5c397d0a84d38974e7e

🧾 Summary (10% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
regression_4449 -8,820 ✅ -33.32% -10,395 ✅ -3.40%
bench_sha256_30 -3,870 ✅ -33.14% -4,727 ✅ -3.56%
bench_sha256_100 -12,900 ✅ -33.15% -15,752 ✅ -3.63%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
sha256_regression 39,233 (+52) +0.13% 202,513 (-189) -0.09%
sha2_byte 20,161 (-129) -0.64% 93,861 (-159) -0.17%
sha256_var_padding_regression 14,288 (-774) -5.14% 208,517 (-395) -0.19%
ecdsa_secp256k1 638 (-129) -16.82% 43,707 (-105) -0.24%
sha256_var_witness_const_regression 2,138 (+155) +7.82% 18,205 (-47) -0.26%
array_dynamic_blackbox_input 1,732 (-258) -12.96% 22,680 (-131) -0.57%
sha256 2,436 (+26) +1.08% 22,398 (-205) -0.91%
conditional_1 4,496 (-129) -2.79% 12,698 (-152) -1.18%
array_dynamic_nested_blackbox_input 367 (-129) -26.01% 7,966 (-155) -1.91%
bench_sha256 269 (-129) -32.41% 7,672 (-158) -2.02%
conditional_regression_short_circuit 591 (-258) -30.39% 11,923 (-306) -2.50%
6 563 (-258) -31.43% 11,897 (-308) -2.52%
sha256_var_size_regression 17,682 (-1,552) -8.07% 72,507 (-2,090) -2.80%
regression_4449 17,647 (-8,820) -33.32% 295,719 (-10,395) -3.40%
bench_sha256_30 7,809 (-3,870) -33.14% 128,030 (-4,727) -3.56%
bench_sha256_100 26,009 (-12,900) -33.15% 418,546 (-15,752) -3.63%

@aakoshh aakoshh requested a review from TomAFrench October 22, 2024 21:44
@aakoshh aakoshh changed the title feat: Sha256 benchmark with longer input feat: Sha256 refactoring and benchmark with longer input Oct 22, 2024
Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Good spot on pad_msg_block

@aakoshh aakoshh added this pull request to the merge queue Oct 23, 2024
Merged via the queue into master with commit d606491 Oct 23, 2024
49 checks passed
@aakoshh aakoshh deleted the 6304-sha-msg-block-size branch October 23, 2024 13:29
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 23, 2024
…ompilation time (noir-lang/noir#6307)

chore: update `noir-edwards` repo to point at `noir-lang` org (noir-lang/noir#6323)
feat: Sha256 refactoring and benchmark with longer input (noir-lang/noir#6318)
chore: Release Noir(0.36.0) (noir-lang/noir#6213)
chore: remove usage of slices in pedersen hash (noir-lang/noir#6295)
chore: remove dead function (noir-lang/noir#6308)
feat: new formatter (noir-lang/noir#6300)
feat: Sync from aztec-packages (noir-lang/noir#6301)
fix: Allow array map on empty arrays (noir-lang/noir#6305)
fix: Display function name and body when inlining recursion limit hit (noir-lang/noir#6291)
feat(interpreter): Comptime derive generators (noir-lang/noir#6303)
fix: enforce correctness of decompositions performed at compile time (noir-lang/noir#6278)
feat: Warn about private types leaking in public functions and struct fields (noir-lang/noir#6296)
chore(docs): refactoring guides and some other nits (noir-lang/noir#6175)
fix: Do not warn on unused self in traits (noir-lang/noir#6298)
fix: Reject invalid expression with in CLI parser (noir-lang/noir#6287)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 23, 2024
…ime (noir-lang/noir#6307)

chore: update `noir-edwards` repo to point at `noir-lang` org (noir-lang/noir#6323)
feat: Sha256 refactoring and benchmark with longer input (noir-lang/noir#6318)
chore: Release Noir(0.36.0) (noir-lang/noir#6213)
chore: remove usage of slices in pedersen hash (noir-lang/noir#6295)
chore: remove dead function (noir-lang/noir#6308)
feat: new formatter (noir-lang/noir#6300)
feat: Sync from aztec-packages (noir-lang/noir#6301)
fix: Allow array map on empty arrays (noir-lang/noir#6305)
fix: Display function name and body when inlining recursion limit hit (noir-lang/noir#6291)
feat(interpreter): Comptime derive generators (noir-lang/noir#6303)
fix: enforce correctness of decompositions performed at compile time (noir-lang/noir#6278)
feat: Warn about private types leaking in public functions and struct fields (noir-lang/noir#6296)
chore(docs): refactoring guides and some other nits (noir-lang/noir#6175)
fix: Do not warn on unused self in traits (noir-lang/noir#6298)
fix: Reject invalid expression with in CLI parser (noir-lang/noir#6287)
TomAFrench added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 23, 2024
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
feat(ssa): Various mem2reg reverts to reduce memory and compilation time
(noir-lang/noir#6307)
chore: update `noir-edwards` repo to point at `noir-lang` org
(noir-lang/noir#6323)
feat: Sha256 refactoring and benchmark with longer input
(noir-lang/noir#6318)
chore: Release Noir(0.36.0)
(noir-lang/noir#6213)
chore: remove usage of slices in pedersen hash
(noir-lang/noir#6295)
chore: remove dead function
(noir-lang/noir#6308)
feat: new formatter (noir-lang/noir#6300)
feat: Sync from aztec-packages
(noir-lang/noir#6301)
fix: Allow array map on empty arrays
(noir-lang/noir#6305)
fix: Display function name and body when inlining recursion limit hit
(noir-lang/noir#6291)
feat(interpreter): Comptime derive generators
(noir-lang/noir#6303)
fix: enforce correctness of decompositions performed at compile time
(noir-lang/noir#6278)
feat: Warn about private types leaking in public functions and struct
fields (noir-lang/noir#6296)
chore(docs): refactoring guides and some other nits
(noir-lang/noir#6175)
fix: Do not warn on unused self in traits
(noir-lang/noir#6298)
fix: Reject invalid expression with in CLI parser
(noir-lang/noir#6287)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
AztecBot added a commit to AztecProtocol/aztec-nr that referenced this pull request Oct 24, 2024
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
feat(ssa): Various mem2reg reverts to reduce memory and compilation time
(noir-lang/noir#6307)
chore: update `noir-edwards` repo to point at `noir-lang` org
(noir-lang/noir#6323)
feat: Sha256 refactoring and benchmark with longer input
(noir-lang/noir#6318)
chore: Release Noir(0.36.0)
(noir-lang/noir#6213)
chore: remove usage of slices in pedersen hash
(noir-lang/noir#6295)
chore: remove dead function
(noir-lang/noir#6308)
feat: new formatter (noir-lang/noir#6300)
feat: Sync from aztec-packages
(noir-lang/noir#6301)
fix: Allow array map on empty arrays
(noir-lang/noir#6305)
fix: Display function name and body when inlining recursion limit hit
(noir-lang/noir#6291)
feat(interpreter): Comptime derive generators
(noir-lang/noir#6303)
fix: enforce correctness of decompositions performed at compile time
(noir-lang/noir#6278)
feat: Warn about private types leaking in public functions and struct
fields (noir-lang/noir#6296)
chore(docs): refactoring guides and some other nits
(noir-lang/noir#6175)
fix: Do not warn on unused self in traits
(noir-lang/noir#6298)
fix: Reject invalid expression with in CLI parser
(noir-lang/noir#6287)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <tom@tomfren.ch>
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 24, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.60.0</summary>

##
[0.60.0](aztec-package-v0.59.0...aztec-package-v0.60.0)
(2024-10-24)


### Features

* Introduce default public keys and replace empty public keys
([#9277](#9277))
([47718ea](47718ea))
* Sequencer cast votes
([#9247](#9247))
([bd05d87](bd05d87))
</details>

<details><summary>barretenberg.js: 0.60.0</summary>

##
[0.60.0](barretenberg.js-v0.59.0...barretenberg.js-v0.60.0)
(2024-10-24)


### Features

* Eccvm translator zk sumcheck
([#9199](#9199))
([c7d4572](c7d4572))


### Miscellaneous

* Remove noir_js_backend_barretenberg
([#9338](#9338))
([cefe3d9](cefe3d9))
</details>

<details><summary>aztec-packages: 0.60.0</summary>

##
[0.60.0](aztec-packages-v0.59.0...aztec-packages-v0.60.0)
(2024-10-24)


### ⚠ BREAKING CHANGES

* replace usage of vector in keccakf1600 input with array
([#9350](#9350))
* TXE single execution env
([#9183](#9183))
* remove hash opcodes from AVM
([#9209](#9209))
* remove delegate call and storage address
([#9330](#9330))

### Features

* Apella
([#9084](#9084))
([205ce69](205ce69))
* **avm:** Full poseidon2
([#9141](#9141))
([eae7587](eae7587))
* Bytes to fields and back
([#8590](#8590))
([65b8493](65b8493))
* Constrain protocol VK hashing
([#9304](#9304))
([3d17e13](3d17e13))
* **docs:** Nits
([#8948](#8948))
([008fdd1](008fdd1))
* Eccvm translator zk sumcheck
([#9199](#9199))
([c7d4572](c7d4572))
* Gerousia
([#8942](#8942))
([54b5ba2](54b5ba2))
* Get logs by tags
([#9353](#9353))
([719c33e](719c33e))
* Handle reorgs on sequencer
([#9201](#9201))
([d4dea16](d4dea16))
* **interpreter:** Comptime derive generators
(noir-lang/noir#6303)
([a166203](a166203))
* Introduce default public keys and replace empty public keys
([#9277](#9277))
([47718ea](47718ea))
* Modify private calldata to use public keys
([#9276](#9276))
([e42e219](e42e219))
* New formatter (noir-lang/noir#6300)
([a166203](a166203))
* **nr:** Serde for signed ints
([#9211](#9211))
([66f31c7](66f31c7))
* Publicly accessible bootstrap cache
([#9335](#9335))
([28392d5](28392d5))
* Remove hash opcodes from AVM
([#9209](#9209))
([e6db535](e6db535)),
closes
[#9208](#9208)
* Sequencer cast votes
([#9247](#9247))
([bd05d87](bd05d87))
* Sha256 refactoring and benchmark with longer input
(noir-lang/noir#6318)
([a166203](a166203))
* **ssa:** Various mem2reg reverts to reduce memory and compilation time
(noir-lang/noir#6307)
([a166203](a166203))
* Sync from aztec-packages (noir-lang/noir#6301)
([a166203](a166203))
* Translator on Shplemini
([#9329](#9329))
([21fa3cf](21fa3cf))
* TXE single execution env
([#9183](#9183))
([1d1d76d](1d1d76d))
* Warn about private types leaking in public functions and struct fields
(noir-lang/noir#6296)
([a166203](a166203))


### Bug Fixes

* 4epochs kind test et al
([#9358](#9358))
([e480e6b](e480e6b))
* Allow array map on empty arrays
(noir-lang/noir#6305)
([a166203](a166203))
* **avm:** Public dispatch in proving tests
([#9331](#9331))
([42e5221](42e5221))
* Barretenberg readme scare warning
([#9313](#9313))
([f759d55](f759d55))
* Broken constants gen
([#9387](#9387))
([eb7bc6b](eb7bc6b))
* Ci github clone edge case
([#9320](#9320))
([15abe6f](15abe6f))
* **ci:** Report 4 epochs true
([#9346](#9346))
([1ce0fa5](1ce0fa5))
* Display function name and body when inlining recursion limit hit
(noir-lang/noir#6291)
([a166203](a166203))
* Do not warn on unused self in traits
(noir-lang/noir#6298)
([a166203](a166203))
* Enforce correctness of decompositions performed at compile time
(noir-lang/noir#6278)
([a166203](a166203))
* Reject invalid expression with in CLI parser
(noir-lang/noir#6287)
([a166203](a166203))
* Remove reliance on invalid decompositions in selector calculation
([#9337](#9337))
([c8e4260](c8e4260))
* Support empty epochs
([#9341](#9341))
([9dda91e](9dda91e))
* Use github.actor on publish workflow dispatch
([#9324](#9324))
([5fa660d](5fa660d))


### Miscellaneous

* **avm:** Some cleaning in avm prover
([#9311](#9311))
([523aa23](523aa23))
* Bump node types
([#9397](#9397))
([763d5b1](763d5b1))
* Copying world state binary to yarn project is on generate
([#9194](#9194))
([8d75dd4](8d75dd4))
* Disable bench-process-history
([#9360](#9360))
([8e6734e](8e6734e))
* **docs:** Refactoring guides and some other nits
(noir-lang/noir#6175)
([a166203](a166203))
* Fix and re-enable prover coordination e2e test
([#9344](#9344))
([3a1a62c](3a1a62c))
* Implement Fq add
([#9354](#9354))
([1711fac](1711fac))
* Minor test cleanup
([#9339](#9339))
([a2ed567](a2ed567))
* Print out gas at start and end of each enqueued call
([#9377](#9377))
([29c0b95](29c0b95))
* Quick account manager refactor
([#9357](#9357))
([648d043](648d043))
* Quick keystore refactor
([#9355](#9355))
([31b9999](31b9999))
* Redo typo PR by pucedoteth
([#9385](#9385))
([fd1a0d1](fd1a0d1))
* Release Noir(0.36.0) (noir-lang/noir#6213)
([a166203](a166203))
* Remove dead function (noir-lang/noir#6308)
([a166203](a166203))
* Remove delegate call and storage address
([#9330](#9330))
([465f88e](465f88e))
* Remove noir_js_backend_barretenberg
([#9338](#9338))
([cefe3d9](cefe3d9))
* Remove unnecessary `is_integral_bit_size` function
([#9352](#9352))
([ac8e6d7](ac8e6d7))
* Remove usage of slices in pedersen hash
(noir-lang/noir#6295)
([a166203](a166203))
* Replace relative paths to noir-protocol-circuits
([32bd7b9](32bd7b9))
* Replace relative paths to noir-protocol-circuits
([add4605](add4605))
* Replace relative paths to noir-protocol-circuits
([8cb89af](8cb89af))
* Replace usage of vector in keccakf1600 input with array
([#9350](#9350))
([cb58490](cb58490))
* Scenario for upgrading gerousia
([#9246](#9246))
([66f59d6](66f59d6))
* Silence cache-download.sh
([#9317](#9317))
([314d9d2](314d9d2))
* Test 4epochs in native-network
([#9309](#9309))
([ddb312a](ddb312a))
* Unstake the bond when the proof lands
([#9363](#9363))
([b25b913](b25b913))
* Update `noir-edwards` repo to point at `noir-lang` org
(noir-lang/noir#6323)
([a166203](a166203))
* Updated NFT flows
([#9150](#9150))
([407f8b4](407f8b4))
</details>

<details><summary>barretenberg: 0.60.0</summary>

##
[0.60.0](barretenberg-v0.59.0...barretenberg-v0.60.0)
(2024-10-24)


### ⚠ BREAKING CHANGES

* replace usage of vector in keccakf1600 input with array
([#9350](#9350))
* remove hash opcodes from AVM
([#9209](#9209))
* remove delegate call and storage address
([#9330](#9330))

### Features

* **avm:** Full poseidon2
([#9141](#9141))
([eae7587](eae7587))
* Eccvm translator zk sumcheck
([#9199](#9199))
([c7d4572](c7d4572))
* Remove hash opcodes from AVM
([#9209](#9209))
([e6db535](e6db535)),
closes
[#9208](#9208)
* Translator on Shplemini
([#9329](#9329))
([21fa3cf](21fa3cf))


### Bug Fixes

* **avm:** Public dispatch in proving tests
([#9331](#9331))
([42e5221](42e5221))
* Barretenberg readme scare warning
([#9313](#9313))
([f759d55](f759d55))


### Miscellaneous

* **avm:** Some cleaning in avm prover
([#9311](#9311))
([523aa23](523aa23))
* Copying world state binary to yarn project is on generate
([#9194](#9194))
([8d75dd4](8d75dd4))
* Remove delegate call and storage address
([#9330](#9330))
([465f88e](465f88e))
* Remove noir_js_backend_barretenberg
([#9338](#9338))
([cefe3d9](cefe3d9))
* Replace usage of vector in keccakf1600 input with array
([#9350](#9350))
([cb58490](cb58490))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
TomAFrench added a commit that referenced this pull request Oct 24, 2024
* master:
  fix: better formatting of leading/trailing line/block comments in expression lists (#6338)
  feat: let the formatter remove lambda block braces for single-statement blocks (#6335)
  chore: run tests in metaprogramming.rs (#6339)
  fix: formatter didn't format `>>=` well (#6337)
  chore: Update title from feedback (#6334)
  feat: Reject programs with unconditional recursion (#6292)
  fix: (formatter) indent after infix lhs (#6331)
  feat: merge and sort imports (#6322)
  fix: mutable global pattern didn't have a span (#6328)
  feat(ssa): Various mem2reg reverts to reduce memory and compilation time (#6307)
  chore: update `noir-edwards` repo to point at `noir-lang` org (#6323)
  feat: Sha256 refactoring and benchmark with longer input (#6318)
  chore: Release Noir(0.36.0) (#6213)
  chore: remove usage of slices in pedersen hash (#6295)
  chore: remove dead function (#6308)
  feat: new formatter (#6300)
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Oct 25, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.60.0</summary>

##
[0.60.0](AztecProtocol/aztec-packages@aztec-package-v0.59.0...aztec-package-v0.60.0)
(2024-10-24)


### Features

* Introduce default public keys and replace empty public keys
([#9277](AztecProtocol/aztec-packages#9277))
([47718ea](AztecProtocol/aztec-packages@47718ea))
* Sequencer cast votes
([#9247](AztecProtocol/aztec-packages#9247))
([bd05d87](AztecProtocol/aztec-packages@bd05d87))
</details>

<details><summary>barretenberg.js: 0.60.0</summary>

##
[0.60.0](AztecProtocol/aztec-packages@barretenberg.js-v0.59.0...barretenberg.js-v0.60.0)
(2024-10-24)


### Features

* Eccvm translator zk sumcheck
([#9199](AztecProtocol/aztec-packages#9199))
([c7d4572](AztecProtocol/aztec-packages@c7d4572))


### Miscellaneous

* Remove noir_js_backend_barretenberg
([#9338](AztecProtocol/aztec-packages#9338))
([cefe3d9](AztecProtocol/aztec-packages@cefe3d9))
</details>

<details><summary>aztec-packages: 0.60.0</summary>

##
[0.60.0](AztecProtocol/aztec-packages@aztec-packages-v0.59.0...aztec-packages-v0.60.0)
(2024-10-24)


### ⚠ BREAKING CHANGES

* replace usage of vector in keccakf1600 input with array
([#9350](AztecProtocol/aztec-packages#9350))
* TXE single execution env
([#9183](AztecProtocol/aztec-packages#9183))
* remove hash opcodes from AVM
([#9209](AztecProtocol/aztec-packages#9209))
* remove delegate call and storage address
([#9330](AztecProtocol/aztec-packages#9330))

### Features

* Apella
([#9084](AztecProtocol/aztec-packages#9084))
([205ce69](AztecProtocol/aztec-packages@205ce69))
* **avm:** Full poseidon2
([#9141](AztecProtocol/aztec-packages#9141))
([eae7587](AztecProtocol/aztec-packages@eae7587))
* Bytes to fields and back
([#8590](AztecProtocol/aztec-packages#8590))
([65b8493](AztecProtocol/aztec-packages@65b8493))
* Constrain protocol VK hashing
([#9304](AztecProtocol/aztec-packages#9304))
([3d17e13](AztecProtocol/aztec-packages@3d17e13))
* **docs:** Nits
([#8948](AztecProtocol/aztec-packages#8948))
([008fdd1](AztecProtocol/aztec-packages@008fdd1))
* Eccvm translator zk sumcheck
([#9199](AztecProtocol/aztec-packages#9199))
([c7d4572](AztecProtocol/aztec-packages@c7d4572))
* Gerousia
([#8942](AztecProtocol/aztec-packages#8942))
([54b5ba2](AztecProtocol/aztec-packages@54b5ba2))
* Get logs by tags
([#9353](AztecProtocol/aztec-packages#9353))
([719c33e](AztecProtocol/aztec-packages@719c33e))
* Handle reorgs on sequencer
([#9201](AztecProtocol/aztec-packages#9201))
([d4dea16](AztecProtocol/aztec-packages@d4dea16))
* **interpreter:** Comptime derive generators
(noir-lang/noir#6303)
([a166203](AztecProtocol/aztec-packages@a166203))
* Introduce default public keys and replace empty public keys
([#9277](AztecProtocol/aztec-packages#9277))
([47718ea](AztecProtocol/aztec-packages@47718ea))
* Modify private calldata to use public keys
([#9276](AztecProtocol/aztec-packages#9276))
([e42e219](AztecProtocol/aztec-packages@e42e219))
* New formatter (noir-lang/noir#6300)
([a166203](AztecProtocol/aztec-packages@a166203))
* **nr:** Serde for signed ints
([#9211](AztecProtocol/aztec-packages#9211))
([66f31c7](AztecProtocol/aztec-packages@66f31c7))
* Publicly accessible bootstrap cache
([#9335](AztecProtocol/aztec-packages#9335))
([28392d5](AztecProtocol/aztec-packages@28392d5))
* Remove hash opcodes from AVM
([#9209](AztecProtocol/aztec-packages#9209))
([e6db535](AztecProtocol/aztec-packages@e6db535)),
closes
[#9208](AztecProtocol/aztec-packages#9208)
* Sequencer cast votes
([#9247](AztecProtocol/aztec-packages#9247))
([bd05d87](AztecProtocol/aztec-packages@bd05d87))
* Sha256 refactoring and benchmark with longer input
(noir-lang/noir#6318)
([a166203](AztecProtocol/aztec-packages@a166203))
* **ssa:** Various mem2reg reverts to reduce memory and compilation time
(noir-lang/noir#6307)
([a166203](AztecProtocol/aztec-packages@a166203))
* Sync from aztec-packages (noir-lang/noir#6301)
([a166203](AztecProtocol/aztec-packages@a166203))
* Translator on Shplemini
([#9329](AztecProtocol/aztec-packages#9329))
([21fa3cf](AztecProtocol/aztec-packages@21fa3cf))
* TXE single execution env
([#9183](AztecProtocol/aztec-packages#9183))
([1d1d76d](AztecProtocol/aztec-packages@1d1d76d))
* Warn about private types leaking in public functions and struct fields
(noir-lang/noir#6296)
([a166203](AztecProtocol/aztec-packages@a166203))


### Bug Fixes

* 4epochs kind test et al
([#9358](AztecProtocol/aztec-packages#9358))
([e480e6b](AztecProtocol/aztec-packages@e480e6b))
* Allow array map on empty arrays
(noir-lang/noir#6305)
([a166203](AztecProtocol/aztec-packages@a166203))
* **avm:** Public dispatch in proving tests
([#9331](AztecProtocol/aztec-packages#9331))
([42e5221](AztecProtocol/aztec-packages@42e5221))
* Barretenberg readme scare warning
([#9313](AztecProtocol/aztec-packages#9313))
([f759d55](AztecProtocol/aztec-packages@f759d55))
* Broken constants gen
([#9387](AztecProtocol/aztec-packages#9387))
([eb7bc6b](AztecProtocol/aztec-packages@eb7bc6b))
* Ci github clone edge case
([#9320](AztecProtocol/aztec-packages#9320))
([15abe6f](AztecProtocol/aztec-packages@15abe6f))
* **ci:** Report 4 epochs true
([#9346](AztecProtocol/aztec-packages#9346))
([1ce0fa5](AztecProtocol/aztec-packages@1ce0fa5))
* Display function name and body when inlining recursion limit hit
(noir-lang/noir#6291)
([a166203](AztecProtocol/aztec-packages@a166203))
* Do not warn on unused self in traits
(noir-lang/noir#6298)
([a166203](AztecProtocol/aztec-packages@a166203))
* Enforce correctness of decompositions performed at compile time
(noir-lang/noir#6278)
([a166203](AztecProtocol/aztec-packages@a166203))
* Reject invalid expression with in CLI parser
(noir-lang/noir#6287)
([a166203](AztecProtocol/aztec-packages@a166203))
* Remove reliance on invalid decompositions in selector calculation
([#9337](AztecProtocol/aztec-packages#9337))
([c8e4260](AztecProtocol/aztec-packages@c8e4260))
* Support empty epochs
([#9341](AztecProtocol/aztec-packages#9341))
([9dda91e](AztecProtocol/aztec-packages@9dda91e))
* Use github.actor on publish workflow dispatch
([#9324](AztecProtocol/aztec-packages#9324))
([5fa660d](AztecProtocol/aztec-packages@5fa660d))


### Miscellaneous

* **avm:** Some cleaning in avm prover
([#9311](AztecProtocol/aztec-packages#9311))
([523aa23](AztecProtocol/aztec-packages@523aa23))
* Bump node types
([#9397](AztecProtocol/aztec-packages#9397))
([763d5b1](AztecProtocol/aztec-packages@763d5b1))
* Copying world state binary to yarn project is on generate
([#9194](AztecProtocol/aztec-packages#9194))
([8d75dd4](AztecProtocol/aztec-packages@8d75dd4))
* Disable bench-process-history
([#9360](AztecProtocol/aztec-packages#9360))
([8e6734e](AztecProtocol/aztec-packages@8e6734e))
* **docs:** Refactoring guides and some other nits
(noir-lang/noir#6175)
([a166203](AztecProtocol/aztec-packages@a166203))
* Fix and re-enable prover coordination e2e test
([#9344](AztecProtocol/aztec-packages#9344))
([3a1a62c](AztecProtocol/aztec-packages@3a1a62c))
* Implement Fq add
([#9354](AztecProtocol/aztec-packages#9354))
([1711fac](AztecProtocol/aztec-packages@1711fac))
* Minor test cleanup
([#9339](AztecProtocol/aztec-packages#9339))
([a2ed567](AztecProtocol/aztec-packages@a2ed567))
* Print out gas at start and end of each enqueued call
([#9377](AztecProtocol/aztec-packages#9377))
([29c0b95](AztecProtocol/aztec-packages@29c0b95))
* Quick account manager refactor
([#9357](AztecProtocol/aztec-packages#9357))
([648d043](AztecProtocol/aztec-packages@648d043))
* Quick keystore refactor
([#9355](AztecProtocol/aztec-packages#9355))
([31b9999](AztecProtocol/aztec-packages@31b9999))
* Redo typo PR by pucedoteth
([#9385](AztecProtocol/aztec-packages#9385))
([fd1a0d1](AztecProtocol/aztec-packages@fd1a0d1))
* Release Noir(0.36.0) (noir-lang/noir#6213)
([a166203](AztecProtocol/aztec-packages@a166203))
* Remove dead function (noir-lang/noir#6308)
([a166203](AztecProtocol/aztec-packages@a166203))
* Remove delegate call and storage address
([#9330](AztecProtocol/aztec-packages#9330))
([465f88e](AztecProtocol/aztec-packages@465f88e))
* Remove noir_js_backend_barretenberg
([#9338](AztecProtocol/aztec-packages#9338))
([cefe3d9](AztecProtocol/aztec-packages@cefe3d9))
* Remove unnecessary `is_integral_bit_size` function
([#9352](AztecProtocol/aztec-packages#9352))
([ac8e6d7](AztecProtocol/aztec-packages@ac8e6d7))
* Remove usage of slices in pedersen hash
(noir-lang/noir#6295)
([a166203](AztecProtocol/aztec-packages@a166203))
* Replace relative paths to noir-protocol-circuits
([32bd7b9](AztecProtocol/aztec-packages@32bd7b9))
* Replace relative paths to noir-protocol-circuits
([add4605](AztecProtocol/aztec-packages@add4605))
* Replace relative paths to noir-protocol-circuits
([8cb89af](AztecProtocol/aztec-packages@8cb89af))
* Replace usage of vector in keccakf1600 input with array
([#9350](AztecProtocol/aztec-packages#9350))
([cb58490](AztecProtocol/aztec-packages@cb58490))
* Scenario for upgrading gerousia
([#9246](AztecProtocol/aztec-packages#9246))
([66f59d6](AztecProtocol/aztec-packages@66f59d6))
* Silence cache-download.sh
([#9317](AztecProtocol/aztec-packages#9317))
([314d9d2](AztecProtocol/aztec-packages@314d9d2))
* Test 4epochs in native-network
([#9309](AztecProtocol/aztec-packages#9309))
([ddb312a](AztecProtocol/aztec-packages@ddb312a))
* Unstake the bond when the proof lands
([#9363](AztecProtocol/aztec-packages#9363))
([b25b913](AztecProtocol/aztec-packages@b25b913))
* Update `noir-edwards` repo to point at `noir-lang` org
(noir-lang/noir#6323)
([a166203](AztecProtocol/aztec-packages@a166203))
* Updated NFT flows
([#9150](AztecProtocol/aztec-packages#9150))
([407f8b4](AztecProtocol/aztec-packages@407f8b4))
</details>

<details><summary>barretenberg: 0.60.0</summary>

##
[0.60.0](AztecProtocol/aztec-packages@barretenberg-v0.59.0...barretenberg-v0.60.0)
(2024-10-24)


### ⚠ BREAKING CHANGES

* replace usage of vector in keccakf1600 input with array
([#9350](AztecProtocol/aztec-packages#9350))
* remove hash opcodes from AVM
([#9209](AztecProtocol/aztec-packages#9209))
* remove delegate call and storage address
([#9330](AztecProtocol/aztec-packages#9330))

### Features

* **avm:** Full poseidon2
([#9141](AztecProtocol/aztec-packages#9141))
([eae7587](AztecProtocol/aztec-packages@eae7587))
* Eccvm translator zk sumcheck
([#9199](AztecProtocol/aztec-packages#9199))
([c7d4572](AztecProtocol/aztec-packages@c7d4572))
* Remove hash opcodes from AVM
([#9209](AztecProtocol/aztec-packages#9209))
([e6db535](AztecProtocol/aztec-packages@e6db535)),
closes
[#9208](AztecProtocol/aztec-packages#9208)
* Translator on Shplemini
([#9329](AztecProtocol/aztec-packages#9329))
([21fa3cf](AztecProtocol/aztec-packages@21fa3cf))


### Bug Fixes

* **avm:** Public dispatch in proving tests
([#9331](AztecProtocol/aztec-packages#9331))
([42e5221](AztecProtocol/aztec-packages@42e5221))
* Barretenberg readme scare warning
([#9313](AztecProtocol/aztec-packages#9313))
([f759d55](AztecProtocol/aztec-packages@f759d55))


### Miscellaneous

* **avm:** Some cleaning in avm prover
([#9311](AztecProtocol/aztec-packages#9311))
([523aa23](AztecProtocol/aztec-packages@523aa23))
* Copying world state binary to yarn project is on generate
([#9194](AztecProtocol/aztec-packages#9194))
([8d75dd4](AztecProtocol/aztec-packages@8d75dd4))
* Remove delegate call and storage address
([#9330](AztecProtocol/aztec-packages#9330))
([465f88e](AztecProtocol/aztec-packages@465f88e))
* Remove noir_js_backend_barretenberg
([#9338](AztecProtocol/aztec-packages#9338))
([cefe3d9](AztecProtocol/aztec-packages@cefe3d9))
* Replace usage of vector in keccakf1600 input with array
([#9350](AztecProtocol/aztec-packages#9350))
([cb58490](AztecProtocol/aztec-packages@cb58490))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
github-merge-queue bot pushed a commit that referenced this pull request Oct 25, 2024
# Description

## Problem\*

Resolves #6304 
Follows #6318

## Summary\*

Changes the `MSG_BLOCK` type in `sha256.nr` from `[u8; 64]` to `[u32;
16]` to:
* save a step of having to convert before compression
* reduce the number of array writes (which currently incur copying) in
favour of more arithmetic operations (byte packing)

## Additional Context

### Testing

```
cargo test -p nargo_cli --test stdlib-tests -- run_stdlib_tests sha256
cargo test -p nargo_cli --test stdlib-props fuzz_sha256
```

NB we can run e.g. `-- run_stdlib_tests msg_just_under_block` to execute
a specific test.

### Benchmarks

```shell
cargo bench -p nargo_cli --bench criterion sha256_long
```

On my machine it shows that it got moderately faster:

```console
❯ cargo bench -p nargo_cli --bench criterion sha256_long
...
bench_sha256_long_execute
                        time:   [1.3413 ms 1.3477 ms 1.3555 ms]
                        change: [-13.718% -13.172% -12.577%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 20 measurements (10.00%)
  2 (10.00%) high mild

bench_sha256_long_execute_brillig
                        time:   [244.52 µs 259.88 µs 280.67 µs]
                        change: [-26.479% -23.096% -20.123%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 20 measurements (20.00%)
  4 (20.00%) low severe
```


## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants