From 603bd435d7e17300f4ce6e3cf559fe05bea555dc Mon Sep 17 00:00:00 2001 From: Aleksandr Cherenkov Date: Tue, 2 Apr 2024 12:23:02 +0000 Subject: [PATCH] add check for ivalid var type --- .../nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp | 4 ++++ .../zk/snark/arithmetization/plonk/table_description.hpp | 4 ++++ .../zk/snark/systems/plonk/placeholder/gates_argument.hpp | 4 ++++ .../zk/snark/systems/plonk/placeholder/lookup_argument.hpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp b/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp index 5fba556e6..2fab964de 100644 --- a/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp +++ b/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint.hpp @@ -131,6 +131,8 @@ namespace nil { case VariableType::column_type::selector: assignment = assignments.selector(var.index); break; + default: + BOOST_ASSERT_MSG(false, "Invalid column type"); } if (var.rotation != 0) { @@ -169,6 +171,8 @@ namespace nil { case VariableType::column_type::selector: assignment = assignments.selector(var.index); break; + default: + BOOST_ASSERT_MSG(false, "Invalid column type"); } if (var.rotation != 0) { diff --git a/include/nil/crypto3/zk/snark/arithmetization/plonk/table_description.hpp b/include/nil/crypto3/zk/snark/arithmetization/plonk/table_description.hpp index fa4ea3e16..03be3bee8 100644 --- a/include/nil/crypto3/zk/snark/arithmetization/plonk/table_description.hpp +++ b/include/nil/crypto3/zk/snark/arithmetization/plonk/table_description.hpp @@ -74,6 +74,10 @@ namespace nil { return witness_columns + public_input_columns + a.index; case plonk_variable::column_type::selector: return witness_columns + public_input_columns + constant_columns + a.index; + default: + std::cerr << "Invalid column type"; + std::abort(); + break; } /* unreachable*/ return std::numeric_limits::max(); diff --git a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/gates_argument.hpp b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/gates_argument.hpp index cb46911dd..61721917f 100644 --- a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/gates_argument.hpp +++ b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/gates_argument.hpp @@ -107,6 +107,10 @@ namespace nil { case polynomial_dfs_variable_type::column_type::selector: assignment = assignments.selector(var.index); break; + default: + std::cerr << "Invalid column type"; + std::abort(); + break; } if (var.rotation != 0) { diff --git a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp index dc1acca60..da28dfed7 100644 --- a/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp +++ b/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp @@ -462,6 +462,10 @@ namespace nil { case DfsVariableType::column_type::selector: assignment = assignments.selector(var.index); break; + default: + std::cerr << "Invalid column type"; + std::abort(); + break; } if (var.rotation != 0) {