From 877b3ee6368a6ad5001c2f123bfd5b7f47ed95cc Mon Sep 17 00:00:00 2001 From: Iluvmagick Date: Mon, 4 Mar 2024 11:21:51 +0400 Subject: [PATCH] Added mutable copy constraint access to circuit. --- .../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 c0114824e..792692f98 100644 --- a/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp +++ b/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp @@ -108,6 +108,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