145 {
146
147 using g1g2_pair = std::vector<std::string>;
148 using pair_test = std::tuple<std::vector<g1g2_pair>, std::variant<fc::alt_bn128_error, bool>>;
149
150 const std::vector<pair_test> tests =
151 {
152
153 {
154 {
155 {
156 "0f25929bcb43d5a57391564615c9e70a992b10eafa4db109709649cf48c50dd2",
157 "16da2f5cb6be7a0aa72c440c53c9bbdfec6c36c7d515536431b3a865468acbba",
158 "2e89718ad33c8bed92e210e81d1853435399a271913a6520736a4729cf0d51eb",
159 "01a9e2ffa2e92599b68e44de5bcf354fa2642bd4f26b259daa6f7ce3ed57aeb3",
160 "14a9a87b789a58af499b314e13c3d65bede56c07ea2d418d6874857b70763713",
161 "178fb49a2d6cd347dc58973ff49613a20757d0fcc22079f9abd10c3baee24590",
162 },
163
164 {
165 "1b9e027bd5cfc2cb5db82d4dc9677ac795ec500ecd47deee3b5da006d6d049b8",
166 "11d7511c78158de484232fc68daf8a45cf217d1c2fae693ff5871e8752d73b21",
167 "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
168 "1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed",
169 "090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b",
170 "12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
171 }
172 },
173 true
174 },
175
176
177 {
178 {
179 {
180 "0000000000000000000000000000000000000000000000000000000000000001",
181 "0000000000000000000000000000000000000000000000000000000000000002",
182 "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
183 "1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed",
184 "090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b",
185 "12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa"
186 },
187
188 },
189 false
190 },
191
192
193 {
194 {
195 {
196 "00000000000000000000000000000000000000000000000000000000000001",
197 "0000000000000000000000000000000000000000000000000000000000000002",
198 "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
199 "1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed",
200 "090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b",
201 "12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa"
202 },
203
204 },
205 alt_bn128_error::pairing_list_size_error
206 },
207
208
209 {
210 {
211 {
212 "0000000000000000000000000000000000000000000000000000000000000000",
213 "0000000000000000000000000000000100000000000000000000000000000000",
214 "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
215 "1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed",
216 "090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b",
217 "12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa"
218 },
219
220 },
221 alt_bn128_error::operand_not_in_curve
222 },
223
224
225 {
226 {
227 {
228 "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47",
229 "0000000000000000000000000000000100000000000000000000000000000000",
230 "198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2",
231 "1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed",
232 "090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b",
233 "12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa"
234 },
235
236 },
237 alt_bn128_error::operand_component_invalid
238 }
239 };
240
241 auto concat = [&](
const std::string&
s,
bytes& buffer) {
243 buffer.insert( buffer.end(), res.begin(), res.end());
244 };
245
247
248 for(const auto& test : tests) {
249 const auto& pairs = std::get<0>(test);
251
253 for(const auto& pair : pairs) {
254 BOOST_REQUIRE(pair.size() == 6);
255 concat(pair[0], g1_g2_pairs);
256 concat(pair[1], g1_g2_pairs);
257 concat(pair[2], g1_g2_pairs);
258 concat(pair[3], g1_g2_pairs);
259 concat(pair[4], g1_g2_pairs);
260 concat(pair[5], g1_g2_pairs);
261 }
262
265 }
266
thread_local yield_t yield
std::vector< char > bytes
std::variant< alt_bn128_error, bool > alt_bn128_pair(const bytes &g1_g2_pairs, const yield_function_t &yield)