Skip to content

Conversation

@nishatkoti
Copy link
Contributor

round.cpp and round.hpp contained a round_to_nearest_byte(num_bits) function that rounds up num_bits to the nearest byte. When constructing the vector of inputs in a Blake2s/Blake3 constraint, num_bits is set to 8 (see this). Hence, round_to_nearest_byte is no longer needed and the number of bytes can simply be set to 1.

This PR removes round.cpp and round.hpp. The relevant constraint files that were dependent are also updated accordingly.

@nishatkoti nishatkoti marked this pull request as ready for review January 8, 2026 10:41
Copy link
Contributor

@federicobarbacovi federicobarbacovi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing this!


// num_bytes = ceil(witness_index_num_bits.num_bits/8). Here, num_bits is set to 8 when constructing the vector
// of inputs in the Blake2s constraint. Hence, we set num_bytes = 1.
uint32_t num_bytes = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could simply set num_bytes = 1 in the function (same for Blake3), no need for an additional variable. I would leave the comment though, quite helpful :D

@nishatkoti nishatkoti merged commit 8fb8b04 into merge-train/barretenberg Jan 8, 2026
8 checks passed
@nishatkoti nishatkoti deleted the nk/rm_roundfiles_acir branch January 8, 2026 12:01
github-merge-queue bot pushed a commit that referenced this pull request Jan 9, 2026
BEGIN_COMMIT_OVERRIDE
chore: remove round.cpp and round.hpp in dsl/acir_format (#19412)
chore: docs for translator (#19056)
chore: update noir/noir-repo to match next branch
chore: update avm-transpiler Cargo.lock for noir submodule
fix: revert noir/noir-repo to match next and update Cargo.lock
fix: add actionable error when bb verify cannot find vk file (#19398)
chore: `utils.cpp` audit (#19425)
chore: sha audit 1 (#19072)
fix: improve no artifacts found message to include search path (#19432)
chore: simplify Flavors' Transcripts + VKs deduplication (#19326)
Add correct VKSerializationMode to AVM VerificationKey Classes
END_COMMIT_OVERRIDE
github-actions bot pushed a commit that referenced this pull request Jan 9, 2026
`round.cpp` and `round.hpp` contained a
`round_to_nearest_byte(num_bits)` function that rounds up `num_bits` to
the nearest byte. When constructing the vector of inputs in a
Blake2s/Blake3 constraint, `num_bits` is set to 8 (see
[this](https://github.com/AztecProtocol/aztec-packages/blob/4fc30d81acf2c727e6becd7376de93185e22dd92/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp#L666-L667)).
Hence, `round_to_nearest_byte` is no longer needed and the number of
bytes can simply be set to 1.

This PR removes `round.cpp` and `round.hpp`. The relevant constraint
files that were dependent are also updated accordingly.
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.

3 participants