Skip to content

Commit 25dc7bb

Browse files
committed
remove round.cpp and round.hpp in acir_format and update relevant constraint files
1 parent 4b48d8d commit 25dc7bb

File tree

6 files changed

+8
-62
lines changed

6 files changed

+8
-62
lines changed

barretenberg/cpp/src/barretenberg/dsl/acir_format/blake2s_constraint.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "barretenberg/common/assert.hpp"
99
#include "barretenberg/stdlib/hash/blake2s/blake2s.hpp"
1010
#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp"
11-
#include "round.hpp"
1211

1312
namespace acir_format {
1413

@@ -24,14 +23,12 @@ template <typename Builder> void create_blake2s_constraints(Builder& builder, co
2423

2524
for (const auto& witness_index_num_bits : constraint.inputs) {
2625
auto witness_index = witness_index_num_bits.blackbox_input;
27-
auto num_bits = witness_index_num_bits.num_bits;
28-
29-
// XXX: The implementation requires us to truncate the element to the nearest byte and not bit
30-
auto num_bytes = round_to_nearest_byte(num_bits);
31-
BB_ASSERT_LTE(num_bytes, 32U, "Input num_bytes exceeds 32 per element in blake2s");
32-
3326
field_ct element = to_field_ct(witness_index, builder);
3427

28+
// num_bytes = ceil(witness_index_num_bits.num_bits/8). Here, num_bits is set to 8 when constructing the vector
29+
// of inputs in the Blake2s constraint. Hence, we set num_bytes = 1.
30+
uint32_t num_bytes = 1;
31+
3532
// byte_array_ct(field, num_bytes) constructor adds range constraints for each byte
3633
byte_array_ct element_bytes(element, num_bytes);
3734

barretenberg/cpp/src/barretenberg/dsl/acir_format/blake3_constraint.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "barretenberg/common/assert.hpp"
99
#include "barretenberg/stdlib/hash/blake3s/blake3s.hpp"
1010
#include "barretenberg/stdlib/primitives/byte_array/byte_array.hpp"
11-
#include "round.hpp"
1211

1312
namespace acir_format {
1413

@@ -22,13 +21,12 @@ template <typename Builder> void create_blake3_constraints(Builder& builder, con
2221

2322
for (const auto& witness_index_num_bits : constraint.inputs) {
2423
auto witness_index = witness_index_num_bits.blackbox_input;
25-
auto num_bits = witness_index_num_bits.num_bits;
26-
27-
// XXX: The implementation requires us to truncate the element to the nearest byte and not bit
28-
auto num_bytes = round_to_nearest_byte(num_bits);
29-
BB_ASSERT_LTE(num_bytes, 32U, "Input num_bytes exceeds 32 per element in blake3s");
3024
field_ct element = to_field_ct(witness_index, builder);
3125

26+
// num_bytes = ceil(witness_index_num_bits.num_bits/8). Here, num_bits is set to 8 when constructing the vector
27+
// of inputs in the Blake3 constraint. Hence, we set num_bytes = 1.
28+
uint32_t num_bytes = 1;
29+
3230
// byte_array_ct(field, num_bytes) constructor adds range constraints for each byte
3331
byte_array_ct element_bytes(element, num_bytes);
3432

barretenberg/cpp/src/barretenberg/dsl/acir_format/keccak_constraint.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "keccak_constraint.hpp"
88
#include "barretenberg/stdlib/hash/keccak/keccak.hpp"
99
#include "barretenberg/stdlib/primitives/circuit_builders/circuit_builders_fwd.hpp"
10-
#include "round.hpp"
1110

1211
namespace acir_format {
1312

barretenberg/cpp/src/barretenberg/dsl/acir_format/round.cpp

Lines changed: 0 additions & 29 deletions
This file was deleted.

barretenberg/cpp/src/barretenberg/dsl/acir_format/round.hpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

barretenberg/cpp/src/barretenberg/dsl/acir_format/sha256_constraint.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "sha256_constraint.hpp"
88
#include "barretenberg/serialize/msgpack_impl.hpp"
99
#include "barretenberg/stdlib/hash/sha256/sha256.hpp"
10-
#include "round.hpp"
1110

1211
namespace acir_format {
1312

0 commit comments

Comments
 (0)