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

chore: Remove HashToField128Security ACIR opcode #3631

Merged
merged 16 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void acvm_info(const std::string& output_path)
"width" : 3
},
"opcodes_supported" : ["arithmetic", "directive", "brillig", "memory_init", "memory_op"],
"black_box_functions_supported" : ["and", "xor", "range", "sha256", "blake2s", "keccak256", "schnorr_verify", "pedersen", "pedersen_hash", "hash_to_field_128_security", "ecdsa_secp256k1", "ecdsa_secp256r1", "fixed_base_scalar_mul", "recursive_aggregation"]
"black_box_functions_supported" : ["and", "xor", "range", "sha256", "blake2s", "keccak256", "schnorr_verify", "pedersen", "pedersen_hash", "ecdsa_secp256k1", "ecdsa_secp256r1", "fixed_base_scalar_mul", "recursive_aggregation"]
})";

size_t length = strlen(jsonData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ void build_constraints(Builder& builder, acir_format const& constraint_system, b
create_fixed_base_constraint(builder, constraint);
}

// Add hash to field constraints
for (const auto& constraint : constraint_system.hash_to_field_constraints) {
create_hash_to_field_constraints(builder, constraint);
}

// Add block constraints
for (const auto& constraint : constraint_system.block_constraints) {
create_block_constraints(builder, constraint, has_valid_witness_assignments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "ecdsa_secp256k1.hpp"
#include "ecdsa_secp256r1.hpp"
#include "fixed_base_scalar_mul.hpp"
#include "hash_to_field.hpp"
#include "keccak_constraint.hpp"
#include "logic_constraint.hpp"
#include "pedersen.hpp"
Expand Down Expand Up @@ -35,7 +34,6 @@ struct acir_format {
std::vector<KeccakVarConstraint> keccak_var_constraints;
std::vector<PedersenConstraint> pedersen_constraints;
std::vector<PedersenHashConstraint> pedersen_hash_constraints;
std::vector<HashToFieldConstraint> hash_to_field_constraints;
std::vector<FixedBaseScalarMul> fixed_base_scalar_mul_constraints;
std::vector<RecursionConstraint> recursion_constraints;
// A standard plonk arithmetic constraint, as defined in the poly_triple struct, consists of selector values
Expand All @@ -60,7 +58,6 @@ struct acir_format {
keccak_var_constraints,
pedersen_constraints,
pedersen_hash_constraints,
hash_to_field_constraints,
fixed_base_scalar_mul_constraints,
recursion_constraints,
constraints,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ TEST_F(AcirFormatTests, TestASingleConstraintNoPubInputs)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { constraint },
Expand Down Expand Up @@ -148,7 +147,6 @@ TEST_F(AcirFormatTests, TestLogicGateFromNoirCircuit)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { expr_a, expr_b, expr_c, expr_d },
Expand Down Expand Up @@ -213,7 +211,6 @@ TEST_F(AcirFormatTests, TestSchnorrVerifyPass)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { poly_triple{
Expand Down Expand Up @@ -301,7 +298,6 @@ TEST_F(AcirFormatTests, TestSchnorrVerifySmallRange)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { poly_triple{
Expand Down Expand Up @@ -408,7 +404,6 @@ TEST_F(AcirFormatTests, TestVarKeccak)
.keccak_var_constraints = { keccak },
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { dummy },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "barretenberg/dsl/acir_format/blake2s_constraint.hpp"
#include "barretenberg/dsl/acir_format/block_constraint.hpp"
#include "barretenberg/dsl/acir_format/ecdsa_secp256k1.hpp"
#include "barretenberg/dsl/acir_format/hash_to_field.hpp"
#include "barretenberg/dsl/acir_format/keccak_constraint.hpp"
#include "barretenberg/dsl/acir_format/logic_constraint.hpp"
#include "barretenberg/dsl/acir_format/pedersen.hpp"
Expand Down Expand Up @@ -135,17 +134,6 @@ void handle_blackbox_func_call(Circuit::Opcode::BlackBoxFuncCall const& arg, aci
.hash_index = arg.domain_separator,
.result = arg.output.value,
});
} else if constexpr (std::is_same_v<T, Circuit::BlackBoxFuncCall::HashToField128Security>) {
af.hash_to_field_constraints.push_back(HashToFieldConstraint{
.inputs = map(arg.inputs,
[](auto& e) {
return HashToFieldInput{
.witness = e.witness.value,
.num_bits = e.num_bits,
};
}),
.result = arg.output.value,
});
} else if constexpr (std::is_same_v<T, Circuit::BlackBoxFuncCall::EcdsaSecp256k1>) {
af.ecdsa_k1_constraints.push_back(EcdsaSecp256k1Constraint{
.hashed_message = map(arg.hashed_message, [](auto& e) { return e.witness.value; }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ TEST_F(UltraPlonkRAM, TestBlockConstraint)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintSucceed)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down Expand Up @@ -142,7 +141,6 @@ TEST_F(ECDSASecp256k1, TestECDSACompilesForVerifier)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down Expand Up @@ -178,7 +176,6 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintFail)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ TEST(ECDSASecp256r1, test_hardcoded)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down Expand Up @@ -177,7 +176,6 @@ TEST(ECDSASecp256r1, TestECDSAConstraintSucceed)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down Expand Up @@ -217,7 +215,6 @@ TEST(ECDSASecp256r1, TestECDSACompilesForVerifier)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down Expand Up @@ -252,7 +249,6 @@ TEST(ECDSASecp256r1, TestECDSAConstraintFail)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = {},
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Builder create_inner_circuit()
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = {},
.constraints = { expr_a, expr_b, expr_c, expr_d },
Expand Down Expand Up @@ -221,7 +220,6 @@ Builder create_outer_circuit(std::vector<Builder>& inner_circuits)
.keccak_var_constraints = {},
.pedersen_constraints = {},
.pedersen_hash_constraints = {},
.hash_to_field_constraints = {},
.fixed_base_scalar_mul_constraints = {},
.recursion_constraints = recursion_constraints,
.constraints = {},
Expand Down
Loading