From 4c601906457fa21b47ad6a9f5db0768aacca7026 Mon Sep 17 00:00:00 2001 From: Iluvmagick Date: Thu, 14 Mar 2024 15:22:43 +0400 Subject: [PATCH] Added mutable copy constraint access to circuit. (#307) --- .../zk/snark/arithmetization/plonk/constraint_system.hpp | 4 ++++ .../zk/snark/arithmetization/plonk/copy_constraint.hpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp b/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp index 64f14e360..129e37fb9 100644 --- a/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp +++ b/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp @@ -126,6 +126,10 @@ namespace nil { return _copy_constraints; } + copy_constraints_container_type &mutable_copy_constraints() { + return _copy_constraints; + } + const lookup_gates_container_type &lookup_gates() const { return _lookup_gates; } diff --git a/include/nil/crypto3/zk/snark/arithmetization/plonk/copy_constraint.hpp b/include/nil/crypto3/zk/snark/arithmetization/plonk/copy_constraint.hpp index 7848608f8..250df1374 100644 --- a/include/nil/crypto3/zk/snark/arithmetization/plonk/copy_constraint.hpp +++ b/include/nil/crypto3/zk/snark/arithmetization/plonk/copy_constraint.hpp @@ -27,6 +27,8 @@ #ifndef CRYPTO3_ZK_PLONK_COPY_CONSTRAINT_HPP #define CRYPTO3_ZK_PLONK_COPY_CONSTRAINT_HPP +#include + #include namespace nil { @@ -37,6 +39,12 @@ namespace nil { template using plonk_copy_constraint = std::pair, plonk_variable>; + template + bool operator==(const plonk_copy_constraint &lhs, const plonk_copy_constraint &rhs) { + return ((lhs.first == rhs.first ) && (lhs.second == rhs.second)) || + ((lhs.first == rhs.second) && (lhs.second == rhs.first )); + } + } // namespace snark } // namespace zk } // namespace crypto3