From 73f6b56aa4912ca88d369b7c2e6fd12a6887bfb3 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 17 Feb 2023 21:55:51 +0000 Subject: [PATCH 1/5] NOIR NEEDS: Equality method and serialisation are needed for serialising a struct which contains a vector of poly_triple --- .../proof_system/composer/composer_base.hpp | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/cpp/src/aztec/proof_system/composer/composer_base.hpp b/cpp/src/aztec/proof_system/composer/composer_base.hpp index 2281ace34c..32c3241cb7 100644 --- a/cpp/src/aztec/proof_system/composer/composer_base.hpp +++ b/cpp/src/aztec/proof_system/composer/composer_base.hpp @@ -1,6 +1,7 @@ #pragma once #include #include +#include namespace bonk { struct add_triple { @@ -56,8 +57,49 @@ struct poly_triple { barretenberg::fr q_r; barretenberg::fr q_o; barretenberg::fr q_c; + + friend bool operator==(poly_triple const& lhs, poly_triple const& rhs) + { + // clang-format off + return + lhs.a == rhs.a && + lhs.b == rhs.b && + lhs.c == rhs.c && + lhs.q_m == rhs.q_m && + lhs.q_l == rhs.q_l && + lhs.q_r == rhs.q_r && + lhs.q_o == rhs.q_o && + lhs.q_c == rhs.q_c; + // clang-format on + } }; +template inline void read(B& buf, poly_triple& constraint) +{ + using serialize::read; + read(buf, constraint.a); + read(buf, constraint.b); + read(buf, constraint.c); + read(buf, constraint.q_m); + read(buf, constraint.q_l); + read(buf, constraint.q_r); + read(buf, constraint.q_o); + read(buf, constraint.q_c); +} + +template inline void write(B& buf, poly_triple const& constraint) +{ + using serialize::write; + write(buf, constraint.a); + write(buf, constraint.b); + write(buf, constraint.c); + write(buf, constraint.q_m); + write(buf, constraint.q_l); + write(buf, constraint.q_r); + write(buf, constraint.q_o); + write(buf, constraint.q_c); +} + struct fixed_group_add_quad { uint32_t a; uint32_t b; From e251d618a6d4b15a4d96052dc100958041e7f6ee Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Tue, 21 Feb 2023 09:44:58 -0700 Subject: [PATCH 2/5] Light formatting --- .../proof_system/composer/composer_base.hpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cpp/src/aztec/proof_system/composer/composer_base.hpp b/cpp/src/aztec/proof_system/composer/composer_base.hpp index 32c3241cb7..a2f8fd77bd 100644 --- a/cpp/src/aztec/proof_system/composer/composer_base.hpp +++ b/cpp/src/aztec/proof_system/composer/composer_base.hpp @@ -61,15 +61,15 @@ struct poly_triple { friend bool operator==(poly_triple const& lhs, poly_triple const& rhs) { // clang-format off - return - lhs.a == rhs.a && - lhs.b == rhs.b && - lhs.c == rhs.c && - lhs.q_m == rhs.q_m && - lhs.q_l == rhs.q_l && - lhs.q_r == rhs.q_r && - lhs.q_o == rhs.q_o && - lhs.q_c == rhs.q_c; + return + lhs.a == rhs.a && + lhs.b == rhs.b && + lhs.c == rhs.c && + lhs.q_m == rhs.q_m && + lhs.q_l == rhs.q_l && + lhs.q_r == rhs.q_r && + lhs.q_o == rhs.q_o && + lhs.q_c == rhs.q_c; // clang-format on } }; @@ -134,4 +134,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk \ No newline at end of file +} // namespace bonk From 289c0d5ebbd188d1b66a55988ea123c8137b159c Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Tue, 21 Feb 2023 09:50:30 -0700 Subject: [PATCH 3/5] remove added newline --- cpp/src/aztec/proof_system/composer/composer_base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/aztec/proof_system/composer/composer_base.hpp b/cpp/src/aztec/proof_system/composer/composer_base.hpp index a2f8fd77bd..8166da87b9 100644 --- a/cpp/src/aztec/proof_system/composer/composer_base.hpp +++ b/cpp/src/aztec/proof_system/composer/composer_base.hpp @@ -134,4 +134,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk +} // namespace bonk \ No newline at end of file From 9d466a73c0ff70a060beedfb26eecb5a015f1bcd Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 23 Feb 2023 08:00:42 -0700 Subject: [PATCH 4/5] change to default --- .../proof_system/composer/composer_base.hpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/cpp/src/aztec/proof_system/composer/composer_base.hpp b/cpp/src/aztec/proof_system/composer/composer_base.hpp index 8166da87b9..eb371a4961 100644 --- a/cpp/src/aztec/proof_system/composer/composer_base.hpp +++ b/cpp/src/aztec/proof_system/composer/composer_base.hpp @@ -58,20 +58,7 @@ struct poly_triple { barretenberg::fr q_o; barretenberg::fr q_c; - friend bool operator==(poly_triple const& lhs, poly_triple const& rhs) - { - // clang-format off - return - lhs.a == rhs.a && - lhs.b == rhs.b && - lhs.c == rhs.c && - lhs.q_m == rhs.q_m && - lhs.q_l == rhs.q_l && - lhs.q_r == rhs.q_r && - lhs.q_o == rhs.q_o && - lhs.q_c == rhs.q_c; - // clang-format on - } + friend bool operator==(poly_triple const& lhs, poly_triple const& rhs) = default; }; template inline void read(B& buf, poly_triple& constraint) @@ -134,4 +121,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk \ No newline at end of file +} // namespace bonk From 295a8cbadce6bf07e46aaa6a89f74798a2b12e15 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Thu, 23 Feb 2023 08:05:06 -0700 Subject: [PATCH 5/5] diff nit --- cpp/src/aztec/proof_system/composer/composer_base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/aztec/proof_system/composer/composer_base.hpp b/cpp/src/aztec/proof_system/composer/composer_base.hpp index eb371a4961..67791f9adc 100644 --- a/cpp/src/aztec/proof_system/composer/composer_base.hpp +++ b/cpp/src/aztec/proof_system/composer/composer_base.hpp @@ -121,4 +121,4 @@ struct ecc_add_gate { barretenberg::fr endomorphism_coefficient; barretenberg::fr sign_coefficient; }; -} // namespace bonk +} // namespace bonk \ No newline at end of file