Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 144a5b2

Browse files
committed
Redshift proof type and LPC added. #3
1 parent 4565aa5 commit 144a5b2

File tree

8 files changed

+293
-14
lines changed

8 files changed

+293
-14
lines changed

include/nil/crypto3/marshalling/containers/types/merkle_proof.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
//
55
// MIT License
66
//
@@ -103,10 +103,10 @@ namespace nil {
103103
>,
104104
nil::marshalling::option::sequence_size_field_prefix<
105105
nil::marshalling::types::integral<
106-
TTypeBase,
106+
TTypeBase,
107107
std::size_t
108108
>
109-
>
109+
>
110110
>
111111
>
112112
>;

include/nil/crypto3/marshalling/zk/types/accumulation_vector.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
//
55
// MIT License
66
//
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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

include/nil/crypto3/marshalling/zk/types/r1cs_gg_ppzksnark/auxiliary_input.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
// Copyright (c) 2021 Noam Yemini <@NoamDev at GitHub>
55

66
//

include/nil/crypto3/marshalling/zk/types/r1cs_gg_ppzksnark/primary_input.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
//
55
// MIT License
66
//

include/nil/crypto3/marshalling/zk/types/r1cs_gg_ppzksnark/proof.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
//
55
// MIT License
66
//

include/nil/crypto3/marshalling/zk/types/r1cs_gg_ppzksnark/verification_key.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//---------------------------------------------------------------------------//
2-
// Copyright (c) 2017-2021 Mikhail Komarov <[email protected]>
3-
// Copyright (c) 2020-2021 Nikita Kaskov <[email protected]>
2+
// Copyright (c) 2021 Mikhail Komarov <[email protected]>
3+
// Copyright (c) 2021 Nikita Kaskov <[email protected]>
44
//
55
// MIT License
66
//
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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_REDSHIFT_PROOF_HPP
27+
#define CRYPTO3_MARSHALLING_REDSHIFT_PROOF_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/systems/plonk/redshift/proof.hpp>
40+
41+
namespace nil {
42+
namespace crypto3 {
43+
namespace marshalling {
44+
namespace types {
45+
46+
template<typename TTypeBase,
47+
typename RedshiftProof,
48+
typename = typename std::enable_if<
49+
std::is_same<RedshiftProof,
50+
nil::crypto3::zk::snark::redshift_proof<
51+
typename RedshiftProof::hash_type,
52+
RedshiftProof::arity
53+
>
54+
>::value,
55+
bool>::type,
56+
typename... TOptions>
57+
using redshift_proof =
58+
nil::marshalling::types::bundle<
59+
TTypeBase,
60+
std::tuple<
61+
// std::vector<typename CommitmentSchemeType::commitment_type> f_commitments
62+
nil::marshalling::types::array_list<
63+
TTypeBase,
64+
merkle_proof<
65+
TTypeBase,
66+
typename RedshiftProof::lpc::openning_type
67+
>,
68+
nil::marshalling::option::sequence_size_field_prefix<
69+
nil::marshalling::types::integral<
70+
TTypeBase,
71+
std::size_t
72+
>
73+
>
74+
>,
75+
// typename CommitmentSchemeType::commitment_type P_commitment
76+
merkle_proof<
77+
TTypeBase,
78+
typename RedshiftProof::lpc::openning_type
79+
>,
80+
// typename CommitmentSchemeType::commitment_type Q_commitment
81+
merkle_proof<
82+
TTypeBase,
83+
typename RedshiftProof::lpc::openning_type
84+
>,
85+
// std::vector<typename CommitmentSchemeType::commitment_type> T_commitments
86+
nil::marshalling::types::array_list<
87+
TTypeBase,
88+
merkle_proof<
89+
TTypeBase,
90+
typename RedshiftProof::lpc::openning_type
91+
>,
92+
nil::marshalling::option::sequence_size_field_prefix<
93+
nil::marshalling::types::integral<
94+
TTypeBase,
95+
std::size_t
96+
>
97+
>
98+
>,
99+
// std::vector<typename CommitmentSchemeType::proof_type> f_lpc_proofs
100+
nil::marshalling::types::array_list<
101+
TTypeBase,
102+
lpc_proof<
103+
TTypeBase,
104+
typename RedshiftProof::lpc
105+
>,
106+
nil::marshalling::option::sequence_size_field_prefix<
107+
nil::marshalling::types::integral<
108+
TTypeBase,
109+
std::size_t
110+
>
111+
>
112+
>,
113+
// typename CommitmentSchemeType::proof_type P_lpc_proof
114+
lpc_proof<
115+
TTypeBase,
116+
typename RedshiftProof::lpc
117+
>,
118+
// typename CommitmentSchemeType::proof_type Q_lpc_proof
119+
lpc_proof<
120+
TTypeBase,
121+
typename RedshiftProof::lpc
122+
>,
123+
// std::vector<typename CommitmentSchemeType::proof_type> T_lpc_proofs
124+
nil::marshalling::types::array_list<
125+
TTypeBase,
126+
lpc_proof<
127+
TTypeBase,
128+
typename RedshiftProof::lpc
129+
>,
130+
nil::marshalling::option::sequence_size_field_prefix<
131+
nil::marshalling::types::integral<
132+
TTypeBase,
133+
std::size_t
134+
>
135+
>
136+
>
137+
>
138+
>;
139+
} // namespace types
140+
} // namespace marshalling
141+
} // namespace crypto3
142+
} // namespace nil
143+
#endif // CRYPTO3_MARSHALLING_REDSHIFT_PROOF_HPP

0 commit comments

Comments
 (0)