|
| 1 | +//---------------------------------------------------------------------------// |
| 2 | +// Copyright (c) 2021 Mikhail Komarov <[email protected]> |
| 3 | +// Copyright (c) 2021 Nikita Kaskov <[email protected]> |
| 4 | +// |
| 5 | +// MIT License |
| 6 | +// |
| 7 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +// of this software and associated documentation files (the "Software"), to deal |
| 9 | +// in the Software without restriction, including without limitation the rights |
| 10 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +// copies of the Software, and to permit persons to whom the Software is |
| 12 | +// furnished to do so, subject to the following conditions: |
| 13 | +// |
| 14 | +// The above copyright notice and this permission notice shall be included in all |
| 15 | +// copies or substantial portions of the Software. |
| 16 | +// |
| 17 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +// SOFTWARE. |
| 24 | +//---------------------------------------------------------------------------// |
| 25 | + |
| 26 | +#ifndef CRYPTO3_MARSHALLING_LPC_COMMITMENT_HPP |
| 27 | +#define CRYPTO3_MARSHALLING_LPC_COMMITMENT_HPP |
| 28 | + |
| 29 | +#include <ratio> |
| 30 | +#include <limits> |
| 31 | +#include <type_traits> |
| 32 | + |
| 33 | +#include <nil/marshalling/types/bundle.hpp> |
| 34 | +#include <nil/marshalling/types/array_list.hpp> |
| 35 | +#include <nil/marshalling/types/integral.hpp> |
| 36 | +#include <nil/marshalling/status_type.hpp> |
| 37 | +#include <nil/marshalling/options.hpp> |
| 38 | + |
| 39 | +#include <nil/crypto3/zk/snark/commitments/list_polynomial_commitment.hpp> |
| 40 | + |
| 41 | +namespace nil { |
| 42 | + namespace crypto3 { |
| 43 | + namespace marshalling { |
| 44 | + namespace types { |
| 45 | + |
| 46 | + template<typename TTypeBase, |
| 47 | + typename LPCScheme, |
| 48 | + typename = typename std::enable_if< |
| 49 | + std::is_same<LPCScheme, |
| 50 | + nil::crypto3::zk::snark::list_polynomial_commitment<> |
| 51 | + >::value, |
| 52 | + bool>::type, |
| 53 | + typename... TOptions> |
| 54 | + using lpc_proof = |
| 55 | + nil::marshalling::types::bundle< |
| 56 | + TTypeBase, |
| 57 | + std::tuple< |
| 58 | + // std::array<merkle_proof_type, k> z_openings; |
| 59 | + nil::marshalling::types::array_list< |
| 60 | + TTypeBase, |
| 61 | + // merkle_proof_type |
| 62 | + merkle_proof< |
| 63 | + TTypeBase, |
| 64 | + LPCScheme::openning_type |
| 65 | + >, |
| 66 | + nil::marshalling::option::fixed_size_storage<LPCScheme::k> |
| 67 | + >, |
| 68 | + // std::array<std::array<merkle_proof_type, m * r>, lamda> alpha_openings |
| 69 | + nil::marshalling::types::array_list< |
| 70 | + TTypeBase, |
| 71 | + // layer path |
| 72 | + nil::marshalling::types::array_list< |
| 73 | + TTypeBase, |
| 74 | + // merkle_proof_type |
| 75 | + merkle_proof< |
| 76 | + TTypeBase, |
| 77 | + LPCScheme::openning_type |
| 78 | + >, |
| 79 | + nil::marshalling::option::fixed_size_storage<LPCScheme::m * LPCScheme::r> |
| 80 | + >, |
| 81 | + nil::marshalling::option::fixed_size_storage<LPCScheme::lamda> |
| 82 | + >, |
| 83 | + // std::array<std::array<merkle_proof_type, r>, lamda> f_y_openings |
| 84 | + nil::marshalling::types::array_list< |
| 85 | + TTypeBase, |
| 86 | + // layer path |
| 87 | + nil::marshalling::types::array_list< |
| 88 | + TTypeBase, |
| 89 | + // merkle_proof_type |
| 90 | + merkle_proof< |
| 91 | + TTypeBase, |
| 92 | + LPCScheme::openning_type |
| 93 | + >, |
| 94 | + nil::marshalling::option::fixed_size_storage<LPCScheme::r> |
| 95 | + >, |
| 96 | + nil::marshalling::option::fixed_size_storage<LPCScheme::lamda> |
| 97 | + >, |
| 98 | + // std::array<std::array<commitment_type, r - 1>, lamda> f_commitments |
| 99 | + nil::marshalling::types::array_list< |
| 100 | + TTypeBase, |
| 101 | + // layer path |
| 102 | + nil::marshalling::types::array_list< |
| 103 | + TTypeBase, |
| 104 | + // merkle_proof_type |
| 105 | + merkle_proof< |
| 106 | + TTypeBase, |
| 107 | + LPCScheme::openning_type |
| 108 | + >, |
| 109 | + nil::marshalling::option::fixed_size_storage<LPCScheme::r - 1> |
| 110 | + >, |
| 111 | + nil::marshalling::option::fixed_size_storage<LPCScheme::lamda> |
| 112 | + >, |
| 113 | + // std::array<std::array<typename FieldType::value_type>, lambda> |
| 114 | + // f_ip1_coefficients |
| 115 | + nil::marshalling::types::array_list< |
| 116 | + TTypeBase, |
| 117 | + // layer path |
| 118 | + nil::marshalling::types::array_list< |
| 119 | + TTypeBase, |
| 120 | + // merkle_proof_type |
| 121 | + merkle_proof< |
| 122 | + TTypeBase, |
| 123 | + LPCScheme::openning_type |
| 124 | + >, |
| 125 | + nil::marshalling::option::fixed_size_storage<LPCScheme::...> |
| 126 | + >, |
| 127 | + nil::marshalling::option::fixed_size_storage<LPCScheme::lamda> |
| 128 | + > |
| 129 | + > |
| 130 | + >; |
| 131 | + |
| 132 | + } // namespace types |
| 133 | + } // namespace marshalling |
| 134 | + } // namespace crypto3 |
| 135 | +} // namespace nil |
| 136 | +#endif // CRYPTO3_MARSHALLING_LPC_COMMITMENT_HPP |
0 commit comments