diff --git a/barretenberg/acir_tests/run_acir_tests.sh b/barretenberg/acir_tests/run_acir_tests.sh index 3f8152541b60..f75efcef24d6 100755 --- a/barretenberg/acir_tests/run_acir_tests.sh +++ b/barretenberg/acir_tests/run_acir_tests.sh @@ -7,7 +7,7 @@ set -eu BIN=${BIN:-../cpp/build/bin/bb} FLOW=${FLOW:-prove_and_verify} CRS_PATH=~/.bb-crs -BRANCH=kw/switch-backend +BRANCH=arv/pedersen_hash VERBOSE=${VERBOSE:-} NAMED_TEST=${1:-} diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 169dc6a10f49..19d4fac408a8 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -300,7 +300,7 @@ void acvmInfo(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", "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", "hash_to_field_128_security", "ecdsa_secp256k1", "ecdsa_secp256r1", "fixed_base_scalar_mul", "recursive_aggregation"] })"; size_t length = strlen(jsonData); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp index 59b5192a6452..6d94ba7b766e 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -1,5 +1,6 @@ #include "acir_format.hpp" #include "barretenberg/common/log.hpp" +#include "barretenberg/dsl/acir_format/pedersen.hpp" namespace acir_format { @@ -83,6 +84,10 @@ void build_constraints(Builder& builder, acir_format const& constraint_system, b create_pedersen_constraint(builder, constraint); } + for (const auto& constraint : constraint_system.pedersen_hash_constraints) { + create_pedersen_hash_constraint(builder, constraint); + } + // Add fixed base scalar mul constraints for (const auto& constraint : constraint_system.fixed_base_scalar_mul_constraints) { create_fixed_base_constraint(builder, constraint); diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp index 0889bd2b4e26..15f2ecbcdd83 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -34,6 +34,7 @@ struct acir_format { std::vector keccak_constraints; std::vector keccak_var_constraints; std::vector pedersen_constraints; + std::vector pedersen_hash_constraints; std::vector hash_to_field_constraints; std::vector fixed_base_scalar_mul_constraints; std::vector recursion_constraints; @@ -58,6 +59,7 @@ struct acir_format { keccak_constraints, keccak_var_constraints, pedersen_constraints, + pedersen_hash_constraints, hash_to_field_constraints, fixed_base_scalar_mul_constraints, recursion_constraints, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp index 171d203ffef6..b0711582deb7 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.test.cpp @@ -40,6 +40,7 @@ TEST_F(AcirFormatTests, TestASingleConstraintNoPubInputs) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -146,6 +147,7 @@ TEST_F(AcirFormatTests, TestLogicGateFromNoirCircuit) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -210,6 +212,7 @@ TEST_F(AcirFormatTests, TestSchnorrVerifyPass) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -297,6 +300,7 @@ TEST_F(AcirFormatTests, TestSchnorrVerifySmallRange) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -403,6 +407,7 @@ TEST_F(AcirFormatTests, TestVarKeccak) .keccak_constraints = {}, .keccak_var_constraints = { keccak }, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp index ef84daaabb16..0c2f63a18170 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.hpp @@ -122,13 +122,19 @@ void handle_blackbox_func_call(Circuit::Opcode::BlackBoxFuncCall const& arg, aci .result = arg.output.value, .signature = map(arg.signature, [](auto& e) { return e.witness.value; }), }); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { af.pedersen_constraints.push_back(PedersenConstraint{ .scalars = map(arg.inputs, [](auto& e) { return e.witness.value; }), .hash_index = arg.domain_separator, .result_x = arg.outputs[0].value, .result_y = arg.outputs[1].value, }); + } else if constexpr (std::is_same_v) { + af.pedersen_hash_constraints.push_back(PedersenHashConstraint{ + .scalars = map(arg.inputs, [](auto& e) { return e.witness.value; }), + .hash_index = arg.domain_separator, + .result = arg.output.value, + }); } else if constexpr (std::is_same_v) { af.hash_to_field_constraints.push_back(HashToFieldConstraint{ .inputs = map(arg.inputs, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp index 02e8a8419116..37c7aa784f20 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/block_constraint.test.cpp @@ -121,6 +121,7 @@ TEST_F(UltraPlonkRAM, TestBlockConstraint) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp index 4dfc0dad44f0..57576bd763f0 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256k1.test.cpp @@ -100,6 +100,7 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintSucceed) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -140,6 +141,7 @@ TEST_F(ECDSASecp256k1, TestECDSACompilesForVerifier) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -175,6 +177,7 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintFail) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp index affb7e25c75f..01adec035f06 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ecdsa_secp256r1.test.cpp @@ -134,6 +134,7 @@ TEST(ECDSASecp256r1, test_hardcoded) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -175,6 +176,7 @@ TEST(ECDSASecp256r1, TestECDSAConstraintSucceed) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -214,6 +216,7 @@ TEST(ECDSASecp256r1, TestECDSACompilesForVerifier) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -248,6 +251,7 @@ TEST(ECDSASecp256r1, TestECDSAConstraintFail) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp index 16a3dcebe7f1..73aad6b94dee 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.cpp @@ -20,4 +20,19 @@ void create_pedersen_constraint(Builder& builder, const PedersenConstraint& inpu builder.assert_equal(point.y.witness_index, input.result_y); } +void create_pedersen_hash_constraint(Builder& builder, const PedersenHashConstraint& input) +{ + std::vector scalars; + + for (const auto& scalar : input.scalars) { + // convert input indices to field_ct + field_ct scalar_as_field = field_ct::from_witness_index(&builder, scalar); + scalars.push_back(scalar_as_field); + } + + auto result = stdlib::pedersen_hash::hash(scalars, input.hash_index); + + builder.assert_equal(result.witness_index, input.result); +} + } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp index e70b418d4f5d..9605c75472b1 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pedersen.hpp @@ -15,7 +15,17 @@ struct PedersenConstraint { friend bool operator==(PedersenConstraint const& lhs, PedersenConstraint const& rhs) = default; }; +struct PedersenHashConstraint { + std::vector scalars; + uint32_t hash_index; + + uint32_t result; + + friend bool operator==(PedersenHashConstraint const& lhs, PedersenHashConstraint const& rhs) = default; +}; + void create_pedersen_constraint(Builder& builder, const PedersenConstraint& input); +void create_pedersen_hash_constraint(Builder& builder, const PedersenHashConstraint& input); template inline void read(B& buf, PedersenConstraint& constraint) { diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp index 775c862b2e28..550bd180cc3d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/recursion_constraint.test.cpp @@ -93,6 +93,7 @@ Builder create_inner_circuit() .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = {}, @@ -219,6 +220,7 @@ Builder create_outer_circuit(std::vector& inner_circuits) .keccak_constraints = {}, .keccak_var_constraints = {}, .pedersen_constraints = {}, + .pedersen_hash_constraints = {}, .hash_to_field_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .recursion_constraints = recursion_constraints, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp index e59f786ce660..dc1e8e148219 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp @@ -82,14 +82,24 @@ struct BlackBoxFuncCall { static SchnorrVerify bincodeDeserialize(std::vector); }; - struct Pedersen { + struct PedersenCommitment { std::vector inputs; uint32_t domain_separator; std::array outputs; - friend bool operator==(const Pedersen&, const Pedersen&); + friend bool operator==(const PedersenCommitment&, const PedersenCommitment&); std::vector bincodeSerialize() const; - static Pedersen bincodeDeserialize(std::vector); + static PedersenCommitment bincodeDeserialize(std::vector); + }; + + struct PedersenHash { + std::vector inputs; + uint32_t domain_separator; + Circuit::Witness output; + + friend bool operator==(const PedersenHash&, const PedersenHash&); + std::vector bincodeSerialize() const; + static PedersenHash bincodeDeserialize(std::vector); }; struct HashToField128Security { @@ -173,7 +183,8 @@ struct BlackBoxFuncCall { SHA256, Blake2s, SchnorrVerify, - Pedersen, + PedersenCommitment, + PedersenHash, HashToField128Security, EcdsaSecp256k1, EcdsaSecp256r1, @@ -457,14 +468,24 @@ struct BlackBoxOp { static SchnorrVerify bincodeDeserialize(std::vector); }; - struct Pedersen { + struct PedersenCommitment { Circuit::HeapVector inputs; Circuit::RegisterIndex domain_separator; Circuit::HeapArray output; - friend bool operator==(const Pedersen&, const Pedersen&); + friend bool operator==(const PedersenCommitment&, const PedersenCommitment&); std::vector bincodeSerialize() const; - static Pedersen bincodeDeserialize(std::vector); + static PedersenCommitment bincodeDeserialize(std::vector); + }; + + struct PedersenHash { + Circuit::HeapVector inputs; + Circuit::RegisterIndex domain_separator; + Circuit::RegisterIndex output; + + friend bool operator==(const PedersenHash&, const PedersenHash&); + std::vector bincodeSerialize() const; + static PedersenHash bincodeDeserialize(std::vector); }; struct FixedBaseScalarMul { @@ -484,7 +505,8 @@ struct BlackBoxOp { EcdsaSecp256k1, EcdsaSecp256r1, SchnorrVerify, - Pedersen, + PedersenCommitment, + PedersenHash, FixedBaseScalarMul> value; @@ -2100,7 +2122,7 @@ Circuit::BlackBoxFuncCall::SchnorrVerify serde::Deserializable BlackBoxFuncCall::Pedersen::bincodeSerialize() const +inline std::vector BlackBoxFuncCall::PedersenCommitment::bincodeSerialize() const { auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); + serde::Serializable::serialize(*this, serializer); return std::move(serializer).bytes(); } -inline BlackBoxFuncCall::Pedersen BlackBoxFuncCall::Pedersen::bincodeDeserialize(std::vector input) +inline BlackBoxFuncCall::PedersenCommitment BlackBoxFuncCall::PedersenCommitment::bincodeDeserialize( + std::vector input) { auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); + auto value = serde::Deserializable::deserialize(deserializer); if (deserializer.get_buffer_offset() < input.size()) { throw_or_abort("Some input bytes were not read"); } @@ -2135,8 +2158,8 @@ inline BlackBoxFuncCall::Pedersen BlackBoxFuncCall::Pedersen::bincodeDeserialize template <> template -void serde::Serializable::serialize(const Circuit::BlackBoxFuncCall::Pedersen& obj, - Serializer& serializer) +void serde::Serializable::serialize( + const Circuit::BlackBoxFuncCall::PedersenCommitment& obj, Serializer& serializer) { serde::Serializable::serialize(obj.inputs, serializer); serde::Serializable::serialize(obj.domain_separator, serializer); @@ -2145,10 +2168,10 @@ void serde::Serializable::serialize(const C template <> template -Circuit::BlackBoxFuncCall::Pedersen serde::Deserializable::deserialize( - Deserializer& deserializer) +Circuit::BlackBoxFuncCall::PedersenCommitment serde::Deserializable< + Circuit::BlackBoxFuncCall::PedersenCommitment>::deserialize(Deserializer& deserializer) { - Circuit::BlackBoxFuncCall::Pedersen obj; + Circuit::BlackBoxFuncCall::PedersenCommitment obj; obj.inputs = serde::Deserializable::deserialize(deserializer); obj.domain_separator = serde::Deserializable::deserialize(deserializer); obj.outputs = serde::Deserializable::deserialize(deserializer); @@ -2157,6 +2180,63 @@ Circuit::BlackBoxFuncCall::Pedersen serde::Deserializable BlackBoxFuncCall::PedersenHash::bincodeSerialize() const +{ + auto serializer = serde::BincodeSerializer(); + serde::Serializable::serialize(*this, serializer); + return std::move(serializer).bytes(); +} + +inline BlackBoxFuncCall::PedersenHash BlackBoxFuncCall::PedersenHash::bincodeDeserialize(std::vector input) +{ + auto deserializer = serde::BincodeDeserializer(input); + auto value = serde::Deserializable::deserialize(deserializer); + if (deserializer.get_buffer_offset() < input.size()) { + throw_or_abort("Some input bytes were not read"); + } + return value; +} + +} // end of namespace Circuit + +template <> +template +void serde::Serializable::serialize( + const Circuit::BlackBoxFuncCall::PedersenHash& obj, Serializer& serializer) +{ + serde::Serializable::serialize(obj.inputs, serializer); + serde::Serializable::serialize(obj.domain_separator, serializer); + serde::Serializable::serialize(obj.output, serializer); +} + +template <> +template +Circuit::BlackBoxFuncCall::PedersenHash serde::Deserializable::deserialize( + Deserializer& deserializer) +{ + Circuit::BlackBoxFuncCall::PedersenHash obj; + obj.inputs = serde::Deserializable::deserialize(deserializer); + obj.domain_separator = serde::Deserializable::deserialize(deserializer); + obj.output = serde::Deserializable::deserialize(deserializer); + return obj; +} + +namespace Circuit { + inline bool operator==(const BlackBoxFuncCall::HashToField128Security& lhs, const BlackBoxFuncCall::HashToField128Security& rhs) { @@ -3048,7 +3128,7 @@ Circuit::BlackBoxOp::SchnorrVerify serde::Deserializable BlackBoxOp::Pedersen::bincodeSerialize() const +inline std::vector BlackBoxOp::PedersenCommitment::bincodeSerialize() const { auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); + serde::Serializable::serialize(*this, serializer); return std::move(serializer).bytes(); } -inline BlackBoxOp::Pedersen BlackBoxOp::Pedersen::bincodeDeserialize(std::vector input) +inline BlackBoxOp::PedersenCommitment BlackBoxOp::PedersenCommitment::bincodeDeserialize(std::vector input) { auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); + auto value = serde::Deserializable::deserialize(deserializer); if (deserializer.get_buffer_offset() < input.size()) { throw_or_abort("Some input bytes were not read"); } @@ -3083,8 +3163,65 @@ inline BlackBoxOp::Pedersen BlackBoxOp::Pedersen::bincodeDeserialize(std::vector template <> template -void serde::Serializable::serialize(const Circuit::BlackBoxOp::Pedersen& obj, - Serializer& serializer) +void serde::Serializable::serialize( + const Circuit::BlackBoxOp::PedersenCommitment& obj, Serializer& serializer) +{ + serde::Serializable::serialize(obj.inputs, serializer); + serde::Serializable::serialize(obj.domain_separator, serializer); + serde::Serializable::serialize(obj.output, serializer); +} + +template <> +template +Circuit::BlackBoxOp::PedersenCommitment serde::Deserializable::deserialize( + Deserializer& deserializer) +{ + Circuit::BlackBoxOp::PedersenCommitment obj; + obj.inputs = serde::Deserializable::deserialize(deserializer); + obj.domain_separator = serde::Deserializable::deserialize(deserializer); + obj.output = serde::Deserializable::deserialize(deserializer); + return obj; +} + +namespace Circuit { + +inline bool operator==(const BlackBoxOp::PedersenHash& lhs, const BlackBoxOp::PedersenHash& rhs) +{ + if (!(lhs.inputs == rhs.inputs)) { + return false; + } + if (!(lhs.domain_separator == rhs.domain_separator)) { + return false; + } + if (!(lhs.output == rhs.output)) { + return false; + } + return true; +} + +inline std::vector BlackBoxOp::PedersenHash::bincodeSerialize() const +{ + auto serializer = serde::BincodeSerializer(); + serde::Serializable::serialize(*this, serializer); + return std::move(serializer).bytes(); +} + +inline BlackBoxOp::PedersenHash BlackBoxOp::PedersenHash::bincodeDeserialize(std::vector input) +{ + auto deserializer = serde::BincodeDeserializer(input); + auto value = serde::Deserializable::deserialize(deserializer); + if (deserializer.get_buffer_offset() < input.size()) { + throw_or_abort("Some input bytes were not read"); + } + return value; +} + +} // end of namespace Circuit + +template <> +template +void serde::Serializable::serialize(const Circuit::BlackBoxOp::PedersenHash& obj, + Serializer& serializer) { serde::Serializable::serialize(obj.inputs, serializer); serde::Serializable::serialize(obj.domain_separator, serializer); @@ -3093,10 +3230,10 @@ void serde::Serializable::serialize(const Circuit template <> template -Circuit::BlackBoxOp::Pedersen serde::Deserializable::deserialize( +Circuit::BlackBoxOp::PedersenHash serde::Deserializable::deserialize( Deserializer& deserializer) { - Circuit::BlackBoxOp::Pedersen obj; + Circuit::BlackBoxOp::PedersenHash obj; obj.inputs = serde::Deserializable::deserialize(deserializer); obj.domain_separator = serde::Deserializable::deserialize(deserializer); obj.output = serde::Deserializable::deserialize(deserializer); diff --git a/barretenberg/ts/src/info.ts b/barretenberg/ts/src/info.ts index 3dffc9bff43d..d6f22a752e50 100644 --- a/barretenberg/ts/src/info.ts +++ b/barretenberg/ts/src/info.ts @@ -14,6 +14,7 @@ export const acvmInfoJson = { 'keccak256', 'schnorr_verify', 'pedersen', + 'pedersen_hash', 'hash_to_field_128_security', 'ecdsa_secp256k1', 'ecdsa_secp256r1',