diff --git a/cpp/src/aztec/dsl/acir_format/ecdsa_secp256k1.cpp b/cpp/src/aztec/dsl/acir_format/ecdsa_secp256k1.cpp index 38a8cb3359..a00edd767f 100644 --- a/cpp/src/aztec/dsl/acir_format/ecdsa_secp256k1.cpp +++ b/cpp/src/aztec/dsl/acir_format/ecdsa_secp256k1.cpp @@ -103,7 +103,18 @@ void create_ecdsa_verify_constraints(plonk::TurboComposer& composer, const Ecdsa stdlib::ecdsa::signature sig{ stdlib::byte_array(&composer, rr), stdlib::byte_array(&composer, ss) }; - auto pub_key = secp256k1_ct::g1_ct(pub_key_x_fq, pub_key_y_fq); + pub_key_x_fq.assert_is_in_field(); + pub_key_y_fq.assert_is_in_field(); + + // TODO: crypto-dev to fix calculation and constraining of the signature result is correct + // the above line is currently a placeholder as unused variabels are not allowed in the build + // auto pub_key = secp256k1_ct::g1_ct(pub_key_x_fq, pub_key_y_fq); + // bool_ct signature_result = stdlib::ecdsa:: + // verify_signature( + // message, pub_key, sig); + + // auto result_bool = composer.add_variable(signature_result.get_value() == true); composer.assert_equal(false, input.result); } diff --git a/cpp/src/aztec/dsl/turbo_proofs/turbo_proofs.cpp b/cpp/src/aztec/dsl/turbo_proofs/turbo_proofs.cpp index 48e3f58549..23f54a048d 100644 --- a/cpp/src/aztec/dsl/turbo_proofs/turbo_proofs.cpp +++ b/cpp/src/aztec/dsl/turbo_proofs/turbo_proofs.cpp @@ -27,21 +27,13 @@ size_t turbo_init_proving_key(uint8_t const* constraint_system_buf, uint8_t cons auto crs_factory = std::make_unique(); auto composer = create_circuit(constraint_system, std::move(crs_factory)); auto proving_key = composer.compute_proving_key(); - - // Computing the size of the serialized key is non trivial. We know it's ~331mb. - // Allocate a buffer large enough to hold it, and abort if we overflow. - // This is to keep memory usage down. - size_t total_buf_len = 350 * 1024 * 1024; - auto raw_buf = (uint8_t*)malloc(total_buf_len); - auto raw_buf_end = raw_buf; - write(raw_buf_end, *proving_key); + + auto buffer = to_buffer(*proving_key); + auto raw_buf = (uint8_t*)malloc(buffer.size()); + memcpy(raw_buf, (void*)buffer.data(), buffer.size()); *pk_buf = raw_buf; - auto len = static_cast(raw_buf_end - raw_buf); - if (len > total_buf_len) { - info("Buffer overflow serializing proving key."); - std::abort(); - } - return len; + + return buffer.size(); } size_t turbo_init_verification_key(void* pippenger, uint8_t const* g2x, uint8_t const* pk_buf, uint8_t const** vk_buf)