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 59c7275d7eb..360d43324e9 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp @@ -84,11 +84,6 @@ void build_constraints(Builder& builder, AcirFormat const& constraint_system, bo create_ec_add_constraint(builder, constraint, has_valid_witness_assignments); } - // Add ec double - for (const auto& constraint : constraint_system.ec_double_constraints) { - create_ec_double_constraint(builder, constraint, has_valid_witness_assignments); - } - // Add block constraints for (const auto& constraint : constraint_system.block_constraints) { create_block_constraints(builder, constraint, has_valid_witness_assignments); 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 82cf7eccad3..f88777038b0 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.hpp @@ -40,7 +40,6 @@ struct AcirFormat { std::vector pedersen_hash_constraints; std::vector fixed_base_scalar_mul_constraints; std::vector ec_add_constraints; - std::vector ec_double_constraints; std::vector recursion_constraints; std::vector bigint_from_le_bytes_constraints; std::vector bigint_operations; @@ -70,6 +69,7 @@ struct AcirFormat { pedersen_constraints, pedersen_hash_constraints, fixed_base_scalar_mul_constraints, + ec_add_constraints, recursion_constraints, constraints, block_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 8804cd0c573..3c85f61d4d1 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 @@ -45,7 +45,6 @@ TEST_F(AcirFormatTests, TestASingleConstraintNoPubInputs) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -158,7 +157,6 @@ TEST_F(AcirFormatTests, TestLogicGateFromNoirCircuit) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -223,7 +221,6 @@ TEST_F(AcirFormatTests, TestSchnorrVerifyPass) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -316,7 +313,6 @@ TEST_F(AcirFormatTests, TestSchnorrVerifySmallRange) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -428,7 +424,6 @@ TEST_F(AcirFormatTests, TestVarKeccak) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -472,7 +467,6 @@ TEST_F(AcirFormatTests, TestKeccakPermutation) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, 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 e68dfb68d9c..058feb5e6a9 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 @@ -214,13 +214,6 @@ void handle_blackbox_func_call(Circuit::Opcode::BlackBoxFuncCall const& arg, Aci .result_x = arg.outputs[0].value, .result_y = arg.outputs[1].value, }); - } else if constexpr (std::is_same_v) { - af.ec_double_constraints.push_back(EcDouble{ - .input_x = arg.input_x.witness.value, - .input_y = arg.input_y.witness.value, - .result_x = arg.outputs[0].value, - .result_y = arg.outputs[1].value, - }); } else if constexpr (std::is_same_v) { af.keccak_constraints.push_back(KeccakConstraint{ .inputs = map(arg.inputs, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp index 0762bfd783a..e8c4b22b4bf 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/bigint_constraint.test.cpp @@ -64,7 +64,6 @@ TEST_F(BigIntTests, TestBigIntConstraintDummy) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = { from_le_bytes_constraint }, .bigint_operations = { add_constraint, neg_constraint, mul_constraint, div_constraint }, 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 7c0444f6191..384520e7f80 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 @@ -126,7 +126,6 @@ TEST_F(UltraPlonkRAM, TestBlockConstraint) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp index 0919ec81caa..805ea1d8427 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.cpp @@ -46,37 +46,4 @@ template void create_ec_add_constraint(GoblinUltraCir const EcAdd& input, bool has_valid_witness_assignments); -template -void create_ec_double_constraint(Builder& builder, const EcDouble& input, bool has_valid_witness_assignments) -{ - using cycle_group_ct = bb::stdlib::cycle_group; - using field_ct = bb::stdlib::field_t; - // Input to cycle_group point - auto x = field_ct::from_witness_index(&builder, input.input_x); - auto y = field_ct::from_witness_index(&builder, input.input_y); - - if (!has_valid_witness_assignments) { - auto g1 = grumpkin::g1::affine_one; - // We need to have correct values representing point on the curve - builder.variables[input.input_x] = g1.x; - builder.variables[input.input_y] = g1.y; - } - cycle_group_ct input_point(x, y, false); - - // Doubling - cycle_group_ct result = input_point.dbl(); - - auto x_normalized = result.x.normalize(); - auto y_normalized = result.y.normalize(); - builder.assert_equal(x_normalized.witness_index, input.result_x); - builder.assert_equal(y_normalized.witness_index, input.result_y); -} - -template void create_ec_double_constraint(UltraCircuitBuilder& builder, - const EcDouble& input, - bool has_valid_witness_assignments); -template void create_ec_double_constraint(GoblinUltraCircuitBuilder& builder, - const EcDouble& input, - bool has_valid_witness_assignments); - } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp index be378192cb9..de28743d16a 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.hpp @@ -20,18 +20,4 @@ struct EcAdd { template void create_ec_add_constraint(Builder& builder, const EcAdd& input, bool has_valid_witness_assignments); - -struct EcDouble { - uint32_t input_x; - uint32_t input_y; - uint32_t result_x; - uint32_t result_y; - - // for serialization, update with any new fields - MSGPACK_FIELDS(input_x, input_y, result_x, result_y); - friend bool operator==(EcDouble const& lhs, EcDouble const& rhs) = default; -}; - -template -void create_ec_double_constraint(Builder& builder, const EcDouble& input, bool has_valid_witness_assignments); } // namespace acir_format diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp index ea5fb82c5d2..11ea6a77b9d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.test.cpp @@ -40,58 +40,12 @@ size_t generate_ec_add_constraint(EcAdd& ec_add_constraint, WitnessVector& witne return witness_values.size(); } -size_t generate_ec_double_constraint(EcDouble& ec_double_constraint, WitnessVector& witness_values) -{ - - using cycle_group_ct = bb::stdlib::cycle_group; - auto g1 = grumpkin::g1::affine_one; - cycle_group_ct input_point(g1); - // Doubling - cycle_group_ct result = input_point.dbl(); - // add: x,y,x2,y2 - uint32_t result_x_witness_index = static_cast(witness_values.size()); - - witness_values.push_back(result.x.get_value()); - uint32_t result_y_witness_index = static_cast(witness_values.size()); - witness_values.push_back(result.y.get_value()); - ec_double_constraint = EcDouble{ - .input_x = 1, - .input_y = 2, - .result_x = result_x_witness_index, - .result_y = result_y_witness_index, - }; - return witness_values.size(); -} - TEST_F(EcOperations, TestECOperations) { EcAdd ec_add_constraint; - EcDouble ec_double_constraint; WitnessVector witness_values; - generate_ec_add_constraint(ec_add_constraint, witness_values); - size_t num_variables = generate_ec_double_constraint(ec_double_constraint, witness_values); - - poly_triple constrain_5_is_7{ - .a = 5, - .b = 7, - .c = 0, - .q_m = 0, - .q_l = 1, - .q_r = -1, - .q_o = 0, - .q_c = 0, - }; - poly_triple constrain_6_is_8{ - .a = 6, - .b = 8, - .c = 0, - .q_m = 0, - .q_l = 1, - .q_r = -1, - .q_o = 0, - .q_c = 0, - }; + size_t num_variables = generate_ec_add_constraint(ec_add_constraint, witness_values); AcirFormat constraint_system{ .varnum = static_cast(num_variables + 1), @@ -111,11 +65,10 @@ TEST_F(EcOperations, TestECOperations) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = { ec_add_constraint }, - .ec_double_constraints = { ec_double_constraint }, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, - .constraints = { constrain_5_is_7, constrain_6_is_8 }, + .constraints = {}, .block_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 2e17b97008d..fb3e405e2f1 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 @@ -105,7 +105,6 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintSucceed) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -151,7 +150,6 @@ TEST_F(ECDSASecp256k1, TestECDSACompilesForVerifier) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -192,7 +190,6 @@ TEST_F(ECDSASecp256k1, TestECDSAConstraintFail) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, 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 c3487e35da0..fe64491c90c 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 @@ -140,7 +140,6 @@ TEST(ECDSASecp256r1, test_hardcoded) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -187,7 +186,6 @@ TEST(ECDSASecp256r1, TestECDSAConstraintSucceed) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -232,7 +230,6 @@ TEST(ECDSASecp256r1, TestECDSACompilesForVerifier) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -272,7 +269,6 @@ TEST(ECDSASecp256r1, TestECDSAConstraintFail) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, 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 20650bf589b..f281f965eea 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 @@ -98,7 +98,6 @@ Builder create_inner_circuit() .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = {}, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, @@ -252,7 +251,6 @@ Builder create_outer_circuit(std::vector& inner_circuits) .pedersen_hash_constraints = {}, .fixed_base_scalar_mul_constraints = {}, .ec_add_constraints = {}, - .ec_double_constraints = {}, .recursion_constraints = recursion_constraints, .bigint_from_le_bytes_constraints = {}, .bigint_operations = {}, 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 8e18e5bc043..2913ce8be81 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp @@ -157,16 +157,6 @@ struct BlackBoxFuncCall { static EmbeddedCurveAdd bincodeDeserialize(std::vector); }; - struct EmbeddedCurveDouble { - Circuit::FunctionInput input_x; - Circuit::FunctionInput input_y; - std::array outputs; - - friend bool operator==(const EmbeddedCurveDouble&, const EmbeddedCurveDouble&); - std::vector bincodeSerialize() const; - static EmbeddedCurveDouble bincodeDeserialize(std::vector); - }; - struct Keccak256 { std::vector inputs; std::vector outputs; @@ -278,7 +268,6 @@ struct BlackBoxFuncCall { EcdsaSecp256r1, FixedBaseScalarMul, EmbeddedCurveAdd, - EmbeddedCurveDouble, Keccak256, Keccak256VariableLength, Keccakf1600, @@ -616,16 +605,6 @@ struct BlackBoxOp { static EmbeddedCurveAdd bincodeDeserialize(std::vector); }; - struct EmbeddedCurveDouble { - Circuit::RegisterIndex input1_x; - Circuit::RegisterIndex input1_y; - Circuit::HeapArray result; - - friend bool operator==(const EmbeddedCurveDouble&, const EmbeddedCurveDouble&); - std::vector bincodeSerialize() const; - static EmbeddedCurveDouble bincodeDeserialize(std::vector); - }; - struct BigIntAdd { Circuit::RegisterIndex lhs; Circuit::RegisterIndex rhs; @@ -697,7 +676,6 @@ struct BlackBoxOp { PedersenHash, FixedBaseScalarMul, EmbeddedCurveAdd, - EmbeddedCurveDouble, BigIntAdd, BigIntNeg, BigIntMul, @@ -2725,65 +2703,6 @@ Circuit::BlackBoxFuncCall::EmbeddedCurveAdd serde::Deserializable< namespace Circuit { -inline bool operator==(const BlackBoxFuncCall::EmbeddedCurveDouble& lhs, - const BlackBoxFuncCall::EmbeddedCurveDouble& rhs) -{ - if (!(lhs.input_x == rhs.input_x)) { - return false; - } - if (!(lhs.input_y == rhs.input_y)) { - return false; - } - if (!(lhs.outputs == rhs.outputs)) { - return false; - } - return true; -} - -inline std::vector BlackBoxFuncCall::EmbeddedCurveDouble::bincodeSerialize() const -{ - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); -} - -inline BlackBoxFuncCall::EmbeddedCurveDouble BlackBoxFuncCall::EmbeddedCurveDouble::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::EmbeddedCurveDouble& obj, Serializer& serializer) -{ - serde::Serializable::serialize(obj.input_x, serializer); - serde::Serializable::serialize(obj.input_y, serializer); - serde::Serializable::serialize(obj.outputs, serializer); -} - -template <> -template -Circuit::BlackBoxFuncCall::EmbeddedCurveDouble serde::Deserializable< - Circuit::BlackBoxFuncCall::EmbeddedCurveDouble>::deserialize(Deserializer& deserializer) -{ - Circuit::BlackBoxFuncCall::EmbeddedCurveDouble obj; - obj.input_x = serde::Deserializable::deserialize(deserializer); - obj.input_y = serde::Deserializable::deserialize(deserializer); - obj.outputs = serde::Deserializable::deserialize(deserializer); - return obj; -} - -namespace Circuit { - inline bool operator==(const BlackBoxFuncCall::Keccak256& lhs, const BlackBoxFuncCall::Keccak256& rhs) { if (!(lhs.inputs == rhs.inputs)) { @@ -4096,63 +4015,6 @@ Circuit::BlackBoxOp::EmbeddedCurveAdd serde::Deserializable BlackBoxOp::EmbeddedCurveDouble::bincodeSerialize() const -{ - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); -} - -inline BlackBoxOp::EmbeddedCurveDouble BlackBoxOp::EmbeddedCurveDouble::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::EmbeddedCurveDouble& obj, Serializer& serializer) -{ - serde::Serializable::serialize(obj.input1_x, serializer); - serde::Serializable::serialize(obj.input1_y, serializer); - serde::Serializable::serialize(obj.result, serializer); -} - -template <> -template -Circuit::BlackBoxOp::EmbeddedCurveDouble serde::Deserializable::deserialize( - Deserializer& deserializer) -{ - Circuit::BlackBoxOp::EmbeddedCurveDouble obj; - obj.input1_x = serde::Deserializable::deserialize(deserializer); - obj.input1_y = serde::Deserializable::deserialize(deserializer); - obj.result = serde::Deserializable::deserialize(deserializer); - return obj; -} - -namespace Circuit { - inline bool operator==(const BlackBoxOp::BigIntAdd& lhs, const BlackBoxOp::BigIntAdd& rhs) { if (!(lhs.lhs == rhs.lhs)) { diff --git a/noir/acvm-repo/acir/codegen/acir.cpp b/noir/acvm-repo/acir/codegen/acir.cpp index 07bcd5f9f97..554e4909574 100644 --- a/noir/acvm-repo/acir/codegen/acir.cpp +++ b/noir/acvm-repo/acir/codegen/acir.cpp @@ -157,16 +157,6 @@ namespace Circuit { static EmbeddedCurveAdd bincodeDeserialize(std::vector); }; - struct EmbeddedCurveDouble { - Circuit::FunctionInput input_x; - Circuit::FunctionInput input_y; - std::array outputs; - - friend bool operator==(const EmbeddedCurveDouble&, const EmbeddedCurveDouble&); - std::vector bincodeSerialize() const; - static EmbeddedCurveDouble bincodeDeserialize(std::vector); - }; - struct Keccak256 { std::vector inputs; std::vector outputs; @@ -265,7 +255,7 @@ namespace Circuit { static BigIntToLeBytes bincodeDeserialize(std::vector); }; - std::variant value; + std::variant value; friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&); std::vector bincodeSerialize() const; @@ -592,16 +582,6 @@ namespace Circuit { static EmbeddedCurveAdd bincodeDeserialize(std::vector); }; - struct EmbeddedCurveDouble { - Circuit::RegisterIndex input1_x; - Circuit::RegisterIndex input1_y; - Circuit::HeapArray result; - - friend bool operator==(const EmbeddedCurveDouble&, const EmbeddedCurveDouble&); - std::vector bincodeSerialize() const; - static EmbeddedCurveDouble bincodeDeserialize(std::vector); - }; - struct BigIntAdd { Circuit::RegisterIndex lhs; Circuit::RegisterIndex rhs; @@ -661,7 +641,7 @@ namespace Circuit { static BigIntToLeBytes bincodeDeserialize(std::vector); }; - std::variant value; + std::variant value; friend bool operator==(const BlackBoxOp&, const BlackBoxOp&); std::vector bincodeSerialize() const; @@ -2370,50 +2350,6 @@ Circuit::BlackBoxFuncCall::EmbeddedCurveAdd serde::Deserializable BlackBoxFuncCall::EmbeddedCurveDouble::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxFuncCall::EmbeddedCurveDouble BlackBoxFuncCall::EmbeddedCurveDouble::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Circuit - -template <> -template -void serde::Serializable::serialize(const Circuit::BlackBoxFuncCall::EmbeddedCurveDouble &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.input_x, serializer); - serde::Serializable::serialize(obj.input_y, serializer); - serde::Serializable::serialize(obj.outputs, serializer); -} - -template <> -template -Circuit::BlackBoxFuncCall::EmbeddedCurveDouble serde::Deserializable::deserialize(Deserializer &deserializer) { - Circuit::BlackBoxFuncCall::EmbeddedCurveDouble obj; - obj.input_x = serde::Deserializable::deserialize(deserializer); - obj.input_y = serde::Deserializable::deserialize(deserializer); - obj.outputs = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Circuit { inline bool operator==(const BlackBoxFuncCall::Keccak256 &lhs, const BlackBoxFuncCall::Keccak256 &rhs) { @@ -3427,50 +3363,6 @@ Circuit::BlackBoxOp::EmbeddedCurveAdd serde::Deserializable BlackBoxOp::EmbeddedCurveDouble::bincodeSerialize() const { - auto serializer = serde::BincodeSerializer(); - serde::Serializable::serialize(*this, serializer); - return std::move(serializer).bytes(); - } - - inline BlackBoxOp::EmbeddedCurveDouble BlackBoxOp::EmbeddedCurveDouble::bincodeDeserialize(std::vector input) { - auto deserializer = serde::BincodeDeserializer(input); - auto value = serde::Deserializable::deserialize(deserializer); - if (deserializer.get_buffer_offset() < input.size()) { - throw serde::deserialization_error("Some input bytes were not read"); - } - return value; - } - -} // end of namespace Circuit - -template <> -template -void serde::Serializable::serialize(const Circuit::BlackBoxOp::EmbeddedCurveDouble &obj, Serializer &serializer) { - serde::Serializable::serialize(obj.input1_x, serializer); - serde::Serializable::serialize(obj.input1_y, serializer); - serde::Serializable::serialize(obj.result, serializer); -} - -template <> -template -Circuit::BlackBoxOp::EmbeddedCurveDouble serde::Deserializable::deserialize(Deserializer &deserializer) { - Circuit::BlackBoxOp::EmbeddedCurveDouble obj; - obj.input1_x = serde::Deserializable::deserialize(deserializer); - obj.input1_y = serde::Deserializable::deserialize(deserializer); - obj.result = serde::Deserializable::deserialize(deserializer); - return obj; -} - namespace Circuit { inline bool operator==(const BlackBoxOp::BigIntAdd &lhs, const BlackBoxOp::BigIntAdd &rhs) { diff --git a/noir/acvm-repo/acir/src/circuit/black_box_functions.rs b/noir/acvm-repo/acir/src/circuit/black_box_functions.rs index 83c1a27bb88..1944771963b 100644 --- a/noir/acvm-repo/acir/src/circuit/black_box_functions.rs +++ b/noir/acvm-repo/acir/src/circuit/black_box_functions.rs @@ -47,8 +47,6 @@ pub enum BlackBoxFunc { RecursiveAggregation, /// Addition over the embedded curve on which [`FieldElement`][acir_field::FieldElement] is defined. EmbeddedCurveAdd, - /// Point doubling over the embedded curve on which [`FieldElement`][acir_field::FieldElement] is defined. - EmbeddedCurveDouble, /// BigInt addition BigIntAdd, /// BigInt subtraction @@ -81,7 +79,6 @@ impl BlackBoxFunc { BlackBoxFunc::EcdsaSecp256k1 => "ecdsa_secp256k1", BlackBoxFunc::FixedBaseScalarMul => "fixed_base_scalar_mul", BlackBoxFunc::EmbeddedCurveAdd => "embedded_curve_add", - BlackBoxFunc::EmbeddedCurveDouble => "embedded_curve_double", BlackBoxFunc::AND => "and", BlackBoxFunc::XOR => "xor", BlackBoxFunc::RANGE => "range", @@ -110,7 +107,6 @@ impl BlackBoxFunc { "ecdsa_secp256r1" => Some(BlackBoxFunc::EcdsaSecp256r1), "fixed_base_scalar_mul" => Some(BlackBoxFunc::FixedBaseScalarMul), "embedded_curve_add" => Some(BlackBoxFunc::EmbeddedCurveAdd), - "embedded_curve_double" => Some(BlackBoxFunc::EmbeddedCurveDouble), "and" => Some(BlackBoxFunc::AND), "xor" => Some(BlackBoxFunc::XOR), "range" => Some(BlackBoxFunc::RANGE), diff --git a/noir/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs b/noir/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs index 1fdc0265377..760a2fcbd78 100644 --- a/noir/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs +++ b/noir/acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs @@ -86,11 +86,6 @@ pub enum BlackBoxFuncCall { input2_y: FunctionInput, outputs: (Witness, Witness), }, - EmbeddedCurveDouble { - input_x: FunctionInput, - input_y: FunctionInput, - outputs: (Witness, Witness), - }, Keccak256 { inputs: Vec, outputs: Vec, @@ -167,7 +162,6 @@ impl BlackBoxFuncCall { BlackBoxFuncCall::EcdsaSecp256r1 { .. } => BlackBoxFunc::EcdsaSecp256r1, BlackBoxFuncCall::FixedBaseScalarMul { .. } => BlackBoxFunc::FixedBaseScalarMul, BlackBoxFuncCall::EmbeddedCurveAdd { .. } => BlackBoxFunc::EmbeddedCurveAdd, - BlackBoxFuncCall::EmbeddedCurveDouble { .. } => BlackBoxFunc::EmbeddedCurveDouble, BlackBoxFuncCall::Keccak256 { .. } => BlackBoxFunc::Keccak256, BlackBoxFuncCall::Keccak256VariableLength { .. } => BlackBoxFunc::Keccak256, BlackBoxFuncCall::Keccakf1600 { .. } => BlackBoxFunc::Keccakf1600, @@ -207,9 +201,6 @@ impl BlackBoxFuncCall { BlackBoxFuncCall::EmbeddedCurveAdd { input1_x, input1_y, input2_x, input2_y, .. } => vec![*input1_x, *input1_y, *input2_x, *input2_y], - BlackBoxFuncCall::EmbeddedCurveDouble { input_x, input_y, .. } => { - vec![*input_x, *input_y] - } BlackBoxFuncCall::RANGE { input } => vec![*input], BlackBoxFuncCall::SchnorrVerify { public_key_x, @@ -300,8 +291,7 @@ impl BlackBoxFuncCall { | BlackBoxFuncCall::EcdsaSecp256r1 { output, .. } => vec![*output], BlackBoxFuncCall::FixedBaseScalarMul { outputs, .. } | BlackBoxFuncCall::PedersenCommitment { outputs, .. } - | BlackBoxFuncCall::EmbeddedCurveAdd { outputs, .. } - | BlackBoxFuncCall::EmbeddedCurveDouble { outputs, .. } => vec![outputs.0, outputs.1], + | BlackBoxFuncCall::EmbeddedCurveAdd { outputs, .. } => vec![outputs.0, outputs.1], BlackBoxFuncCall::RANGE { .. } | BlackBoxFuncCall::RecursiveAggregation { .. } | BlackBoxFuncCall::BigIntFromLeBytes { .. } diff --git a/noir/acvm-repo/acvm/src/compiler/transformers/mod.rs b/noir/acvm-repo/acvm/src/compiler/transformers/mod.rs index effe1128d36..01badbdf914 100644 --- a/noir/acvm-repo/acvm/src/compiler/transformers/mod.rs +++ b/noir/acvm-repo/acvm/src/compiler/transformers/mod.rs @@ -134,10 +134,6 @@ pub(super) fn transform_internal( | acir::circuit::opcodes::BlackBoxFuncCall::EmbeddedCurveAdd { outputs, .. } - | acir::circuit::opcodes::BlackBoxFuncCall::EmbeddedCurveDouble { - outputs, - .. - } | acir::circuit::opcodes::BlackBoxFuncCall::PedersenCommitment { outputs, .. diff --git a/noir/acvm-repo/acvm/src/pwg/blackbox/fixed_base_scalar_mul.rs b/noir/acvm-repo/acvm/src/pwg/blackbox/fixed_base_scalar_mul.rs index 2bf16419232..c5bfd1d5646 100644 --- a/noir/acvm-repo/acvm/src/pwg/blackbox/fixed_base_scalar_mul.rs +++ b/noir/acvm-repo/acvm/src/pwg/blackbox/fixed_base_scalar_mul.rs @@ -24,16 +24,6 @@ pub(super) fn fixed_base_scalar_mul( Ok(()) } -pub(super) fn embedded_curve_double( - backend: &impl BlackBoxFunctionSolver, - initial_witness: &mut WitnessMap, - input_x: FunctionInput, - input_y: FunctionInput, - outputs: (Witness, Witness), -) -> Result<(), OpcodeResolutionError> { - embedded_curve_add(backend, initial_witness, input_x, input_y, input_x, input_y, outputs) -} - pub(super) fn embedded_curve_add( backend: &impl BlackBoxFunctionSolver, initial_witness: &mut WitnessMap, diff --git a/noir/acvm-repo/acvm/src/pwg/blackbox/mod.rs b/noir/acvm-repo/acvm/src/pwg/blackbox/mod.rs index 99eff68dd23..34fd442f1eb 100644 --- a/noir/acvm-repo/acvm/src/pwg/blackbox/mod.rs +++ b/noir/acvm-repo/acvm/src/pwg/blackbox/mod.rs @@ -17,8 +17,7 @@ mod pedersen; mod range; mod signature; -use fixed_base_scalar_mul::fixed_base_scalar_mul; -use fixed_base_scalar_mul::{embedded_curve_add, embedded_curve_double}; +use fixed_base_scalar_mul::{embedded_curve_add, fixed_base_scalar_mul}; // Hash functions should eventually be exposed for external consumers. use hash::solve_generic_256_hash_opcode; use logic::{and, xor}; @@ -189,9 +188,6 @@ pub(crate) fn solve( *outputs, ) } - BlackBoxFuncCall::EmbeddedCurveDouble { input_x, input_y, outputs } => { - embedded_curve_double(backend, initial_witness, *input_x, *input_y, *outputs) - } // Recursive aggregation will be entirely handled by the backend and is not solved by the ACVM BlackBoxFuncCall::RecursiveAggregation { .. } => Ok(()), BlackBoxFuncCall::BigIntAdd { .. } => todo!(), diff --git a/noir/acvm-repo/blackbox_solver/src/curve_specific_solver.rs b/noir/acvm-repo/blackbox_solver/src/curve_specific_solver.rs index 82941e91d61..2234710dec0 100644 --- a/noir/acvm-repo/blackbox_solver/src/curve_specific_solver.rs +++ b/noir/acvm-repo/blackbox_solver/src/curve_specific_solver.rs @@ -36,11 +36,6 @@ pub trait BlackBoxFunctionSolver { input2_x: &FieldElement, input2_y: &FieldElement, ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; - fn ec_double( - &self, - input_x: &FieldElement, - input_x: &FieldElement, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError>; } pub struct StubbedBlackBoxSolver; @@ -94,11 +89,4 @@ impl BlackBoxFunctionSolver for StubbedBlackBoxSolver { ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { Err(Self::fail(BlackBoxFunc::EmbeddedCurveAdd)) } - fn ec_double( - &self, - _input_x: &FieldElement, - _input_y: &FieldElement, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - Err(Self::fail(BlackBoxFunc::EmbeddedCurveDouble)) - } } diff --git a/noir/acvm-repo/bn254_blackbox_solver/src/lib.rs b/noir/acvm-repo/bn254_blackbox_solver/src/lib.rs index f4b866b5882..13aa956f9e1 100644 --- a/noir/acvm-repo/bn254_blackbox_solver/src/lib.rs +++ b/noir/acvm-repo/bn254_blackbox_solver/src/lib.rs @@ -97,12 +97,4 @@ impl BlackBoxFunctionSolver for Bn254BlackBoxSolver { ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { embedded_curve_add(*input1_x, *input1_y, *input2_x, *input2_y) } - - fn ec_double( - &self, - input_x: &FieldElement, - input_y: &FieldElement, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - embedded_curve_add(*input_x, *input_y, *input_x, *input_y) - } } diff --git a/noir/acvm-repo/brillig/src/black_box.rs b/noir/acvm-repo/brillig/src/black_box.rs index 5893758ce9e..309c1c741f3 100644 --- a/noir/acvm-repo/brillig/src/black_box.rs +++ b/noir/acvm-repo/brillig/src/black_box.rs @@ -80,13 +80,6 @@ pub enum BlackBoxOp { input2_y: RegisterIndex, result: HeapArray, }, - /// Performs point doubling over the embedded curve. - EmbeddedCurveDouble { - input1_x: RegisterIndex, - input1_y: RegisterIndex, - result: HeapArray, - }, - BigIntAdd { lhs: RegisterIndex, rhs: RegisterIndex, diff --git a/noir/acvm-repo/brillig_vm/src/black_box.rs b/noir/acvm-repo/brillig_vm/src/black_box.rs index edbebb61ece..9a8e851a7af 100644 --- a/noir/acvm-repo/brillig_vm/src/black_box.rs +++ b/noir/acvm-repo/brillig_vm/src/black_box.rs @@ -165,13 +165,6 @@ pub(crate) fn evaluate_black_box( memory.write_slice(registers.get(result.pointer).to_usize(), &[x.into(), y.into()]); Ok(()) } - BlackBoxOp::EmbeddedCurveDouble { input1_x, input1_y, result } => { - let input1_x = registers.get(*input1_x).to_field(); - let input1_y = registers.get(*input1_y).to_field(); - let (x, y) = solver.ec_double(&input1_x, &input1_y)?; - memory.write_slice(registers.get(result.pointer).to_usize(), &[x.into(), y.into()]); - Ok(()) - } BlackBoxOp::PedersenCommitment { inputs, domain_separator, output } => { let inputs: Vec = read_heap_vector(memory, registers, inputs).iter().map(|x| x.to_field()).collect(); @@ -223,7 +216,6 @@ fn black_box_function_from_op(op: &BlackBoxOp) -> BlackBoxFunc { BlackBoxOp::PedersenHash { .. } => BlackBoxFunc::PedersenHash, BlackBoxOp::FixedBaseScalarMul { .. } => BlackBoxFunc::FixedBaseScalarMul, BlackBoxOp::EmbeddedCurveAdd { .. } => BlackBoxFunc::EmbeddedCurveAdd, - BlackBoxOp::EmbeddedCurveDouble { .. } => BlackBoxFunc::EmbeddedCurveDouble, BlackBoxOp::BigIntAdd { .. } => BlackBoxFunc::BigIntAdd, BlackBoxOp::BigIntNeg { .. } => BlackBoxFunc::BigIntNeg, BlackBoxOp::BigIntMul { .. } => BlackBoxFunc::BigIntMul, diff --git a/noir/acvm-repo/brillig_vm/src/lib.rs b/noir/acvm-repo/brillig_vm/src/lib.rs index df4c8135bce..cb957295819 100644 --- a/noir/acvm-repo/brillig_vm/src/lib.rs +++ b/noir/acvm-repo/brillig_vm/src/lib.rs @@ -460,13 +460,6 @@ impl BlackBoxFunctionSolver for DummyBlackBoxSolver { ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { Ok((5_u128.into(), 6_u128.into())) } - fn ec_double( - &self, - _input1_x: &FieldElement, - _input1_y: &FieldElement, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - Ok((7_u128.into(), 8_u128.into())) - } } #[cfg(test)] diff --git a/noir/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs b/noir/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs index c7b6f39279b..de59fd26873 100644 --- a/noir/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs +++ b/noir/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs @@ -215,23 +215,6 @@ pub(crate) fn convert_black_box_call( ) } } - BlackBoxFunc::EmbeddedCurveDouble => { - if let ( - [BrilligVariable::Simple(input1_x), BrilligVariable::Simple(input1_y)], - [BrilligVariable::BrilligArray(result_array)], - ) = (function_arguments, function_results) - { - brillig_context.black_box_op_instruction(BlackBoxOp::EmbeddedCurveDouble { - input1_x: *input1_x, - input1_y: *input1_y, - result: result_array.to_heap_array(), - }); - } else { - unreachable!( - "ICE: EmbeddedCurveAdd expects two register arguments and one array result" - ) - } - } BlackBoxFunc::AND => { unreachable!("ICE: `BlackBoxFunc::AND` calls should be transformed into a `BinaryOp`") } diff --git a/noir/compiler/noirc_evaluator/src/brillig/brillig_ir.rs b/noir/compiler/noirc_evaluator/src/brillig/brillig_ir.rs index db3cd501ca0..3e6c3d4d7de 100644 --- a/noir/compiler/noirc_evaluator/src/brillig/brillig_ir.rs +++ b/noir/compiler/noirc_evaluator/src/brillig/brillig_ir.rs @@ -1096,14 +1096,6 @@ pub(crate) mod tests { ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { panic!("Path not trodden by this test") } - - fn ec_double( - &self, - _input_x: &FieldElement, - _input_y: &FieldElement, - ) -> Result<(FieldElement, FieldElement), BlackBoxResolutionError> { - panic!("Path not trodden by this test") - } } pub(crate) fn create_context() -> BrilligContext { diff --git a/noir/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs b/noir/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs index 5709b0a1aa2..0e81e3d07ec 100644 --- a/noir/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs +++ b/noir/compiler/noirc_evaluator/src/brillig/brillig_ir/debug_show.rs @@ -413,15 +413,6 @@ impl DebugShow { result ); } - BlackBoxOp::EmbeddedCurveDouble { input1_x, input1_y, result } => { - debug_println!( - self.enable_debug_trace, - " EMBEDDED_CURVE_DOUBLE ({} {}) -> {}", - input1_x, - input1_y, - result - ); - } BlackBoxOp::PedersenCommitment { inputs, domain_separator, output } => { debug_println!( self.enable_debug_trace, diff --git a/noir/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs b/noir/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs index ac0981acfda..27c5d06cda2 100644 --- a/noir/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs +++ b/noir/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs @@ -220,11 +220,6 @@ impl GeneratedAcir { input2_y: inputs[3][0], outputs: (outputs[0], outputs[1]), }, - BlackBoxFunc::EmbeddedCurveDouble => BlackBoxFuncCall::EmbeddedCurveDouble { - input_x: inputs[0][0], - input_y: inputs[1][0], - outputs: (outputs[0], outputs[1]), - }, BlackBoxFunc::Keccak256 => { let var_message_size = match inputs.to_vec().pop() { Some(var_message_size) => var_message_size[0], @@ -635,9 +630,6 @@ fn black_box_func_expected_input_size(name: BlackBoxFunc) -> Option { // Addition over the embedded curve: input are coordinates (x1,y1) and (x2,y2) of the Grumpkin points BlackBoxFunc::EmbeddedCurveAdd => Some(4), - // Doubling over the embedded curve: input is (x,y) coordinate of the point. - BlackBoxFunc::EmbeddedCurveDouble => Some(2), - // Big integer operations take in 0 inputs. They use constants for their inputs. BlackBoxFunc::BigIntAdd | BlackBoxFunc::BigIntNeg @@ -683,9 +675,7 @@ fn black_box_expected_output_size(name: BlackBoxFunc) -> Option { // Output of operations over the embedded curve // will be 2 field elements representing the point. - BlackBoxFunc::FixedBaseScalarMul - | BlackBoxFunc::EmbeddedCurveAdd - | BlackBoxFunc::EmbeddedCurveDouble => Some(2), + BlackBoxFunc::FixedBaseScalarMul | BlackBoxFunc::EmbeddedCurveAdd => Some(2), // Big integer operations return a big integer BlackBoxFunc::BigIntAdd diff --git a/noir/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs b/noir/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs index ff9dc4f345e..1da376e1f2d 100644 --- a/noir/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs +++ b/noir/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs @@ -429,8 +429,7 @@ fn simplify_black_box_func( | BlackBoxFunc::SchnorrVerify | BlackBoxFunc::PedersenCommitment | BlackBoxFunc::PedersenHash - | BlackBoxFunc::EmbeddedCurveAdd - | BlackBoxFunc::EmbeddedCurveDouble => { + | BlackBoxFunc::EmbeddedCurveAdd => { // Currently unsolvable here as we rely on an implementation in the backend. SimplifyResult::None } diff --git a/noir/noir_stdlib/src/scalar_mul.nr b/noir/noir_stdlib/src/scalar_mul.nr index e1d0ff4d453..2f852628dbb 100644 --- a/noir/noir_stdlib/src/scalar_mul.nr +++ b/noir/noir_stdlib/src/scalar_mul.nr @@ -16,5 +16,6 @@ pub fn fixed_base_embedded_curve(_low: Field, _high: Field) -> [Field; 2] {} #[foreign(embedded_curve_add)] pub fn embedded_curve_add(_point1: EmbeddedCurvePoint, _point2: EmbeddedCurvePoint) -> EmbeddedCurvePoint {} -#[foreign(embedded_curve_double)] -pub fn embedded_curve_double(_point: EmbeddedCurvePoint) -> EmbeddedCurvePoint {} +pub fn embedded_curve_double(point: EmbeddedCurvePoint) -> EmbeddedCurvePoint { + embedded_curve_add(point, point) +} diff --git a/noir/tooling/lsp/src/solver.rs b/noir/tooling/lsp/src/solver.rs index 6217b7ad71f..f001cebaa4d 100644 --- a/noir/tooling/lsp/src/solver.rs +++ b/noir/tooling/lsp/src/solver.rs @@ -49,12 +49,4 @@ impl BlackBoxFunctionSolver for WrapperSolver { ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { self.0.ec_add(input1_x, input1_y, input2_x, input2_y) } - - fn ec_double( - &self, - input_x: &acvm::FieldElement, - input_y: &acvm::FieldElement, - ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { - self.0.ec_double(input_x, input_y) - } }