diff --git a/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp b/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp index 6f1c3c190..d78316bbe 100644 --- a/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp +++ b/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp @@ -61,64 +61,25 @@ namespace nil { field_element, // typename FieldType::value_type lagrange_0 field_element, - // typename witness_commitment_scheme_type::proof_type witness - lpc_proof, - // typename permutation_commitment_scheme_type::proof_type permutation + + //typename fixed_values_commitment_scheme_type::proof_type fixed_values; + lpc_proof, + //typename variable_values_commitment_scheme_type::proof_type variable_values; + lpc_proof, + // typename permutation_commitment_scheme_type::proof_type permutation; lpc_proof, // typename runtime_size_commitment_scheme_type::proof_type quotient - lpc_proof, + lpc_proof, + // std::vector lookups nil::marshalling::types::array_list< TTypeBase, lpc_proof, nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::integral>>, - // typename runtime_size_commitment_scheme_type::proof_type id_permutation - lpc_proof, - // typename runtime_size_commitment_scheme_type::proof_type sigma_permutation - lpc_proof, - // typename public_input_commitment_scheme_type::proof_type public_input - lpc_proof, - // typename constant_commitment_scheme_type::proof_type constant - lpc_proof, - // typename selector_commitment_scheme_type::proof_type selector - lpc_proof, - // typename special_commitment_scheme_type::proof_type special_selectors - lpc_proof + nil::marshalling::types::integral>> > >; - template>::value, -// bool>::type, - typename... TOptions> - using placeholder_proof = nil::marshalling::types::bundle< - TTypeBase, - std::tuple< - // typename witness_commitment_scheme_type::commitment_type witness_commitment - typename merkle_node_value< - TTypeBase, typename Proof::witness_commitment_scheme_type::commitment_type>::type, - // typename permutation_commitment_scheme_type::commitment_type v_perm_commitment - typename merkle_node_value< - TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename permutation_commitment_scheme_type::commitment_type input_perm_commitment - typename merkle_node_value< - TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename permutation_commitment_scheme_type::commitment_type value_perm_commitment - typename merkle_node_value< - TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename permutation_commitment_scheme_type::commitment_type v_l_perm_commitment - typename merkle_node_value< - TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename runtime_size_commitment_scheme_type::commitment_type T_commitment - typename merkle_node_value< - TTypeBase, typename Proof::runtime_size_commitment_scheme_type::commitment_type>::type, - // evaluation_proof eval_proof - placeholder_evaluation_proof - > - >; template placeholder_evaluation_proof, Proof> @@ -128,26 +89,12 @@ namespace nil { using uint64_t_marshalling_type = nil::marshalling::types::integral; using field_marhsalling_type = field_element; - - using lpc_witness_proof_marshalling_type = - lpc_proof; - using lpc_permutation_proof_marshalling_type = - lpc_proof; using lpc_quotient_proof_marshalling_type = - lpc_proof; + lpc_proof; + using lpc_quotient_proof_vector_marshalling_type = nil::marshalling::types::array_list< TTypeBase, lpc_quotient_proof_marshalling_type, nil::marshalling::option::sequence_size_field_prefix>; - using lpc_runtime_size_proof_marshalling_type = - lpc_proof; - using lpc_public_input_proof_marshalling_type = - lpc_proof; - using lpc_constant_proof_marshalling_type = - lpc_proof; - using lpc_selector_proof_marshalling_type = - lpc_proof; - using lpc_special_proof_marshalling_type = - lpc_proof; // typename FieldType::value_type challenge field_marhsalling_type filled_challenge = field_marhsalling_type(proof.challenge); @@ -155,17 +102,21 @@ namespace nil { // typename FieldType::value_type lagrange_0 field_marhsalling_type filled_lagrange_0 = field_marhsalling_type(proof.lagrange_0); - // typename CommitmentSchemeTypeWitness::proof_type witness - lpc_witness_proof_marshalling_type filled_witness = - fill_lpc_proof(proof.witness); + // typename fixed_values_commitment_scheme_type::proof_type fixed_values + auto filled_fixed_values = + fill_lpc_proof(proof.fixed_values); + + // typename variable_values_commitment_scheme_type::proof_type variable_values + auto filled_variable_values = + fill_lpc_proof(proof.variable_values); // typename permutation_commitment_scheme_type::proof_type permutation - lpc_permutation_proof_marshalling_type filled_permutation = + auto filled_permutation = fill_lpc_proof( proof.permutation); // typename runtime_size_commitment_scheme_type::proof_type quotient - lpc_runtime_size_proof_marshalling_type filled_quotient = + auto filled_quotient = fill_lpc_proof(proof.quotient); // std::vector lookups @@ -175,40 +126,11 @@ namespace nil { fill_lpc_proof(p)); } - // typename runtime_size_commitment_scheme_type::proof_type id_permutation - lpc_runtime_size_proof_marshalling_type filled_id_permutation = - fill_lpc_proof( - proof.id_permutation); - - // typename runtime_size_commitment_scheme_type::proof_type sigma_permutation - lpc_runtime_size_proof_marshalling_type filled_sigma_permutation = - fill_lpc_proof( - proof.sigma_permutation); - - // typename public_input_commitment_scheme_type::proof_type public_input - lpc_public_input_proof_marshalling_type filled_public_input = - fill_lpc_proof( - proof.public_input); - - // typename constant_commitment_scheme_type::proof_type constant - lpc_constant_proof_marshalling_type filled_constant = - fill_lpc_proof(proof.constant); - - // typename selector_commitment_scheme_type::proof_type selector - lpc_selector_proof_marshalling_type filled_selector = - fill_lpc_proof(proof.selector); - - // typename special_commitment_scheme_type::proof_type special_selectors - lpc_special_proof_marshalling_type filled_special_selectors = - fill_lpc_proof( - proof.special_selectors); - - return placeholder_evaluation_proof( - std::make_tuple(filled_challenge, filled_lagrange_0, filled_witness, filled_permutation, - filled_quotient, filled_lookups, filled_id_permutation, - filled_sigma_permutation, filled_public_input, filled_constant, filled_selector, - filled_special_selectors) - ); + return placeholder_evaluation_proof(std::make_tuple( + filled_challenge, filled_lagrange_0, + filled_fixed_values, filled_variable_values, + filled_permutation, filled_quotient, filled_lookups + )); } template @@ -224,56 +146,70 @@ namespace nil { // typename FieldType::value_type lagrange_0 proof.lagrange_0 = std::get<1>(filled_proof.value()).value(); - // typename witness_commitment_scheme_type::proof_type witness - proof.witness = make_lpc_proof( + // typename witness_commitment_scheme_type::proof_type fixed_values + proof.fixed_values = make_lpc_proof( std::get<2>(filled_proof.value())); + // typename permutation_commitment_scheme_type::proof_type variables_values + proof.variable_values = make_lpc_proof( + std::get<3>(filled_proof.value())); + // typename permutation_commitment_scheme_type::proof_type permutation proof.permutation = make_lpc_proof( - std::get<3>(filled_proof.value())); + std::get<4>(filled_proof.value())); // typename runtime_size_commitment_scheme_type::proof_type quotient proof.quotient = make_lpc_proof( - std::get<4>(filled_proof.value())); + std::get<5>(filled_proof.value())); - // std::vector lookups - proof.lookups.reserve(std::get<5>(filled_proof.value()).value().size()); - for (std::size_t i = 0; i < std::get<5>(filled_proof.value()).value().size(); ++i) { + // std::vector lookups + proof.lookups.reserve(std::get<6>(filled_proof.value()).value().size()); + for (std::size_t i = 0; i < std::get<6>(filled_proof.value()).value().size(); ++i) { proof.lookups.emplace_back( make_lpc_proof( - std::get<5>(filled_proof.value()).value().at(i))); + std::get<6>(filled_proof.value()).value().at(i))); } + + return proof; + } - // typename runtime_size_commitment_scheme_type::proof_type id_permutation - proof.id_permutation = - make_lpc_proof( - std::get<6>(filled_proof.value())); - - // typename runtime_size_commitment_scheme_type::proof_type sigma_permutation - proof.sigma_permutation = - make_lpc_proof( - std::get<7>(filled_proof.value())); - - // typename public_input_commitment_scheme_type::proof_type public_input - proof.public_input = - make_lpc_proof( - std::get<8>(filled_proof.value())); + template>::value, +// bool>::type, + typename... TOptions> + using placeholder_proof = nil::marshalling::types::bundle< + TTypeBase, + std::tuple< + // typename variable_values_commitment_scheme_type::commitment_type variable_values_commitment + typename merkle_node_value< + TTypeBase, typename Proof::variable_values_commitment_scheme_type::commitment_type>::type, - // typename constant_commitment_scheme_type::proof_type constant - proof.constant = make_lpc_proof( - std::get<9>(filled_proof.value())); + //typename permutation_commitment_scheme_type::proof_type v_perm_commitment; + typename merkle_node_value< + TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename selector_commitment_scheme_type::proof_type selector - proof.selector = make_lpc_proof( - std::get<10>(filled_proof.value())); + // typename permutation_commitment_scheme_type::commitment_type input_perm_commitment + typename merkle_node_value< + TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - // typename special_commitment_scheme_type::proof_type special_selectors - proof.special_selectors = - make_lpc_proof( - std::get<11>(filled_proof.value())); + // typename permutation_commitment_scheme_type::commitment_type value_perm_commitment + typename merkle_node_value< + TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, - return proof; - } + // typename permutation_commitment_scheme_type::commitment_type v_l_perm_commitment + typename merkle_node_value< + TTypeBase, typename Proof::permutation_commitment_scheme_type::commitment_type>::type, + + // typename runtime_size_commitment_scheme_type::commitment_type T_commitment + typename merkle_node_value< + TTypeBase, typename Proof::runtime_size_commitment_scheme_type::commitment_type>::type, + + // evaluation_proof eval_proof + placeholder_evaluation_proof + > + >; template placeholder_proof, Proof> @@ -281,10 +217,10 @@ namespace nil { using TTypeBase = nil::marshalling::field_type; - // typename witness_commitment_scheme_type::commitment_type witness_commitment - auto filled_witness_commitment = - fill_merkle_node_value(proof.witness_commitment); + // typename variable_values_commitment_scheme_type::commitment_type variable_values_commitment + auto filled_variable_values_commitment = + fill_merkle_node_value(proof.variable_values_commitment); // typename permutation_commitment_scheme_type::commitment_type v_perm_commitment auto filled_v_perm_commitment = @@ -312,9 +248,14 @@ namespace nil { Endianness>(proof.T_commitment); return placeholder_proof(std::make_tuple( - filled_witness_commitment, filled_v_perm_commitment, filled_input_perm_commitment, - filled_value_perm_commitment, filled_v_l_perm_commitment, filled_T_commitment, - fill_placeholder_evaluation_proof(proof.eval_proof))); + filled_variable_values_commitment, + filled_v_perm_commitment, + filled_input_perm_commitment, + filled_value_perm_commitment, + filled_v_l_perm_commitment, + filled_T_commitment, + fill_placeholder_evaluation_proof(proof.eval_proof) + )); } template @@ -322,9 +263,9 @@ namespace nil { Proof proof; - // typename witness_commitment_scheme_type::commitment_type witness_commitment - proof.witness_commitment = - make_merkle_node_value(std::get<0>(filled_proof.value())); // typename permutation_commitment_scheme_type::commitment_type v_perm_commitment