Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
acir.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "bincode.hpp"
5#include "serde.hpp"
6
7namespace Acir {
8struct Helpers {
9 static std::map<std::string, msgpack::object const*> make_kvmap(msgpack::object const& o, std::string const& name)
10 {
11 if (o.type != msgpack::type::MAP) {
12 std::cerr << o << std::endl;
13 throw_or_abort("expected MAP for " + name);
14 }
16 for (uint32_t i = 0; i < o.via.map.size; ++i) {
17 if (o.via.map.ptr[i].key.type != msgpack::type::STR) {
18 std::cerr << o << std::endl;
19 throw_or_abort("expected STR for keys of " + name);
20 }
21 kvmap.emplace(std::string(o.via.map.ptr[i].key.via.str.ptr, o.via.map.ptr[i].key.via.str.size),
22 &o.via.map.ptr[i].val);
23 }
24 return kvmap;
25 }
26
27 template <typename T>
29 std::string const& struct_name,
30 std::string const& field_name,
31 T& field,
32 bool is_optional)
33 {
34 auto it = kvmap.find(field_name);
35 if (it != kvmap.end()) {
36 try {
37 it->second->convert(field);
38 } catch (const msgpack::type_error&) {
39 std::cerr << *it->second << std::endl;
40 throw_or_abort("error converting into field " + struct_name + "::" + field_name);
41 }
42 } else if (!is_optional) {
43 throw_or_abort("missing field: " + struct_name + "::" + field_name);
44 }
45 }
46
47 template <typename T>
48 static void conv_fld_from_array(msgpack::object_array const& array,
49 std::string const& struct_name,
50 std::string const& field_name,
51 T& field,
52 uint32_t index)
53 {
54 if (index >= array.size) {
55 throw_or_abort("index out of bounds: " + struct_name + "::" + field_name + " at " + std::to_string(index));
56 }
57 auto element = array.ptr[index];
58 try {
59 element.convert(field);
60 } catch (const msgpack::type_error&) {
61 std::cerr << element << std::endl;
62 throw_or_abort("error converting into field " + struct_name + "::" + field_name);
63 }
64 }
65};
66} // namespace Acir
67
68namespace Acir {
69
71
72 struct Add {
73 friend bool operator==(const Add&, const Add&);
74 std::vector<uint8_t> bincodeSerialize() const;
75 static Add bincodeDeserialize(std::vector<uint8_t>);
76
77 void msgpack_pack(auto& packer) const {}
78 void msgpack_unpack(msgpack::object const& o) {}
79 };
80
81 struct Sub {
82 friend bool operator==(const Sub&, const Sub&);
83 std::vector<uint8_t> bincodeSerialize() const;
84 static Sub bincodeDeserialize(std::vector<uint8_t>);
85
86 void msgpack_pack(auto& packer) const {}
87 void msgpack_unpack(msgpack::object const& o) {}
88 };
89
90 struct Mul {
91 friend bool operator==(const Mul&, const Mul&);
92 std::vector<uint8_t> bincodeSerialize() const;
93 static Mul bincodeDeserialize(std::vector<uint8_t>);
94
95 void msgpack_pack(auto& packer) const {}
96 void msgpack_unpack(msgpack::object const& o) {}
97 };
98
99 struct Div {
100 friend bool operator==(const Div&, const Div&);
101 std::vector<uint8_t> bincodeSerialize() const;
102 static Div bincodeDeserialize(std::vector<uint8_t>);
103
104 void msgpack_pack(auto& packer) const {}
105 void msgpack_unpack(msgpack::object const& o) {}
106 };
107
108 struct IntegerDiv {
109 friend bool operator==(const IntegerDiv&, const IntegerDiv&);
110 std::vector<uint8_t> bincodeSerialize() const;
111 static IntegerDiv bincodeDeserialize(std::vector<uint8_t>);
112
113 void msgpack_pack(auto& packer) const {}
114 void msgpack_unpack(msgpack::object const& o) {}
115 };
116
117 struct Equals {
118 friend bool operator==(const Equals&, const Equals&);
119 std::vector<uint8_t> bincodeSerialize() const;
120 static Equals bincodeDeserialize(std::vector<uint8_t>);
121
122 void msgpack_pack(auto& packer) const {}
123 void msgpack_unpack(msgpack::object const& o) {}
124 };
125
126 struct LessThan {
127 friend bool operator==(const LessThan&, const LessThan&);
128 std::vector<uint8_t> bincodeSerialize() const;
129 static LessThan bincodeDeserialize(std::vector<uint8_t>);
130
131 void msgpack_pack(auto& packer) const {}
132 void msgpack_unpack(msgpack::object const& o) {}
133 };
134
136 friend bool operator==(const LessThanEquals&, const LessThanEquals&);
137 std::vector<uint8_t> bincodeSerialize() const;
138 static LessThanEquals bincodeDeserialize(std::vector<uint8_t>);
139
140 void msgpack_pack(auto& packer) const {}
141 void msgpack_unpack(msgpack::object const& o) {}
142 };
143
145
146 friend bool operator==(const BinaryFieldOp&, const BinaryFieldOp&);
147 std::vector<uint8_t> bincodeSerialize() const;
148 static BinaryFieldOp bincodeDeserialize(std::vector<uint8_t>);
149
150 void msgpack_pack(auto& packer) const
151 {
152 std::string tag;
153 bool is_unit;
154 switch (value.index()) {
155
156 case 0:
157 tag = "Add";
158 is_unit = true;
159 break;
160 case 1:
161 tag = "Sub";
162 is_unit = true;
163 break;
164 case 2:
165 tag = "Mul";
166 is_unit = true;
167 break;
168 case 3:
169 tag = "Div";
170 is_unit = true;
171 break;
172 case 4:
173 tag = "IntegerDiv";
174 is_unit = true;
175 break;
176 case 5:
177 tag = "Equals";
178 is_unit = true;
179 break;
180 case 6:
181 tag = "LessThan";
182 is_unit = true;
183 break;
184 case 7:
185 tag = "LessThanEquals";
186 is_unit = true;
187 break;
188 default:
189 throw_or_abort("unknown enum 'BinaryFieldOp' variant index: " + std::to_string(value.index()));
190 }
191 if (is_unit) {
192 packer.pack(tag);
193 } else {
194 std::visit(
195 [&packer, tag](const auto& arg) {
197 data[tag] = msgpack::object(arg);
198 packer.pack(data);
199 },
200 value);
201 }
202 }
203
204 void msgpack_unpack(msgpack::object const& o)
205 {
206
207 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
208 std::cerr << o << std::endl;
209 throw_or_abort("expected MAP or STR for enum 'BinaryFieldOp'; got type " + std::to_string(o.type));
210 }
211 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
212 throw_or_abort("expected 1 entry for enum 'BinaryFieldOp'; got " + std::to_string(o.via.map.size));
213 }
214 std::string tag;
215 try {
216 if (o.type == msgpack::type::object_type::MAP) {
217 o.via.map.ptr[0].key.convert(tag);
218 } else {
219 o.convert(tag);
220 }
221 } catch (const msgpack::type_error&) {
222 std::cerr << o << std::endl;
223 throw_or_abort("error converting tag to string for enum 'BinaryFieldOp'");
224 }
225 if (tag == "Add") {
226 Add v;
227 value = v;
228 } else if (tag == "Sub") {
229 Sub v;
230 value = v;
231 } else if (tag == "Mul") {
232 Mul v;
233 value = v;
234 } else if (tag == "Div") {
235 Div v;
236 value = v;
237 } else if (tag == "IntegerDiv") {
238 IntegerDiv v;
239 value = v;
240 } else if (tag == "Equals") {
241 Equals v;
242 value = v;
243 } else if (tag == "LessThan") {
244 LessThan v;
245 value = v;
246 } else if (tag == "LessThanEquals") {
248 value = v;
249 } else {
250 std::cerr << o << std::endl;
251 throw_or_abort("unknown 'BinaryFieldOp' enum variant: " + tag);
252 }
253 }
254};
255
257
258 struct Add {
259 friend bool operator==(const Add&, const Add&);
260 std::vector<uint8_t> bincodeSerialize() const;
261 static Add bincodeDeserialize(std::vector<uint8_t>);
262
263 void msgpack_pack(auto& packer) const {}
264 void msgpack_unpack(msgpack::object const& o) {}
265 };
266
267 struct Sub {
268 friend bool operator==(const Sub&, const Sub&);
269 std::vector<uint8_t> bincodeSerialize() const;
270 static Sub bincodeDeserialize(std::vector<uint8_t>);
271
272 void msgpack_pack(auto& packer) const {}
273 void msgpack_unpack(msgpack::object const& o) {}
274 };
275
276 struct Mul {
277 friend bool operator==(const Mul&, const Mul&);
278 std::vector<uint8_t> bincodeSerialize() const;
279 static Mul bincodeDeserialize(std::vector<uint8_t>);
280
281 void msgpack_pack(auto& packer) const {}
282 void msgpack_unpack(msgpack::object const& o) {}
283 };
284
285 struct Div {
286 friend bool operator==(const Div&, const Div&);
287 std::vector<uint8_t> bincodeSerialize() const;
288 static Div bincodeDeserialize(std::vector<uint8_t>);
289
290 void msgpack_pack(auto& packer) const {}
291 void msgpack_unpack(msgpack::object const& o) {}
292 };
293
294 struct Equals {
295 friend bool operator==(const Equals&, const Equals&);
296 std::vector<uint8_t> bincodeSerialize() const;
297 static Equals bincodeDeserialize(std::vector<uint8_t>);
298
299 void msgpack_pack(auto& packer) const {}
300 void msgpack_unpack(msgpack::object const& o) {}
301 };
302
303 struct LessThan {
304 friend bool operator==(const LessThan&, const LessThan&);
305 std::vector<uint8_t> bincodeSerialize() const;
306 static LessThan bincodeDeserialize(std::vector<uint8_t>);
307
308 void msgpack_pack(auto& packer) const {}
309 void msgpack_unpack(msgpack::object const& o) {}
310 };
311
313 friend bool operator==(const LessThanEquals&, const LessThanEquals&);
314 std::vector<uint8_t> bincodeSerialize() const;
315 static LessThanEquals bincodeDeserialize(std::vector<uint8_t>);
316
317 void msgpack_pack(auto& packer) const {}
318 void msgpack_unpack(msgpack::object const& o) {}
319 };
320
321 struct And {
322 friend bool operator==(const And&, const And&);
323 std::vector<uint8_t> bincodeSerialize() const;
324 static And bincodeDeserialize(std::vector<uint8_t>);
325
326 void msgpack_pack(auto& packer) const {}
327 void msgpack_unpack(msgpack::object const& o) {}
328 };
329
330 struct Or {
331 friend bool operator==(const Or&, const Or&);
332 std::vector<uint8_t> bincodeSerialize() const;
333 static Or bincodeDeserialize(std::vector<uint8_t>);
334
335 void msgpack_pack(auto& packer) const {}
336 void msgpack_unpack(msgpack::object const& o) {}
337 };
338
339 struct Xor {
340 friend bool operator==(const Xor&, const Xor&);
341 std::vector<uint8_t> bincodeSerialize() const;
342 static Xor bincodeDeserialize(std::vector<uint8_t>);
343
344 void msgpack_pack(auto& packer) const {}
345 void msgpack_unpack(msgpack::object const& o) {}
346 };
347
348 struct Shl {
349 friend bool operator==(const Shl&, const Shl&);
350 std::vector<uint8_t> bincodeSerialize() const;
351 static Shl bincodeDeserialize(std::vector<uint8_t>);
352
353 void msgpack_pack(auto& packer) const {}
354 void msgpack_unpack(msgpack::object const& o) {}
355 };
356
357 struct Shr {
358 friend bool operator==(const Shr&, const Shr&);
359 std::vector<uint8_t> bincodeSerialize() const;
360 static Shr bincodeDeserialize(std::vector<uint8_t>);
361
362 void msgpack_pack(auto& packer) const {}
363 void msgpack_unpack(msgpack::object const& o) {}
364 };
365
367
368 friend bool operator==(const BinaryIntOp&, const BinaryIntOp&);
369 std::vector<uint8_t> bincodeSerialize() const;
370 static BinaryIntOp bincodeDeserialize(std::vector<uint8_t>);
371
372 void msgpack_pack(auto& packer) const
373 {
374 std::string tag;
375 bool is_unit;
376 switch (value.index()) {
377
378 case 0:
379 tag = "Add";
380 is_unit = true;
381 break;
382 case 1:
383 tag = "Sub";
384 is_unit = true;
385 break;
386 case 2:
387 tag = "Mul";
388 is_unit = true;
389 break;
390 case 3:
391 tag = "Div";
392 is_unit = true;
393 break;
394 case 4:
395 tag = "Equals";
396 is_unit = true;
397 break;
398 case 5:
399 tag = "LessThan";
400 is_unit = true;
401 break;
402 case 6:
403 tag = "LessThanEquals";
404 is_unit = true;
405 break;
406 case 7:
407 tag = "And";
408 is_unit = true;
409 break;
410 case 8:
411 tag = "Or";
412 is_unit = true;
413 break;
414 case 9:
415 tag = "Xor";
416 is_unit = true;
417 break;
418 case 10:
419 tag = "Shl";
420 is_unit = true;
421 break;
422 case 11:
423 tag = "Shr";
424 is_unit = true;
425 break;
426 default:
427 throw_or_abort("unknown enum 'BinaryIntOp' variant index: " + std::to_string(value.index()));
428 }
429 if (is_unit) {
430 packer.pack(tag);
431 } else {
432 std::visit(
433 [&packer, tag](const auto& arg) {
435 data[tag] = msgpack::object(arg);
436 packer.pack(data);
437 },
438 value);
439 }
440 }
441
442 void msgpack_unpack(msgpack::object const& o)
443 {
444
445 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
446 std::cerr << o << std::endl;
447 throw_or_abort("expected MAP or STR for enum 'BinaryIntOp'; got type " + std::to_string(o.type));
448 }
449 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
450 throw_or_abort("expected 1 entry for enum 'BinaryIntOp'; got " + std::to_string(o.via.map.size));
451 }
452 std::string tag;
453 try {
454 if (o.type == msgpack::type::object_type::MAP) {
455 o.via.map.ptr[0].key.convert(tag);
456 } else {
457 o.convert(tag);
458 }
459 } catch (const msgpack::type_error&) {
460 std::cerr << o << std::endl;
461 throw_or_abort("error converting tag to string for enum 'BinaryIntOp'");
462 }
463 if (tag == "Add") {
464 Add v;
465 value = v;
466 } else if (tag == "Sub") {
467 Sub v;
468 value = v;
469 } else if (tag == "Mul") {
470 Mul v;
471 value = v;
472 } else if (tag == "Div") {
473 Div v;
474 value = v;
475 } else if (tag == "Equals") {
476 Equals v;
477 value = v;
478 } else if (tag == "LessThan") {
479 LessThan v;
480 value = v;
481 } else if (tag == "LessThanEquals") {
483 value = v;
484 } else if (tag == "And") {
485 And v;
486 value = v;
487 } else if (tag == "Or") {
488 Or v;
489 value = v;
490 } else if (tag == "Xor") {
491 Xor v;
492 value = v;
493 } else if (tag == "Shl") {
494 Shl v;
495 value = v;
496 } else if (tag == "Shr") {
497 Shr v;
498 value = v;
499 } else {
500 std::cerr << o << std::endl;
501 throw_or_abort("unknown 'BinaryIntOp' enum variant: " + tag);
502 }
503 }
504};
505
507
508 struct U1 {
509 friend bool operator==(const U1&, const U1&);
510 std::vector<uint8_t> bincodeSerialize() const;
511 static U1 bincodeDeserialize(std::vector<uint8_t>);
512
513 void msgpack_pack(auto& packer) const {}
514 void msgpack_unpack(msgpack::object const& o) {}
515 };
516
517 struct U8 {
518 friend bool operator==(const U8&, const U8&);
519 std::vector<uint8_t> bincodeSerialize() const;
520 static U8 bincodeDeserialize(std::vector<uint8_t>);
521
522 void msgpack_pack(auto& packer) const {}
523 void msgpack_unpack(msgpack::object const& o) {}
524 };
525
526 struct U16 {
527 friend bool operator==(const U16&, const U16&);
528 std::vector<uint8_t> bincodeSerialize() const;
529 static U16 bincodeDeserialize(std::vector<uint8_t>);
530
531 void msgpack_pack(auto& packer) const {}
532 void msgpack_unpack(msgpack::object const& o) {}
533 };
534
535 struct U32 {
536 friend bool operator==(const U32&, const U32&);
537 std::vector<uint8_t> bincodeSerialize() const;
538 static U32 bincodeDeserialize(std::vector<uint8_t>);
539
540 void msgpack_pack(auto& packer) const {}
541 void msgpack_unpack(msgpack::object const& o) {}
542 };
543
544 struct U64 {
545 friend bool operator==(const U64&, const U64&);
546 std::vector<uint8_t> bincodeSerialize() const;
547 static U64 bincodeDeserialize(std::vector<uint8_t>);
548
549 void msgpack_pack(auto& packer) const {}
550 void msgpack_unpack(msgpack::object const& o) {}
551 };
552
553 struct U128 {
554 friend bool operator==(const U128&, const U128&);
555 std::vector<uint8_t> bincodeSerialize() const;
556 static U128 bincodeDeserialize(std::vector<uint8_t>);
557
558 void msgpack_pack(auto& packer) const {}
559 void msgpack_unpack(msgpack::object const& o) {}
560 };
561
563
564 friend bool operator==(const IntegerBitSize&, const IntegerBitSize&);
565 std::vector<uint8_t> bincodeSerialize() const;
566 static IntegerBitSize bincodeDeserialize(std::vector<uint8_t>);
567
568 void msgpack_pack(auto& packer) const
569 {
570 std::string tag;
571 bool is_unit;
572 switch (value.index()) {
573
574 case 0:
575 tag = "U1";
576 is_unit = true;
577 break;
578 case 1:
579 tag = "U8";
580 is_unit = true;
581 break;
582 case 2:
583 tag = "U16";
584 is_unit = true;
585 break;
586 case 3:
587 tag = "U32";
588 is_unit = true;
589 break;
590 case 4:
591 tag = "U64";
592 is_unit = true;
593 break;
594 case 5:
595 tag = "U128";
596 is_unit = true;
597 break;
598 default:
599 throw_or_abort("unknown enum 'IntegerBitSize' variant index: " + std::to_string(value.index()));
600 }
601 if (is_unit) {
602 packer.pack(tag);
603 } else {
604 std::visit(
605 [&packer, tag](const auto& arg) {
607 data[tag] = msgpack::object(arg);
608 packer.pack(data);
609 },
610 value);
611 }
612 }
613
614 void msgpack_unpack(msgpack::object const& o)
615 {
616
617 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
618 std::cerr << o << std::endl;
619 throw_or_abort("expected MAP or STR for enum 'IntegerBitSize'; got type " + std::to_string(o.type));
620 }
621 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
622 throw_or_abort("expected 1 entry for enum 'IntegerBitSize'; got " + std::to_string(o.via.map.size));
623 }
624 std::string tag;
625 try {
626 if (o.type == msgpack::type::object_type::MAP) {
627 o.via.map.ptr[0].key.convert(tag);
628 } else {
629 o.convert(tag);
630 }
631 } catch (const msgpack::type_error&) {
632 std::cerr << o << std::endl;
633 throw_or_abort("error converting tag to string for enum 'IntegerBitSize'");
634 }
635 if (tag == "U1") {
636 U1 v;
637 value = v;
638 } else if (tag == "U8") {
639 U8 v;
640 value = v;
641 } else if (tag == "U16") {
642 U16 v;
643 value = v;
644 } else if (tag == "U32") {
645 U32 v;
646 value = v;
647 } else if (tag == "U64") {
648 U64 v;
649 value = v;
650 } else if (tag == "U128") {
651 U128 v;
652 value = v;
653 } else {
654 std::cerr << o << std::endl;
655 throw_or_abort("unknown 'IntegerBitSize' enum variant: " + tag);
656 }
657 }
658};
659
660struct BitSize {
661
662 struct Field {
663 friend bool operator==(const Field&, const Field&);
664 std::vector<uint8_t> bincodeSerialize() const;
665 static Field bincodeDeserialize(std::vector<uint8_t>);
666
667 void msgpack_pack(auto& packer) const {}
668 void msgpack_unpack(msgpack::object const& o) {}
669 };
670
671 struct Integer {
673
674 friend bool operator==(const Integer&, const Integer&);
675 std::vector<uint8_t> bincodeSerialize() const;
676 static Integer bincodeDeserialize(std::vector<uint8_t>);
677
678 void msgpack_pack(auto& packer) const { packer.pack(value); }
679
680 void msgpack_unpack(msgpack::object const& o)
681 {
682 try {
683 o.convert(value);
684 } catch (const msgpack::type_error&) {
685 std::cerr << o << std::endl;
686 throw_or_abort("error converting into newtype 'Integer'");
687 }
688 }
689 };
690
692
693 friend bool operator==(const BitSize&, const BitSize&);
694 std::vector<uint8_t> bincodeSerialize() const;
695 static BitSize bincodeDeserialize(std::vector<uint8_t>);
696
697 void msgpack_pack(auto& packer) const
698 {
699 std::string tag;
700 bool is_unit;
701 switch (value.index()) {
702
703 case 0:
704 tag = "Field";
705 is_unit = true;
706 break;
707 case 1:
708 tag = "Integer";
709 is_unit = false;
710 break;
711 default:
712 throw_or_abort("unknown enum 'BitSize' variant index: " + std::to_string(value.index()));
713 }
714 if (is_unit) {
715 packer.pack(tag);
716 } else {
717 std::visit(
718 [&packer, tag](const auto& arg) {
720 data[tag] = msgpack::object(arg);
721 packer.pack(data);
722 },
723 value);
724 }
725 }
726
727 void msgpack_unpack(msgpack::object const& o)
728 {
729
730 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
731 std::cerr << o << std::endl;
732 throw_or_abort("expected MAP or STR for enum 'BitSize'; got type " + std::to_string(o.type));
733 }
734 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
735 throw_or_abort("expected 1 entry for enum 'BitSize'; got " + std::to_string(o.via.map.size));
736 }
737 std::string tag;
738 try {
739 if (o.type == msgpack::type::object_type::MAP) {
740 o.via.map.ptr[0].key.convert(tag);
741 } else {
742 o.convert(tag);
743 }
744 } catch (const msgpack::type_error&) {
745 std::cerr << o << std::endl;
746 throw_or_abort("error converting tag to string for enum 'BitSize'");
747 }
748 if (tag == "Field") {
749 Field v;
750 value = v;
751 } else if (tag == "Integer") {
752 Integer v;
753 try {
754 o.via.map.ptr[0].val.convert(v);
755 } catch (const msgpack::type_error&) {
756 std::cerr << o << std::endl;
757 throw_or_abort("error converting into enum variant 'BitSize::Integer'");
758 }
759
760 value = v;
761 } else {
762 std::cerr << o << std::endl;
763 throw_or_abort("unknown 'BitSize' enum variant: " + tag);
764 }
765 }
766};
767
769
770 struct Direct {
771 uint64_t value;
772
773 friend bool operator==(const Direct&, const Direct&);
774 std::vector<uint8_t> bincodeSerialize() const;
775 static Direct bincodeDeserialize(std::vector<uint8_t>);
776
777 void msgpack_pack(auto& packer) const { packer.pack(value); }
778
779 void msgpack_unpack(msgpack::object const& o)
780 {
781 try {
782 o.convert(value);
783 } catch (const msgpack::type_error&) {
784 std::cerr << o << std::endl;
785 throw_or_abort("error converting into newtype 'Direct'");
786 }
787 }
788 };
789
790 struct Relative {
791 uint64_t value;
792
793 friend bool operator==(const Relative&, const Relative&);
794 std::vector<uint8_t> bincodeSerialize() const;
795 static Relative bincodeDeserialize(std::vector<uint8_t>);
796
797 void msgpack_pack(auto& packer) const { packer.pack(value); }
798
799 void msgpack_unpack(msgpack::object const& o)
800 {
801 try {
802 o.convert(value);
803 } catch (const msgpack::type_error&) {
804 std::cerr << o << std::endl;
805 throw_or_abort("error converting into newtype 'Relative'");
806 }
807 }
808 };
809
811
812 friend bool operator==(const MemoryAddress&, const MemoryAddress&);
813 std::vector<uint8_t> bincodeSerialize() const;
814 static MemoryAddress bincodeDeserialize(std::vector<uint8_t>);
815
816 void msgpack_pack(auto& packer) const
817 {
818 std::string tag;
819 bool is_unit;
820 switch (value.index()) {
821
822 case 0:
823 tag = "Direct";
824 is_unit = false;
825 break;
826 case 1:
827 tag = "Relative";
828 is_unit = false;
829 break;
830 default:
831 throw_or_abort("unknown enum 'MemoryAddress' variant index: " + std::to_string(value.index()));
832 }
833 if (is_unit) {
834 packer.pack(tag);
835 } else {
836 std::visit(
837 [&packer, tag](const auto& arg) {
839 data[tag] = msgpack::object(arg);
840 packer.pack(data);
841 },
842 value);
843 }
844 }
845
846 void msgpack_unpack(msgpack::object const& o)
847 {
848
849 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
850 std::cerr << o << std::endl;
851 throw_or_abort("expected MAP or STR for enum 'MemoryAddress'; got type " + std::to_string(o.type));
852 }
853 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
854 throw_or_abort("expected 1 entry for enum 'MemoryAddress'; got " + std::to_string(o.via.map.size));
855 }
856 std::string tag;
857 try {
858 if (o.type == msgpack::type::object_type::MAP) {
859 o.via.map.ptr[0].key.convert(tag);
860 } else {
861 o.convert(tag);
862 }
863 } catch (const msgpack::type_error&) {
864 std::cerr << o << std::endl;
865 throw_or_abort("error converting tag to string for enum 'MemoryAddress'");
866 }
867 if (tag == "Direct") {
868 Direct v;
869 try {
870 o.via.map.ptr[0].val.convert(v);
871 } catch (const msgpack::type_error&) {
872 std::cerr << o << std::endl;
873 throw_or_abort("error converting into enum variant 'MemoryAddress::Direct'");
874 }
875
876 value = v;
877 } else if (tag == "Relative") {
878 Relative v;
879 try {
880 o.via.map.ptr[0].val.convert(v);
881 } catch (const msgpack::type_error&) {
882 std::cerr << o << std::endl;
883 throw_or_abort("error converting into enum variant 'MemoryAddress::Relative'");
884 }
885
886 value = v;
887 } else {
888 std::cerr << o << std::endl;
889 throw_or_abort("unknown 'MemoryAddress' enum variant: " + tag);
890 }
891 }
892};
893
894struct HeapArray {
896 uint64_t size;
897
898 friend bool operator==(const HeapArray&, const HeapArray&);
899 std::vector<uint8_t> bincodeSerialize() const;
900 static HeapArray bincodeDeserialize(std::vector<uint8_t>);
901
902 void msgpack_pack(auto& packer) const
903 {
904 packer.pack_map(2);
905 packer.pack(std::make_pair("pointer", pointer));
906 packer.pack(std::make_pair("size", size));
907 }
908
909 void msgpack_unpack(msgpack::object const& o)
910 {
911 std::string name = "HeapArray";
912 if (o.type == msgpack::type::MAP) {
913 auto kvmap = Helpers::make_kvmap(o, name);
914 Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false);
915 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
916 } else if (o.type == msgpack::type::ARRAY) {
917 auto array = o.via.array;
918 Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0);
919 Helpers::conv_fld_from_array(array, name, "size", size, 1);
920 } else {
921 throw_or_abort("expected MAP or ARRAY for " + name);
922 }
923 }
924};
925
929
930 friend bool operator==(const HeapVector&, const HeapVector&);
931 std::vector<uint8_t> bincodeSerialize() const;
932 static HeapVector bincodeDeserialize(std::vector<uint8_t>);
933
934 void msgpack_pack(auto& packer) const
935 {
936 packer.pack_map(2);
937 packer.pack(std::make_pair("pointer", pointer));
938 packer.pack(std::make_pair("size", size));
939 }
940
941 void msgpack_unpack(msgpack::object const& o)
942 {
943 std::string name = "HeapVector";
944 if (o.type == msgpack::type::MAP) {
945 auto kvmap = Helpers::make_kvmap(o, name);
946 Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false);
947 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
948 } else if (o.type == msgpack::type::ARRAY) {
949 auto array = o.via.array;
950 Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0);
951 Helpers::conv_fld_from_array(array, name, "size", size, 1);
952 } else {
953 throw_or_abort("expected MAP or ARRAY for " + name);
954 }
955 }
956};
957
959
965
966 friend bool operator==(const AES128Encrypt&, const AES128Encrypt&);
967 std::vector<uint8_t> bincodeSerialize() const;
968 static AES128Encrypt bincodeDeserialize(std::vector<uint8_t>);
969
970 void msgpack_pack(auto& packer) const
971 {
972 packer.pack_map(4);
973 packer.pack(std::make_pair("inputs", inputs));
974 packer.pack(std::make_pair("iv", iv));
975 packer.pack(std::make_pair("key", key));
976 packer.pack(std::make_pair("outputs", outputs));
977 }
978
979 void msgpack_unpack(msgpack::object const& o)
980 {
981 std::string name = "AES128Encrypt";
982 if (o.type == msgpack::type::MAP) {
983 auto kvmap = Helpers::make_kvmap(o, name);
984 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
985 Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false);
986 Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false);
987 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
988 } else if (o.type == msgpack::type::ARRAY) {
989 auto array = o.via.array;
990 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
991 Helpers::conv_fld_from_array(array, name, "iv", iv, 1);
992 Helpers::conv_fld_from_array(array, name, "key", key, 2);
993 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
994 } else {
995 throw_or_abort("expected MAP or ARRAY for " + name);
996 }
997 }
998 };
999
1000 struct Blake2s {
1003
1004 friend bool operator==(const Blake2s&, const Blake2s&);
1005 std::vector<uint8_t> bincodeSerialize() const;
1006 static Blake2s bincodeDeserialize(std::vector<uint8_t>);
1007
1008 void msgpack_pack(auto& packer) const
1009 {
1010 packer.pack_map(2);
1011 packer.pack(std::make_pair("message", message));
1012 packer.pack(std::make_pair("output", output));
1013 }
1014
1015 void msgpack_unpack(msgpack::object const& o)
1016 {
1017 std::string name = "Blake2s";
1018 if (o.type == msgpack::type::MAP) {
1019 auto kvmap = Helpers::make_kvmap(o, name);
1020 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1021 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1022 } else if (o.type == msgpack::type::ARRAY) {
1023 auto array = o.via.array;
1024 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1025 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1026 } else {
1027 throw_or_abort("expected MAP or ARRAY for " + name);
1028 }
1029 }
1030 };
1031
1032 struct Blake3 {
1035
1036 friend bool operator==(const Blake3&, const Blake3&);
1037 std::vector<uint8_t> bincodeSerialize() const;
1038 static Blake3 bincodeDeserialize(std::vector<uint8_t>);
1039
1040 void msgpack_pack(auto& packer) const
1041 {
1042 packer.pack_map(2);
1043 packer.pack(std::make_pair("message", message));
1044 packer.pack(std::make_pair("output", output));
1045 }
1046
1047 void msgpack_unpack(msgpack::object const& o)
1048 {
1049 std::string name = "Blake3";
1050 if (o.type == msgpack::type::MAP) {
1051 auto kvmap = Helpers::make_kvmap(o, name);
1052 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1053 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1054 } else if (o.type == msgpack::type::ARRAY) {
1055 auto array = o.via.array;
1056 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1057 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1058 } else {
1059 throw_or_abort("expected MAP or ARRAY for " + name);
1060 }
1061 }
1062 };
1063
1067
1068 friend bool operator==(const Keccakf1600&, const Keccakf1600&);
1069 std::vector<uint8_t> bincodeSerialize() const;
1070 static Keccakf1600 bincodeDeserialize(std::vector<uint8_t>);
1071
1072 void msgpack_pack(auto& packer) const
1073 {
1074 packer.pack_map(2);
1075 packer.pack(std::make_pair("input", input));
1076 packer.pack(std::make_pair("output", output));
1077 }
1078
1079 void msgpack_unpack(msgpack::object const& o)
1080 {
1081 std::string name = "Keccakf1600";
1082 if (o.type == msgpack::type::MAP) {
1083 auto kvmap = Helpers::make_kvmap(o, name);
1084 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1085 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1086 } else if (o.type == msgpack::type::ARRAY) {
1087 auto array = o.via.array;
1088 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1089 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1090 } else {
1091 throw_or_abort("expected MAP or ARRAY for " + name);
1092 }
1093 }
1094 };
1095
1102
1103 friend bool operator==(const EcdsaSecp256k1&, const EcdsaSecp256k1&);
1104 std::vector<uint8_t> bincodeSerialize() const;
1105 static EcdsaSecp256k1 bincodeDeserialize(std::vector<uint8_t>);
1106
1107 void msgpack_pack(auto& packer) const
1108 {
1109 packer.pack_map(5);
1110 packer.pack(std::make_pair("hashed_msg", hashed_msg));
1111 packer.pack(std::make_pair("public_key_x", public_key_x));
1112 packer.pack(std::make_pair("public_key_y", public_key_y));
1113 packer.pack(std::make_pair("signature", signature));
1114 packer.pack(std::make_pair("result", result));
1115 }
1116
1117 void msgpack_unpack(msgpack::object const& o)
1118 {
1119 std::string name = "EcdsaSecp256k1";
1120 if (o.type == msgpack::type::MAP) {
1121 auto kvmap = Helpers::make_kvmap(o, name);
1122 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false);
1123 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
1124 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
1125 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
1126 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1127 } else if (o.type == msgpack::type::ARRAY) {
1128 auto array = o.via.array;
1129 Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0);
1130 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1);
1131 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2);
1132 Helpers::conv_fld_from_array(array, name, "signature", signature, 3);
1133 Helpers::conv_fld_from_array(array, name, "result", result, 4);
1134 } else {
1135 throw_or_abort("expected MAP or ARRAY for " + name);
1136 }
1137 }
1138 };
1139
1146
1147 friend bool operator==(const EcdsaSecp256r1&, const EcdsaSecp256r1&);
1148 std::vector<uint8_t> bincodeSerialize() const;
1149 static EcdsaSecp256r1 bincodeDeserialize(std::vector<uint8_t>);
1150
1151 void msgpack_pack(auto& packer) const
1152 {
1153 packer.pack_map(5);
1154 packer.pack(std::make_pair("hashed_msg", hashed_msg));
1155 packer.pack(std::make_pair("public_key_x", public_key_x));
1156 packer.pack(std::make_pair("public_key_y", public_key_y));
1157 packer.pack(std::make_pair("signature", signature));
1158 packer.pack(std::make_pair("result", result));
1159 }
1160
1161 void msgpack_unpack(msgpack::object const& o)
1162 {
1163 std::string name = "EcdsaSecp256r1";
1164 if (o.type == msgpack::type::MAP) {
1165 auto kvmap = Helpers::make_kvmap(o, name);
1166 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false);
1167 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
1168 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
1169 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
1170 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1171 } else if (o.type == msgpack::type::ARRAY) {
1172 auto array = o.via.array;
1173 Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0);
1174 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1);
1175 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2);
1176 Helpers::conv_fld_from_array(array, name, "signature", signature, 3);
1177 Helpers::conv_fld_from_array(array, name, "result", result, 4);
1178 } else {
1179 throw_or_abort("expected MAP or ARRAY for " + name);
1180 }
1181 }
1182 };
1183
1188
1189 friend bool operator==(const MultiScalarMul&, const MultiScalarMul&);
1190 std::vector<uint8_t> bincodeSerialize() const;
1191 static MultiScalarMul bincodeDeserialize(std::vector<uint8_t>);
1192
1193 void msgpack_pack(auto& packer) const
1194 {
1195 packer.pack_map(3);
1196 packer.pack(std::make_pair("points", points));
1197 packer.pack(std::make_pair("scalars", scalars));
1198 packer.pack(std::make_pair("outputs", outputs));
1199 }
1200
1201 void msgpack_unpack(msgpack::object const& o)
1202 {
1203 std::string name = "MultiScalarMul";
1204 if (o.type == msgpack::type::MAP) {
1205 auto kvmap = Helpers::make_kvmap(o, name);
1206 Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false);
1207 Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false);
1208 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
1209 } else if (o.type == msgpack::type::ARRAY) {
1210 auto array = o.via.array;
1211 Helpers::conv_fld_from_array(array, name, "points", points, 0);
1212 Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1);
1213 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
1214 } else {
1215 throw_or_abort("expected MAP or ARRAY for " + name);
1216 }
1217 }
1218 };
1219
1228
1229 friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&);
1230 std::vector<uint8_t> bincodeSerialize() const;
1231 static EmbeddedCurveAdd bincodeDeserialize(std::vector<uint8_t>);
1232
1233 void msgpack_pack(auto& packer) const
1234 {
1235 packer.pack_map(7);
1236 packer.pack(std::make_pair("input1_x", input1_x));
1237 packer.pack(std::make_pair("input1_y", input1_y));
1238 packer.pack(std::make_pair("input1_infinite", input1_infinite));
1239 packer.pack(std::make_pair("input2_x", input2_x));
1240 packer.pack(std::make_pair("input2_y", input2_y));
1241 packer.pack(std::make_pair("input2_infinite", input2_infinite));
1242 packer.pack(std::make_pair("result", result));
1243 }
1244
1245 void msgpack_unpack(msgpack::object const& o)
1246 {
1247 std::string name = "EmbeddedCurveAdd";
1248 if (o.type == msgpack::type::MAP) {
1249 auto kvmap = Helpers::make_kvmap(o, name);
1250 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_x", input1_x, false);
1251 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_y", input1_y, false);
1252 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_infinite", input1_infinite, false);
1253 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_x", input2_x, false);
1254 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_y", input2_y, false);
1255 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_infinite", input2_infinite, false);
1256 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1257 } else if (o.type == msgpack::type::ARRAY) {
1258 auto array = o.via.array;
1259 Helpers::conv_fld_from_array(array, name, "input1_x", input1_x, 0);
1260 Helpers::conv_fld_from_array(array, name, "input1_y", input1_y, 1);
1261 Helpers::conv_fld_from_array(array, name, "input1_infinite", input1_infinite, 2);
1262 Helpers::conv_fld_from_array(array, name, "input2_x", input2_x, 3);
1263 Helpers::conv_fld_from_array(array, name, "input2_y", input2_y, 4);
1264 Helpers::conv_fld_from_array(array, name, "input2_infinite", input2_infinite, 5);
1265 Helpers::conv_fld_from_array(array, name, "result", result, 6);
1266 } else {
1267 throw_or_abort("expected MAP or ARRAY for " + name);
1268 }
1269 }
1270 };
1271
1275
1276 friend bool operator==(const Poseidon2Permutation&, const Poseidon2Permutation&);
1277 std::vector<uint8_t> bincodeSerialize() const;
1278 static Poseidon2Permutation bincodeDeserialize(std::vector<uint8_t>);
1279
1280 void msgpack_pack(auto& packer) const
1281 {
1282 packer.pack_map(2);
1283 packer.pack(std::make_pair("message", message));
1284 packer.pack(std::make_pair("output", output));
1285 }
1286
1287 void msgpack_unpack(msgpack::object const& o)
1288 {
1289 std::string name = "Poseidon2Permutation";
1290 if (o.type == msgpack::type::MAP) {
1291 auto kvmap = Helpers::make_kvmap(o, name);
1292 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1293 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1294 } else if (o.type == msgpack::type::ARRAY) {
1295 auto array = o.via.array;
1296 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1297 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1298 } else {
1299 throw_or_abort("expected MAP or ARRAY for " + name);
1300 }
1301 }
1302 };
1303
1308
1309 friend bool operator==(const Sha256Compression&, const Sha256Compression&);
1310 std::vector<uint8_t> bincodeSerialize() const;
1311 static Sha256Compression bincodeDeserialize(std::vector<uint8_t>);
1312
1313 void msgpack_pack(auto& packer) const
1314 {
1315 packer.pack_map(3);
1316 packer.pack(std::make_pair("input", input));
1317 packer.pack(std::make_pair("hash_values", hash_values));
1318 packer.pack(std::make_pair("output", output));
1319 }
1320
1321 void msgpack_unpack(msgpack::object const& o)
1322 {
1323 std::string name = "Sha256Compression";
1324 if (o.type == msgpack::type::MAP) {
1325 auto kvmap = Helpers::make_kvmap(o, name);
1326 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1327 Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false);
1328 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1329 } else if (o.type == msgpack::type::ARRAY) {
1330 auto array = o.via.array;
1331 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1332 Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1);
1333 Helpers::conv_fld_from_array(array, name, "output", output, 2);
1334 } else {
1335 throw_or_abort("expected MAP or ARRAY for " + name);
1336 }
1337 }
1338 };
1339
1340 struct ToRadix {
1346
1347 friend bool operator==(const ToRadix&, const ToRadix&);
1348 std::vector<uint8_t> bincodeSerialize() const;
1349 static ToRadix bincodeDeserialize(std::vector<uint8_t>);
1350
1351 void msgpack_pack(auto& packer) const
1352 {
1353 packer.pack_map(5);
1354 packer.pack(std::make_pair("input", input));
1355 packer.pack(std::make_pair("radix", radix));
1356 packer.pack(std::make_pair("output_pointer", output_pointer));
1357 packer.pack(std::make_pair("num_limbs", num_limbs));
1358 packer.pack(std::make_pair("output_bits", output_bits));
1359 }
1360
1361 void msgpack_unpack(msgpack::object const& o)
1362 {
1363 std::string name = "ToRadix";
1364 if (o.type == msgpack::type::MAP) {
1365 auto kvmap = Helpers::make_kvmap(o, name);
1366 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1367 Helpers::conv_fld_from_kvmap(kvmap, name, "radix", radix, false);
1368 Helpers::conv_fld_from_kvmap(kvmap, name, "output_pointer", output_pointer, false);
1369 Helpers::conv_fld_from_kvmap(kvmap, name, "num_limbs", num_limbs, false);
1370 Helpers::conv_fld_from_kvmap(kvmap, name, "output_bits", output_bits, false);
1371 } else if (o.type == msgpack::type::ARRAY) {
1372 auto array = o.via.array;
1373 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1374 Helpers::conv_fld_from_array(array, name, "radix", radix, 1);
1375 Helpers::conv_fld_from_array(array, name, "output_pointer", output_pointer, 2);
1376 Helpers::conv_fld_from_array(array, name, "num_limbs", num_limbs, 3);
1377 Helpers::conv_fld_from_array(array, name, "output_bits", output_bits, 4);
1378 } else {
1379 throw_or_abort("expected MAP or ARRAY for " + name);
1380 }
1381 }
1382 };
1383
1384 std::variant<AES128Encrypt,
1385 Blake2s,
1386 Blake3,
1387 Keccakf1600,
1388 EcdsaSecp256k1,
1389 EcdsaSecp256r1,
1390 MultiScalarMul,
1391 EmbeddedCurveAdd,
1392 Poseidon2Permutation,
1393 Sha256Compression,
1394 ToRadix>
1396
1397 friend bool operator==(const BlackBoxOp&, const BlackBoxOp&);
1398 std::vector<uint8_t> bincodeSerialize() const;
1399 static BlackBoxOp bincodeDeserialize(std::vector<uint8_t>);
1400
1401 void msgpack_pack(auto& packer) const
1402 {
1403 std::string tag;
1404 bool is_unit;
1405 switch (value.index()) {
1406
1407 case 0:
1408 tag = "AES128Encrypt";
1409 is_unit = false;
1410 break;
1411 case 1:
1412 tag = "Blake2s";
1413 is_unit = false;
1414 break;
1415 case 2:
1416 tag = "Blake3";
1417 is_unit = false;
1418 break;
1419 case 3:
1420 tag = "Keccakf1600";
1421 is_unit = false;
1422 break;
1423 case 4:
1424 tag = "EcdsaSecp256k1";
1425 is_unit = false;
1426 break;
1427 case 5:
1428 tag = "EcdsaSecp256r1";
1429 is_unit = false;
1430 break;
1431 case 6:
1432 tag = "MultiScalarMul";
1433 is_unit = false;
1434 break;
1435 case 7:
1436 tag = "EmbeddedCurveAdd";
1437 is_unit = false;
1438 break;
1439 case 8:
1440 tag = "Poseidon2Permutation";
1441 is_unit = false;
1442 break;
1443 case 9:
1444 tag = "Sha256Compression";
1445 is_unit = false;
1446 break;
1447 case 10:
1448 tag = "ToRadix";
1449 is_unit = false;
1450 break;
1451 default:
1452 throw_or_abort("unknown enum 'BlackBoxOp' variant index: " + std::to_string(value.index()));
1453 }
1454 if (is_unit) {
1455 packer.pack(tag);
1456 } else {
1457 std::visit(
1458 [&packer, tag](const auto& arg) {
1460 data[tag] = msgpack::object(arg);
1461 packer.pack(data);
1462 },
1463 value);
1464 }
1465 }
1466
1467 void msgpack_unpack(msgpack::object const& o)
1468 {
1469
1470 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1471 std::cerr << o << std::endl;
1472 throw_or_abort("expected MAP or STR for enum 'BlackBoxOp'; got type " + std::to_string(o.type));
1473 }
1474 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1475 throw_or_abort("expected 1 entry for enum 'BlackBoxOp'; got " + std::to_string(o.via.map.size));
1476 }
1477 std::string tag;
1478 try {
1479 if (o.type == msgpack::type::object_type::MAP) {
1480 o.via.map.ptr[0].key.convert(tag);
1481 } else {
1482 o.convert(tag);
1483 }
1484 } catch (const msgpack::type_error&) {
1485 std::cerr << o << std::endl;
1486 throw_or_abort("error converting tag to string for enum 'BlackBoxOp'");
1487 }
1488 if (tag == "AES128Encrypt") {
1489 AES128Encrypt v;
1490 try {
1491 o.via.map.ptr[0].val.convert(v);
1492 } catch (const msgpack::type_error&) {
1493 std::cerr << o << std::endl;
1494 throw_or_abort("error converting into enum variant 'BlackBoxOp::AES128Encrypt'");
1495 }
1496
1497 value = v;
1498 } else if (tag == "Blake2s") {
1499 Blake2s v;
1500 try {
1501 o.via.map.ptr[0].val.convert(v);
1502 } catch (const msgpack::type_error&) {
1503 std::cerr << o << std::endl;
1504 throw_or_abort("error converting into enum variant 'BlackBoxOp::Blake2s'");
1505 }
1506
1507 value = v;
1508 } else if (tag == "Blake3") {
1509 Blake3 v;
1510 try {
1511 o.via.map.ptr[0].val.convert(v);
1512 } catch (const msgpack::type_error&) {
1513 std::cerr << o << std::endl;
1514 throw_or_abort("error converting into enum variant 'BlackBoxOp::Blake3'");
1515 }
1516
1517 value = v;
1518 } else if (tag == "Keccakf1600") {
1519 Keccakf1600 v;
1520 try {
1521 o.via.map.ptr[0].val.convert(v);
1522 } catch (const msgpack::type_error&) {
1523 std::cerr << o << std::endl;
1524 throw_or_abort("error converting into enum variant 'BlackBoxOp::Keccakf1600'");
1525 }
1526
1527 value = v;
1528 } else if (tag == "EcdsaSecp256k1") {
1530 try {
1531 o.via.map.ptr[0].val.convert(v);
1532 } catch (const msgpack::type_error&) {
1533 std::cerr << o << std::endl;
1534 throw_or_abort("error converting into enum variant 'BlackBoxOp::EcdsaSecp256k1'");
1535 }
1536
1537 value = v;
1538 } else if (tag == "EcdsaSecp256r1") {
1540 try {
1541 o.via.map.ptr[0].val.convert(v);
1542 } catch (const msgpack::type_error&) {
1543 std::cerr << o << std::endl;
1544 throw_or_abort("error converting into enum variant 'BlackBoxOp::EcdsaSecp256r1'");
1545 }
1546
1547 value = v;
1548 } else if (tag == "MultiScalarMul") {
1550 try {
1551 o.via.map.ptr[0].val.convert(v);
1552 } catch (const msgpack::type_error&) {
1553 std::cerr << o << std::endl;
1554 throw_or_abort("error converting into enum variant 'BlackBoxOp::MultiScalarMul'");
1555 }
1556
1557 value = v;
1558 } else if (tag == "EmbeddedCurveAdd") {
1560 try {
1561 o.via.map.ptr[0].val.convert(v);
1562 } catch (const msgpack::type_error&) {
1563 std::cerr << o << std::endl;
1564 throw_or_abort("error converting into enum variant 'BlackBoxOp::EmbeddedCurveAdd'");
1565 }
1566
1567 value = v;
1568 } else if (tag == "Poseidon2Permutation") {
1570 try {
1571 o.via.map.ptr[0].val.convert(v);
1572 } catch (const msgpack::type_error&) {
1573 std::cerr << o << std::endl;
1574 throw_or_abort("error converting into enum variant 'BlackBoxOp::Poseidon2Permutation'");
1575 }
1576
1577 value = v;
1578 } else if (tag == "Sha256Compression") {
1580 try {
1581 o.via.map.ptr[0].val.convert(v);
1582 } catch (const msgpack::type_error&) {
1583 std::cerr << o << std::endl;
1584 throw_or_abort("error converting into enum variant 'BlackBoxOp::Sha256Compression'");
1585 }
1586
1587 value = v;
1588 } else if (tag == "ToRadix") {
1589 ToRadix v;
1590 try {
1591 o.via.map.ptr[0].val.convert(v);
1592 } catch (const msgpack::type_error&) {
1593 std::cerr << o << std::endl;
1594 throw_or_abort("error converting into enum variant 'BlackBoxOp::ToRadix'");
1595 }
1596
1597 value = v;
1598 } else {
1599 std::cerr << o << std::endl;
1600 throw_or_abort("unknown 'BlackBoxOp' enum variant: " + tag);
1601 }
1602 }
1603};
1604
1605struct HeapValueType;
1606
1608
1609 struct Simple {
1611
1612 friend bool operator==(const Simple&, const Simple&);
1613 std::vector<uint8_t> bincodeSerialize() const;
1614 static Simple bincodeDeserialize(std::vector<uint8_t>);
1615
1616 void msgpack_pack(auto& packer) const { packer.pack(value); }
1617
1618 void msgpack_unpack(msgpack::object const& o)
1619 {
1620 try {
1621 o.convert(value);
1622 } catch (const msgpack::type_error&) {
1623 std::cerr << o << std::endl;
1624 throw_or_abort("error converting into newtype 'Simple'");
1625 }
1626 }
1627 };
1628
1629 struct Array {
1630 std::vector<Acir::HeapValueType> value_types;
1631 uint64_t size;
1632
1633 friend bool operator==(const Array&, const Array&);
1634 std::vector<uint8_t> bincodeSerialize() const;
1635 static Array bincodeDeserialize(std::vector<uint8_t>);
1636
1637 void msgpack_pack(auto& packer) const
1638 {
1639 packer.pack_map(2);
1640 packer.pack(std::make_pair("value_types", value_types));
1641 packer.pack(std::make_pair("size", size));
1642 }
1643
1644 void msgpack_unpack(msgpack::object const& o)
1645 {
1646 std::string name = "Array";
1647 if (o.type == msgpack::type::MAP) {
1648 auto kvmap = Helpers::make_kvmap(o, name);
1649 Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false);
1650 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
1651 } else if (o.type == msgpack::type::ARRAY) {
1652 auto array = o.via.array;
1653 Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0);
1654 Helpers::conv_fld_from_array(array, name, "size", size, 1);
1655 } else {
1656 throw_or_abort("expected MAP or ARRAY for " + name);
1657 }
1658 }
1659 };
1660
1661 struct Vector {
1662 std::vector<Acir::HeapValueType> value_types;
1663
1664 friend bool operator==(const Vector&, const Vector&);
1665 std::vector<uint8_t> bincodeSerialize() const;
1666 static Vector bincodeDeserialize(std::vector<uint8_t>);
1667
1668 void msgpack_pack(auto& packer) const
1669 {
1670 packer.pack_map(1);
1671 packer.pack(std::make_pair("value_types", value_types));
1672 }
1673
1674 void msgpack_unpack(msgpack::object const& o)
1675 {
1676 std::string name = "Vector";
1677 if (o.type == msgpack::type::MAP) {
1678 auto kvmap = Helpers::make_kvmap(o, name);
1679 Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false);
1680 } else if (o.type == msgpack::type::ARRAY) {
1681 auto array = o.via.array;
1682 Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0);
1683 } else {
1684 throw_or_abort("expected MAP or ARRAY for " + name);
1685 }
1686 }
1687 };
1688
1690
1691 friend bool operator==(const HeapValueType&, const HeapValueType&);
1692 std::vector<uint8_t> bincodeSerialize() const;
1693 static HeapValueType bincodeDeserialize(std::vector<uint8_t>);
1694
1695 void msgpack_pack(auto& packer) const
1696 {
1697 std::string tag;
1698 bool is_unit;
1699 switch (value.index()) {
1700
1701 case 0:
1702 tag = "Simple";
1703 is_unit = false;
1704 break;
1705 case 1:
1706 tag = "Array";
1707 is_unit = false;
1708 break;
1709 case 2:
1710 tag = "Vector";
1711 is_unit = false;
1712 break;
1713 default:
1714 throw_or_abort("unknown enum 'HeapValueType' variant index: " + std::to_string(value.index()));
1715 }
1716 if (is_unit) {
1717 packer.pack(tag);
1718 } else {
1719 std::visit(
1720 [&packer, tag](const auto& arg) {
1722 data[tag] = msgpack::object(arg);
1723 packer.pack(data);
1724 },
1725 value);
1726 }
1727 }
1728
1729 void msgpack_unpack(msgpack::object const& o)
1730 {
1731
1732 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1733 std::cerr << o << std::endl;
1734 throw_or_abort("expected MAP or STR for enum 'HeapValueType'; got type " + std::to_string(o.type));
1735 }
1736 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1737 throw_or_abort("expected 1 entry for enum 'HeapValueType'; got " + std::to_string(o.via.map.size));
1738 }
1739 std::string tag;
1740 try {
1741 if (o.type == msgpack::type::object_type::MAP) {
1742 o.via.map.ptr[0].key.convert(tag);
1743 } else {
1744 o.convert(tag);
1745 }
1746 } catch (const msgpack::type_error&) {
1747 std::cerr << o << std::endl;
1748 throw_or_abort("error converting tag to string for enum 'HeapValueType'");
1749 }
1750 if (tag == "Simple") {
1751 Simple v;
1752 try {
1753 o.via.map.ptr[0].val.convert(v);
1754 } catch (const msgpack::type_error&) {
1755 std::cerr << o << std::endl;
1756 throw_or_abort("error converting into enum variant 'HeapValueType::Simple'");
1757 }
1758
1759 value = v;
1760 } else if (tag == "Array") {
1761 Array v;
1762 try {
1763 o.via.map.ptr[0].val.convert(v);
1764 } catch (const msgpack::type_error&) {
1765 std::cerr << o << std::endl;
1766 throw_or_abort("error converting into enum variant 'HeapValueType::Array'");
1767 }
1768
1769 value = v;
1770 } else if (tag == "Vector") {
1771 Vector v;
1772 try {
1773 o.via.map.ptr[0].val.convert(v);
1774 } catch (const msgpack::type_error&) {
1775 std::cerr << o << std::endl;
1776 throw_or_abort("error converting into enum variant 'HeapValueType::Vector'");
1777 }
1778
1779 value = v;
1780 } else {
1781 std::cerr << o << std::endl;
1782 throw_or_abort("unknown 'HeapValueType' enum variant: " + tag);
1783 }
1784 }
1785};
1786
1788
1791
1792 friend bool operator==(const MemoryAddress&, const MemoryAddress&);
1793 std::vector<uint8_t> bincodeSerialize() const;
1794 static MemoryAddress bincodeDeserialize(std::vector<uint8_t>);
1795
1796 void msgpack_pack(auto& packer) const { packer.pack(value); }
1797
1798 void msgpack_unpack(msgpack::object const& o)
1799 {
1800 try {
1801 o.convert(value);
1802 } catch (const msgpack::type_error&) {
1803 std::cerr << o << std::endl;
1804 throw_or_abort("error converting into newtype 'MemoryAddress'");
1805 }
1806 }
1807 };
1808
1809 struct HeapArray {
1811
1812 friend bool operator==(const HeapArray&, const HeapArray&);
1813 std::vector<uint8_t> bincodeSerialize() const;
1814 static HeapArray bincodeDeserialize(std::vector<uint8_t>);
1815
1816 void msgpack_pack(auto& packer) const { packer.pack(value); }
1817
1818 void msgpack_unpack(msgpack::object const& o)
1819 {
1820 try {
1821 o.convert(value);
1822 } catch (const msgpack::type_error&) {
1823 std::cerr << o << std::endl;
1824 throw_or_abort("error converting into newtype 'HeapArray'");
1825 }
1826 }
1827 };
1828
1829 struct HeapVector {
1831
1832 friend bool operator==(const HeapVector&, const HeapVector&);
1833 std::vector<uint8_t> bincodeSerialize() const;
1834 static HeapVector bincodeDeserialize(std::vector<uint8_t>);
1835
1836 void msgpack_pack(auto& packer) const { packer.pack(value); }
1837
1838 void msgpack_unpack(msgpack::object const& o)
1839 {
1840 try {
1841 o.convert(value);
1842 } catch (const msgpack::type_error&) {
1843 std::cerr << o << std::endl;
1844 throw_or_abort("error converting into newtype 'HeapVector'");
1845 }
1846 }
1847 };
1848
1850
1851 friend bool operator==(const ValueOrArray&, const ValueOrArray&);
1852 std::vector<uint8_t> bincodeSerialize() const;
1853 static ValueOrArray bincodeDeserialize(std::vector<uint8_t>);
1854
1855 void msgpack_pack(auto& packer) const
1856 {
1857 std::string tag;
1858 bool is_unit;
1859 switch (value.index()) {
1860
1861 case 0:
1862 tag = "MemoryAddress";
1863 is_unit = false;
1864 break;
1865 case 1:
1866 tag = "HeapArray";
1867 is_unit = false;
1868 break;
1869 case 2:
1870 tag = "HeapVector";
1871 is_unit = false;
1872 break;
1873 default:
1874 throw_or_abort("unknown enum 'ValueOrArray' variant index: " + std::to_string(value.index()));
1875 }
1876 if (is_unit) {
1877 packer.pack(tag);
1878 } else {
1879 std::visit(
1880 [&packer, tag](const auto& arg) {
1882 data[tag] = msgpack::object(arg);
1883 packer.pack(data);
1884 },
1885 value);
1886 }
1887 }
1888
1889 void msgpack_unpack(msgpack::object const& o)
1890 {
1891
1892 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1893 std::cerr << o << std::endl;
1894 throw_or_abort("expected MAP or STR for enum 'ValueOrArray'; got type " + std::to_string(o.type));
1895 }
1896 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1897 throw_or_abort("expected 1 entry for enum 'ValueOrArray'; got " + std::to_string(o.via.map.size));
1898 }
1899 std::string tag;
1900 try {
1901 if (o.type == msgpack::type::object_type::MAP) {
1902 o.via.map.ptr[0].key.convert(tag);
1903 } else {
1904 o.convert(tag);
1905 }
1906 } catch (const msgpack::type_error&) {
1907 std::cerr << o << std::endl;
1908 throw_or_abort("error converting tag to string for enum 'ValueOrArray'");
1909 }
1910 if (tag == "MemoryAddress") {
1911 MemoryAddress v;
1912 try {
1913 o.via.map.ptr[0].val.convert(v);
1914 } catch (const msgpack::type_error&) {
1915 std::cerr << o << std::endl;
1916 throw_or_abort("error converting into enum variant 'ValueOrArray::MemoryAddress'");
1917 }
1918
1919 value = v;
1920 } else if (tag == "HeapArray") {
1921 HeapArray v;
1922 try {
1923 o.via.map.ptr[0].val.convert(v);
1924 } catch (const msgpack::type_error&) {
1925 std::cerr << o << std::endl;
1926 throw_or_abort("error converting into enum variant 'ValueOrArray::HeapArray'");
1927 }
1928
1929 value = v;
1930 } else if (tag == "HeapVector") {
1931 HeapVector v;
1932 try {
1933 o.via.map.ptr[0].val.convert(v);
1934 } catch (const msgpack::type_error&) {
1935 std::cerr << o << std::endl;
1936 throw_or_abort("error converting into enum variant 'ValueOrArray::HeapVector'");
1937 }
1938
1939 value = v;
1940 } else {
1941 std::cerr << o << std::endl;
1942 throw_or_abort("unknown 'ValueOrArray' enum variant: " + tag);
1943 }
1944 }
1945};
1946
1948
1954
1955 friend bool operator==(const BinaryFieldOp&, const BinaryFieldOp&);
1956 std::vector<uint8_t> bincodeSerialize() const;
1957 static BinaryFieldOp bincodeDeserialize(std::vector<uint8_t>);
1958
1959 void msgpack_pack(auto& packer) const
1960 {
1961 packer.pack_map(4);
1962 packer.pack(std::make_pair("destination", destination));
1963 packer.pack(std::make_pair("op", op));
1964 packer.pack(std::make_pair("lhs", lhs));
1965 packer.pack(std::make_pair("rhs", rhs));
1966 }
1967
1968 void msgpack_unpack(msgpack::object const& o)
1969 {
1970 std::string name = "BinaryFieldOp";
1971 if (o.type == msgpack::type::MAP) {
1972 auto kvmap = Helpers::make_kvmap(o, name);
1973 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
1974 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
1975 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
1976 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
1977 } else if (o.type == msgpack::type::ARRAY) {
1978 auto array = o.via.array;
1979 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
1980 Helpers::conv_fld_from_array(array, name, "op", op, 1);
1981 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 2);
1982 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 3);
1983 } else {
1984 throw_or_abort("expected MAP or ARRAY for " + name);
1985 }
1986 }
1987 };
1988
1995
1996 friend bool operator==(const BinaryIntOp&, const BinaryIntOp&);
1997 std::vector<uint8_t> bincodeSerialize() const;
1998 static BinaryIntOp bincodeDeserialize(std::vector<uint8_t>);
1999
2000 void msgpack_pack(auto& packer) const
2001 {
2002 packer.pack_map(5);
2003 packer.pack(std::make_pair("destination", destination));
2004 packer.pack(std::make_pair("op", op));
2005 packer.pack(std::make_pair("bit_size", bit_size));
2006 packer.pack(std::make_pair("lhs", lhs));
2007 packer.pack(std::make_pair("rhs", rhs));
2008 }
2009
2010 void msgpack_unpack(msgpack::object const& o)
2011 {
2012 std::string name = "BinaryIntOp";
2013 if (o.type == msgpack::type::MAP) {
2014 auto kvmap = Helpers::make_kvmap(o, name);
2015 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2016 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
2017 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2018 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
2019 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
2020 } else if (o.type == msgpack::type::ARRAY) {
2021 auto array = o.via.array;
2022 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2023 Helpers::conv_fld_from_array(array, name, "op", op, 1);
2024 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2025 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 3);
2026 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 4);
2027 } else {
2028 throw_or_abort("expected MAP or ARRAY for " + name);
2029 }
2030 }
2031 };
2032
2033 struct Not {
2037
2038 friend bool operator==(const Not&, const Not&);
2039 std::vector<uint8_t> bincodeSerialize() const;
2040 static Not bincodeDeserialize(std::vector<uint8_t>);
2041
2042 void msgpack_pack(auto& packer) const
2043 {
2044 packer.pack_map(3);
2045 packer.pack(std::make_pair("destination", destination));
2046 packer.pack(std::make_pair("source", source));
2047 packer.pack(std::make_pair("bit_size", bit_size));
2048 }
2049
2050 void msgpack_unpack(msgpack::object const& o)
2051 {
2052 std::string name = "Not";
2053 if (o.type == msgpack::type::MAP) {
2054 auto kvmap = Helpers::make_kvmap(o, name);
2055 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2056 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2057 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2058 } else if (o.type == msgpack::type::ARRAY) {
2059 auto array = o.via.array;
2060 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2061 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2062 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2063 } else {
2064 throw_or_abort("expected MAP or ARRAY for " + name);
2065 }
2066 }
2067 };
2068
2069 struct Cast {
2073
2074 friend bool operator==(const Cast&, const Cast&);
2075 std::vector<uint8_t> bincodeSerialize() const;
2076 static Cast bincodeDeserialize(std::vector<uint8_t>);
2077
2078 void msgpack_pack(auto& packer) const
2079 {
2080 packer.pack_map(3);
2081 packer.pack(std::make_pair("destination", destination));
2082 packer.pack(std::make_pair("source", source));
2083 packer.pack(std::make_pair("bit_size", bit_size));
2084 }
2085
2086 void msgpack_unpack(msgpack::object const& o)
2087 {
2088 std::string name = "Cast";
2089 if (o.type == msgpack::type::MAP) {
2090 auto kvmap = Helpers::make_kvmap(o, name);
2091 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2092 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2093 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2094 } else if (o.type == msgpack::type::ARRAY) {
2095 auto array = o.via.array;
2096 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2097 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2098 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2099 } else {
2100 throw_or_abort("expected MAP or ARRAY for " + name);
2101 }
2102 }
2103 };
2104
2105 struct JumpIf {
2107 uint64_t location;
2108
2109 friend bool operator==(const JumpIf&, const JumpIf&);
2110 std::vector<uint8_t> bincodeSerialize() const;
2111 static JumpIf bincodeDeserialize(std::vector<uint8_t>);
2112
2113 void msgpack_pack(auto& packer) const
2114 {
2115 packer.pack_map(2);
2116 packer.pack(std::make_pair("condition", condition));
2117 packer.pack(std::make_pair("location", location));
2118 }
2119
2120 void msgpack_unpack(msgpack::object const& o)
2121 {
2122 std::string name = "JumpIf";
2123 if (o.type == msgpack::type::MAP) {
2124 auto kvmap = Helpers::make_kvmap(o, name);
2125 Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false);
2126 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2127 } else if (o.type == msgpack::type::ARRAY) {
2128 auto array = o.via.array;
2129 Helpers::conv_fld_from_array(array, name, "condition", condition, 0);
2130 Helpers::conv_fld_from_array(array, name, "location", location, 1);
2131 } else {
2132 throw_or_abort("expected MAP or ARRAY for " + name);
2133 }
2134 }
2135 };
2136
2137 struct Jump {
2138 uint64_t location;
2139
2140 friend bool operator==(const Jump&, const Jump&);
2141 std::vector<uint8_t> bincodeSerialize() const;
2142 static Jump bincodeDeserialize(std::vector<uint8_t>);
2143
2144 void msgpack_pack(auto& packer) const
2145 {
2146 packer.pack_map(1);
2147 packer.pack(std::make_pair("location", location));
2148 }
2149
2150 void msgpack_unpack(msgpack::object const& o)
2151 {
2152 std::string name = "Jump";
2153 if (o.type == msgpack::type::MAP) {
2154 auto kvmap = Helpers::make_kvmap(o, name);
2155 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2156 } else if (o.type == msgpack::type::ARRAY) {
2157 auto array = o.via.array;
2158 Helpers::conv_fld_from_array(array, name, "location", location, 0);
2159 } else {
2160 throw_or_abort("expected MAP or ARRAY for " + name);
2161 }
2162 }
2163 };
2164
2169
2170 friend bool operator==(const CalldataCopy&, const CalldataCopy&);
2171 std::vector<uint8_t> bincodeSerialize() const;
2172 static CalldataCopy bincodeDeserialize(std::vector<uint8_t>);
2173
2174 void msgpack_pack(auto& packer) const
2175 {
2176 packer.pack_map(3);
2177 packer.pack(std::make_pair("destination_address", destination_address));
2178 packer.pack(std::make_pair("size_address", size_address));
2179 packer.pack(std::make_pair("offset_address", offset_address));
2180 }
2181
2182 void msgpack_unpack(msgpack::object const& o)
2183 {
2184 std::string name = "CalldataCopy";
2185 if (o.type == msgpack::type::MAP) {
2186 auto kvmap = Helpers::make_kvmap(o, name);
2187 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_address", destination_address, false);
2188 Helpers::conv_fld_from_kvmap(kvmap, name, "size_address", size_address, false);
2189 Helpers::conv_fld_from_kvmap(kvmap, name, "offset_address", offset_address, false);
2190 } else if (o.type == msgpack::type::ARRAY) {
2191 auto array = o.via.array;
2192 Helpers::conv_fld_from_array(array, name, "destination_address", destination_address, 0);
2193 Helpers::conv_fld_from_array(array, name, "size_address", size_address, 1);
2194 Helpers::conv_fld_from_array(array, name, "offset_address", offset_address, 2);
2195 } else {
2196 throw_or_abort("expected MAP or ARRAY for " + name);
2197 }
2198 }
2199 };
2200
2201 struct Call {
2202 uint64_t location;
2203
2204 friend bool operator==(const Call&, const Call&);
2205 std::vector<uint8_t> bincodeSerialize() const;
2206 static Call bincodeDeserialize(std::vector<uint8_t>);
2207
2208 void msgpack_pack(auto& packer) const
2209 {
2210 packer.pack_map(1);
2211 packer.pack(std::make_pair("location", location));
2212 }
2213
2214 void msgpack_unpack(msgpack::object const& o)
2215 {
2216 std::string name = "Call";
2217 if (o.type == msgpack::type::MAP) {
2218 auto kvmap = Helpers::make_kvmap(o, name);
2219 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2220 } else if (o.type == msgpack::type::ARRAY) {
2221 auto array = o.via.array;
2222 Helpers::conv_fld_from_array(array, name, "location", location, 0);
2223 } else {
2224 throw_or_abort("expected MAP or ARRAY for " + name);
2225 }
2226 }
2227 };
2228
2229 struct Const {
2232 std::vector<uint8_t> value;
2233
2234 friend bool operator==(const Const&, const Const&);
2235 std::vector<uint8_t> bincodeSerialize() const;
2236 static Const bincodeDeserialize(std::vector<uint8_t>);
2237
2238 void msgpack_pack(auto& packer) const
2239 {
2240 packer.pack_map(3);
2241 packer.pack(std::make_pair("destination", destination));
2242 packer.pack(std::make_pair("bit_size", bit_size));
2243 packer.pack(std::make_pair("value", value));
2244 }
2245
2246 void msgpack_unpack(msgpack::object const& o)
2247 {
2248 std::string name = "Const";
2249 if (o.type == msgpack::type::MAP) {
2250 auto kvmap = Helpers::make_kvmap(o, name);
2251 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2252 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2253 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
2254 } else if (o.type == msgpack::type::ARRAY) {
2255 auto array = o.via.array;
2256 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2257 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1);
2258 Helpers::conv_fld_from_array(array, name, "value", value, 2);
2259 } else {
2260 throw_or_abort("expected MAP or ARRAY for " + name);
2261 }
2262 }
2263 };
2264
2268 std::vector<uint8_t> value;
2269
2270 friend bool operator==(const IndirectConst&, const IndirectConst&);
2271 std::vector<uint8_t> bincodeSerialize() const;
2272 static IndirectConst bincodeDeserialize(std::vector<uint8_t>);
2273
2274 void msgpack_pack(auto& packer) const
2275 {
2276 packer.pack_map(3);
2277 packer.pack(std::make_pair("destination_pointer", destination_pointer));
2278 packer.pack(std::make_pair("bit_size", bit_size));
2279 packer.pack(std::make_pair("value", value));
2280 }
2281
2282 void msgpack_unpack(msgpack::object const& o)
2283 {
2284 std::string name = "IndirectConst";
2285 if (o.type == msgpack::type::MAP) {
2286 auto kvmap = Helpers::make_kvmap(o, name);
2287 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false);
2288 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2289 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
2290 } else if (o.type == msgpack::type::ARRAY) {
2291 auto array = o.via.array;
2292 Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0);
2293 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1);
2294 Helpers::conv_fld_from_array(array, name, "value", value, 2);
2295 } else {
2296 throw_or_abort("expected MAP or ARRAY for " + name);
2297 }
2298 }
2299 };
2300
2301 struct Return {
2302 friend bool operator==(const Return&, const Return&);
2303 std::vector<uint8_t> bincodeSerialize() const;
2304 static Return bincodeDeserialize(std::vector<uint8_t>);
2305
2306 void msgpack_pack(auto& packer) const {}
2307 void msgpack_unpack(msgpack::object const& o) {}
2308 };
2309
2311 std::string function;
2312 std::vector<Acir::ValueOrArray> destinations;
2313 std::vector<Acir::HeapValueType> destination_value_types;
2314 std::vector<Acir::ValueOrArray> inputs;
2315 std::vector<Acir::HeapValueType> input_value_types;
2316
2317 friend bool operator==(const ForeignCall&, const ForeignCall&);
2318 std::vector<uint8_t> bincodeSerialize() const;
2319 static ForeignCall bincodeDeserialize(std::vector<uint8_t>);
2320
2321 void msgpack_pack(auto& packer) const
2322 {
2323 packer.pack_map(5);
2324 packer.pack(std::make_pair("function", function));
2325 packer.pack(std::make_pair("destinations", destinations));
2326 packer.pack(std::make_pair("destination_value_types", destination_value_types));
2327 packer.pack(std::make_pair("inputs", inputs));
2328 packer.pack(std::make_pair("input_value_types", input_value_types));
2329 }
2330
2331 void msgpack_unpack(msgpack::object const& o)
2332 {
2333 std::string name = "ForeignCall";
2334 if (o.type == msgpack::type::MAP) {
2335 auto kvmap = Helpers::make_kvmap(o, name);
2336 Helpers::conv_fld_from_kvmap(kvmap, name, "function", function, false);
2337 Helpers::conv_fld_from_kvmap(kvmap, name, "destinations", destinations, false);
2338 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_value_types", destination_value_types, false);
2339 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
2340 Helpers::conv_fld_from_kvmap(kvmap, name, "input_value_types", input_value_types, false);
2341 } else if (o.type == msgpack::type::ARRAY) {
2342 auto array = o.via.array;
2343 Helpers::conv_fld_from_array(array, name, "function", function, 0);
2344 Helpers::conv_fld_from_array(array, name, "destinations", destinations, 1);
2345 Helpers::conv_fld_from_array(array, name, "destination_value_types", destination_value_types, 2);
2346 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 3);
2347 Helpers::conv_fld_from_array(array, name, "input_value_types", input_value_types, 4);
2348 } else {
2349 throw_or_abort("expected MAP or ARRAY for " + name);
2350 }
2351 }
2352 };
2353
2354 struct Mov {
2357
2358 friend bool operator==(const Mov&, const Mov&);
2359 std::vector<uint8_t> bincodeSerialize() const;
2360 static Mov bincodeDeserialize(std::vector<uint8_t>);
2361
2362 void msgpack_pack(auto& packer) const
2363 {
2364 packer.pack_map(2);
2365 packer.pack(std::make_pair("destination", destination));
2366 packer.pack(std::make_pair("source", source));
2367 }
2368
2369 void msgpack_unpack(msgpack::object const& o)
2370 {
2371 std::string name = "Mov";
2372 if (o.type == msgpack::type::MAP) {
2373 auto kvmap = Helpers::make_kvmap(o, name);
2374 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2375 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2376 } else if (o.type == msgpack::type::ARRAY) {
2377 auto array = o.via.array;
2378 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2379 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2380 } else {
2381 throw_or_abort("expected MAP or ARRAY for " + name);
2382 }
2383 }
2384 };
2385
2391
2392 friend bool operator==(const ConditionalMov&, const ConditionalMov&);
2393 std::vector<uint8_t> bincodeSerialize() const;
2394 static ConditionalMov bincodeDeserialize(std::vector<uint8_t>);
2395
2396 void msgpack_pack(auto& packer) const
2397 {
2398 packer.pack_map(4);
2399 packer.pack(std::make_pair("destination", destination));
2400 packer.pack(std::make_pair("source_a", source_a));
2401 packer.pack(std::make_pair("source_b", source_b));
2402 packer.pack(std::make_pair("condition", condition));
2403 }
2404
2405 void msgpack_unpack(msgpack::object const& o)
2406 {
2407 std::string name = "ConditionalMov";
2408 if (o.type == msgpack::type::MAP) {
2409 auto kvmap = Helpers::make_kvmap(o, name);
2410 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2411 Helpers::conv_fld_from_kvmap(kvmap, name, "source_a", source_a, false);
2412 Helpers::conv_fld_from_kvmap(kvmap, name, "source_b", source_b, false);
2413 Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false);
2414 } else if (o.type == msgpack::type::ARRAY) {
2415 auto array = o.via.array;
2416 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2417 Helpers::conv_fld_from_array(array, name, "source_a", source_a, 1);
2418 Helpers::conv_fld_from_array(array, name, "source_b", source_b, 2);
2419 Helpers::conv_fld_from_array(array, name, "condition", condition, 3);
2420 } else {
2421 throw_or_abort("expected MAP or ARRAY for " + name);
2422 }
2423 }
2424 };
2425
2426 struct Load {
2429
2430 friend bool operator==(const Load&, const Load&);
2431 std::vector<uint8_t> bincodeSerialize() const;
2432 static Load bincodeDeserialize(std::vector<uint8_t>);
2433
2434 void msgpack_pack(auto& packer) const
2435 {
2436 packer.pack_map(2);
2437 packer.pack(std::make_pair("destination", destination));
2438 packer.pack(std::make_pair("source_pointer", source_pointer));
2439 }
2440
2441 void msgpack_unpack(msgpack::object const& o)
2442 {
2443 std::string name = "Load";
2444 if (o.type == msgpack::type::MAP) {
2445 auto kvmap = Helpers::make_kvmap(o, name);
2446 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2447 Helpers::conv_fld_from_kvmap(kvmap, name, "source_pointer", source_pointer, false);
2448 } else if (o.type == msgpack::type::ARRAY) {
2449 auto array = o.via.array;
2450 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2451 Helpers::conv_fld_from_array(array, name, "source_pointer", source_pointer, 1);
2452 } else {
2453 throw_or_abort("expected MAP or ARRAY for " + name);
2454 }
2455 }
2456 };
2457
2458 struct Store {
2461
2462 friend bool operator==(const Store&, const Store&);
2463 std::vector<uint8_t> bincodeSerialize() const;
2464 static Store bincodeDeserialize(std::vector<uint8_t>);
2465
2466 void msgpack_pack(auto& packer) const
2467 {
2468 packer.pack_map(2);
2469 packer.pack(std::make_pair("destination_pointer", destination_pointer));
2470 packer.pack(std::make_pair("source", source));
2471 }
2472
2473 void msgpack_unpack(msgpack::object const& o)
2474 {
2475 std::string name = "Store";
2476 if (o.type == msgpack::type::MAP) {
2477 auto kvmap = Helpers::make_kvmap(o, name);
2478 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false);
2479 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2480 } else if (o.type == msgpack::type::ARRAY) {
2481 auto array = o.via.array;
2482 Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0);
2483 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2484 } else {
2485 throw_or_abort("expected MAP or ARRAY for " + name);
2486 }
2487 }
2488 };
2489
2490 struct BlackBox {
2492
2493 friend bool operator==(const BlackBox&, const BlackBox&);
2494 std::vector<uint8_t> bincodeSerialize() const;
2495 static BlackBox bincodeDeserialize(std::vector<uint8_t>);
2496
2497 void msgpack_pack(auto& packer) const { packer.pack(value); }
2498
2499 void msgpack_unpack(msgpack::object const& o)
2500 {
2501 try {
2502 o.convert(value);
2503 } catch (const msgpack::type_error&) {
2504 std::cerr << o << std::endl;
2505 throw_or_abort("error converting into newtype 'BlackBox'");
2506 }
2507 }
2508 };
2509
2510 struct Trap {
2512
2513 friend bool operator==(const Trap&, const Trap&);
2514 std::vector<uint8_t> bincodeSerialize() const;
2515 static Trap bincodeDeserialize(std::vector<uint8_t>);
2516
2517 void msgpack_pack(auto& packer) const
2518 {
2519 packer.pack_map(1);
2520 packer.pack(std::make_pair("revert_data", revert_data));
2521 }
2522
2523 void msgpack_unpack(msgpack::object const& o)
2524 {
2525 std::string name = "Trap";
2526 if (o.type == msgpack::type::MAP) {
2527 auto kvmap = Helpers::make_kvmap(o, name);
2528 Helpers::conv_fld_from_kvmap(kvmap, name, "revert_data", revert_data, false);
2529 } else if (o.type == msgpack::type::ARRAY) {
2530 auto array = o.via.array;
2531 Helpers::conv_fld_from_array(array, name, "revert_data", revert_data, 0);
2532 } else {
2533 throw_or_abort("expected MAP or ARRAY for " + name);
2534 }
2535 }
2536 };
2537
2538 struct Stop {
2540
2541 friend bool operator==(const Stop&, const Stop&);
2542 std::vector<uint8_t> bincodeSerialize() const;
2543 static Stop bincodeDeserialize(std::vector<uint8_t>);
2544
2545 void msgpack_pack(auto& packer) const
2546 {
2547 packer.pack_map(1);
2548 packer.pack(std::make_pair("return_data", return_data));
2549 }
2550
2551 void msgpack_unpack(msgpack::object const& o)
2552 {
2553 std::string name = "Stop";
2554 if (o.type == msgpack::type::MAP) {
2555 auto kvmap = Helpers::make_kvmap(o, name);
2556 Helpers::conv_fld_from_kvmap(kvmap, name, "return_data", return_data, false);
2557 } else if (o.type == msgpack::type::ARRAY) {
2558 auto array = o.via.array;
2559 Helpers::conv_fld_from_array(array, name, "return_data", return_data, 0);
2560 } else {
2561 throw_or_abort("expected MAP or ARRAY for " + name);
2562 }
2563 }
2564 };
2565
2568 Not,
2569 Cast,
2570 JumpIf,
2571 Jump,
2572 CalldataCopy,
2573 Call,
2574 Const,
2575 IndirectConst,
2576 Return,
2577 ForeignCall,
2578 Mov,
2579 ConditionalMov,
2580 Load,
2581 Store,
2582 BlackBox,
2583 Trap,
2584 Stop>
2586
2587 friend bool operator==(const BrilligOpcode&, const BrilligOpcode&);
2588 std::vector<uint8_t> bincodeSerialize() const;
2589 static BrilligOpcode bincodeDeserialize(std::vector<uint8_t>);
2590
2591 void msgpack_pack(auto& packer) const
2592 {
2593 std::string tag;
2594 bool is_unit;
2595 switch (value.index()) {
2596
2597 case 0:
2598 tag = "BinaryFieldOp";
2599 is_unit = false;
2600 break;
2601 case 1:
2602 tag = "BinaryIntOp";
2603 is_unit = false;
2604 break;
2605 case 2:
2606 tag = "Not";
2607 is_unit = false;
2608 break;
2609 case 3:
2610 tag = "Cast";
2611 is_unit = false;
2612 break;
2613 case 4:
2614 tag = "JumpIf";
2615 is_unit = false;
2616 break;
2617 case 5:
2618 tag = "Jump";
2619 is_unit = false;
2620 break;
2621 case 6:
2622 tag = "CalldataCopy";
2623 is_unit = false;
2624 break;
2625 case 7:
2626 tag = "Call";
2627 is_unit = false;
2628 break;
2629 case 8:
2630 tag = "Const";
2631 is_unit = false;
2632 break;
2633 case 9:
2634 tag = "IndirectConst";
2635 is_unit = false;
2636 break;
2637 case 10:
2638 tag = "Return";
2639 is_unit = true;
2640 break;
2641 case 11:
2642 tag = "ForeignCall";
2643 is_unit = false;
2644 break;
2645 case 12:
2646 tag = "Mov";
2647 is_unit = false;
2648 break;
2649 case 13:
2650 tag = "ConditionalMov";
2651 is_unit = false;
2652 break;
2653 case 14:
2654 tag = "Load";
2655 is_unit = false;
2656 break;
2657 case 15:
2658 tag = "Store";
2659 is_unit = false;
2660 break;
2661 case 16:
2662 tag = "BlackBox";
2663 is_unit = false;
2664 break;
2665 case 17:
2666 tag = "Trap";
2667 is_unit = false;
2668 break;
2669 case 18:
2670 tag = "Stop";
2671 is_unit = false;
2672 break;
2673 default:
2674 throw_or_abort("unknown enum 'BrilligOpcode' variant index: " + std::to_string(value.index()));
2675 }
2676 if (is_unit) {
2677 packer.pack(tag);
2678 } else {
2679 std::visit(
2680 [&packer, tag](const auto& arg) {
2682 data[tag] = msgpack::object(arg);
2683 packer.pack(data);
2684 },
2685 value);
2686 }
2687 }
2688
2689 void msgpack_unpack(msgpack::object const& o)
2690 {
2691
2692 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
2693 std::cerr << o << std::endl;
2694 throw_or_abort("expected MAP or STR for enum 'BrilligOpcode'; got type " + std::to_string(o.type));
2695 }
2696 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
2697 throw_or_abort("expected 1 entry for enum 'BrilligOpcode'; got " + std::to_string(o.via.map.size));
2698 }
2699 std::string tag;
2700 try {
2701 if (o.type == msgpack::type::object_type::MAP) {
2702 o.via.map.ptr[0].key.convert(tag);
2703 } else {
2704 o.convert(tag);
2705 }
2706 } catch (const msgpack::type_error&) {
2707 std::cerr << o << std::endl;
2708 throw_or_abort("error converting tag to string for enum 'BrilligOpcode'");
2709 }
2710 if (tag == "BinaryFieldOp") {
2711 BinaryFieldOp v;
2712 try {
2713 o.via.map.ptr[0].val.convert(v);
2714 } catch (const msgpack::type_error&) {
2715 std::cerr << o << std::endl;
2716 throw_or_abort("error converting into enum variant 'BrilligOpcode::BinaryFieldOp'");
2717 }
2718
2719 value = v;
2720 } else if (tag == "BinaryIntOp") {
2721 BinaryIntOp v;
2722 try {
2723 o.via.map.ptr[0].val.convert(v);
2724 } catch (const msgpack::type_error&) {
2725 std::cerr << o << std::endl;
2726 throw_or_abort("error converting into enum variant 'BrilligOpcode::BinaryIntOp'");
2727 }
2728
2729 value = v;
2730 } else if (tag == "Not") {
2731 Not v;
2732 try {
2733 o.via.map.ptr[0].val.convert(v);
2734 } catch (const msgpack::type_error&) {
2735 std::cerr << o << std::endl;
2736 throw_or_abort("error converting into enum variant 'BrilligOpcode::Not'");
2737 }
2738
2739 value = v;
2740 } else if (tag == "Cast") {
2741 Cast v;
2742 try {
2743 o.via.map.ptr[0].val.convert(v);
2744 } catch (const msgpack::type_error&) {
2745 std::cerr << o << std::endl;
2746 throw_or_abort("error converting into enum variant 'BrilligOpcode::Cast'");
2747 }
2748
2749 value = v;
2750 } else if (tag == "JumpIf") {
2751 JumpIf v;
2752 try {
2753 o.via.map.ptr[0].val.convert(v);
2754 } catch (const msgpack::type_error&) {
2755 std::cerr << o << std::endl;
2756 throw_or_abort("error converting into enum variant 'BrilligOpcode::JumpIf'");
2757 }
2758
2759 value = v;
2760 } else if (tag == "Jump") {
2761 Jump v;
2762 try {
2763 o.via.map.ptr[0].val.convert(v);
2764 } catch (const msgpack::type_error&) {
2765 std::cerr << o << std::endl;
2766 throw_or_abort("error converting into enum variant 'BrilligOpcode::Jump'");
2767 }
2768
2769 value = v;
2770 } else if (tag == "CalldataCopy") {
2771 CalldataCopy v;
2772 try {
2773 o.via.map.ptr[0].val.convert(v);
2774 } catch (const msgpack::type_error&) {
2775 std::cerr << o << std::endl;
2776 throw_or_abort("error converting into enum variant 'BrilligOpcode::CalldataCopy'");
2777 }
2778
2779 value = v;
2780 } else if (tag == "Call") {
2781 Call v;
2782 try {
2783 o.via.map.ptr[0].val.convert(v);
2784 } catch (const msgpack::type_error&) {
2785 std::cerr << o << std::endl;
2786 throw_or_abort("error converting into enum variant 'BrilligOpcode::Call'");
2787 }
2788
2789 value = v;
2790 } else if (tag == "Const") {
2791 Const v;
2792 try {
2793 o.via.map.ptr[0].val.convert(v);
2794 } catch (const msgpack::type_error&) {
2795 std::cerr << o << std::endl;
2796 throw_or_abort("error converting into enum variant 'BrilligOpcode::Const'");
2797 }
2798
2799 value = v;
2800 } else if (tag == "IndirectConst") {
2801 IndirectConst v;
2802 try {
2803 o.via.map.ptr[0].val.convert(v);
2804 } catch (const msgpack::type_error&) {
2805 std::cerr << o << std::endl;
2806 throw_or_abort("error converting into enum variant 'BrilligOpcode::IndirectConst'");
2807 }
2808
2809 value = v;
2810 } else if (tag == "Return") {
2811 Return v;
2812 value = v;
2813 } else if (tag == "ForeignCall") {
2814 ForeignCall v;
2815 try {
2816 o.via.map.ptr[0].val.convert(v);
2817 } catch (const msgpack::type_error&) {
2818 std::cerr << o << std::endl;
2819 throw_or_abort("error converting into enum variant 'BrilligOpcode::ForeignCall'");
2820 }
2821
2822 value = v;
2823 } else if (tag == "Mov") {
2824 Mov v;
2825 try {
2826 o.via.map.ptr[0].val.convert(v);
2827 } catch (const msgpack::type_error&) {
2828 std::cerr << o << std::endl;
2829 throw_or_abort("error converting into enum variant 'BrilligOpcode::Mov'");
2830 }
2831
2832 value = v;
2833 } else if (tag == "ConditionalMov") {
2835 try {
2836 o.via.map.ptr[0].val.convert(v);
2837 } catch (const msgpack::type_error&) {
2838 std::cerr << o << std::endl;
2839 throw_or_abort("error converting into enum variant 'BrilligOpcode::ConditionalMov'");
2840 }
2841
2842 value = v;
2843 } else if (tag == "Load") {
2844 Load v;
2845 try {
2846 o.via.map.ptr[0].val.convert(v);
2847 } catch (const msgpack::type_error&) {
2848 std::cerr << o << std::endl;
2849 throw_or_abort("error converting into enum variant 'BrilligOpcode::Load'");
2850 }
2851
2852 value = v;
2853 } else if (tag == "Store") {
2854 Store v;
2855 try {
2856 o.via.map.ptr[0].val.convert(v);
2857 } catch (const msgpack::type_error&) {
2858 std::cerr << o << std::endl;
2859 throw_or_abort("error converting into enum variant 'BrilligOpcode::Store'");
2860 }
2861
2862 value = v;
2863 } else if (tag == "BlackBox") {
2864 BlackBox v;
2865 try {
2866 o.via.map.ptr[0].val.convert(v);
2867 } catch (const msgpack::type_error&) {
2868 std::cerr << o << std::endl;
2869 throw_or_abort("error converting into enum variant 'BrilligOpcode::BlackBox'");
2870 }
2871
2872 value = v;
2873 } else if (tag == "Trap") {
2874 Trap v;
2875 try {
2876 o.via.map.ptr[0].val.convert(v);
2877 } catch (const msgpack::type_error&) {
2878 std::cerr << o << std::endl;
2879 throw_or_abort("error converting into enum variant 'BrilligOpcode::Trap'");
2880 }
2881
2882 value = v;
2883 } else if (tag == "Stop") {
2884 Stop v;
2885 try {
2886 o.via.map.ptr[0].val.convert(v);
2887 } catch (const msgpack::type_error&) {
2888 std::cerr << o << std::endl;
2889 throw_or_abort("error converting into enum variant 'BrilligOpcode::Stop'");
2890 }
2891
2892 value = v;
2893 } else {
2894 std::cerr << o << std::endl;
2895 throw_or_abort("unknown 'BrilligOpcode' enum variant: " + tag);
2896 }
2897 }
2898};
2899
2900struct Witness {
2901 uint32_t value;
2902
2903 friend bool operator==(const Witness&, const Witness&);
2904 std::vector<uint8_t> bincodeSerialize() const;
2905 static Witness bincodeDeserialize(std::vector<uint8_t>);
2906
2907 void msgpack_pack(auto& packer) const { packer.pack(value); }
2908
2909 void msgpack_unpack(msgpack::object const& o)
2910 {
2911 try {
2912 o.convert(value);
2913 } catch (const msgpack::type_error&) {
2914 std::cerr << o << std::endl;
2915 throw_or_abort("error converting into newtype 'Witness'");
2916 }
2917 }
2918};
2919
2921
2922 struct Constant {
2923 std::vector<uint8_t> value;
2924
2925 friend bool operator==(const Constant&, const Constant&);
2926 std::vector<uint8_t> bincodeSerialize() const;
2927 static Constant bincodeDeserialize(std::vector<uint8_t>);
2928
2929 void msgpack_pack(auto& packer) const { packer.pack(value); }
2930
2931 void msgpack_unpack(msgpack::object const& o)
2932 {
2933 try {
2934 o.convert(value);
2935 } catch (const msgpack::type_error&) {
2936 std::cerr << o << std::endl;
2937 throw_or_abort("error converting into newtype 'Constant'");
2938 }
2939 }
2940 };
2941
2942 struct Witness {
2944
2945 friend bool operator==(const Witness&, const Witness&);
2946 std::vector<uint8_t> bincodeSerialize() const;
2947 static Witness bincodeDeserialize(std::vector<uint8_t>);
2948
2949 void msgpack_pack(auto& packer) const { packer.pack(value); }
2950
2951 void msgpack_unpack(msgpack::object const& o)
2952 {
2953 try {
2954 o.convert(value);
2955 } catch (const msgpack::type_error&) {
2956 std::cerr << o << std::endl;
2957 throw_or_abort("error converting into newtype 'Witness'");
2958 }
2959 }
2960 };
2961
2963
2964 friend bool operator==(const FunctionInput&, const FunctionInput&);
2965 std::vector<uint8_t> bincodeSerialize() const;
2966 static FunctionInput bincodeDeserialize(std::vector<uint8_t>);
2967
2968 void msgpack_pack(auto& packer) const
2969 {
2970 std::string tag;
2971 bool is_unit;
2972 switch (value.index()) {
2973
2974 case 0:
2975 tag = "Constant";
2976 is_unit = false;
2977 break;
2978 case 1:
2979 tag = "Witness";
2980 is_unit = false;
2981 break;
2982 default:
2983 throw_or_abort("unknown enum 'FunctionInput' variant index: " + std::to_string(value.index()));
2984 }
2985 if (is_unit) {
2986 packer.pack(tag);
2987 } else {
2988 std::visit(
2989 [&packer, tag](const auto& arg) {
2991 data[tag] = msgpack::object(arg);
2992 packer.pack(data);
2993 },
2994 value);
2995 }
2996 }
2997
2998 void msgpack_unpack(msgpack::object const& o)
2999 {
3000
3001 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3002 std::cerr << o << std::endl;
3003 throw_or_abort("expected MAP or STR for enum 'FunctionInput'; got type " + std::to_string(o.type));
3004 }
3005 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3006 throw_or_abort("expected 1 entry for enum 'FunctionInput'; got " + std::to_string(o.via.map.size));
3007 }
3008 std::string tag;
3009 try {
3010 if (o.type == msgpack::type::object_type::MAP) {
3011 o.via.map.ptr[0].key.convert(tag);
3012 } else {
3013 o.convert(tag);
3014 }
3015 } catch (const msgpack::type_error&) {
3016 std::cerr << o << std::endl;
3017 throw_or_abort("error converting tag to string for enum 'FunctionInput'");
3018 }
3019 if (tag == "Constant") {
3020 Constant v;
3021 try {
3022 o.via.map.ptr[0].val.convert(v);
3023 } catch (const msgpack::type_error&) {
3024 std::cerr << o << std::endl;
3025 throw_or_abort("error converting into enum variant 'FunctionInput::Constant'");
3026 }
3027
3028 value = v;
3029 } else if (tag == "Witness") {
3030 Witness v;
3031 try {
3032 o.via.map.ptr[0].val.convert(v);
3033 } catch (const msgpack::type_error&) {
3034 std::cerr << o << std::endl;
3035 throw_or_abort("error converting into enum variant 'FunctionInput::Witness'");
3036 }
3037
3038 value = v;
3039 } else {
3040 std::cerr << o << std::endl;
3041 throw_or_abort("unknown 'FunctionInput' enum variant: " + tag);
3042 }
3043 }
3044};
3045
3047
3049 std::vector<Acir::FunctionInput> inputs;
3052 std::vector<Acir::Witness> outputs;
3053
3054 friend bool operator==(const AES128Encrypt&, const AES128Encrypt&);
3055 std::vector<uint8_t> bincodeSerialize() const;
3056 static AES128Encrypt bincodeDeserialize(std::vector<uint8_t>);
3057
3058 void msgpack_pack(auto& packer) const
3059 {
3060 packer.pack_map(4);
3061 packer.pack(std::make_pair("inputs", inputs));
3062 packer.pack(std::make_pair("iv", iv));
3063 packer.pack(std::make_pair("key", key));
3064 packer.pack(std::make_pair("outputs", outputs));
3065 }
3066
3067 void msgpack_unpack(msgpack::object const& o)
3068 {
3069 std::string name = "AES128Encrypt";
3070 if (o.type == msgpack::type::MAP) {
3071 auto kvmap = Helpers::make_kvmap(o, name);
3072 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3073 Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false);
3074 Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false);
3075 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3076 } else if (o.type == msgpack::type::ARRAY) {
3077 auto array = o.via.array;
3078 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3079 Helpers::conv_fld_from_array(array, name, "iv", iv, 1);
3080 Helpers::conv_fld_from_array(array, name, "key", key, 2);
3081 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3082 } else {
3083 throw_or_abort("expected MAP or ARRAY for " + name);
3084 }
3085 }
3086 };
3087
3088 struct AND {
3091 uint32_t num_bits;
3093
3094 friend bool operator==(const AND&, const AND&);
3095 std::vector<uint8_t> bincodeSerialize() const;
3096 static AND bincodeDeserialize(std::vector<uint8_t>);
3097
3098 void msgpack_pack(auto& packer) const
3099 {
3100 packer.pack_map(4);
3101 packer.pack(std::make_pair("lhs", lhs));
3102 packer.pack(std::make_pair("rhs", rhs));
3103 packer.pack(std::make_pair("num_bits", num_bits));
3104 packer.pack(std::make_pair("output", output));
3105 }
3106
3107 void msgpack_unpack(msgpack::object const& o)
3108 {
3109 std::string name = "AND";
3110 if (o.type == msgpack::type::MAP) {
3111 auto kvmap = Helpers::make_kvmap(o, name);
3112 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
3113 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
3114 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3115 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3116 } else if (o.type == msgpack::type::ARRAY) {
3117 auto array = o.via.array;
3118 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0);
3119 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1);
3120 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2);
3121 Helpers::conv_fld_from_array(array, name, "output", output, 3);
3122 } else {
3123 throw_or_abort("expected MAP or ARRAY for " + name);
3124 }
3125 }
3126 };
3127
3128 struct XOR {
3131 uint32_t num_bits;
3133
3134 friend bool operator==(const XOR&, const XOR&);
3135 std::vector<uint8_t> bincodeSerialize() const;
3136 static XOR bincodeDeserialize(std::vector<uint8_t>);
3137
3138 void msgpack_pack(auto& packer) const
3139 {
3140 packer.pack_map(4);
3141 packer.pack(std::make_pair("lhs", lhs));
3142 packer.pack(std::make_pair("rhs", rhs));
3143 packer.pack(std::make_pair("num_bits", num_bits));
3144 packer.pack(std::make_pair("output", output));
3145 }
3146
3147 void msgpack_unpack(msgpack::object const& o)
3148 {
3149 std::string name = "XOR";
3150 if (o.type == msgpack::type::MAP) {
3151 auto kvmap = Helpers::make_kvmap(o, name);
3152 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
3153 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
3154 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3155 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3156 } else if (o.type == msgpack::type::ARRAY) {
3157 auto array = o.via.array;
3158 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0);
3159 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1);
3160 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2);
3161 Helpers::conv_fld_from_array(array, name, "output", output, 3);
3162 } else {
3163 throw_or_abort("expected MAP or ARRAY for " + name);
3164 }
3165 }
3166 };
3167
3168 struct RANGE {
3170 uint32_t num_bits;
3171
3172 friend bool operator==(const RANGE&, const RANGE&);
3173 std::vector<uint8_t> bincodeSerialize() const;
3174 static RANGE bincodeDeserialize(std::vector<uint8_t>);
3175
3176 void msgpack_pack(auto& packer) const
3177 {
3178 packer.pack_map(2);
3179 packer.pack(std::make_pair("input", input));
3180 packer.pack(std::make_pair("num_bits", num_bits));
3181 }
3182
3183 void msgpack_unpack(msgpack::object const& o)
3184 {
3185 std::string name = "RANGE";
3186 if (o.type == msgpack::type::MAP) {
3187 auto kvmap = Helpers::make_kvmap(o, name);
3188 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
3189 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3190 } else if (o.type == msgpack::type::ARRAY) {
3191 auto array = o.via.array;
3192 Helpers::conv_fld_from_array(array, name, "input", input, 0);
3193 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 1);
3194 } else {
3195 throw_or_abort("expected MAP or ARRAY for " + name);
3196 }
3197 }
3198 };
3199
3200 struct Blake2s {
3201 std::vector<Acir::FunctionInput> inputs;
3203
3204 friend bool operator==(const Blake2s&, const Blake2s&);
3205 std::vector<uint8_t> bincodeSerialize() const;
3206 static Blake2s bincodeDeserialize(std::vector<uint8_t>);
3207
3208 void msgpack_pack(auto& packer) const
3209 {
3210 packer.pack_map(2);
3211 packer.pack(std::make_pair("inputs", inputs));
3212 packer.pack(std::make_pair("outputs", outputs));
3213 }
3214
3215 void msgpack_unpack(msgpack::object const& o)
3216 {
3217 std::string name = "Blake2s";
3218 if (o.type == msgpack::type::MAP) {
3219 auto kvmap = Helpers::make_kvmap(o, name);
3220 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3221 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3222 } else if (o.type == msgpack::type::ARRAY) {
3223 auto array = o.via.array;
3224 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3225 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3226 } else {
3227 throw_or_abort("expected MAP or ARRAY for " + name);
3228 }
3229 }
3230 };
3231
3232 struct Blake3 {
3233 std::vector<Acir::FunctionInput> inputs;
3235
3236 friend bool operator==(const Blake3&, const Blake3&);
3237 std::vector<uint8_t> bincodeSerialize() const;
3238 static Blake3 bincodeDeserialize(std::vector<uint8_t>);
3239
3240 void msgpack_pack(auto& packer) const
3241 {
3242 packer.pack_map(2);
3243 packer.pack(std::make_pair("inputs", inputs));
3244 packer.pack(std::make_pair("outputs", outputs));
3245 }
3246
3247 void msgpack_unpack(msgpack::object const& o)
3248 {
3249 std::string name = "Blake3";
3250 if (o.type == msgpack::type::MAP) {
3251 auto kvmap = Helpers::make_kvmap(o, name);
3252 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3253 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3254 } else if (o.type == msgpack::type::ARRAY) {
3255 auto array = o.via.array;
3256 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3257 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3258 } else {
3259 throw_or_abort("expected MAP or ARRAY for " + name);
3260 }
3261 }
3262 };
3263
3271
3272 friend bool operator==(const EcdsaSecp256k1&, const EcdsaSecp256k1&);
3273 std::vector<uint8_t> bincodeSerialize() const;
3274 static EcdsaSecp256k1 bincodeDeserialize(std::vector<uint8_t>);
3275
3276 void msgpack_pack(auto& packer) const
3277 {
3278 packer.pack_map(6);
3279 packer.pack(std::make_pair("public_key_x", public_key_x));
3280 packer.pack(std::make_pair("public_key_y", public_key_y));
3281 packer.pack(std::make_pair("signature", signature));
3282 packer.pack(std::make_pair("hashed_message", hashed_message));
3283 packer.pack(std::make_pair("predicate", predicate));
3284 packer.pack(std::make_pair("output", output));
3285 }
3286
3287 void msgpack_unpack(msgpack::object const& o)
3288 {
3289 std::string name = "EcdsaSecp256k1";
3290 if (o.type == msgpack::type::MAP) {
3291 auto kvmap = Helpers::make_kvmap(o, name);
3292 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
3293 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
3294 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
3295 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false);
3296 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3297 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3298 } else if (o.type == msgpack::type::ARRAY) {
3299 auto array = o.via.array;
3300 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0);
3301 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1);
3302 Helpers::conv_fld_from_array(array, name, "signature", signature, 2);
3303 Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3);
3304 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4);
3305 Helpers::conv_fld_from_array(array, name, "output", output, 5);
3306 } else {
3307 throw_or_abort("expected MAP or ARRAY for " + name);
3308 }
3309 }
3310 };
3311
3319
3320 friend bool operator==(const EcdsaSecp256r1&, const EcdsaSecp256r1&);
3321 std::vector<uint8_t> bincodeSerialize() const;
3322 static EcdsaSecp256r1 bincodeDeserialize(std::vector<uint8_t>);
3323
3324 void msgpack_pack(auto& packer) const
3325 {
3326 packer.pack_map(6);
3327 packer.pack(std::make_pair("public_key_x", public_key_x));
3328 packer.pack(std::make_pair("public_key_y", public_key_y));
3329 packer.pack(std::make_pair("signature", signature));
3330 packer.pack(std::make_pair("hashed_message", hashed_message));
3331 packer.pack(std::make_pair("predicate", predicate));
3332 packer.pack(std::make_pair("output", output));
3333 }
3334
3335 void msgpack_unpack(msgpack::object const& o)
3336 {
3337 std::string name = "EcdsaSecp256r1";
3338 if (o.type == msgpack::type::MAP) {
3339 auto kvmap = Helpers::make_kvmap(o, name);
3340 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
3341 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
3342 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
3343 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false);
3344 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3345 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3346 } else if (o.type == msgpack::type::ARRAY) {
3347 auto array = o.via.array;
3348 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0);
3349 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1);
3350 Helpers::conv_fld_from_array(array, name, "signature", signature, 2);
3351 Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3);
3352 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4);
3353 Helpers::conv_fld_from_array(array, name, "output", output, 5);
3354 } else {
3355 throw_or_abort("expected MAP or ARRAY for " + name);
3356 }
3357 }
3358 };
3359
3361 std::vector<Acir::FunctionInput> points;
3362 std::vector<Acir::FunctionInput> scalars;
3365
3366 friend bool operator==(const MultiScalarMul&, const MultiScalarMul&);
3367 std::vector<uint8_t> bincodeSerialize() const;
3368 static MultiScalarMul bincodeDeserialize(std::vector<uint8_t>);
3369
3370 void msgpack_pack(auto& packer) const
3371 {
3372 packer.pack_map(4);
3373 packer.pack(std::make_pair("points", points));
3374 packer.pack(std::make_pair("scalars", scalars));
3375 packer.pack(std::make_pair("predicate", predicate));
3376 packer.pack(std::make_pair("outputs", outputs));
3377 }
3378
3379 void msgpack_unpack(msgpack::object const& o)
3380 {
3381 std::string name = "MultiScalarMul";
3382 if (o.type == msgpack::type::MAP) {
3383 auto kvmap = Helpers::make_kvmap(o, name);
3384 Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false);
3385 Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false);
3386 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3387 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3388 } else if (o.type == msgpack::type::ARRAY) {
3389 auto array = o.via.array;
3390 Helpers::conv_fld_from_array(array, name, "points", points, 0);
3391 Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1);
3392 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2);
3393 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3394 } else {
3395 throw_or_abort("expected MAP or ARRAY for " + name);
3396 }
3397 }
3398 };
3399
3405
3406 friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&);
3407 std::vector<uint8_t> bincodeSerialize() const;
3408 static EmbeddedCurveAdd bincodeDeserialize(std::vector<uint8_t>);
3409
3410 void msgpack_pack(auto& packer) const
3411 {
3412 packer.pack_map(4);
3413 packer.pack(std::make_pair("input1", input1));
3414 packer.pack(std::make_pair("input2", input2));
3415 packer.pack(std::make_pair("predicate", predicate));
3416 packer.pack(std::make_pair("outputs", outputs));
3417 }
3418
3419 void msgpack_unpack(msgpack::object const& o)
3420 {
3421 std::string name = "EmbeddedCurveAdd";
3422 if (o.type == msgpack::type::MAP) {
3423 auto kvmap = Helpers::make_kvmap(o, name);
3424 Helpers::conv_fld_from_kvmap(kvmap, name, "input1", input1, false);
3425 Helpers::conv_fld_from_kvmap(kvmap, name, "input2", input2, false);
3426 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3427 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3428 } else if (o.type == msgpack::type::ARRAY) {
3429 auto array = o.via.array;
3430 Helpers::conv_fld_from_array(array, name, "input1", input1, 0);
3431 Helpers::conv_fld_from_array(array, name, "input2", input2, 1);
3432 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2);
3433 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3434 } else {
3435 throw_or_abort("expected MAP or ARRAY for " + name);
3436 }
3437 }
3438 };
3439
3443
3444 friend bool operator==(const Keccakf1600&, const Keccakf1600&);
3445 std::vector<uint8_t> bincodeSerialize() const;
3446 static Keccakf1600 bincodeDeserialize(std::vector<uint8_t>);
3447
3448 void msgpack_pack(auto& packer) const
3449 {
3450 packer.pack_map(2);
3451 packer.pack(std::make_pair("inputs", inputs));
3452 packer.pack(std::make_pair("outputs", outputs));
3453 }
3454
3455 void msgpack_unpack(msgpack::object const& o)
3456 {
3457 std::string name = "Keccakf1600";
3458 if (o.type == msgpack::type::MAP) {
3459 auto kvmap = Helpers::make_kvmap(o, name);
3460 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3461 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3462 } else if (o.type == msgpack::type::ARRAY) {
3463 auto array = o.via.array;
3464 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3465 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3466 } else {
3467 throw_or_abort("expected MAP or ARRAY for " + name);
3468 }
3469 }
3470 };
3471
3473 std::vector<Acir::FunctionInput> verification_key;
3474 std::vector<Acir::FunctionInput> proof;
3475 std::vector<Acir::FunctionInput> public_inputs;
3477 uint32_t proof_type;
3479
3480 friend bool operator==(const RecursiveAggregation&, const RecursiveAggregation&);
3481 std::vector<uint8_t> bincodeSerialize() const;
3482 static RecursiveAggregation bincodeDeserialize(std::vector<uint8_t>);
3483
3484 void msgpack_pack(auto& packer) const
3485 {
3486 packer.pack_map(6);
3487 packer.pack(std::make_pair("verification_key", verification_key));
3488 packer.pack(std::make_pair("proof", proof));
3489 packer.pack(std::make_pair("public_inputs", public_inputs));
3490 packer.pack(std::make_pair("key_hash", key_hash));
3491 packer.pack(std::make_pair("proof_type", proof_type));
3492 packer.pack(std::make_pair("predicate", predicate));
3493 }
3494
3495 void msgpack_unpack(msgpack::object const& o)
3496 {
3497 std::string name = "RecursiveAggregation";
3498 if (o.type == msgpack::type::MAP) {
3499 auto kvmap = Helpers::make_kvmap(o, name);
3500 Helpers::conv_fld_from_kvmap(kvmap, name, "verification_key", verification_key, false);
3501 Helpers::conv_fld_from_kvmap(kvmap, name, "proof", proof, false);
3502 Helpers::conv_fld_from_kvmap(kvmap, name, "public_inputs", public_inputs, false);
3503 Helpers::conv_fld_from_kvmap(kvmap, name, "key_hash", key_hash, false);
3504 Helpers::conv_fld_from_kvmap(kvmap, name, "proof_type", proof_type, false);
3505 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3506 } else if (o.type == msgpack::type::ARRAY) {
3507 auto array = o.via.array;
3508 Helpers::conv_fld_from_array(array, name, "verification_key", verification_key, 0);
3509 Helpers::conv_fld_from_array(array, name, "proof", proof, 1);
3510 Helpers::conv_fld_from_array(array, name, "public_inputs", public_inputs, 2);
3511 Helpers::conv_fld_from_array(array, name, "key_hash", key_hash, 3);
3512 Helpers::conv_fld_from_array(array, name, "proof_type", proof_type, 4);
3513 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 5);
3514 } else {
3515 throw_or_abort("expected MAP or ARRAY for " + name);
3516 }
3517 }
3518 };
3519
3521 std::vector<Acir::FunctionInput> inputs;
3522 std::vector<Acir::Witness> outputs;
3523
3524 friend bool operator==(const Poseidon2Permutation&, const Poseidon2Permutation&);
3525 std::vector<uint8_t> bincodeSerialize() const;
3526 static Poseidon2Permutation bincodeDeserialize(std::vector<uint8_t>);
3527
3528 void msgpack_pack(auto& packer) const
3529 {
3530 packer.pack_map(2);
3531 packer.pack(std::make_pair("inputs", inputs));
3532 packer.pack(std::make_pair("outputs", outputs));
3533 }
3534
3535 void msgpack_unpack(msgpack::object const& o)
3536 {
3537 std::string name = "Poseidon2Permutation";
3538 if (o.type == msgpack::type::MAP) {
3539 auto kvmap = Helpers::make_kvmap(o, name);
3540 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3541 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3542 } else if (o.type == msgpack::type::ARRAY) {
3543 auto array = o.via.array;
3544 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3545 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3546 } else {
3547 throw_or_abort("expected MAP or ARRAY for " + name);
3548 }
3549 }
3550 };
3551
3556
3557 friend bool operator==(const Sha256Compression&, const Sha256Compression&);
3558 std::vector<uint8_t> bincodeSerialize() const;
3559 static Sha256Compression bincodeDeserialize(std::vector<uint8_t>);
3560
3561 void msgpack_pack(auto& packer) const
3562 {
3563 packer.pack_map(3);
3564 packer.pack(std::make_pair("inputs", inputs));
3565 packer.pack(std::make_pair("hash_values", hash_values));
3566 packer.pack(std::make_pair("outputs", outputs));
3567 }
3568
3569 void msgpack_unpack(msgpack::object const& o)
3570 {
3571 std::string name = "Sha256Compression";
3572 if (o.type == msgpack::type::MAP) {
3573 auto kvmap = Helpers::make_kvmap(o, name);
3574 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3575 Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false);
3576 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3577 } else if (o.type == msgpack::type::ARRAY) {
3578 auto array = o.via.array;
3579 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3580 Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1);
3581 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
3582 } else {
3583 throw_or_abort("expected MAP or ARRAY for " + name);
3584 }
3585 }
3586 };
3587
3588 std::variant<AES128Encrypt,
3589 AND,
3590 XOR,
3591 RANGE,
3592 Blake2s,
3593 Blake3,
3594 EcdsaSecp256k1,
3595 EcdsaSecp256r1,
3596 MultiScalarMul,
3597 EmbeddedCurveAdd,
3598 Keccakf1600,
3599 RecursiveAggregation,
3600 Poseidon2Permutation,
3601 Sha256Compression>
3603
3604 friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&);
3605 std::vector<uint8_t> bincodeSerialize() const;
3606 static BlackBoxFuncCall bincodeDeserialize(std::vector<uint8_t>);
3607
3608 void msgpack_pack(auto& packer) const
3609 {
3610 std::string tag;
3611 bool is_unit;
3612 switch (value.index()) {
3613
3614 case 0:
3615 tag = "AES128Encrypt";
3616 is_unit = false;
3617 break;
3618 case 1:
3619 tag = "AND";
3620 is_unit = false;
3621 break;
3622 case 2:
3623 tag = "XOR";
3624 is_unit = false;
3625 break;
3626 case 3:
3627 tag = "RANGE";
3628 is_unit = false;
3629 break;
3630 case 4:
3631 tag = "Blake2s";
3632 is_unit = false;
3633 break;
3634 case 5:
3635 tag = "Blake3";
3636 is_unit = false;
3637 break;
3638 case 6:
3639 tag = "EcdsaSecp256k1";
3640 is_unit = false;
3641 break;
3642 case 7:
3643 tag = "EcdsaSecp256r1";
3644 is_unit = false;
3645 break;
3646 case 8:
3647 tag = "MultiScalarMul";
3648 is_unit = false;
3649 break;
3650 case 9:
3651 tag = "EmbeddedCurveAdd";
3652 is_unit = false;
3653 break;
3654 case 10:
3655 tag = "Keccakf1600";
3656 is_unit = false;
3657 break;
3658 case 11:
3659 tag = "RecursiveAggregation";
3660 is_unit = false;
3661 break;
3662 case 12:
3663 tag = "Poseidon2Permutation";
3664 is_unit = false;
3665 break;
3666 case 13:
3667 tag = "Sha256Compression";
3668 is_unit = false;
3669 break;
3670 default:
3671 throw_or_abort("unknown enum 'BlackBoxFuncCall' variant index: " + std::to_string(value.index()));
3672 }
3673 if (is_unit) {
3674 packer.pack(tag);
3675 } else {
3676 std::visit(
3677 [&packer, tag](const auto& arg) {
3679 data[tag] = msgpack::object(arg);
3680 packer.pack(data);
3681 },
3682 value);
3683 }
3684 }
3685
3686 void msgpack_unpack(msgpack::object const& o)
3687 {
3688
3689 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3690 std::cerr << o << std::endl;
3691 throw_or_abort("expected MAP or STR for enum 'BlackBoxFuncCall'; got type " + std::to_string(o.type));
3692 }
3693 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3694 throw_or_abort("expected 1 entry for enum 'BlackBoxFuncCall'; got " + std::to_string(o.via.map.size));
3695 }
3696 std::string tag;
3697 try {
3698 if (o.type == msgpack::type::object_type::MAP) {
3699 o.via.map.ptr[0].key.convert(tag);
3700 } else {
3701 o.convert(tag);
3702 }
3703 } catch (const msgpack::type_error&) {
3704 std::cerr << o << std::endl;
3705 throw_or_abort("error converting tag to string for enum 'BlackBoxFuncCall'");
3706 }
3707 if (tag == "AES128Encrypt") {
3708 AES128Encrypt v;
3709 try {
3710 o.via.map.ptr[0].val.convert(v);
3711 } catch (const msgpack::type_error&) {
3712 std::cerr << o << std::endl;
3713 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::AES128Encrypt'");
3714 }
3715
3716 value = v;
3717 } else if (tag == "AND") {
3718 AND v;
3719 try {
3720 o.via.map.ptr[0].val.convert(v);
3721 } catch (const msgpack::type_error&) {
3722 std::cerr << o << std::endl;
3723 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::AND'");
3724 }
3725
3726 value = v;
3727 } else if (tag == "XOR") {
3728 XOR v;
3729 try {
3730 o.via.map.ptr[0].val.convert(v);
3731 } catch (const msgpack::type_error&) {
3732 std::cerr << o << std::endl;
3733 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::XOR'");
3734 }
3735
3736 value = v;
3737 } else if (tag == "RANGE") {
3738 RANGE v;
3739 try {
3740 o.via.map.ptr[0].val.convert(v);
3741 } catch (const msgpack::type_error&) {
3742 std::cerr << o << std::endl;
3743 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::RANGE'");
3744 }
3745
3746 value = v;
3747 } else if (tag == "Blake2s") {
3748 Blake2s v;
3749 try {
3750 o.via.map.ptr[0].val.convert(v);
3751 } catch (const msgpack::type_error&) {
3752 std::cerr << o << std::endl;
3753 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Blake2s'");
3754 }
3755
3756 value = v;
3757 } else if (tag == "Blake3") {
3758 Blake3 v;
3759 try {
3760 o.via.map.ptr[0].val.convert(v);
3761 } catch (const msgpack::type_error&) {
3762 std::cerr << o << std::endl;
3763 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Blake3'");
3764 }
3765
3766 value = v;
3767 } else if (tag == "EcdsaSecp256k1") {
3769 try {
3770 o.via.map.ptr[0].val.convert(v);
3771 } catch (const msgpack::type_error&) {
3772 std::cerr << o << std::endl;
3773 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EcdsaSecp256k1'");
3774 }
3775
3776 value = v;
3777 } else if (tag == "EcdsaSecp256r1") {
3779 try {
3780 o.via.map.ptr[0].val.convert(v);
3781 } catch (const msgpack::type_error&) {
3782 std::cerr << o << std::endl;
3783 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EcdsaSecp256r1'");
3784 }
3785
3786 value = v;
3787 } else if (tag == "MultiScalarMul") {
3789 try {
3790 o.via.map.ptr[0].val.convert(v);
3791 } catch (const msgpack::type_error&) {
3792 std::cerr << o << std::endl;
3793 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::MultiScalarMul'");
3794 }
3795
3796 value = v;
3797 } else if (tag == "EmbeddedCurveAdd") {
3799 try {
3800 o.via.map.ptr[0].val.convert(v);
3801 } catch (const msgpack::type_error&) {
3802 std::cerr << o << std::endl;
3803 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EmbeddedCurveAdd'");
3804 }
3805
3806 value = v;
3807 } else if (tag == "Keccakf1600") {
3808 Keccakf1600 v;
3809 try {
3810 o.via.map.ptr[0].val.convert(v);
3811 } catch (const msgpack::type_error&) {
3812 std::cerr << o << std::endl;
3813 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Keccakf1600'");
3814 }
3815
3816 value = v;
3817 } else if (tag == "RecursiveAggregation") {
3819 try {
3820 o.via.map.ptr[0].val.convert(v);
3821 } catch (const msgpack::type_error&) {
3822 std::cerr << o << std::endl;
3823 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::RecursiveAggregation'");
3824 }
3825
3826 value = v;
3827 } else if (tag == "Poseidon2Permutation") {
3829 try {
3830 o.via.map.ptr[0].val.convert(v);
3831 } catch (const msgpack::type_error&) {
3832 std::cerr << o << std::endl;
3833 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Poseidon2Permutation'");
3834 }
3835
3836 value = v;
3837 } else if (tag == "Sha256Compression") {
3839 try {
3840 o.via.map.ptr[0].val.convert(v);
3841 } catch (const msgpack::type_error&) {
3842 std::cerr << o << std::endl;
3843 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Sha256Compression'");
3844 }
3845
3846 value = v;
3847 } else {
3848 std::cerr << o << std::endl;
3849 throw_or_abort("unknown 'BlackBoxFuncCall' enum variant: " + tag);
3850 }
3851 }
3852};
3853
3854struct BlockId {
3855 uint32_t value;
3856
3857 friend bool operator==(const BlockId&, const BlockId&);
3858 std::vector<uint8_t> bincodeSerialize() const;
3859 static BlockId bincodeDeserialize(std::vector<uint8_t>);
3860
3861 void msgpack_pack(auto& packer) const { packer.pack(value); }
3862
3863 void msgpack_unpack(msgpack::object const& o)
3864 {
3865 try {
3866 o.convert(value);
3867 } catch (const msgpack::type_error&) {
3868 std::cerr << o << std::endl;
3869 throw_or_abort("error converting into newtype 'BlockId'");
3870 }
3871 }
3872};
3873
3875
3876 struct Memory {
3877 friend bool operator==(const Memory&, const Memory&);
3878 std::vector<uint8_t> bincodeSerialize() const;
3879 static Memory bincodeDeserialize(std::vector<uint8_t>);
3880
3881 void msgpack_pack(auto& packer) const {}
3882 void msgpack_unpack(msgpack::object const& o) {}
3883 };
3884
3885 struct CallData {
3886 uint32_t value;
3887
3888 friend bool operator==(const CallData&, const CallData&);
3889 std::vector<uint8_t> bincodeSerialize() const;
3890 static CallData bincodeDeserialize(std::vector<uint8_t>);
3891
3892 void msgpack_pack(auto& packer) const { packer.pack(value); }
3893
3894 void msgpack_unpack(msgpack::object const& o)
3895 {
3896 try {
3897 o.convert(value);
3898 } catch (const msgpack::type_error&) {
3899 std::cerr << o << std::endl;
3900 throw_or_abort("error converting into newtype 'CallData'");
3901 }
3902 }
3903 };
3904
3905 struct ReturnData {
3906 friend bool operator==(const ReturnData&, const ReturnData&);
3907 std::vector<uint8_t> bincodeSerialize() const;
3908 static ReturnData bincodeDeserialize(std::vector<uint8_t>);
3909
3910 void msgpack_pack(auto& packer) const {}
3911 void msgpack_unpack(msgpack::object const& o) {}
3912 };
3913
3915
3916 friend bool operator==(const BlockType&, const BlockType&);
3917 std::vector<uint8_t> bincodeSerialize() const;
3918 static BlockType bincodeDeserialize(std::vector<uint8_t>);
3919
3920 void msgpack_pack(auto& packer) const
3921 {
3922 std::string tag;
3923 bool is_unit;
3924 switch (value.index()) {
3925
3926 case 0:
3927 tag = "Memory";
3928 is_unit = true;
3929 break;
3930 case 1:
3931 tag = "CallData";
3932 is_unit = false;
3933 break;
3934 case 2:
3935 tag = "ReturnData";
3936 is_unit = true;
3937 break;
3938 default:
3939 throw_or_abort("unknown enum 'BlockType' variant index: " + std::to_string(value.index()));
3940 }
3941 if (is_unit) {
3942 packer.pack(tag);
3943 } else {
3944 std::visit(
3945 [&packer, tag](const auto& arg) {
3947 data[tag] = msgpack::object(arg);
3948 packer.pack(data);
3949 },
3950 value);
3951 }
3952 }
3953
3954 void msgpack_unpack(msgpack::object const& o)
3955 {
3956
3957 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3958 std::cerr << o << std::endl;
3959 throw_or_abort("expected MAP or STR for enum 'BlockType'; got type " + std::to_string(o.type));
3960 }
3961 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3962 throw_or_abort("expected 1 entry for enum 'BlockType'; got " + std::to_string(o.via.map.size));
3963 }
3964 std::string tag;
3965 try {
3966 if (o.type == msgpack::type::object_type::MAP) {
3967 o.via.map.ptr[0].key.convert(tag);
3968 } else {
3969 o.convert(tag);
3970 }
3971 } catch (const msgpack::type_error&) {
3972 std::cerr << o << std::endl;
3973 throw_or_abort("error converting tag to string for enum 'BlockType'");
3974 }
3975 if (tag == "Memory") {
3976 Memory v;
3977 value = v;
3978 } else if (tag == "CallData") {
3979 CallData v;
3980 try {
3981 o.via.map.ptr[0].val.convert(v);
3982 } catch (const msgpack::type_error&) {
3983 std::cerr << o << std::endl;
3984 throw_or_abort("error converting into enum variant 'BlockType::CallData'");
3985 }
3986
3987 value = v;
3988 } else if (tag == "ReturnData") {
3989 ReturnData v;
3990 value = v;
3991 } else {
3992 std::cerr << o << std::endl;
3993 throw_or_abort("unknown 'BlockType' enum variant: " + tag);
3994 }
3995 }
3996};
3997
4001 std::vector<uint8_t> q_c;
4002
4003 friend bool operator==(const Expression&, const Expression&);
4004 std::vector<uint8_t> bincodeSerialize() const;
4005 static Expression bincodeDeserialize(std::vector<uint8_t>);
4006
4007 void msgpack_pack(auto& packer) const
4008 {
4009 packer.pack_map(3);
4010 packer.pack(std::make_pair("mul_terms", mul_terms));
4011 packer.pack(std::make_pair("linear_combinations", linear_combinations));
4012 packer.pack(std::make_pair("q_c", q_c));
4013 }
4014
4015 void msgpack_unpack(msgpack::object const& o)
4016 {
4017 std::string name = "Expression";
4018 if (o.type == msgpack::type::MAP) {
4019 auto kvmap = Helpers::make_kvmap(o, name);
4020 Helpers::conv_fld_from_kvmap(kvmap, name, "mul_terms", mul_terms, false);
4021 Helpers::conv_fld_from_kvmap(kvmap, name, "linear_combinations", linear_combinations, false);
4022 Helpers::conv_fld_from_kvmap(kvmap, name, "q_c", q_c, false);
4023 } else if (o.type == msgpack::type::ARRAY) {
4024 auto array = o.via.array;
4025 Helpers::conv_fld_from_array(array, name, "mul_terms", mul_terms, 0);
4026 Helpers::conv_fld_from_array(array, name, "linear_combinations", linear_combinations, 1);
4027 Helpers::conv_fld_from_array(array, name, "q_c", q_c, 2);
4028 } else {
4029 throw_or_abort("expected MAP or ARRAY for " + name);
4030 }
4031 }
4032};
4033
4035
4036 struct Single {
4038
4039 friend bool operator==(const Single&, const Single&);
4040 std::vector<uint8_t> bincodeSerialize() const;
4041 static Single bincodeDeserialize(std::vector<uint8_t>);
4042
4043 void msgpack_pack(auto& packer) const { packer.pack(value); }
4044
4045 void msgpack_unpack(msgpack::object const& o)
4046 {
4047 try {
4048 o.convert(value);
4049 } catch (const msgpack::type_error&) {
4050 std::cerr << o << std::endl;
4051 throw_or_abort("error converting into newtype 'Single'");
4052 }
4053 }
4054 };
4055
4056 struct Array {
4057 std::vector<Acir::Expression> value;
4058
4059 friend bool operator==(const Array&, const Array&);
4060 std::vector<uint8_t> bincodeSerialize() const;
4061 static Array bincodeDeserialize(std::vector<uint8_t>);
4062
4063 void msgpack_pack(auto& packer) const { packer.pack(value); }
4064
4065 void msgpack_unpack(msgpack::object const& o)
4066 {
4067 try {
4068 o.convert(value);
4069 } catch (const msgpack::type_error&) {
4070 std::cerr << o << std::endl;
4071 throw_or_abort("error converting into newtype 'Array'");
4072 }
4073 }
4074 };
4075
4078
4079 friend bool operator==(const MemoryArray&, const MemoryArray&);
4080 std::vector<uint8_t> bincodeSerialize() const;
4081 static MemoryArray bincodeDeserialize(std::vector<uint8_t>);
4082
4083 void msgpack_pack(auto& packer) const { packer.pack(value); }
4084
4085 void msgpack_unpack(msgpack::object const& o)
4086 {
4087 try {
4088 o.convert(value);
4089 } catch (const msgpack::type_error&) {
4090 std::cerr << o << std::endl;
4091 throw_or_abort("error converting into newtype 'MemoryArray'");
4092 }
4093 }
4094 };
4095
4097
4098 friend bool operator==(const BrilligInputs&, const BrilligInputs&);
4099 std::vector<uint8_t> bincodeSerialize() const;
4100 static BrilligInputs bincodeDeserialize(std::vector<uint8_t>);
4101
4102 void msgpack_pack(auto& packer) const
4103 {
4104 std::string tag;
4105 bool is_unit;
4106 switch (value.index()) {
4107
4108 case 0:
4109 tag = "Single";
4110 is_unit = false;
4111 break;
4112 case 1:
4113 tag = "Array";
4114 is_unit = false;
4115 break;
4116 case 2:
4117 tag = "MemoryArray";
4118 is_unit = false;
4119 break;
4120 default:
4121 throw_or_abort("unknown enum 'BrilligInputs' variant index: " + std::to_string(value.index()));
4122 }
4123 if (is_unit) {
4124 packer.pack(tag);
4125 } else {
4126 std::visit(
4127 [&packer, tag](const auto& arg) {
4129 data[tag] = msgpack::object(arg);
4130 packer.pack(data);
4131 },
4132 value);
4133 }
4134 }
4135
4136 void msgpack_unpack(msgpack::object const& o)
4137 {
4138
4139 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4140 std::cerr << o << std::endl;
4141 throw_or_abort("expected MAP or STR for enum 'BrilligInputs'; got type " + std::to_string(o.type));
4142 }
4143 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4144 throw_or_abort("expected 1 entry for enum 'BrilligInputs'; got " + std::to_string(o.via.map.size));
4145 }
4146 std::string tag;
4147 try {
4148 if (o.type == msgpack::type::object_type::MAP) {
4149 o.via.map.ptr[0].key.convert(tag);
4150 } else {
4151 o.convert(tag);
4152 }
4153 } catch (const msgpack::type_error&) {
4154 std::cerr << o << std::endl;
4155 throw_or_abort("error converting tag to string for enum 'BrilligInputs'");
4156 }
4157 if (tag == "Single") {
4158 Single v;
4159 try {
4160 o.via.map.ptr[0].val.convert(v);
4161 } catch (const msgpack::type_error&) {
4162 std::cerr << o << std::endl;
4163 throw_or_abort("error converting into enum variant 'BrilligInputs::Single'");
4164 }
4165
4166 value = v;
4167 } else if (tag == "Array") {
4168 Array v;
4169 try {
4170 o.via.map.ptr[0].val.convert(v);
4171 } catch (const msgpack::type_error&) {
4172 std::cerr << o << std::endl;
4173 throw_or_abort("error converting into enum variant 'BrilligInputs::Array'");
4174 }
4175
4176 value = v;
4177 } else if (tag == "MemoryArray") {
4178 MemoryArray v;
4179 try {
4180 o.via.map.ptr[0].val.convert(v);
4181 } catch (const msgpack::type_error&) {
4182 std::cerr << o << std::endl;
4183 throw_or_abort("error converting into enum variant 'BrilligInputs::MemoryArray'");
4184 }
4185
4186 value = v;
4187 } else {
4188 std::cerr << o << std::endl;
4189 throw_or_abort("unknown 'BrilligInputs' enum variant: " + tag);
4190 }
4191 }
4192};
4193
4195
4196 struct Simple {
4198
4199 friend bool operator==(const Simple&, const Simple&);
4200 std::vector<uint8_t> bincodeSerialize() const;
4201 static Simple bincodeDeserialize(std::vector<uint8_t>);
4202
4203 void msgpack_pack(auto& packer) const { packer.pack(value); }
4204
4205 void msgpack_unpack(msgpack::object const& o)
4206 {
4207 try {
4208 o.convert(value);
4209 } catch (const msgpack::type_error&) {
4210 std::cerr << o << std::endl;
4211 throw_or_abort("error converting into newtype 'Simple'");
4212 }
4213 }
4214 };
4215
4216 struct Array {
4217 std::vector<Acir::Witness> value;
4218
4219 friend bool operator==(const Array&, const Array&);
4220 std::vector<uint8_t> bincodeSerialize() const;
4221 static Array bincodeDeserialize(std::vector<uint8_t>);
4222
4223 void msgpack_pack(auto& packer) const { packer.pack(value); }
4224
4225 void msgpack_unpack(msgpack::object const& o)
4226 {
4227 try {
4228 o.convert(value);
4229 } catch (const msgpack::type_error&) {
4230 std::cerr << o << std::endl;
4231 throw_or_abort("error converting into newtype 'Array'");
4232 }
4233 }
4234 };
4235
4237
4238 friend bool operator==(const BrilligOutputs&, const BrilligOutputs&);
4239 std::vector<uint8_t> bincodeSerialize() const;
4240 static BrilligOutputs bincodeDeserialize(std::vector<uint8_t>);
4241
4242 void msgpack_pack(auto& packer) const
4243 {
4244 std::string tag;
4245 bool is_unit;
4246 switch (value.index()) {
4247
4248 case 0:
4249 tag = "Simple";
4250 is_unit = false;
4251 break;
4252 case 1:
4253 tag = "Array";
4254 is_unit = false;
4255 break;
4256 default:
4257 throw_or_abort("unknown enum 'BrilligOutputs' variant index: " + std::to_string(value.index()));
4258 }
4259 if (is_unit) {
4260 packer.pack(tag);
4261 } else {
4262 std::visit(
4263 [&packer, tag](const auto& arg) {
4265 data[tag] = msgpack::object(arg);
4266 packer.pack(data);
4267 },
4268 value);
4269 }
4270 }
4271
4272 void msgpack_unpack(msgpack::object const& o)
4273 {
4274
4275 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4276 std::cerr << o << std::endl;
4277 throw_or_abort("expected MAP or STR for enum 'BrilligOutputs'; got type " + std::to_string(o.type));
4278 }
4279 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4280 throw_or_abort("expected 1 entry for enum 'BrilligOutputs'; got " + std::to_string(o.via.map.size));
4281 }
4282 std::string tag;
4283 try {
4284 if (o.type == msgpack::type::object_type::MAP) {
4285 o.via.map.ptr[0].key.convert(tag);
4286 } else {
4287 o.convert(tag);
4288 }
4289 } catch (const msgpack::type_error&) {
4290 std::cerr << o << std::endl;
4291 throw_or_abort("error converting tag to string for enum 'BrilligOutputs'");
4292 }
4293 if (tag == "Simple") {
4294 Simple v;
4295 try {
4296 o.via.map.ptr[0].val.convert(v);
4297 } catch (const msgpack::type_error&) {
4298 std::cerr << o << std::endl;
4299 throw_or_abort("error converting into enum variant 'BrilligOutputs::Simple'");
4300 }
4301
4302 value = v;
4303 } else if (tag == "Array") {
4304 Array v;
4305 try {
4306 o.via.map.ptr[0].val.convert(v);
4307 } catch (const msgpack::type_error&) {
4308 std::cerr << o << std::endl;
4309 throw_or_abort("error converting into enum variant 'BrilligOutputs::Array'");
4310 }
4311
4312 value = v;
4313 } else {
4314 std::cerr << o << std::endl;
4315 throw_or_abort("unknown 'BrilligOutputs' enum variant: " + tag);
4316 }
4317 }
4318};
4319
4320struct MemOp {
4324
4325 friend bool operator==(const MemOp&, const MemOp&);
4326 std::vector<uint8_t> bincodeSerialize() const;
4327 static MemOp bincodeDeserialize(std::vector<uint8_t>);
4328
4329 void msgpack_pack(auto& packer) const
4330 {
4331 packer.pack_map(3);
4332 packer.pack(std::make_pair("operation", operation));
4333 packer.pack(std::make_pair("index", index));
4334 packer.pack(std::make_pair("value", value));
4335 }
4336
4337 void msgpack_unpack(msgpack::object const& o)
4338 {
4339 std::string name = "MemOp";
4340 if (o.type == msgpack::type::MAP) {
4341 auto kvmap = Helpers::make_kvmap(o, name);
4342 Helpers::conv_fld_from_kvmap(kvmap, name, "operation", operation, false);
4343 Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false);
4344 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
4345 } else if (o.type == msgpack::type::ARRAY) {
4346 auto array = o.via.array;
4347 Helpers::conv_fld_from_array(array, name, "operation", operation, 0);
4348 Helpers::conv_fld_from_array(array, name, "index", index, 1);
4349 Helpers::conv_fld_from_array(array, name, "value", value, 2);
4350 } else {
4351 throw_or_abort("expected MAP or ARRAY for " + name);
4352 }
4353 }
4354};
4355
4356struct Opcode {
4357
4358 struct AssertZero {
4360
4361 friend bool operator==(const AssertZero&, const AssertZero&);
4362 std::vector<uint8_t> bincodeSerialize() const;
4363 static AssertZero bincodeDeserialize(std::vector<uint8_t>);
4364
4365 void msgpack_pack(auto& packer) const { packer.pack(value); }
4366
4367 void msgpack_unpack(msgpack::object const& o)
4368 {
4369 try {
4370 o.convert(value);
4371 } catch (const msgpack::type_error&) {
4372 std::cerr << o << std::endl;
4373 throw_or_abort("error converting into newtype 'AssertZero'");
4374 }
4375 }
4376 };
4377
4380
4381 friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&);
4382 std::vector<uint8_t> bincodeSerialize() const;
4383 static BlackBoxFuncCall bincodeDeserialize(std::vector<uint8_t>);
4384
4385 void msgpack_pack(auto& packer) const { packer.pack(value); }
4386
4387 void msgpack_unpack(msgpack::object const& o)
4388 {
4389 try {
4390 o.convert(value);
4391 } catch (const msgpack::type_error&) {
4392 std::cerr << o << std::endl;
4393 throw_or_abort("error converting into newtype 'BlackBoxFuncCall'");
4394 }
4395 }
4396 };
4397
4398 struct MemoryOp {
4401
4402 friend bool operator==(const MemoryOp&, const MemoryOp&);
4403 std::vector<uint8_t> bincodeSerialize() const;
4404 static MemoryOp bincodeDeserialize(std::vector<uint8_t>);
4405
4406 void msgpack_pack(auto& packer) const
4407 {
4408 packer.pack_map(2);
4409 packer.pack(std::make_pair("block_id", block_id));
4410 packer.pack(std::make_pair("op", op));
4411 }
4412
4413 void msgpack_unpack(msgpack::object const& o)
4414 {
4415 std::string name = "MemoryOp";
4416 if (o.type == msgpack::type::MAP) {
4417 auto kvmap = Helpers::make_kvmap(o, name);
4418 Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false);
4419 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
4420 } else if (o.type == msgpack::type::ARRAY) {
4421 auto array = o.via.array;
4422 Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0);
4423 Helpers::conv_fld_from_array(array, name, "op", op, 1);
4424 } else {
4425 throw_or_abort("expected MAP or ARRAY for " + name);
4426 }
4427 }
4428 };
4429
4430 struct MemoryInit {
4432 std::vector<Acir::Witness> init;
4434
4435 friend bool operator==(const MemoryInit&, const MemoryInit&);
4436 std::vector<uint8_t> bincodeSerialize() const;
4437 static MemoryInit bincodeDeserialize(std::vector<uint8_t>);
4438
4439 void msgpack_pack(auto& packer) const
4440 {
4441 packer.pack_map(3);
4442 packer.pack(std::make_pair("block_id", block_id));
4443 packer.pack(std::make_pair("init", init));
4444 packer.pack(std::make_pair("block_type", block_type));
4445 }
4446
4447 void msgpack_unpack(msgpack::object const& o)
4448 {
4449 std::string name = "MemoryInit";
4450 if (o.type == msgpack::type::MAP) {
4451 auto kvmap = Helpers::make_kvmap(o, name);
4452 Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false);
4453 Helpers::conv_fld_from_kvmap(kvmap, name, "init", init, false);
4454 Helpers::conv_fld_from_kvmap(kvmap, name, "block_type", block_type, false);
4455 } else if (o.type == msgpack::type::ARRAY) {
4456 auto array = o.via.array;
4457 Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0);
4458 Helpers::conv_fld_from_array(array, name, "init", init, 1);
4459 Helpers::conv_fld_from_array(array, name, "block_type", block_type, 2);
4460 } else {
4461 throw_or_abort("expected MAP or ARRAY for " + name);
4462 }
4463 }
4464 };
4465
4467 uint32_t id;
4468 std::vector<Acir::BrilligInputs> inputs;
4469 std::vector<Acir::BrilligOutputs> outputs;
4471
4472 friend bool operator==(const BrilligCall&, const BrilligCall&);
4473 std::vector<uint8_t> bincodeSerialize() const;
4474 static BrilligCall bincodeDeserialize(std::vector<uint8_t>);
4475
4476 void msgpack_pack(auto& packer) const
4477 {
4478 packer.pack_map(4);
4479 packer.pack(std::make_pair("id", id));
4480 packer.pack(std::make_pair("inputs", inputs));
4481 packer.pack(std::make_pair("outputs", outputs));
4482 packer.pack(std::make_pair("predicate", predicate));
4483 }
4484
4485 void msgpack_unpack(msgpack::object const& o)
4486 {
4487 std::string name = "BrilligCall";
4488 if (o.type == msgpack::type::MAP) {
4489 auto kvmap = Helpers::make_kvmap(o, name);
4490 Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false);
4491 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
4492 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
4493 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true);
4494 } else if (o.type == msgpack::type::ARRAY) {
4495 auto array = o.via.array;
4496 Helpers::conv_fld_from_array(array, name, "id", id, 0);
4497 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1);
4498 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
4499 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3);
4500 } else {
4501 throw_or_abort("expected MAP or ARRAY for " + name);
4502 }
4503 }
4504 };
4505
4506 struct Call {
4507 uint32_t id;
4508 std::vector<Acir::Witness> inputs;
4509 std::vector<Acir::Witness> outputs;
4511
4512 friend bool operator==(const Call&, const Call&);
4513 std::vector<uint8_t> bincodeSerialize() const;
4514 static Call bincodeDeserialize(std::vector<uint8_t>);
4515
4516 void msgpack_pack(auto& packer) const
4517 {
4518 packer.pack_map(4);
4519 packer.pack(std::make_pair("id", id));
4520 packer.pack(std::make_pair("inputs", inputs));
4521 packer.pack(std::make_pair("outputs", outputs));
4522 packer.pack(std::make_pair("predicate", predicate));
4523 }
4524
4525 void msgpack_unpack(msgpack::object const& o)
4526 {
4527 std::string name = "Call";
4528 if (o.type == msgpack::type::MAP) {
4529 auto kvmap = Helpers::make_kvmap(o, name);
4530 Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false);
4531 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
4532 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
4533 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true);
4534 } else if (o.type == msgpack::type::ARRAY) {
4535 auto array = o.via.array;
4536 Helpers::conv_fld_from_array(array, name, "id", id, 0);
4537 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1);
4538 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
4539 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3);
4540 } else {
4541 throw_or_abort("expected MAP or ARRAY for " + name);
4542 }
4543 }
4544 };
4545
4547
4548 friend bool operator==(const Opcode&, const Opcode&);
4549 std::vector<uint8_t> bincodeSerialize() const;
4550 static Opcode bincodeDeserialize(std::vector<uint8_t>);
4551
4552 void msgpack_pack(auto& packer) const
4553 {
4554 std::string tag;
4555 bool is_unit;
4556 switch (value.index()) {
4557
4558 case 0:
4559 tag = "AssertZero";
4560 is_unit = false;
4561 break;
4562 case 1:
4563 tag = "BlackBoxFuncCall";
4564 is_unit = false;
4565 break;
4566 case 2:
4567 tag = "MemoryOp";
4568 is_unit = false;
4569 break;
4570 case 3:
4571 tag = "MemoryInit";
4572 is_unit = false;
4573 break;
4574 case 4:
4575 tag = "BrilligCall";
4576 is_unit = false;
4577 break;
4578 case 5:
4579 tag = "Call";
4580 is_unit = false;
4581 break;
4582 default:
4583 throw_or_abort("unknown enum 'Opcode' variant index: " + std::to_string(value.index()));
4584 }
4585 if (is_unit) {
4586 packer.pack(tag);
4587 } else {
4588 std::visit(
4589 [&packer, tag](const auto& arg) {
4591 data[tag] = msgpack::object(arg);
4592 packer.pack(data);
4593 },
4594 value);
4595 }
4596 }
4597
4598 void msgpack_unpack(msgpack::object const& o)
4599 {
4600
4601 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4602 std::cerr << o << std::endl;
4603 throw_or_abort("expected MAP or STR for enum 'Opcode'; got type " + std::to_string(o.type));
4604 }
4605 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4606 throw_or_abort("expected 1 entry for enum 'Opcode'; got " + std::to_string(o.via.map.size));
4607 }
4608 std::string tag;
4609 try {
4610 if (o.type == msgpack::type::object_type::MAP) {
4611 o.via.map.ptr[0].key.convert(tag);
4612 } else {
4613 o.convert(tag);
4614 }
4615 } catch (const msgpack::type_error&) {
4616 std::cerr << o << std::endl;
4617 throw_or_abort("error converting tag to string for enum 'Opcode'");
4618 }
4619 if (tag == "AssertZero") {
4620 AssertZero v;
4621 try {
4622 o.via.map.ptr[0].val.convert(v);
4623 } catch (const msgpack::type_error&) {
4624 std::cerr << o << std::endl;
4625 throw_or_abort("error converting into enum variant 'Opcode::AssertZero'");
4626 }
4627
4628 value = v;
4629 } else if (tag == "BlackBoxFuncCall") {
4631 try {
4632 o.via.map.ptr[0].val.convert(v);
4633 } catch (const msgpack::type_error&) {
4634 std::cerr << o << std::endl;
4635 throw_or_abort("error converting into enum variant 'Opcode::BlackBoxFuncCall'");
4636 }
4637
4638 value = v;
4639 } else if (tag == "MemoryOp") {
4640 MemoryOp v;
4641 try {
4642 o.via.map.ptr[0].val.convert(v);
4643 } catch (const msgpack::type_error&) {
4644 std::cerr << o << std::endl;
4645 throw_or_abort("error converting into enum variant 'Opcode::MemoryOp'");
4646 }
4647
4648 value = v;
4649 } else if (tag == "MemoryInit") {
4650 MemoryInit v;
4651 try {
4652 o.via.map.ptr[0].val.convert(v);
4653 } catch (const msgpack::type_error&) {
4654 std::cerr << o << std::endl;
4655 throw_or_abort("error converting into enum variant 'Opcode::MemoryInit'");
4656 }
4657
4658 value = v;
4659 } else if (tag == "BrilligCall") {
4660 BrilligCall v;
4661 try {
4662 o.via.map.ptr[0].val.convert(v);
4663 } catch (const msgpack::type_error&) {
4664 std::cerr << o << std::endl;
4665 throw_or_abort("error converting into enum variant 'Opcode::BrilligCall'");
4666 }
4667
4668 value = v;
4669 } else if (tag == "Call") {
4670 Call v;
4671 try {
4672 o.via.map.ptr[0].val.convert(v);
4673 } catch (const msgpack::type_error&) {
4674 std::cerr << o << std::endl;
4675 throw_or_abort("error converting into enum variant 'Opcode::Call'");
4676 }
4677
4678 value = v;
4679 } else {
4680 std::cerr << o << std::endl;
4681 throw_or_abort("unknown 'Opcode' enum variant: " + tag);
4682 }
4683 }
4684};
4685
4687
4688 struct Expression {
4690
4691 friend bool operator==(const Expression&, const Expression&);
4692 std::vector<uint8_t> bincodeSerialize() const;
4693 static Expression bincodeDeserialize(std::vector<uint8_t>);
4694
4695 void msgpack_pack(auto& packer) const { packer.pack(value); }
4696
4697 void msgpack_unpack(msgpack::object const& o)
4698 {
4699 try {
4700 o.convert(value);
4701 } catch (const msgpack::type_error&) {
4702 std::cerr << o << std::endl;
4703 throw_or_abort("error converting into newtype 'Expression'");
4704 }
4705 }
4706 };
4707
4708 struct Memory {
4710
4711 friend bool operator==(const Memory&, const Memory&);
4712 std::vector<uint8_t> bincodeSerialize() const;
4713 static Memory bincodeDeserialize(std::vector<uint8_t>);
4714
4715 void msgpack_pack(auto& packer) const { packer.pack(value); }
4716
4717 void msgpack_unpack(msgpack::object const& o)
4718 {
4719 try {
4720 o.convert(value);
4721 } catch (const msgpack::type_error&) {
4722 std::cerr << o << std::endl;
4723 throw_or_abort("error converting into newtype 'Memory'");
4724 }
4725 }
4726 };
4727
4729
4730 friend bool operator==(const ExpressionOrMemory&, const ExpressionOrMemory&);
4731 std::vector<uint8_t> bincodeSerialize() const;
4732 static ExpressionOrMemory bincodeDeserialize(std::vector<uint8_t>);
4733
4734 void msgpack_pack(auto& packer) const
4735 {
4736 std::string tag;
4737 bool is_unit;
4738 switch (value.index()) {
4739
4740 case 0:
4741 tag = "Expression";
4742 is_unit = false;
4743 break;
4744 case 1:
4745 tag = "Memory";
4746 is_unit = false;
4747 break;
4748 default:
4749 throw_or_abort("unknown enum 'ExpressionOrMemory' variant index: " + std::to_string(value.index()));
4750 }
4751 if (is_unit) {
4752 packer.pack(tag);
4753 } else {
4754 std::visit(
4755 [&packer, tag](const auto& arg) {
4757 data[tag] = msgpack::object(arg);
4758 packer.pack(data);
4759 },
4760 value);
4761 }
4762 }
4763
4764 void msgpack_unpack(msgpack::object const& o)
4765 {
4766
4767 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4768 std::cerr << o << std::endl;
4769 throw_or_abort("expected MAP or STR for enum 'ExpressionOrMemory'; got type " + std::to_string(o.type));
4770 }
4771 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4772 throw_or_abort("expected 1 entry for enum 'ExpressionOrMemory'; got " + std::to_string(o.via.map.size));
4773 }
4774 std::string tag;
4775 try {
4776 if (o.type == msgpack::type::object_type::MAP) {
4777 o.via.map.ptr[0].key.convert(tag);
4778 } else {
4779 o.convert(tag);
4780 }
4781 } catch (const msgpack::type_error&) {
4782 std::cerr << o << std::endl;
4783 throw_or_abort("error converting tag to string for enum 'ExpressionOrMemory'");
4784 }
4785 if (tag == "Expression") {
4786 Expression v;
4787 try {
4788 o.via.map.ptr[0].val.convert(v);
4789 } catch (const msgpack::type_error&) {
4790 std::cerr << o << std::endl;
4791 throw_or_abort("error converting into enum variant 'ExpressionOrMemory::Expression'");
4792 }
4793
4794 value = v;
4795 } else if (tag == "Memory") {
4796 Memory v;
4797 try {
4798 o.via.map.ptr[0].val.convert(v);
4799 } catch (const msgpack::type_error&) {
4800 std::cerr << o << std::endl;
4801 throw_or_abort("error converting into enum variant 'ExpressionOrMemory::Memory'");
4802 }
4803
4804 value = v;
4805 } else {
4806 std::cerr << o << std::endl;
4807 throw_or_abort("unknown 'ExpressionOrMemory' enum variant: " + tag);
4808 }
4809 }
4810};
4811
4814 std::vector<Acir::ExpressionOrMemory> payload;
4815
4816 friend bool operator==(const AssertionPayload&, const AssertionPayload&);
4817 std::vector<uint8_t> bincodeSerialize() const;
4818 static AssertionPayload bincodeDeserialize(std::vector<uint8_t>);
4819
4820 void msgpack_pack(auto& packer) const
4821 {
4822 packer.pack_map(2);
4823 packer.pack(std::make_pair("error_selector", error_selector));
4824 packer.pack(std::make_pair("payload", payload));
4825 }
4826
4827 void msgpack_unpack(msgpack::object const& o)
4828 {
4829 std::string name = "AssertionPayload";
4830 if (o.type == msgpack::type::MAP) {
4831 auto kvmap = Helpers::make_kvmap(o, name);
4832 Helpers::conv_fld_from_kvmap(kvmap, name, "error_selector", error_selector, false);
4833 Helpers::conv_fld_from_kvmap(kvmap, name, "payload", payload, false);
4834 } else if (o.type == msgpack::type::ARRAY) {
4835 auto array = o.via.array;
4836 Helpers::conv_fld_from_array(array, name, "error_selector", error_selector, 0);
4837 Helpers::conv_fld_from_array(array, name, "payload", payload, 1);
4838 } else {
4839 throw_or_abort("expected MAP or ARRAY for " + name);
4840 }
4841 }
4842};
4843
4845
4846 struct Acir {
4847 uint64_t value;
4848
4849 friend bool operator==(const Acir&, const Acir&);
4850 std::vector<uint8_t> bincodeSerialize() const;
4851 static Acir bincodeDeserialize(std::vector<uint8_t>);
4852
4853 void msgpack_pack(auto& packer) const { packer.pack(value); }
4854
4855 void msgpack_unpack(msgpack::object const& o)
4856 {
4857 try {
4858 o.convert(value);
4859 } catch (const msgpack::type_error&) {
4860 std::cerr << o << std::endl;
4861 throw_or_abort("error converting into newtype 'Acir'");
4862 }
4863 }
4864 };
4865
4866 struct Brillig {
4867 uint64_t acir_index;
4869
4870 friend bool operator==(const Brillig&, const Brillig&);
4871 std::vector<uint8_t> bincodeSerialize() const;
4872 static Brillig bincodeDeserialize(std::vector<uint8_t>);
4873
4874 void msgpack_pack(auto& packer) const
4875 {
4876 packer.pack_map(2);
4877 packer.pack(std::make_pair("acir_index", acir_index));
4878 packer.pack(std::make_pair("brillig_index", brillig_index));
4879 }
4880
4881 void msgpack_unpack(msgpack::object const& o)
4882 {
4883 std::string name = "Brillig";
4884 if (o.type == msgpack::type::MAP) {
4885 auto kvmap = Helpers::make_kvmap(o, name);
4886 Helpers::conv_fld_from_kvmap(kvmap, name, "acir_index", acir_index, false);
4887 Helpers::conv_fld_from_kvmap(kvmap, name, "brillig_index", brillig_index, false);
4888 } else if (o.type == msgpack::type::ARRAY) {
4889 auto array = o.via.array;
4890 Helpers::conv_fld_from_array(array, name, "acir_index", acir_index, 0);
4891 Helpers::conv_fld_from_array(array, name, "brillig_index", brillig_index, 1);
4892 } else {
4893 throw_or_abort("expected MAP or ARRAY for " + name);
4894 }
4895 }
4896 };
4897
4899
4900 friend bool operator==(const OpcodeLocation&, const OpcodeLocation&);
4901 std::vector<uint8_t> bincodeSerialize() const;
4902 static OpcodeLocation bincodeDeserialize(std::vector<uint8_t>);
4903
4904 void msgpack_pack(auto& packer) const
4905 {
4906 std::string tag;
4907 bool is_unit;
4908 switch (value.index()) {
4909
4910 case 0:
4911 tag = "Acir";
4912 is_unit = false;
4913 break;
4914 case 1:
4915 tag = "Brillig";
4916 is_unit = false;
4917 break;
4918 default:
4919 throw_or_abort("unknown enum 'OpcodeLocation' variant index: " + std::to_string(value.index()));
4920 }
4921 if (is_unit) {
4922 packer.pack(tag);
4923 } else {
4924 std::visit(
4925 [&packer, tag](const auto& arg) {
4927 data[tag] = msgpack::object(arg);
4928 packer.pack(data);
4929 },
4930 value);
4931 }
4932 }
4933
4934 void msgpack_unpack(msgpack::object const& o)
4935 {
4936
4937 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4938 std::cerr << o << std::endl;
4939 throw_or_abort("expected MAP or STR for enum 'OpcodeLocation'; got type " + std::to_string(o.type));
4940 }
4941 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4942 throw_or_abort("expected 1 entry for enum 'OpcodeLocation'; got " + std::to_string(o.via.map.size));
4943 }
4944 std::string tag;
4945 try {
4946 if (o.type == msgpack::type::object_type::MAP) {
4947 o.via.map.ptr[0].key.convert(tag);
4948 } else {
4949 o.convert(tag);
4950 }
4951 } catch (const msgpack::type_error&) {
4952 std::cerr << o << std::endl;
4953 throw_or_abort("error converting tag to string for enum 'OpcodeLocation'");
4954 }
4955 if (tag == "Acir") {
4956 Acir v;
4957 try {
4958 o.via.map.ptr[0].val.convert(v);
4959 } catch (const msgpack::type_error&) {
4960 std::cerr << o << std::endl;
4961 throw_or_abort("error converting into enum variant 'OpcodeLocation::Acir'");
4962 }
4963
4964 value = v;
4965 } else if (tag == "Brillig") {
4966 Brillig v;
4967 try {
4968 o.via.map.ptr[0].val.convert(v);
4969 } catch (const msgpack::type_error&) {
4970 std::cerr << o << std::endl;
4971 throw_or_abort("error converting into enum variant 'OpcodeLocation::Brillig'");
4972 }
4973
4974 value = v;
4975 } else {
4976 std::cerr << o << std::endl;
4977 throw_or_abort("unknown 'OpcodeLocation' enum variant: " + tag);
4978 }
4979 }
4980};
4981
4983 std::vector<Acir::Witness> value;
4984
4985 friend bool operator==(const PublicInputs&, const PublicInputs&);
4986 std::vector<uint8_t> bincodeSerialize() const;
4987 static PublicInputs bincodeDeserialize(std::vector<uint8_t>);
4988
4989 void msgpack_pack(auto& packer) const { packer.pack(value); }
4990
4991 void msgpack_unpack(msgpack::object const& o)
4992 {
4993 try {
4994 o.convert(value);
4995 } catch (const msgpack::type_error&) {
4996 std::cerr << o << std::endl;
4997 throw_or_abort("error converting into newtype 'PublicInputs'");
4998 }
4999 }
5000};
5001
5002struct Circuit {
5003 std::string function_name;
5005 std::vector<Acir::Opcode> opcodes;
5006 std::vector<Acir::Witness> private_parameters;
5010
5011 friend bool operator==(const Circuit&, const Circuit&);
5012 std::vector<uint8_t> bincodeSerialize() const;
5013 static Circuit bincodeDeserialize(std::vector<uint8_t>);
5014
5015 void msgpack_pack(auto& packer) const
5016 {
5017 packer.pack_map(7);
5018 packer.pack(std::make_pair("function_name", function_name));
5019 packer.pack(std::make_pair("current_witness_index", current_witness_index));
5020 packer.pack(std::make_pair("opcodes", opcodes));
5021 packer.pack(std::make_pair("private_parameters", private_parameters));
5022 packer.pack(std::make_pair("public_parameters", public_parameters));
5023 packer.pack(std::make_pair("return_values", return_values));
5024 packer.pack(std::make_pair("assert_messages", assert_messages));
5025 }
5026
5027 void msgpack_unpack(msgpack::object const& o)
5028 {
5029 std::string name = "Circuit";
5030 if (o.type == msgpack::type::MAP) {
5031 auto kvmap = Helpers::make_kvmap(o, name);
5032 Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false);
5033 Helpers::conv_fld_from_kvmap(kvmap, name, "current_witness_index", current_witness_index, false);
5034 Helpers::conv_fld_from_kvmap(kvmap, name, "opcodes", opcodes, false);
5035 Helpers::conv_fld_from_kvmap(kvmap, name, "private_parameters", private_parameters, false);
5036 Helpers::conv_fld_from_kvmap(kvmap, name, "public_parameters", public_parameters, false);
5037 Helpers::conv_fld_from_kvmap(kvmap, name, "return_values", return_values, false);
5038 Helpers::conv_fld_from_kvmap(kvmap, name, "assert_messages", assert_messages, false);
5039 } else if (o.type == msgpack::type::ARRAY) {
5040 auto array = o.via.array;
5041 Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0);
5042 Helpers::conv_fld_from_array(array, name, "current_witness_index", current_witness_index, 1);
5043 Helpers::conv_fld_from_array(array, name, "opcodes", opcodes, 2);
5044 Helpers::conv_fld_from_array(array, name, "private_parameters", private_parameters, 3);
5045 Helpers::conv_fld_from_array(array, name, "public_parameters", public_parameters, 4);
5046 Helpers::conv_fld_from_array(array, name, "return_values", return_values, 5);
5047 Helpers::conv_fld_from_array(array, name, "assert_messages", assert_messages, 6);
5048 } else {
5049 throw_or_abort("expected MAP or ARRAY for " + name);
5050 }
5051 }
5052};
5053
5055 std::string function_name;
5056 std::vector<Acir::BrilligOpcode> bytecode;
5057
5058 friend bool operator==(const BrilligBytecode&, const BrilligBytecode&);
5059 std::vector<uint8_t> bincodeSerialize() const;
5060 static BrilligBytecode bincodeDeserialize(std::vector<uint8_t>);
5061
5062 void msgpack_pack(auto& packer) const
5063 {
5064 packer.pack_map(2);
5065 packer.pack(std::make_pair("function_name", function_name));
5066 packer.pack(std::make_pair("bytecode", bytecode));
5067 }
5068
5069 void msgpack_unpack(msgpack::object const& o)
5070 {
5071 std::string name = "BrilligBytecode";
5072 if (o.type == msgpack::type::MAP) {
5073 auto kvmap = Helpers::make_kvmap(o, name);
5074 Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false);
5075 Helpers::conv_fld_from_kvmap(kvmap, name, "bytecode", bytecode, false);
5076 } else if (o.type == msgpack::type::ARRAY) {
5077 auto array = o.via.array;
5078 Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0);
5079 Helpers::conv_fld_from_array(array, name, "bytecode", bytecode, 1);
5080 } else {
5081 throw_or_abort("expected MAP or ARRAY for " + name);
5082 }
5083 }
5084};
5085
5086struct Program {
5087 std::vector<Acir::Circuit> functions;
5088 std::vector<Acir::BrilligBytecode> unconstrained_functions;
5089
5090 friend bool operator==(const Program&, const Program&);
5091 std::vector<uint8_t> bincodeSerialize() const;
5092 static Program bincodeDeserialize(std::vector<uint8_t>);
5093
5094 void msgpack_pack(auto& packer) const
5095 {
5096 packer.pack_map(2);
5097 packer.pack(std::make_pair("functions", functions));
5098 packer.pack(std::make_pair("unconstrained_functions", unconstrained_functions));
5099 }
5100
5101 void msgpack_unpack(msgpack::object const& o)
5102 {
5103 std::string name = "Program";
5104 if (o.type == msgpack::type::MAP) {
5105 auto kvmap = Helpers::make_kvmap(o, name);
5106 Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false);
5107 Helpers::conv_fld_from_kvmap(kvmap, name, "unconstrained_functions", unconstrained_functions, false);
5108 } else if (o.type == msgpack::type::ARRAY) {
5109 auto array = o.via.array;
5110 Helpers::conv_fld_from_array(array, name, "functions", functions, 0);
5111 Helpers::conv_fld_from_array(array, name, "unconstrained_functions", unconstrained_functions, 1);
5112 } else {
5113 throw_or_abort("expected MAP or ARRAY for " + name);
5114 }
5115 }
5116};
5117
5119 std::vector<Acir::Circuit> functions;
5121
5122 friend bool operator==(const ProgramWithoutBrillig&, const ProgramWithoutBrillig&);
5123 std::vector<uint8_t> bincodeSerialize() const;
5124 static ProgramWithoutBrillig bincodeDeserialize(std::vector<uint8_t>);
5125
5126 void msgpack_pack(auto& packer) const
5127 {
5128 packer.pack_map(1);
5129 packer.pack(std::make_pair("functions", functions));
5130 }
5131
5132 void msgpack_unpack(msgpack::object const& o)
5133 {
5134 std::string name = "ProgramWithoutBrillig";
5135 if (o.type == msgpack::type::MAP) {
5136 auto kvmap = Helpers::make_kvmap(o, name);
5137 Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false);
5138 } else if (o.type == msgpack::type::ARRAY) {
5139 auto array = o.via.array;
5140 Helpers::conv_fld_from_array(array, name, "functions", functions, 0);
5141 } else {
5142 throw_or_abort("expected MAP or ARRAY for " + name);
5143 }
5144 }
5145};
5146
5148
5149 struct Unbounded {
5150 friend bool operator==(const Unbounded&, const Unbounded&);
5151 std::vector<uint8_t> bincodeSerialize() const;
5152 static Unbounded bincodeDeserialize(std::vector<uint8_t>);
5153
5154 void msgpack_pack(auto& packer) const {}
5155 void msgpack_unpack(msgpack::object const& o) {}
5156 };
5157
5158 struct Bounded {
5159 uint64_t width;
5160
5161 friend bool operator==(const Bounded&, const Bounded&);
5162 std::vector<uint8_t> bincodeSerialize() const;
5163 static Bounded bincodeDeserialize(std::vector<uint8_t>);
5164
5165 void msgpack_pack(auto& packer) const
5166 {
5167 packer.pack_map(1);
5168 packer.pack(std::make_pair("width", width));
5169 }
5170
5171 void msgpack_unpack(msgpack::object const& o)
5172 {
5173 std::string name = "Bounded";
5174 if (o.type == msgpack::type::MAP) {
5175 auto kvmap = Helpers::make_kvmap(o, name);
5176 Helpers::conv_fld_from_kvmap(kvmap, name, "width", width, false);
5177 } else if (o.type == msgpack::type::ARRAY) {
5178 auto array = o.via.array;
5179 Helpers::conv_fld_from_array(array, name, "width", width, 0);
5180 } else {
5181 throw_or_abort("expected MAP or ARRAY for " + name);
5182 }
5183 }
5184 };
5185
5187
5188 friend bool operator==(const ExpressionWidth&, const ExpressionWidth&);
5189 std::vector<uint8_t> bincodeSerialize() const;
5190 static ExpressionWidth bincodeDeserialize(std::vector<uint8_t>);
5191
5192 void msgpack_pack(auto& packer) const
5193 {
5194 std::string tag;
5195 bool is_unit;
5196 switch (value.index()) {
5197
5198 case 0:
5199 tag = "Unbounded";
5200 is_unit = true;
5201 break;
5202 case 1:
5203 tag = "Bounded";
5204 is_unit = false;
5205 break;
5206 default:
5207 throw_or_abort("unknown enum 'ExpressionWidth' variant index: " + std::to_string(value.index()));
5208 }
5209 if (is_unit) {
5210 packer.pack(tag);
5211 } else {
5212 std::visit(
5213 [&packer, tag](const auto& arg) {
5215 data[tag] = msgpack::object(arg);
5216 packer.pack(data);
5217 },
5218 value);
5219 }
5220 }
5221
5222 void msgpack_unpack(msgpack::object const& o)
5223 {
5224
5225 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
5226 std::cerr << o << std::endl;
5227 throw_or_abort("expected MAP or STR for enum 'ExpressionWidth'; got type " + std::to_string(o.type));
5228 }
5229 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
5230 throw_or_abort("expected 1 entry for enum 'ExpressionWidth'; got " + std::to_string(o.via.map.size));
5231 }
5232 std::string tag;
5233 try {
5234 if (o.type == msgpack::type::object_type::MAP) {
5235 o.via.map.ptr[0].key.convert(tag);
5236 } else {
5237 o.convert(tag);
5238 }
5239 } catch (const msgpack::type_error&) {
5240 std::cerr << o << std::endl;
5241 throw_or_abort("error converting tag to string for enum 'ExpressionWidth'");
5242 }
5243 if (tag == "Unbounded") {
5244 Unbounded v;
5245 value = v;
5246 } else if (tag == "Bounded") {
5247 Bounded v;
5248 try {
5249 o.via.map.ptr[0].val.convert(v);
5250 } catch (const msgpack::type_error&) {
5251 std::cerr << o << std::endl;
5252 throw_or_abort("error converting into enum variant 'ExpressionWidth::Bounded'");
5253 }
5254
5255 value = v;
5256 } else {
5257 std::cerr << o << std::endl;
5258 throw_or_abort("unknown 'ExpressionWidth' enum variant: " + tag);
5259 }
5260 }
5261};
5262
5263} // end of namespace Acir
5264
5265namespace Acir {
5266
5267inline bool operator==(const AssertionPayload& lhs, const AssertionPayload& rhs)
5268{
5269 if (!(lhs.error_selector == rhs.error_selector)) {
5270 return false;
5271 }
5272 if (!(lhs.payload == rhs.payload)) {
5273 return false;
5274 }
5275 return true;
5276}
5277
5278inline std::vector<uint8_t> AssertionPayload::bincodeSerialize() const
5279{
5280 auto serializer = serde::BincodeSerializer();
5282 return std::move(serializer).bytes();
5283}
5284
5286{
5287 auto deserializer = serde::BincodeDeserializer(input);
5289 if (deserializer.get_buffer_offset() < input.size()) {
5290 throw_or_abort("Some input bytes were not read");
5291 }
5292 return value;
5293}
5294
5295} // end of namespace Acir
5296
5297template <>
5298template <typename Serializer>
5300{
5301 serializer.increase_container_depth();
5302 serde::Serializable<decltype(obj.error_selector)>::serialize(obj.error_selector, serializer);
5303 serde::Serializable<decltype(obj.payload)>::serialize(obj.payload, serializer);
5304 serializer.decrease_container_depth();
5305}
5306
5307template <>
5308template <typename Deserializer>
5310{
5311 deserializer.increase_container_depth();
5313 obj.error_selector = serde::Deserializable<decltype(obj.error_selector)>::deserialize(deserializer);
5314 obj.payload = serde::Deserializable<decltype(obj.payload)>::deserialize(deserializer);
5315 deserializer.decrease_container_depth();
5316 return obj;
5317}
5318
5319namespace Acir {
5320
5321inline bool operator==(const BinaryFieldOp& lhs, const BinaryFieldOp& rhs)
5322{
5323 if (!(lhs.value == rhs.value)) {
5324 return false;
5325 }
5326 return true;
5327}
5328
5329inline std::vector<uint8_t> BinaryFieldOp::bincodeSerialize() const
5330{
5331 auto serializer = serde::BincodeSerializer();
5333 return std::move(serializer).bytes();
5334}
5335
5336inline BinaryFieldOp BinaryFieldOp::bincodeDeserialize(std::vector<uint8_t> input)
5337{
5338 auto deserializer = serde::BincodeDeserializer(input);
5340 if (deserializer.get_buffer_offset() < input.size()) {
5341 throw_or_abort("Some input bytes were not read");
5342 }
5343 return value;
5344}
5345
5346} // end of namespace Acir
5347
5348template <>
5349template <typename Serializer>
5351{
5352 serializer.increase_container_depth();
5353 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
5354 serializer.decrease_container_depth();
5355}
5356
5357template <>
5358template <typename Deserializer>
5360{
5361 deserializer.increase_container_depth();
5363 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
5364 deserializer.decrease_container_depth();
5365 return obj;
5366}
5367
5368namespace Acir {
5369
5370inline bool operator==(const BinaryFieldOp::Add& lhs, const BinaryFieldOp::Add& rhs)
5371{
5372 return true;
5373}
5374
5375inline std::vector<uint8_t> BinaryFieldOp::Add::bincodeSerialize() const
5376{
5377 auto serializer = serde::BincodeSerializer();
5379 return std::move(serializer).bytes();
5380}
5381
5383{
5384 auto deserializer = serde::BincodeDeserializer(input);
5386 if (deserializer.get_buffer_offset() < input.size()) {
5387 throw_or_abort("Some input bytes were not read");
5388 }
5389 return value;
5390}
5391
5392} // end of namespace Acir
5393
5394template <>
5395template <typename Serializer>
5399
5400template <>
5401template <typename Deserializer>
5407
5408namespace Acir {
5409
5410inline bool operator==(const BinaryFieldOp::Sub& lhs, const BinaryFieldOp::Sub& rhs)
5411{
5412 return true;
5413}
5414
5415inline std::vector<uint8_t> BinaryFieldOp::Sub::bincodeSerialize() const
5416{
5417 auto serializer = serde::BincodeSerializer();
5419 return std::move(serializer).bytes();
5420}
5421
5423{
5424 auto deserializer = serde::BincodeDeserializer(input);
5426 if (deserializer.get_buffer_offset() < input.size()) {
5427 throw_or_abort("Some input bytes were not read");
5428 }
5429 return value;
5430}
5431
5432} // end of namespace Acir
5433
5434template <>
5435template <typename Serializer>
5439
5440template <>
5441template <typename Deserializer>
5447
5448namespace Acir {
5449
5450inline bool operator==(const BinaryFieldOp::Mul& lhs, const BinaryFieldOp::Mul& rhs)
5451{
5452 return true;
5453}
5454
5455inline std::vector<uint8_t> BinaryFieldOp::Mul::bincodeSerialize() const
5456{
5457 auto serializer = serde::BincodeSerializer();
5459 return std::move(serializer).bytes();
5460}
5461
5463{
5464 auto deserializer = serde::BincodeDeserializer(input);
5466 if (deserializer.get_buffer_offset() < input.size()) {
5467 throw_or_abort("Some input bytes were not read");
5468 }
5469 return value;
5470}
5471
5472} // end of namespace Acir
5473
5474template <>
5475template <typename Serializer>
5479
5480template <>
5481template <typename Deserializer>
5487
5488namespace Acir {
5489
5490inline bool operator==(const BinaryFieldOp::Div& lhs, const BinaryFieldOp::Div& rhs)
5491{
5492 return true;
5493}
5494
5495inline std::vector<uint8_t> BinaryFieldOp::Div::bincodeSerialize() const
5496{
5497 auto serializer = serde::BincodeSerializer();
5499 return std::move(serializer).bytes();
5500}
5501
5503{
5504 auto deserializer = serde::BincodeDeserializer(input);
5506 if (deserializer.get_buffer_offset() < input.size()) {
5507 throw_or_abort("Some input bytes were not read");
5508 }
5509 return value;
5510}
5511
5512} // end of namespace Acir
5513
5514template <>
5515template <typename Serializer>
5519
5520template <>
5521template <typename Deserializer>
5527
5528namespace Acir {
5529
5531{
5532 return true;
5533}
5534
5535inline std::vector<uint8_t> BinaryFieldOp::IntegerDiv::bincodeSerialize() const
5536{
5537 auto serializer = serde::BincodeSerializer();
5539 return std::move(serializer).bytes();
5540}
5541
5543{
5544 auto deserializer = serde::BincodeDeserializer(input);
5546 if (deserializer.get_buffer_offset() < input.size()) {
5547 throw_or_abort("Some input bytes were not read");
5548 }
5549 return value;
5550}
5551
5552} // end of namespace Acir
5553
5554template <>
5555template <typename Serializer>
5559
5560template <>
5561template <typename Deserializer>
5568
5569namespace Acir {
5570
5571inline bool operator==(const BinaryFieldOp::Equals& lhs, const BinaryFieldOp::Equals& rhs)
5572{
5573 return true;
5574}
5575
5576inline std::vector<uint8_t> BinaryFieldOp::Equals::bincodeSerialize() const
5577{
5578 auto serializer = serde::BincodeSerializer();
5580 return std::move(serializer).bytes();
5581}
5582
5584{
5585 auto deserializer = serde::BincodeDeserializer(input);
5587 if (deserializer.get_buffer_offset() < input.size()) {
5588 throw_or_abort("Some input bytes were not read");
5589 }
5590 return value;
5591}
5592
5593} // end of namespace Acir
5594
5595template <>
5596template <typename Serializer>
5600
5601template <>
5602template <typename Deserializer>
5608
5609namespace Acir {
5610
5612{
5613 return true;
5614}
5615
5616inline std::vector<uint8_t> BinaryFieldOp::LessThan::bincodeSerialize() const
5617{
5618 auto serializer = serde::BincodeSerializer();
5620 return std::move(serializer).bytes();
5621}
5622
5624{
5625 auto deserializer = serde::BincodeDeserializer(input);
5627 if (deserializer.get_buffer_offset() < input.size()) {
5628 throw_or_abort("Some input bytes were not read");
5629 }
5630 return value;
5631}
5632
5633} // end of namespace Acir
5634
5635template <>
5636template <typename Serializer>
5640
5641template <>
5642template <typename Deserializer>
5649
5650namespace Acir {
5651
5653{
5654 return true;
5655}
5656
5657inline std::vector<uint8_t> BinaryFieldOp::LessThanEquals::bincodeSerialize() const
5658{
5659 auto serializer = serde::BincodeSerializer();
5661 return std::move(serializer).bytes();
5662}
5663
5665{
5666 auto deserializer = serde::BincodeDeserializer(input);
5668 if (deserializer.get_buffer_offset() < input.size()) {
5669 throw_or_abort("Some input bytes were not read");
5670 }
5671 return value;
5672}
5673
5674} // end of namespace Acir
5675
5676template <>
5677template <typename Serializer>
5681
5682template <>
5683template <typename Deserializer>
5690
5691namespace Acir {
5692
5693inline bool operator==(const BinaryIntOp& lhs, const BinaryIntOp& rhs)
5694{
5695 if (!(lhs.value == rhs.value)) {
5696 return false;
5697 }
5698 return true;
5699}
5700
5701inline std::vector<uint8_t> BinaryIntOp::bincodeSerialize() const
5702{
5703 auto serializer = serde::BincodeSerializer();
5705 return std::move(serializer).bytes();
5706}
5707
5708inline BinaryIntOp BinaryIntOp::bincodeDeserialize(std::vector<uint8_t> input)
5709{
5710 auto deserializer = serde::BincodeDeserializer(input);
5712 if (deserializer.get_buffer_offset() < input.size()) {
5713 throw_or_abort("Some input bytes were not read");
5714 }
5715 return value;
5716}
5717
5718} // end of namespace Acir
5719
5720template <>
5721template <typename Serializer>
5723{
5724 serializer.increase_container_depth();
5725 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
5726 serializer.decrease_container_depth();
5727}
5728
5729template <>
5730template <typename Deserializer>
5732{
5733 deserializer.increase_container_depth();
5735 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
5736 deserializer.decrease_container_depth();
5737 return obj;
5738}
5739
5740namespace Acir {
5741
5742inline bool operator==(const BinaryIntOp::Add& lhs, const BinaryIntOp::Add& rhs)
5743{
5744 return true;
5745}
5746
5747inline std::vector<uint8_t> BinaryIntOp::Add::bincodeSerialize() const
5748{
5749 auto serializer = serde::BincodeSerializer();
5751 return std::move(serializer).bytes();
5752}
5753
5755{
5756 auto deserializer = serde::BincodeDeserializer(input);
5758 if (deserializer.get_buffer_offset() < input.size()) {
5759 throw_or_abort("Some input bytes were not read");
5760 }
5761 return value;
5762}
5763
5764} // end of namespace Acir
5765
5766template <>
5767template <typename Serializer>
5770
5771template <>
5772template <typename Deserializer>
5778
5779namespace Acir {
5780
5781inline bool operator==(const BinaryIntOp::Sub& lhs, const BinaryIntOp::Sub& rhs)
5782{
5783 return true;
5784}
5785
5786inline std::vector<uint8_t> BinaryIntOp::Sub::bincodeSerialize() const
5787{
5788 auto serializer = serde::BincodeSerializer();
5790 return std::move(serializer).bytes();
5791}
5792
5794{
5795 auto deserializer = serde::BincodeDeserializer(input);
5797 if (deserializer.get_buffer_offset() < input.size()) {
5798 throw_or_abort("Some input bytes were not read");
5799 }
5800 return value;
5801}
5802
5803} // end of namespace Acir
5804
5805template <>
5806template <typename Serializer>
5809
5810template <>
5811template <typename Deserializer>
5817
5818namespace Acir {
5819
5820inline bool operator==(const BinaryIntOp::Mul& lhs, const BinaryIntOp::Mul& rhs)
5821{
5822 return true;
5823}
5824
5825inline std::vector<uint8_t> BinaryIntOp::Mul::bincodeSerialize() const
5826{
5827 auto serializer = serde::BincodeSerializer();
5829 return std::move(serializer).bytes();
5830}
5831
5833{
5834 auto deserializer = serde::BincodeDeserializer(input);
5836 if (deserializer.get_buffer_offset() < input.size()) {
5837 throw_or_abort("Some input bytes were not read");
5838 }
5839 return value;
5840}
5841
5842} // end of namespace Acir
5843
5844template <>
5845template <typename Serializer>
5848
5849template <>
5850template <typename Deserializer>
5856
5857namespace Acir {
5858
5859inline bool operator==(const BinaryIntOp::Div& lhs, const BinaryIntOp::Div& rhs)
5860{
5861 return true;
5862}
5863
5864inline std::vector<uint8_t> BinaryIntOp::Div::bincodeSerialize() const
5865{
5866 auto serializer = serde::BincodeSerializer();
5868 return std::move(serializer).bytes();
5869}
5870
5872{
5873 auto deserializer = serde::BincodeDeserializer(input);
5875 if (deserializer.get_buffer_offset() < input.size()) {
5876 throw_or_abort("Some input bytes were not read");
5877 }
5878 return value;
5879}
5880
5881} // end of namespace Acir
5882
5883template <>
5884template <typename Serializer>
5887
5888template <>
5889template <typename Deserializer>
5895
5896namespace Acir {
5897
5898inline bool operator==(const BinaryIntOp::Equals& lhs, const BinaryIntOp::Equals& rhs)
5899{
5900 return true;
5901}
5902
5903inline std::vector<uint8_t> BinaryIntOp::Equals::bincodeSerialize() const
5904{
5905 auto serializer = serde::BincodeSerializer();
5907 return std::move(serializer).bytes();
5908}
5909
5911{
5912 auto deserializer = serde::BincodeDeserializer(input);
5914 if (deserializer.get_buffer_offset() < input.size()) {
5915 throw_or_abort("Some input bytes were not read");
5916 }
5917 return value;
5918}
5919
5920} // end of namespace Acir
5921
5922template <>
5923template <typename Serializer>
5927
5928template <>
5929template <typename Deserializer>
5935
5936namespace Acir {
5937
5938inline bool operator==(const BinaryIntOp::LessThan& lhs, const BinaryIntOp::LessThan& rhs)
5939{
5940 return true;
5941}
5942
5943inline std::vector<uint8_t> BinaryIntOp::LessThan::bincodeSerialize() const
5944{
5945 auto serializer = serde::BincodeSerializer();
5947 return std::move(serializer).bytes();
5948}
5949
5951{
5952 auto deserializer = serde::BincodeDeserializer(input);
5954 if (deserializer.get_buffer_offset() < input.size()) {
5955 throw_or_abort("Some input bytes were not read");
5956 }
5957 return value;
5958}
5959
5960} // end of namespace Acir
5961
5962template <>
5963template <typename Serializer>
5967
5968template <>
5969template <typename Deserializer>
5975
5976namespace Acir {
5977
5979{
5980 return true;
5981}
5982
5983inline std::vector<uint8_t> BinaryIntOp::LessThanEquals::bincodeSerialize() const
5984{
5985 auto serializer = serde::BincodeSerializer();
5987 return std::move(serializer).bytes();
5988}
5989
5991{
5992 auto deserializer = serde::BincodeDeserializer(input);
5994 if (deserializer.get_buffer_offset() < input.size()) {
5995 throw_or_abort("Some input bytes were not read");
5996 }
5997 return value;
5998}
5999
6000} // end of namespace Acir
6001
6002template <>
6003template <typename Serializer>
6007
6008template <>
6009template <typename Deserializer>
6016
6017namespace Acir {
6018
6019inline bool operator==(const BinaryIntOp::And& lhs, const BinaryIntOp::And& rhs)
6020{
6021 return true;
6022}
6023
6024inline std::vector<uint8_t> BinaryIntOp::And::bincodeSerialize() const
6025{
6026 auto serializer = serde::BincodeSerializer();
6028 return std::move(serializer).bytes();
6029}
6030
6032{
6033 auto deserializer = serde::BincodeDeserializer(input);
6035 if (deserializer.get_buffer_offset() < input.size()) {
6036 throw_or_abort("Some input bytes were not read");
6037 }
6038 return value;
6039}
6040
6041} // end of namespace Acir
6042
6043template <>
6044template <typename Serializer>
6047
6048template <>
6049template <typename Deserializer>
6055
6056namespace Acir {
6057
6058inline bool operator==(const BinaryIntOp::Or& lhs, const BinaryIntOp::Or& rhs)
6059{
6060 return true;
6061}
6062
6063inline std::vector<uint8_t> BinaryIntOp::Or::bincodeSerialize() const
6064{
6065 auto serializer = serde::BincodeSerializer();
6067 return std::move(serializer).bytes();
6068}
6069
6071{
6072 auto deserializer = serde::BincodeDeserializer(input);
6074 if (deserializer.get_buffer_offset() < input.size()) {
6075 throw_or_abort("Some input bytes were not read");
6076 }
6077 return value;
6078}
6079
6080} // end of namespace Acir
6081
6082template <>
6083template <typename Serializer>
6086
6087template <>
6088template <typename Deserializer>
6090{
6092 return obj;
6093}
6094
6095namespace Acir {
6096
6097inline bool operator==(const BinaryIntOp::Xor& lhs, const BinaryIntOp::Xor& rhs)
6098{
6099 return true;
6100}
6101
6102inline std::vector<uint8_t> BinaryIntOp::Xor::bincodeSerialize() const
6103{
6104 auto serializer = serde::BincodeSerializer();
6106 return std::move(serializer).bytes();
6107}
6108
6110{
6111 auto deserializer = serde::BincodeDeserializer(input);
6113 if (deserializer.get_buffer_offset() < input.size()) {
6114 throw_or_abort("Some input bytes were not read");
6115 }
6116 return value;
6117}
6118
6119} // end of namespace Acir
6120
6121template <>
6122template <typename Serializer>
6125
6126template <>
6127template <typename Deserializer>
6133
6134namespace Acir {
6135
6136inline bool operator==(const BinaryIntOp::Shl& lhs, const BinaryIntOp::Shl& rhs)
6137{
6138 return true;
6139}
6140
6141inline std::vector<uint8_t> BinaryIntOp::Shl::bincodeSerialize() const
6142{
6143 auto serializer = serde::BincodeSerializer();
6145 return std::move(serializer).bytes();
6146}
6147
6149{
6150 auto deserializer = serde::BincodeDeserializer(input);
6152 if (deserializer.get_buffer_offset() < input.size()) {
6153 throw_or_abort("Some input bytes were not read");
6154 }
6155 return value;
6156}
6157
6158} // end of namespace Acir
6159
6160template <>
6161template <typename Serializer>
6164
6165template <>
6166template <typename Deserializer>
6172
6173namespace Acir {
6174
6175inline bool operator==(const BinaryIntOp::Shr& lhs, const BinaryIntOp::Shr& rhs)
6176{
6177 return true;
6178}
6179
6180inline std::vector<uint8_t> BinaryIntOp::Shr::bincodeSerialize() const
6181{
6182 auto serializer = serde::BincodeSerializer();
6184 return std::move(serializer).bytes();
6185}
6186
6188{
6189 auto deserializer = serde::BincodeDeserializer(input);
6191 if (deserializer.get_buffer_offset() < input.size()) {
6192 throw_or_abort("Some input bytes were not read");
6193 }
6194 return value;
6195}
6196
6197} // end of namespace Acir
6198
6199template <>
6200template <typename Serializer>
6203
6204template <>
6205template <typename Deserializer>
6211
6212namespace Acir {
6213
6214inline bool operator==(const BitSize& lhs, const BitSize& rhs)
6215{
6216 if (!(lhs.value == rhs.value)) {
6217 return false;
6218 }
6219 return true;
6220}
6221
6222inline std::vector<uint8_t> BitSize::bincodeSerialize() const
6223{
6224 auto serializer = serde::BincodeSerializer();
6225 serde::Serializable<BitSize>::serialize(*this, serializer);
6226 return std::move(serializer).bytes();
6227}
6228
6229inline BitSize BitSize::bincodeDeserialize(std::vector<uint8_t> input)
6230{
6231 auto deserializer = serde::BincodeDeserializer(input);
6233 if (deserializer.get_buffer_offset() < input.size()) {
6234 throw_or_abort("Some input bytes were not read");
6235 }
6236 return value;
6237}
6238
6239} // end of namespace Acir
6240
6241template <>
6242template <typename Serializer>
6243void serde::Serializable<Acir::BitSize>::serialize(const Acir::BitSize& obj, Serializer& serializer)
6244{
6245 serializer.increase_container_depth();
6246 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6247 serializer.decrease_container_depth();
6248}
6249
6250template <>
6251template <typename Deserializer>
6253{
6254 deserializer.increase_container_depth();
6255 Acir::BitSize obj;
6256 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6257 deserializer.decrease_container_depth();
6258 return obj;
6259}
6260
6261namespace Acir {
6262
6263inline bool operator==(const BitSize::Field& lhs, const BitSize::Field& rhs)
6264{
6265 return true;
6266}
6267
6268inline std::vector<uint8_t> BitSize::Field::bincodeSerialize() const
6269{
6270 auto serializer = serde::BincodeSerializer();
6272 return std::move(serializer).bytes();
6273}
6274
6275inline BitSize::Field BitSize::Field::bincodeDeserialize(std::vector<uint8_t> input)
6276{
6277 auto deserializer = serde::BincodeDeserializer(input);
6279 if (deserializer.get_buffer_offset() < input.size()) {
6280 throw_or_abort("Some input bytes were not read");
6281 }
6282 return value;
6283}
6284
6285} // end of namespace Acir
6286
6287template <>
6288template <typename Serializer>
6291
6292template <>
6293template <typename Deserializer>
6295{
6297 return obj;
6298}
6299
6300namespace Acir {
6301
6302inline bool operator==(const BitSize::Integer& lhs, const BitSize::Integer& rhs)
6303{
6304 if (!(lhs.value == rhs.value)) {
6305 return false;
6306 }
6307 return true;
6308}
6309
6310inline std::vector<uint8_t> BitSize::Integer::bincodeSerialize() const
6311{
6312 auto serializer = serde::BincodeSerializer();
6314 return std::move(serializer).bytes();
6315}
6316
6318{
6319 auto deserializer = serde::BincodeDeserializer(input);
6321 if (deserializer.get_buffer_offset() < input.size()) {
6322 throw_or_abort("Some input bytes were not read");
6323 }
6324 return value;
6325}
6326
6327} // end of namespace Acir
6328
6329template <>
6330template <typename Serializer>
6332{
6333 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6334}
6335
6336template <>
6337template <typename Deserializer>
6339{
6341 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6342 return obj;
6343}
6344
6345namespace Acir {
6346
6347inline bool operator==(const BlackBoxFuncCall& lhs, const BlackBoxFuncCall& rhs)
6348{
6349 if (!(lhs.value == rhs.value)) {
6350 return false;
6351 }
6352 return true;
6353}
6354
6355inline std::vector<uint8_t> BlackBoxFuncCall::bincodeSerialize() const
6356{
6357 auto serializer = serde::BincodeSerializer();
6359 return std::move(serializer).bytes();
6360}
6361
6363{
6364 auto deserializer = serde::BincodeDeserializer(input);
6366 if (deserializer.get_buffer_offset() < input.size()) {
6367 throw_or_abort("Some input bytes were not read");
6368 }
6369 return value;
6370}
6371
6372} // end of namespace Acir
6373
6374template <>
6375template <typename Serializer>
6377{
6378 serializer.increase_container_depth();
6379 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6380 serializer.decrease_container_depth();
6381}
6382
6383template <>
6384template <typename Deserializer>
6386{
6387 deserializer.increase_container_depth();
6389 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6390 deserializer.decrease_container_depth();
6391 return obj;
6392}
6393
6394namespace Acir {
6395
6397{
6398 if (!(lhs.inputs == rhs.inputs)) {
6399 return false;
6400 }
6401 if (!(lhs.iv == rhs.iv)) {
6402 return false;
6403 }
6404 if (!(lhs.key == rhs.key)) {
6405 return false;
6406 }
6407 if (!(lhs.outputs == rhs.outputs)) {
6408 return false;
6409 }
6410 return true;
6411}
6412
6413inline std::vector<uint8_t> BlackBoxFuncCall::AES128Encrypt::bincodeSerialize() const
6414{
6415 auto serializer = serde::BincodeSerializer();
6417 return std::move(serializer).bytes();
6418}
6419
6421{
6422 auto deserializer = serde::BincodeDeserializer(input);
6424 if (deserializer.get_buffer_offset() < input.size()) {
6425 throw_or_abort("Some input bytes were not read");
6426 }
6427 return value;
6428}
6429
6430} // end of namespace Acir
6431
6432template <>
6433template <typename Serializer>
6435 const Acir::BlackBoxFuncCall::AES128Encrypt& obj, Serializer& serializer)
6436{
6437 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6438 serde::Serializable<decltype(obj.iv)>::serialize(obj.iv, serializer);
6439 serde::Serializable<decltype(obj.key)>::serialize(obj.key, serializer);
6440 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6441}
6442
6443template <>
6444template <typename Deserializer>
6446 Deserializer& deserializer)
6447{
6449 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6450 obj.iv = serde::Deserializable<decltype(obj.iv)>::deserialize(deserializer);
6451 obj.key = serde::Deserializable<decltype(obj.key)>::deserialize(deserializer);
6452 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6453 return obj;
6454}
6455
6456namespace Acir {
6457
6458inline bool operator==(const BlackBoxFuncCall::AND& lhs, const BlackBoxFuncCall::AND& rhs)
6459{
6460 if (!(lhs.lhs == rhs.lhs)) {
6461 return false;
6462 }
6463 if (!(lhs.rhs == rhs.rhs)) {
6464 return false;
6465 }
6466 if (!(lhs.num_bits == rhs.num_bits)) {
6467 return false;
6468 }
6469 if (!(lhs.output == rhs.output)) {
6470 return false;
6471 }
6472 return true;
6473}
6474
6475inline std::vector<uint8_t> BlackBoxFuncCall::AND::bincodeSerialize() const
6476{
6477 auto serializer = serde::BincodeSerializer();
6479 return std::move(serializer).bytes();
6480}
6481
6483{
6484 auto deserializer = serde::BincodeDeserializer(input);
6486 if (deserializer.get_buffer_offset() < input.size()) {
6487 throw_or_abort("Some input bytes were not read");
6488 }
6489 return value;
6490}
6491
6492} // end of namespace Acir
6493
6494template <>
6495template <typename Serializer>
6497 Serializer& serializer)
6498{
6499 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
6500 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
6501 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6502 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6503}
6504
6505template <>
6506template <typename Deserializer>
6508{
6510 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
6511 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
6512 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6513 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6514 return obj;
6515}
6516
6517namespace Acir {
6518
6519inline bool operator==(const BlackBoxFuncCall::XOR& lhs, const BlackBoxFuncCall::XOR& rhs)
6520{
6521 if (!(lhs.lhs == rhs.lhs)) {
6522 return false;
6523 }
6524 if (!(lhs.rhs == rhs.rhs)) {
6525 return false;
6526 }
6527 if (!(lhs.num_bits == rhs.num_bits)) {
6528 return false;
6529 }
6530 if (!(lhs.output == rhs.output)) {
6531 return false;
6532 }
6533 return true;
6534}
6535
6536inline std::vector<uint8_t> BlackBoxFuncCall::XOR::bincodeSerialize() const
6537{
6538 auto serializer = serde::BincodeSerializer();
6540 return std::move(serializer).bytes();
6541}
6542
6544{
6545 auto deserializer = serde::BincodeDeserializer(input);
6547 if (deserializer.get_buffer_offset() < input.size()) {
6548 throw_or_abort("Some input bytes were not read");
6549 }
6550 return value;
6551}
6552
6553} // end of namespace Acir
6554
6555template <>
6556template <typename Serializer>
6558 Serializer& serializer)
6559{
6560 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
6561 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
6562 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6563 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6564}
6565
6566template <>
6567template <typename Deserializer>
6569{
6571 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
6572 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
6573 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6574 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6575 return obj;
6576}
6577
6578namespace Acir {
6579
6581{
6582 if (!(lhs.input == rhs.input)) {
6583 return false;
6584 }
6585 if (!(lhs.num_bits == rhs.num_bits)) {
6586 return false;
6587 }
6588 return true;
6589}
6590
6591inline std::vector<uint8_t> BlackBoxFuncCall::RANGE::bincodeSerialize() const
6592{
6593 auto serializer = serde::BincodeSerializer();
6595 return std::move(serializer).bytes();
6596}
6597
6599{
6600 auto deserializer = serde::BincodeDeserializer(input);
6602 if (deserializer.get_buffer_offset() < input.size()) {
6603 throw_or_abort("Some input bytes were not read");
6604 }
6605 return value;
6606}
6607
6608} // end of namespace Acir
6609
6610template <>
6611template <typename Serializer>
6613 Serializer& serializer)
6614{
6615 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
6616 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6617}
6618
6619template <>
6620template <typename Deserializer>
6622 Deserializer& deserializer)
6623{
6625 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
6626 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6627 return obj;
6628}
6629
6630namespace Acir {
6631
6633{
6634 if (!(lhs.inputs == rhs.inputs)) {
6635 return false;
6636 }
6637 if (!(lhs.outputs == rhs.outputs)) {
6638 return false;
6639 }
6640 return true;
6641}
6642
6643inline std::vector<uint8_t> BlackBoxFuncCall::Blake2s::bincodeSerialize() const
6644{
6645 auto serializer = serde::BincodeSerializer();
6647 return std::move(serializer).bytes();
6648}
6649
6651{
6652 auto deserializer = serde::BincodeDeserializer(input);
6654 if (deserializer.get_buffer_offset() < input.size()) {
6655 throw_or_abort("Some input bytes were not read");
6656 }
6657 return value;
6658}
6659
6660} // end of namespace Acir
6661
6662template <>
6663template <typename Serializer>
6665 Serializer& serializer)
6666{
6667 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6668 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6669}
6670
6671template <>
6672template <typename Deserializer>
6674 Deserializer& deserializer)
6675{
6677 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6678 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6679 return obj;
6680}
6681
6682namespace Acir {
6683
6685{
6686 if (!(lhs.inputs == rhs.inputs)) {
6687 return false;
6688 }
6689 if (!(lhs.outputs == rhs.outputs)) {
6690 return false;
6691 }
6692 return true;
6693}
6694
6695inline std::vector<uint8_t> BlackBoxFuncCall::Blake3::bincodeSerialize() const
6696{
6697 auto serializer = serde::BincodeSerializer();
6699 return std::move(serializer).bytes();
6700}
6701
6703{
6704 auto deserializer = serde::BincodeDeserializer(input);
6706 if (deserializer.get_buffer_offset() < input.size()) {
6707 throw_or_abort("Some input bytes were not read");
6708 }
6709 return value;
6710}
6711
6712} // end of namespace Acir
6713
6714template <>
6715template <typename Serializer>
6717 Serializer& serializer)
6718{
6719 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6720 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6721}
6722
6723template <>
6724template <typename Deserializer>
6726 Deserializer& deserializer)
6727{
6729 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6730 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6731 return obj;
6732}
6733
6734namespace Acir {
6735
6737{
6738 if (!(lhs.public_key_x == rhs.public_key_x)) {
6739 return false;
6740 }
6741 if (!(lhs.public_key_y == rhs.public_key_y)) {
6742 return false;
6743 }
6744 if (!(lhs.signature == rhs.signature)) {
6745 return false;
6746 }
6747 if (!(lhs.hashed_message == rhs.hashed_message)) {
6748 return false;
6749 }
6750 if (!(lhs.predicate == rhs.predicate)) {
6751 return false;
6752 }
6753 if (!(lhs.output == rhs.output)) {
6754 return false;
6755 }
6756 return true;
6757}
6758
6760{
6761 auto serializer = serde::BincodeSerializer();
6763 return std::move(serializer).bytes();
6764}
6765
6767{
6768 auto deserializer = serde::BincodeDeserializer(input);
6770 if (deserializer.get_buffer_offset() < input.size()) {
6771 throw_or_abort("Some input bytes were not read");
6772 }
6773 return value;
6774}
6775
6776} // end of namespace Acir
6777
6778template <>
6779template <typename Serializer>
6781 const Acir::BlackBoxFuncCall::EcdsaSecp256k1& obj, Serializer& serializer)
6782{
6783 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
6784 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
6785 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
6786 serde::Serializable<decltype(obj.hashed_message)>::serialize(obj.hashed_message, serializer);
6787 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6788 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6789}
6790
6791template <>
6792template <typename Deserializer>
6794 Deserializer& deserializer)
6795{
6797 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
6798 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
6799 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
6800 obj.hashed_message = serde::Deserializable<decltype(obj.hashed_message)>::deserialize(deserializer);
6801 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6802 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6803 return obj;
6804}
6805
6806namespace Acir {
6807
6809{
6810 if (!(lhs.public_key_x == rhs.public_key_x)) {
6811 return false;
6812 }
6813 if (!(lhs.public_key_y == rhs.public_key_y)) {
6814 return false;
6815 }
6816 if (!(lhs.signature == rhs.signature)) {
6817 return false;
6818 }
6819 if (!(lhs.hashed_message == rhs.hashed_message)) {
6820 return false;
6821 }
6822 if (!(lhs.predicate == rhs.predicate)) {
6823 return false;
6824 }
6825 if (!(lhs.output == rhs.output)) {
6826 return false;
6827 }
6828 return true;
6829}
6830
6832{
6833 auto serializer = serde::BincodeSerializer();
6835 return std::move(serializer).bytes();
6836}
6837
6839{
6840 auto deserializer = serde::BincodeDeserializer(input);
6842 if (deserializer.get_buffer_offset() < input.size()) {
6843 throw_or_abort("Some input bytes were not read");
6844 }
6845 return value;
6846}
6847
6848} // end of namespace Acir
6849
6850template <>
6851template <typename Serializer>
6853 const Acir::BlackBoxFuncCall::EcdsaSecp256r1& obj, Serializer& serializer)
6854{
6855 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
6856 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
6857 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
6858 serde::Serializable<decltype(obj.hashed_message)>::serialize(obj.hashed_message, serializer);
6859 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6860 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6861}
6862
6863template <>
6864template <typename Deserializer>
6866 Deserializer& deserializer)
6867{
6869 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
6870 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
6871 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
6872 obj.hashed_message = serde::Deserializable<decltype(obj.hashed_message)>::deserialize(deserializer);
6873 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6874 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6875 return obj;
6876}
6877
6878namespace Acir {
6879
6881{
6882 if (!(lhs.points == rhs.points)) {
6883 return false;
6884 }
6885 if (!(lhs.scalars == rhs.scalars)) {
6886 return false;
6887 }
6888 if (!(lhs.predicate == rhs.predicate)) {
6889 return false;
6890 }
6891 if (!(lhs.outputs == rhs.outputs)) {
6892 return false;
6893 }
6894 return true;
6895}
6896
6898{
6899 auto serializer = serde::BincodeSerializer();
6901 return std::move(serializer).bytes();
6902}
6903
6905{
6906 auto deserializer = serde::BincodeDeserializer(input);
6908 if (deserializer.get_buffer_offset() < input.size()) {
6909 throw_or_abort("Some input bytes were not read");
6910 }
6911 return value;
6912}
6913
6914} // end of namespace Acir
6915
6916template <>
6917template <typename Serializer>
6919 const Acir::BlackBoxFuncCall::MultiScalarMul& obj, Serializer& serializer)
6920{
6921 serde::Serializable<decltype(obj.points)>::serialize(obj.points, serializer);
6922 serde::Serializable<decltype(obj.scalars)>::serialize(obj.scalars, serializer);
6923 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6924 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6925}
6926
6927template <>
6928template <typename Deserializer>
6930 Deserializer& deserializer)
6931{
6933 obj.points = serde::Deserializable<decltype(obj.points)>::deserialize(deserializer);
6934 obj.scalars = serde::Deserializable<decltype(obj.scalars)>::deserialize(deserializer);
6935 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6936 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6937 return obj;
6938}
6939
6940namespace Acir {
6941
6943{
6944 if (!(lhs.input1 == rhs.input1)) {
6945 return false;
6946 }
6947 if (!(lhs.input2 == rhs.input2)) {
6948 return false;
6949 }
6950 if (!(lhs.predicate == rhs.predicate)) {
6951 return false;
6952 }
6953 if (!(lhs.outputs == rhs.outputs)) {
6954 return false;
6955 }
6956 return true;
6957}
6958
6960{
6961 auto serializer = serde::BincodeSerializer();
6963 return std::move(serializer).bytes();
6964}
6965
6967 std::vector<uint8_t> input)
6968{
6969 auto deserializer = serde::BincodeDeserializer(input);
6971 if (deserializer.get_buffer_offset() < input.size()) {
6972 throw_or_abort("Some input bytes were not read");
6973 }
6974 return value;
6975}
6976
6977} // end of namespace Acir
6978
6979template <>
6980template <typename Serializer>
6982 const Acir::BlackBoxFuncCall::EmbeddedCurveAdd& obj, Serializer& serializer)
6983{
6984 serde::Serializable<decltype(obj.input1)>::serialize(obj.input1, serializer);
6985 serde::Serializable<decltype(obj.input2)>::serialize(obj.input2, serializer);
6986 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6987 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6988}
6989
6990template <>
6991template <typename Deserializer>
6993 Deserializer& deserializer)
6994{
6996 obj.input1 = serde::Deserializable<decltype(obj.input1)>::deserialize(deserializer);
6997 obj.input2 = serde::Deserializable<decltype(obj.input2)>::deserialize(deserializer);
6998 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6999 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7000 return obj;
7001}
7002
7003namespace Acir {
7004
7006{
7007 if (!(lhs.inputs == rhs.inputs)) {
7008 return false;
7009 }
7010 if (!(lhs.outputs == rhs.outputs)) {
7011 return false;
7012 }
7013 return true;
7014}
7015
7016inline std::vector<uint8_t> BlackBoxFuncCall::Keccakf1600::bincodeSerialize() const
7017{
7018 auto serializer = serde::BincodeSerializer();
7020 return std::move(serializer).bytes();
7021}
7022
7024{
7025 auto deserializer = serde::BincodeDeserializer(input);
7027 if (deserializer.get_buffer_offset() < input.size()) {
7028 throw_or_abort("Some input bytes were not read");
7029 }
7030 return value;
7031}
7032
7033} // end of namespace Acir
7034
7035template <>
7036template <typename Serializer>
7038 Serializer& serializer)
7039{
7040 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7041 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7042}
7043
7044template <>
7045template <typename Deserializer>
7047 Deserializer& deserializer)
7048{
7050 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7051 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7052 return obj;
7053}
7054
7055namespace Acir {
7056
7059{
7060 if (!(lhs.verification_key == rhs.verification_key)) {
7061 return false;
7062 }
7063 if (!(lhs.proof == rhs.proof)) {
7064 return false;
7065 }
7066 if (!(lhs.public_inputs == rhs.public_inputs)) {
7067 return false;
7068 }
7069 if (!(lhs.key_hash == rhs.key_hash)) {
7070 return false;
7071 }
7072 if (!(lhs.proof_type == rhs.proof_type)) {
7073 return false;
7074 }
7075 if (!(lhs.predicate == rhs.predicate)) {
7076 return false;
7077 }
7078 return true;
7079}
7080
7082{
7083 auto serializer = serde::BincodeSerializer();
7085 return std::move(serializer).bytes();
7086}
7087
7089 std::vector<uint8_t> input)
7090{
7091 auto deserializer = serde::BincodeDeserializer(input);
7093 if (deserializer.get_buffer_offset() < input.size()) {
7094 throw_or_abort("Some input bytes were not read");
7095 }
7096 return value;
7097}
7098
7099} // end of namespace Acir
7100
7101template <>
7102template <typename Serializer>
7104 const Acir::BlackBoxFuncCall::RecursiveAggregation& obj, Serializer& serializer)
7105{
7106 serde::Serializable<decltype(obj.verification_key)>::serialize(obj.verification_key, serializer);
7107 serde::Serializable<decltype(obj.proof)>::serialize(obj.proof, serializer);
7108 serde::Serializable<decltype(obj.public_inputs)>::serialize(obj.public_inputs, serializer);
7109 serde::Serializable<decltype(obj.key_hash)>::serialize(obj.key_hash, serializer);
7110 serde::Serializable<decltype(obj.proof_type)>::serialize(obj.proof_type, serializer);
7111 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
7112}
7113
7114template <>
7115template <typename Deserializer>
7117 Acir::BlackBoxFuncCall::RecursiveAggregation>::deserialize(Deserializer& deserializer)
7118{
7120 obj.verification_key = serde::Deserializable<decltype(obj.verification_key)>::deserialize(deserializer);
7121 obj.proof = serde::Deserializable<decltype(obj.proof)>::deserialize(deserializer);
7122 obj.public_inputs = serde::Deserializable<decltype(obj.public_inputs)>::deserialize(deserializer);
7123 obj.key_hash = serde::Deserializable<decltype(obj.key_hash)>::deserialize(deserializer);
7124 obj.proof_type = serde::Deserializable<decltype(obj.proof_type)>::deserialize(deserializer);
7125 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
7126 return obj;
7127}
7128
7129namespace Acir {
7130
7133{
7134 if (!(lhs.inputs == rhs.inputs)) {
7135 return false;
7136 }
7137 if (!(lhs.outputs == rhs.outputs)) {
7138 return false;
7139 }
7140 return true;
7141}
7142
7144{
7145 auto serializer = serde::BincodeSerializer();
7147 return std::move(serializer).bytes();
7148}
7149
7151 std::vector<uint8_t> input)
7152{
7153 auto deserializer = serde::BincodeDeserializer(input);
7155 if (deserializer.get_buffer_offset() < input.size()) {
7156 throw_or_abort("Some input bytes were not read");
7157 }
7158 return value;
7159}
7160
7161} // end of namespace Acir
7162
7163template <>
7164template <typename Serializer>
7166 const Acir::BlackBoxFuncCall::Poseidon2Permutation& obj, Serializer& serializer)
7167{
7168 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7169 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7170}
7171
7172template <>
7173template <typename Deserializer>
7175 Acir::BlackBoxFuncCall::Poseidon2Permutation>::deserialize(Deserializer& deserializer)
7176{
7178 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7179 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7180 return obj;
7181}
7182
7183namespace Acir {
7184
7186{
7187 if (!(lhs.inputs == rhs.inputs)) {
7188 return false;
7189 }
7190 if (!(lhs.hash_values == rhs.hash_values)) {
7191 return false;
7192 }
7193 if (!(lhs.outputs == rhs.outputs)) {
7194 return false;
7195 }
7196 return true;
7197}
7198
7200{
7201 auto serializer = serde::BincodeSerializer();
7203 return std::move(serializer).bytes();
7204}
7205
7207 std::vector<uint8_t> input)
7208{
7209 auto deserializer = serde::BincodeDeserializer(input);
7211 if (deserializer.get_buffer_offset() < input.size()) {
7212 throw_or_abort("Some input bytes were not read");
7213 }
7214 return value;
7215}
7216
7217} // end of namespace Acir
7218
7219template <>
7220template <typename Serializer>
7222 const Acir::BlackBoxFuncCall::Sha256Compression& obj, Serializer& serializer)
7223{
7224 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7225 serde::Serializable<decltype(obj.hash_values)>::serialize(obj.hash_values, serializer);
7226 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7227}
7228
7229template <>
7230template <typename Deserializer>
7232 Deserializer& deserializer)
7233{
7235 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7236 obj.hash_values = serde::Deserializable<decltype(obj.hash_values)>::deserialize(deserializer);
7237 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7238 return obj;
7239}
7240
7241namespace Acir {
7242
7243inline bool operator==(const BlackBoxOp& lhs, const BlackBoxOp& rhs)
7244{
7245 if (!(lhs.value == rhs.value)) {
7246 return false;
7247 }
7248 return true;
7249}
7250
7251inline std::vector<uint8_t> BlackBoxOp::bincodeSerialize() const
7252{
7253 auto serializer = serde::BincodeSerializer();
7255 return std::move(serializer).bytes();
7256}
7257
7258inline BlackBoxOp BlackBoxOp::bincodeDeserialize(std::vector<uint8_t> input)
7259{
7260 auto deserializer = serde::BincodeDeserializer(input);
7262 if (deserializer.get_buffer_offset() < input.size()) {
7263 throw_or_abort("Some input bytes were not read");
7264 }
7265 return value;
7266}
7267
7268} // end of namespace Acir
7269
7270template <>
7271template <typename Serializer>
7273{
7274 serializer.increase_container_depth();
7275 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
7276 serializer.decrease_container_depth();
7277}
7278
7279template <>
7280template <typename Deserializer>
7282{
7283 deserializer.increase_container_depth();
7284 Acir::BlackBoxOp obj;
7285 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
7286 deserializer.decrease_container_depth();
7287 return obj;
7288}
7289
7290namespace Acir {
7291
7293{
7294 if (!(lhs.inputs == rhs.inputs)) {
7295 return false;
7296 }
7297 if (!(lhs.iv == rhs.iv)) {
7298 return false;
7299 }
7300 if (!(lhs.key == rhs.key)) {
7301 return false;
7302 }
7303 if (!(lhs.outputs == rhs.outputs)) {
7304 return false;
7305 }
7306 return true;
7307}
7308
7309inline std::vector<uint8_t> BlackBoxOp::AES128Encrypt::bincodeSerialize() const
7310{
7311 auto serializer = serde::BincodeSerializer();
7313 return std::move(serializer).bytes();
7314}
7315
7317{
7318 auto deserializer = serde::BincodeDeserializer(input);
7320 if (deserializer.get_buffer_offset() < input.size()) {
7321 throw_or_abort("Some input bytes were not read");
7322 }
7323 return value;
7324}
7325
7326} // end of namespace Acir
7327
7328template <>
7329template <typename Serializer>
7331 Serializer& serializer)
7332{
7333 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7334 serde::Serializable<decltype(obj.iv)>::serialize(obj.iv, serializer);
7335 serde::Serializable<decltype(obj.key)>::serialize(obj.key, serializer);
7336 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7337}
7338
7339template <>
7340template <typename Deserializer>
7342 Deserializer& deserializer)
7343{
7345 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7346 obj.iv = serde::Deserializable<decltype(obj.iv)>::deserialize(deserializer);
7347 obj.key = serde::Deserializable<decltype(obj.key)>::deserialize(deserializer);
7348 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7349 return obj;
7350}
7351
7352namespace Acir {
7353
7354inline bool operator==(const BlackBoxOp::Blake2s& lhs, const BlackBoxOp::Blake2s& rhs)
7355{
7356 if (!(lhs.message == rhs.message)) {
7357 return false;
7358 }
7359 if (!(lhs.output == rhs.output)) {
7360 return false;
7361 }
7362 return true;
7363}
7364
7365inline std::vector<uint8_t> BlackBoxOp::Blake2s::bincodeSerialize() const
7366{
7367 auto serializer = serde::BincodeSerializer();
7369 return std::move(serializer).bytes();
7370}
7371
7373{
7374 auto deserializer = serde::BincodeDeserializer(input);
7376 if (deserializer.get_buffer_offset() < input.size()) {
7377 throw_or_abort("Some input bytes were not read");
7378 }
7379 return value;
7380}
7381
7382} // end of namespace Acir
7383
7384template <>
7385template <typename Serializer>
7387 Serializer& serializer)
7388{
7389 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7390 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7391}
7392
7393template <>
7394template <typename Deserializer>
7396{
7398 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7399 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7400 return obj;
7401}
7402
7403namespace Acir {
7404
7405inline bool operator==(const BlackBoxOp::Blake3& lhs, const BlackBoxOp::Blake3& rhs)
7406{
7407 if (!(lhs.message == rhs.message)) {
7408 return false;
7409 }
7410 if (!(lhs.output == rhs.output)) {
7411 return false;
7412 }
7413 return true;
7414}
7415
7416inline std::vector<uint8_t> BlackBoxOp::Blake3::bincodeSerialize() const
7417{
7418 auto serializer = serde::BincodeSerializer();
7420 return std::move(serializer).bytes();
7421}
7422
7424{
7425 auto deserializer = serde::BincodeDeserializer(input);
7427 if (deserializer.get_buffer_offset() < input.size()) {
7428 throw_or_abort("Some input bytes were not read");
7429 }
7430 return value;
7431}
7432
7433} // end of namespace Acir
7434
7435template <>
7436template <typename Serializer>
7438 Serializer& serializer)
7439{
7440 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7441 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7442}
7443
7444template <>
7445template <typename Deserializer>
7447{
7449 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7450 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7451 return obj;
7452}
7453
7454namespace Acir {
7455
7457{
7458 if (!(lhs.input == rhs.input)) {
7459 return false;
7460 }
7461 if (!(lhs.output == rhs.output)) {
7462 return false;
7463 }
7464 return true;
7465}
7466
7467inline std::vector<uint8_t> BlackBoxOp::Keccakf1600::bincodeSerialize() const
7468{
7469 auto serializer = serde::BincodeSerializer();
7471 return std::move(serializer).bytes();
7472}
7473
7475{
7476 auto deserializer = serde::BincodeDeserializer(input);
7478 if (deserializer.get_buffer_offset() < input.size()) {
7479 throw_or_abort("Some input bytes were not read");
7480 }
7481 return value;
7482}
7483
7484} // end of namespace Acir
7485
7486template <>
7487template <typename Serializer>
7489 Serializer& serializer)
7490{
7491 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7492 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7493}
7494
7495template <>
7496template <typename Deserializer>
7498 Deserializer& deserializer)
7499{
7501 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7502 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7503 return obj;
7504}
7505
7506namespace Acir {
7507
7509{
7510 if (!(lhs.hashed_msg == rhs.hashed_msg)) {
7511 return false;
7512 }
7513 if (!(lhs.public_key_x == rhs.public_key_x)) {
7514 return false;
7515 }
7516 if (!(lhs.public_key_y == rhs.public_key_y)) {
7517 return false;
7518 }
7519 if (!(lhs.signature == rhs.signature)) {
7520 return false;
7521 }
7522 if (!(lhs.result == rhs.result)) {
7523 return false;
7524 }
7525 return true;
7526}
7527
7528inline std::vector<uint8_t> BlackBoxOp::EcdsaSecp256k1::bincodeSerialize() const
7529{
7530 auto serializer = serde::BincodeSerializer();
7532 return std::move(serializer).bytes();
7533}
7534
7536{
7537 auto deserializer = serde::BincodeDeserializer(input);
7539 if (deserializer.get_buffer_offset() < input.size()) {
7540 throw_or_abort("Some input bytes were not read");
7541 }
7542 return value;
7543}
7544
7545} // end of namespace Acir
7546
7547template <>
7548template <typename Serializer>
7550 Serializer& serializer)
7551{
7552 serde::Serializable<decltype(obj.hashed_msg)>::serialize(obj.hashed_msg, serializer);
7553 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
7554 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
7555 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
7556 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7557}
7558
7559template <>
7560template <typename Deserializer>
7562 Deserializer& deserializer)
7563{
7565 obj.hashed_msg = serde::Deserializable<decltype(obj.hashed_msg)>::deserialize(deserializer);
7566 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
7567 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
7568 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
7569 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7570 return obj;
7571}
7572
7573namespace Acir {
7574
7576{
7577 if (!(lhs.hashed_msg == rhs.hashed_msg)) {
7578 return false;
7579 }
7580 if (!(lhs.public_key_x == rhs.public_key_x)) {
7581 return false;
7582 }
7583 if (!(lhs.public_key_y == rhs.public_key_y)) {
7584 return false;
7585 }
7586 if (!(lhs.signature == rhs.signature)) {
7587 return false;
7588 }
7589 if (!(lhs.result == rhs.result)) {
7590 return false;
7591 }
7592 return true;
7593}
7594
7595inline std::vector<uint8_t> BlackBoxOp::EcdsaSecp256r1::bincodeSerialize() const
7596{
7597 auto serializer = serde::BincodeSerializer();
7599 return std::move(serializer).bytes();
7600}
7601
7603{
7604 auto deserializer = serde::BincodeDeserializer(input);
7606 if (deserializer.get_buffer_offset() < input.size()) {
7607 throw_or_abort("Some input bytes were not read");
7608 }
7609 return value;
7610}
7611
7612} // end of namespace Acir
7613
7614template <>
7615template <typename Serializer>
7617 Serializer& serializer)
7618{
7619 serde::Serializable<decltype(obj.hashed_msg)>::serialize(obj.hashed_msg, serializer);
7620 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
7621 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
7622 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
7623 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7624}
7625
7626template <>
7627template <typename Deserializer>
7629 Deserializer& deserializer)
7630{
7632 obj.hashed_msg = serde::Deserializable<decltype(obj.hashed_msg)>::deserialize(deserializer);
7633 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
7634 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
7635 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
7636 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7637 return obj;
7638}
7639
7640namespace Acir {
7641
7643{
7644 if (!(lhs.points == rhs.points)) {
7645 return false;
7646 }
7647 if (!(lhs.scalars == rhs.scalars)) {
7648 return false;
7649 }
7650 if (!(lhs.outputs == rhs.outputs)) {
7651 return false;
7652 }
7653 return true;
7654}
7655
7656inline std::vector<uint8_t> BlackBoxOp::MultiScalarMul::bincodeSerialize() const
7657{
7658 auto serializer = serde::BincodeSerializer();
7660 return std::move(serializer).bytes();
7661}
7662
7664{
7665 auto deserializer = serde::BincodeDeserializer(input);
7667 if (deserializer.get_buffer_offset() < input.size()) {
7668 throw_or_abort("Some input bytes were not read");
7669 }
7670 return value;
7671}
7672
7673} // end of namespace Acir
7674
7675template <>
7676template <typename Serializer>
7678 Serializer& serializer)
7679{
7680 serde::Serializable<decltype(obj.points)>::serialize(obj.points, serializer);
7681 serde::Serializable<decltype(obj.scalars)>::serialize(obj.scalars, serializer);
7682 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7683}
7684
7685template <>
7686template <typename Deserializer>
7688 Deserializer& deserializer)
7689{
7691 obj.points = serde::Deserializable<decltype(obj.points)>::deserialize(deserializer);
7692 obj.scalars = serde::Deserializable<decltype(obj.scalars)>::deserialize(deserializer);
7693 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7694 return obj;
7695}
7696
7697namespace Acir {
7698
7700{
7701 if (!(lhs.input1_x == rhs.input1_x)) {
7702 return false;
7703 }
7704 if (!(lhs.input1_y == rhs.input1_y)) {
7705 return false;
7706 }
7707 if (!(lhs.input1_infinite == rhs.input1_infinite)) {
7708 return false;
7709 }
7710 if (!(lhs.input2_x == rhs.input2_x)) {
7711 return false;
7712 }
7713 if (!(lhs.input2_y == rhs.input2_y)) {
7714 return false;
7715 }
7716 if (!(lhs.input2_infinite == rhs.input2_infinite)) {
7717 return false;
7718 }
7719 if (!(lhs.result == rhs.result)) {
7720 return false;
7721 }
7722 return true;
7723}
7724
7725inline std::vector<uint8_t> BlackBoxOp::EmbeddedCurveAdd::bincodeSerialize() const
7726{
7727 auto serializer = serde::BincodeSerializer();
7729 return std::move(serializer).bytes();
7730}
7731
7733{
7734 auto deserializer = serde::BincodeDeserializer(input);
7736 if (deserializer.get_buffer_offset() < input.size()) {
7737 throw_or_abort("Some input bytes were not read");
7738 }
7739 return value;
7740}
7741
7742} // end of namespace Acir
7743
7744template <>
7745template <typename Serializer>
7747 Serializer& serializer)
7748{
7749 serde::Serializable<decltype(obj.input1_x)>::serialize(obj.input1_x, serializer);
7750 serde::Serializable<decltype(obj.input1_y)>::serialize(obj.input1_y, serializer);
7751 serde::Serializable<decltype(obj.input1_infinite)>::serialize(obj.input1_infinite, serializer);
7752 serde::Serializable<decltype(obj.input2_x)>::serialize(obj.input2_x, serializer);
7753 serde::Serializable<decltype(obj.input2_y)>::serialize(obj.input2_y, serializer);
7754 serde::Serializable<decltype(obj.input2_infinite)>::serialize(obj.input2_infinite, serializer);
7755 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7756}
7757
7758template <>
7759template <typename Deserializer>
7761 Deserializer& deserializer)
7762{
7764 obj.input1_x = serde::Deserializable<decltype(obj.input1_x)>::deserialize(deserializer);
7765 obj.input1_y = serde::Deserializable<decltype(obj.input1_y)>::deserialize(deserializer);
7766 obj.input1_infinite = serde::Deserializable<decltype(obj.input1_infinite)>::deserialize(deserializer);
7767 obj.input2_x = serde::Deserializable<decltype(obj.input2_x)>::deserialize(deserializer);
7768 obj.input2_y = serde::Deserializable<decltype(obj.input2_y)>::deserialize(deserializer);
7769 obj.input2_infinite = serde::Deserializable<decltype(obj.input2_infinite)>::deserialize(deserializer);
7770 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7771 return obj;
7772}
7773
7774namespace Acir {
7775
7777{
7778 if (!(lhs.message == rhs.message)) {
7779 return false;
7780 }
7781 if (!(lhs.output == rhs.output)) {
7782 return false;
7783 }
7784 return true;
7785}
7786
7788{
7789 auto serializer = serde::BincodeSerializer();
7791 return std::move(serializer).bytes();
7792}
7793
7795{
7796 auto deserializer = serde::BincodeDeserializer(input);
7798 if (deserializer.get_buffer_offset() < input.size()) {
7799 throw_or_abort("Some input bytes were not read");
7800 }
7801 return value;
7802}
7803
7804} // end of namespace Acir
7805
7806template <>
7807template <typename Serializer>
7809 const Acir::BlackBoxOp::Poseidon2Permutation& obj, Serializer& serializer)
7810{
7811 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7812 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7813}
7814
7815template <>
7816template <typename Deserializer>
7818 Deserializer& deserializer)
7819{
7821 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7822 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7823 return obj;
7824}
7825
7826namespace Acir {
7827
7829{
7830 if (!(lhs.input == rhs.input)) {
7831 return false;
7832 }
7833 if (!(lhs.hash_values == rhs.hash_values)) {
7834 return false;
7835 }
7836 if (!(lhs.output == rhs.output)) {
7837 return false;
7838 }
7839 return true;
7840}
7841
7842inline std::vector<uint8_t> BlackBoxOp::Sha256Compression::bincodeSerialize() const
7843{
7844 auto serializer = serde::BincodeSerializer();
7846 return std::move(serializer).bytes();
7847}
7848
7850{
7851 auto deserializer = serde::BincodeDeserializer(input);
7853 if (deserializer.get_buffer_offset() < input.size()) {
7854 throw_or_abort("Some input bytes were not read");
7855 }
7856 return value;
7857}
7858
7859} // end of namespace Acir
7860
7861template <>
7862template <typename Serializer>
7864 Serializer& serializer)
7865{
7866 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7867 serde::Serializable<decltype(obj.hash_values)>::serialize(obj.hash_values, serializer);
7868 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7869}
7870
7871template <>
7872template <typename Deserializer>
7874 Deserializer& deserializer)
7875{
7877 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7878 obj.hash_values = serde::Deserializable<decltype(obj.hash_values)>::deserialize(deserializer);
7879 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7880 return obj;
7881}
7882
7883namespace Acir {
7884
7885inline bool operator==(const BlackBoxOp::ToRadix& lhs, const BlackBoxOp::ToRadix& rhs)
7886{
7887 if (!(lhs.input == rhs.input)) {
7888 return false;
7889 }
7890 if (!(lhs.radix == rhs.radix)) {
7891 return false;
7892 }
7893 if (!(lhs.output_pointer == rhs.output_pointer)) {
7894 return false;
7895 }
7896 if (!(lhs.num_limbs == rhs.num_limbs)) {
7897 return false;
7898 }
7899 if (!(lhs.output_bits == rhs.output_bits)) {
7900 return false;
7901 }
7902 return true;
7903}
7904
7905inline std::vector<uint8_t> BlackBoxOp::ToRadix::bincodeSerialize() const
7906{
7907 auto serializer = serde::BincodeSerializer();
7909 return std::move(serializer).bytes();
7910}
7911
7913{
7914 auto deserializer = serde::BincodeDeserializer(input);
7916 if (deserializer.get_buffer_offset() < input.size()) {
7917 throw_or_abort("Some input bytes were not read");
7918 }
7919 return value;
7920}
7921
7922} // end of namespace Acir
7923
7924template <>
7925template <typename Serializer>
7927 Serializer& serializer)
7928{
7929 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7930 serde::Serializable<decltype(obj.radix)>::serialize(obj.radix, serializer);
7931 serde::Serializable<decltype(obj.output_pointer)>::serialize(obj.output_pointer, serializer);
7932 serde::Serializable<decltype(obj.num_limbs)>::serialize(obj.num_limbs, serializer);
7933 serde::Serializable<decltype(obj.output_bits)>::serialize(obj.output_bits, serializer);
7934}
7935
7936template <>
7937template <typename Deserializer>
7939{
7941 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7942 obj.radix = serde::Deserializable<decltype(obj.radix)>::deserialize(deserializer);
7943 obj.output_pointer = serde::Deserializable<decltype(obj.output_pointer)>::deserialize(deserializer);
7944 obj.num_limbs = serde::Deserializable<decltype(obj.num_limbs)>::deserialize(deserializer);
7945 obj.output_bits = serde::Deserializable<decltype(obj.output_bits)>::deserialize(deserializer);
7946 return obj;
7947}
7948
7949namespace Acir {
7950
7951inline bool operator==(const BlockId& lhs, const BlockId& rhs)
7952{
7953 if (!(lhs.value == rhs.value)) {
7954 return false;
7955 }
7956 return true;
7957}
7958
7959inline std::vector<uint8_t> BlockId::bincodeSerialize() const
7960{
7961 auto serializer = serde::BincodeSerializer();
7962 serde::Serializable<BlockId>::serialize(*this, serializer);
7963 return std::move(serializer).bytes();
7964}
7965
7966inline BlockId BlockId::bincodeDeserialize(std::vector<uint8_t> input)
7967{
7968 auto deserializer = serde::BincodeDeserializer(input);
7970 if (deserializer.get_buffer_offset() < input.size()) {
7971 throw_or_abort("Some input bytes were not read");
7972 }
7973 return value;
7974}
7975
7976} // end of namespace Acir
7977
7978template <>
7979template <typename Serializer>
7980void serde::Serializable<Acir::BlockId>::serialize(const Acir::BlockId& obj, Serializer& serializer)
7981{
7982 serializer.increase_container_depth();
7983 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
7984 serializer.decrease_container_depth();
7985}
7986
7987template <>
7988template <typename Deserializer>
7990{
7991 deserializer.increase_container_depth();
7992 Acir::BlockId obj;
7993 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
7994 deserializer.decrease_container_depth();
7995 return obj;
7996}
7997
7998namespace Acir {
7999
8000inline bool operator==(const BlockType& lhs, const BlockType& rhs)
8001{
8002 if (!(lhs.value == rhs.value)) {
8003 return false;
8004 }
8005 return true;
8006}
8007
8008inline std::vector<uint8_t> BlockType::bincodeSerialize() const
8009{
8010 auto serializer = serde::BincodeSerializer();
8012 return std::move(serializer).bytes();
8013}
8014
8015inline BlockType BlockType::bincodeDeserialize(std::vector<uint8_t> input)
8016{
8017 auto deserializer = serde::BincodeDeserializer(input);
8019 if (deserializer.get_buffer_offset() < input.size()) {
8020 throw_or_abort("Some input bytes were not read");
8021 }
8022 return value;
8023}
8024
8025} // end of namespace Acir
8026
8027template <>
8028template <typename Serializer>
8030{
8031 serializer.increase_container_depth();
8032 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8033 serializer.decrease_container_depth();
8034}
8035
8036template <>
8037template <typename Deserializer>
8039{
8040 deserializer.increase_container_depth();
8041 Acir::BlockType obj;
8042 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8043 deserializer.decrease_container_depth();
8044 return obj;
8045}
8046
8047namespace Acir {
8048
8049inline bool operator==(const BlockType::Memory& lhs, const BlockType::Memory& rhs)
8050{
8051 return true;
8052}
8053
8054inline std::vector<uint8_t> BlockType::Memory::bincodeSerialize() const
8055{
8056 auto serializer = serde::BincodeSerializer();
8058 return std::move(serializer).bytes();
8059}
8060
8062{
8063 auto deserializer = serde::BincodeDeserializer(input);
8065 if (deserializer.get_buffer_offset() < input.size()) {
8066 throw_or_abort("Some input bytes were not read");
8067 }
8068 return value;
8069}
8070
8071} // end of namespace Acir
8072
8073template <>
8074template <typename Serializer>
8077
8078template <>
8079template <typename Deserializer>
8085
8086namespace Acir {
8087
8088inline bool operator==(const BlockType::CallData& lhs, const BlockType::CallData& rhs)
8089{
8090 if (!(lhs.value == rhs.value)) {
8091 return false;
8092 }
8093 return true;
8094}
8095
8096inline std::vector<uint8_t> BlockType::CallData::bincodeSerialize() const
8097{
8098 auto serializer = serde::BincodeSerializer();
8100 return std::move(serializer).bytes();
8101}
8102
8104{
8105 auto deserializer = serde::BincodeDeserializer(input);
8107 if (deserializer.get_buffer_offset() < input.size()) {
8108 throw_or_abort("Some input bytes were not read");
8109 }
8110 return value;
8111}
8112
8113} // end of namespace Acir
8114
8115template <>
8116template <typename Serializer>
8118 Serializer& serializer)
8119{
8120 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8121}
8122
8123template <>
8124template <typename Deserializer>
8126{
8128 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8129 return obj;
8130}
8131
8132namespace Acir {
8133
8134inline bool operator==(const BlockType::ReturnData& lhs, const BlockType::ReturnData& rhs)
8135{
8136 return true;
8137}
8138
8139inline std::vector<uint8_t> BlockType::ReturnData::bincodeSerialize() const
8140{
8141 auto serializer = serde::BincodeSerializer();
8143 return std::move(serializer).bytes();
8144}
8145
8147{
8148 auto deserializer = serde::BincodeDeserializer(input);
8150 if (deserializer.get_buffer_offset() < input.size()) {
8151 throw_or_abort("Some input bytes were not read");
8152 }
8153 return value;
8154}
8155
8156} // end of namespace Acir
8157
8158template <>
8159template <typename Serializer>
8163
8164template <>
8165template <typename Deserializer>
8171
8172namespace Acir {
8173
8174inline bool operator==(const BrilligBytecode& lhs, const BrilligBytecode& rhs)
8175{
8176 if (!(lhs.function_name == rhs.function_name)) {
8177 return false;
8178 }
8179 if (!(lhs.bytecode == rhs.bytecode)) {
8180 return false;
8181 }
8182 return true;
8183}
8184
8185inline std::vector<uint8_t> BrilligBytecode::bincodeSerialize() const
8186{
8187 auto serializer = serde::BincodeSerializer();
8189 return std::move(serializer).bytes();
8190}
8191
8193{
8194 auto deserializer = serde::BincodeDeserializer(input);
8196 if (deserializer.get_buffer_offset() < input.size()) {
8197 throw_or_abort("Some input bytes were not read");
8198 }
8199 return value;
8200}
8201
8202} // end of namespace Acir
8203
8204template <>
8205template <typename Serializer>
8207{
8208 serializer.increase_container_depth();
8209 serde::Serializable<decltype(obj.function_name)>::serialize(obj.function_name, serializer);
8210 serde::Serializable<decltype(obj.bytecode)>::serialize(obj.bytecode, serializer);
8211 serializer.decrease_container_depth();
8212}
8213
8214template <>
8215template <typename Deserializer>
8217{
8218 deserializer.increase_container_depth();
8220 obj.function_name = serde::Deserializable<decltype(obj.function_name)>::deserialize(deserializer);
8221 obj.bytecode = serde::Deserializable<decltype(obj.bytecode)>::deserialize(deserializer);
8222 deserializer.decrease_container_depth();
8223 return obj;
8224}
8225
8226namespace Acir {
8227
8228inline bool operator==(const BrilligInputs& lhs, const BrilligInputs& rhs)
8229{
8230 if (!(lhs.value == rhs.value)) {
8231 return false;
8232 }
8233 return true;
8234}
8235
8236inline std::vector<uint8_t> BrilligInputs::bincodeSerialize() const
8237{
8238 auto serializer = serde::BincodeSerializer();
8240 return std::move(serializer).bytes();
8241}
8242
8243inline BrilligInputs BrilligInputs::bincodeDeserialize(std::vector<uint8_t> input)
8244{
8245 auto deserializer = serde::BincodeDeserializer(input);
8247 if (deserializer.get_buffer_offset() < input.size()) {
8248 throw_or_abort("Some input bytes were not read");
8249 }
8250 return value;
8251}
8252
8253} // end of namespace Acir
8254
8255template <>
8256template <typename Serializer>
8258{
8259 serializer.increase_container_depth();
8260 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8261 serializer.decrease_container_depth();
8262}
8263
8264template <>
8265template <typename Deserializer>
8267{
8268 deserializer.increase_container_depth();
8270 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8271 deserializer.decrease_container_depth();
8272 return obj;
8273}
8274
8275namespace Acir {
8276
8277inline bool operator==(const BrilligInputs::Single& lhs, const BrilligInputs::Single& rhs)
8278{
8279 if (!(lhs.value == rhs.value)) {
8280 return false;
8281 }
8282 return true;
8283}
8284
8285inline std::vector<uint8_t> BrilligInputs::Single::bincodeSerialize() const
8286{
8287 auto serializer = serde::BincodeSerializer();
8289 return std::move(serializer).bytes();
8290}
8291
8293{
8294 auto deserializer = serde::BincodeDeserializer(input);
8296 if (deserializer.get_buffer_offset() < input.size()) {
8297 throw_or_abort("Some input bytes were not read");
8298 }
8299 return value;
8300}
8301
8302} // end of namespace Acir
8303
8304template <>
8305template <typename Serializer>
8307 Serializer& serializer)
8308{
8309 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8310}
8311
8312template <>
8313template <typename Deserializer>
8315{
8317 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8318 return obj;
8319}
8320
8321namespace Acir {
8322
8323inline bool operator==(const BrilligInputs::Array& lhs, const BrilligInputs::Array& rhs)
8324{
8325 if (!(lhs.value == rhs.value)) {
8326 return false;
8327 }
8328 return true;
8329}
8330
8331inline std::vector<uint8_t> BrilligInputs::Array::bincodeSerialize() const
8332{
8333 auto serializer = serde::BincodeSerializer();
8335 return std::move(serializer).bytes();
8336}
8337
8339{
8340 auto deserializer = serde::BincodeDeserializer(input);
8342 if (deserializer.get_buffer_offset() < input.size()) {
8343 throw_or_abort("Some input bytes were not read");
8344 }
8345 return value;
8346}
8347
8348} // end of namespace Acir
8349
8350template <>
8351template <typename Serializer>
8353 Serializer& serializer)
8354{
8355 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8356}
8357
8358template <>
8359template <typename Deserializer>
8361{
8363 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8364 return obj;
8365}
8366
8367namespace Acir {
8368
8370{
8371 if (!(lhs.value == rhs.value)) {
8372 return false;
8373 }
8374 return true;
8375}
8376
8377inline std::vector<uint8_t> BrilligInputs::MemoryArray::bincodeSerialize() const
8378{
8379 auto serializer = serde::BincodeSerializer();
8381 return std::move(serializer).bytes();
8382}
8383
8385{
8386 auto deserializer = serde::BincodeDeserializer(input);
8388 if (deserializer.get_buffer_offset() < input.size()) {
8389 throw_or_abort("Some input bytes were not read");
8390 }
8391 return value;
8392}
8393
8394} // end of namespace Acir
8395
8396template <>
8397template <typename Serializer>
8399 Serializer& serializer)
8400{
8401 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8402}
8403
8404template <>
8405template <typename Deserializer>
8407 Deserializer& deserializer)
8408{
8410 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8411 return obj;
8412}
8413
8414namespace Acir {
8415
8416inline bool operator==(const BrilligOpcode& lhs, const BrilligOpcode& rhs)
8417{
8418 if (!(lhs.value == rhs.value)) {
8419 return false;
8420 }
8421 return true;
8422}
8423
8424inline std::vector<uint8_t> BrilligOpcode::bincodeSerialize() const
8425{
8426 auto serializer = serde::BincodeSerializer();
8428 return std::move(serializer).bytes();
8429}
8430
8431inline BrilligOpcode BrilligOpcode::bincodeDeserialize(std::vector<uint8_t> input)
8432{
8433 auto deserializer = serde::BincodeDeserializer(input);
8435 if (deserializer.get_buffer_offset() < input.size()) {
8436 throw_or_abort("Some input bytes were not read");
8437 }
8438 return value;
8439}
8440
8441} // end of namespace Acir
8442
8443template <>
8444template <typename Serializer>
8446{
8447 serializer.increase_container_depth();
8448 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8449 serializer.decrease_container_depth();
8450}
8451
8452template <>
8453template <typename Deserializer>
8455{
8456 deserializer.increase_container_depth();
8458 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8459 deserializer.decrease_container_depth();
8460 return obj;
8461}
8462
8463namespace Acir {
8464
8466{
8467 if (!(lhs.destination == rhs.destination)) {
8468 return false;
8469 }
8470 if (!(lhs.op == rhs.op)) {
8471 return false;
8472 }
8473 if (!(lhs.lhs == rhs.lhs)) {
8474 return false;
8475 }
8476 if (!(lhs.rhs == rhs.rhs)) {
8477 return false;
8478 }
8479 return true;
8480}
8481
8482inline std::vector<uint8_t> BrilligOpcode::BinaryFieldOp::bincodeSerialize() const
8483{
8484 auto serializer = serde::BincodeSerializer();
8486 return std::move(serializer).bytes();
8487}
8488
8490{
8491 auto deserializer = serde::BincodeDeserializer(input);
8493 if (deserializer.get_buffer_offset() < input.size()) {
8494 throw_or_abort("Some input bytes were not read");
8495 }
8496 return value;
8497}
8498
8499} // end of namespace Acir
8500
8501template <>
8502template <typename Serializer>
8504 Serializer& serializer)
8505{
8506 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8507 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
8508 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
8509 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
8510}
8511
8512template <>
8513template <typename Deserializer>
8515 Deserializer& deserializer)
8516{
8518 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8519 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
8520 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
8521 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
8522 return obj;
8523}
8524
8525namespace Acir {
8526
8528{
8529 if (!(lhs.destination == rhs.destination)) {
8530 return false;
8531 }
8532 if (!(lhs.op == rhs.op)) {
8533 return false;
8534 }
8535 if (!(lhs.bit_size == rhs.bit_size)) {
8536 return false;
8537 }
8538 if (!(lhs.lhs == rhs.lhs)) {
8539 return false;
8540 }
8541 if (!(lhs.rhs == rhs.rhs)) {
8542 return false;
8543 }
8544 return true;
8545}
8546
8547inline std::vector<uint8_t> BrilligOpcode::BinaryIntOp::bincodeSerialize() const
8548{
8549 auto serializer = serde::BincodeSerializer();
8551 return std::move(serializer).bytes();
8552}
8553
8555{
8556 auto deserializer = serde::BincodeDeserializer(input);
8558 if (deserializer.get_buffer_offset() < input.size()) {
8559 throw_or_abort("Some input bytes were not read");
8560 }
8561 return value;
8562}
8563
8564} // end of namespace Acir
8565
8566template <>
8567template <typename Serializer>
8569 Serializer& serializer)
8570{
8571 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8572 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
8573 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8574 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
8575 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
8576}
8577
8578template <>
8579template <typename Deserializer>
8581 Deserializer& deserializer)
8582{
8584 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8585 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
8586 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8587 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
8588 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
8589 return obj;
8590}
8591
8592namespace Acir {
8593
8594inline bool operator==(const BrilligOpcode::Not& lhs, const BrilligOpcode::Not& rhs)
8595{
8596 if (!(lhs.destination == rhs.destination)) {
8597 return false;
8598 }
8599 if (!(lhs.source == rhs.source)) {
8600 return false;
8601 }
8602 if (!(lhs.bit_size == rhs.bit_size)) {
8603 return false;
8604 }
8605 return true;
8606}
8607
8608inline std::vector<uint8_t> BrilligOpcode::Not::bincodeSerialize() const
8609{
8610 auto serializer = serde::BincodeSerializer();
8612 return std::move(serializer).bytes();
8613}
8614
8616{
8617 auto deserializer = serde::BincodeDeserializer(input);
8619 if (deserializer.get_buffer_offset() < input.size()) {
8620 throw_or_abort("Some input bytes were not read");
8621 }
8622 return value;
8623}
8624
8625} // end of namespace Acir
8626
8627template <>
8628template <typename Serializer>
8630 Serializer& serializer)
8631{
8632 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8633 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
8634 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8635}
8636
8637template <>
8638template <typename Deserializer>
8640{
8642 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8643 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
8644 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8645 return obj;
8646}
8647
8648namespace Acir {
8649
8650inline bool operator==(const BrilligOpcode::Cast& lhs, const BrilligOpcode::Cast& rhs)
8651{
8652 if (!(lhs.destination == rhs.destination)) {
8653 return false;
8654 }
8655 if (!(lhs.source == rhs.source)) {
8656 return false;
8657 }
8658 if (!(lhs.bit_size == rhs.bit_size)) {
8659 return false;
8660 }
8661 return true;
8662}
8663
8664inline std::vector<uint8_t> BrilligOpcode::Cast::bincodeSerialize() const
8665{
8666 auto serializer = serde::BincodeSerializer();
8668 return std::move(serializer).bytes();
8669}
8670
8672{
8673 auto deserializer = serde::BincodeDeserializer(input);
8675 if (deserializer.get_buffer_offset() < input.size()) {
8676 throw_or_abort("Some input bytes were not read");
8677 }
8678 return value;
8679}
8680
8681} // end of namespace Acir
8682
8683template <>
8684template <typename Serializer>
8686 Serializer& serializer)
8687{
8688 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8689 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
8690 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8691}
8692
8693template <>
8694template <typename Deserializer>
8696{
8698 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8699 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
8700 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8701 return obj;
8702}
8703
8704namespace Acir {
8705
8706inline bool operator==(const BrilligOpcode::JumpIf& lhs, const BrilligOpcode::JumpIf& rhs)
8707{
8708 if (!(lhs.condition == rhs.condition)) {
8709 return false;
8710 }
8711 if (!(lhs.location == rhs.location)) {
8712 return false;
8713 }
8714 return true;
8715}
8716
8717inline std::vector<uint8_t> BrilligOpcode::JumpIf::bincodeSerialize() const
8718{
8719 auto serializer = serde::BincodeSerializer();
8721 return std::move(serializer).bytes();
8722}
8723
8725{
8726 auto deserializer = serde::BincodeDeserializer(input);
8728 if (deserializer.get_buffer_offset() < input.size()) {
8729 throw_or_abort("Some input bytes were not read");
8730 }
8731 return value;
8732}
8733
8734} // end of namespace Acir
8735
8736template <>
8737template <typename Serializer>
8739 Serializer& serializer)
8740{
8741 serde::Serializable<decltype(obj.condition)>::serialize(obj.condition, serializer);
8742 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8743}
8744
8745template <>
8746template <typename Deserializer>
8748{
8750 obj.condition = serde::Deserializable<decltype(obj.condition)>::deserialize(deserializer);
8751 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8752 return obj;
8753}
8754
8755namespace Acir {
8756
8757inline bool operator==(const BrilligOpcode::Jump& lhs, const BrilligOpcode::Jump& rhs)
8758{
8759 if (!(lhs.location == rhs.location)) {
8760 return false;
8761 }
8762 return true;
8763}
8764
8765inline std::vector<uint8_t> BrilligOpcode::Jump::bincodeSerialize() const
8766{
8767 auto serializer = serde::BincodeSerializer();
8769 return std::move(serializer).bytes();
8770}
8771
8773{
8774 auto deserializer = serde::BincodeDeserializer(input);
8776 if (deserializer.get_buffer_offset() < input.size()) {
8777 throw_or_abort("Some input bytes were not read");
8778 }
8779 return value;
8780}
8781
8782} // end of namespace Acir
8783
8784template <>
8785template <typename Serializer>
8787 Serializer& serializer)
8788{
8789 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8790}
8791
8792template <>
8793template <typename Deserializer>
8795{
8797 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8798 return obj;
8799}
8800
8801namespace Acir {
8802
8804{
8805 if (!(lhs.destination_address == rhs.destination_address)) {
8806 return false;
8807 }
8808 if (!(lhs.size_address == rhs.size_address)) {
8809 return false;
8810 }
8811 if (!(lhs.offset_address == rhs.offset_address)) {
8812 return false;
8813 }
8814 return true;
8815}
8816
8817inline std::vector<uint8_t> BrilligOpcode::CalldataCopy::bincodeSerialize() const
8818{
8819 auto serializer = serde::BincodeSerializer();
8821 return std::move(serializer).bytes();
8822}
8823
8825{
8826 auto deserializer = serde::BincodeDeserializer(input);
8828 if (deserializer.get_buffer_offset() < input.size()) {
8829 throw_or_abort("Some input bytes were not read");
8830 }
8831 return value;
8832}
8833
8834} // end of namespace Acir
8835
8836template <>
8837template <typename Serializer>
8839 Serializer& serializer)
8840{
8841 serde::Serializable<decltype(obj.destination_address)>::serialize(obj.destination_address, serializer);
8842 serde::Serializable<decltype(obj.size_address)>::serialize(obj.size_address, serializer);
8843 serde::Serializable<decltype(obj.offset_address)>::serialize(obj.offset_address, serializer);
8844}
8845
8846template <>
8847template <typename Deserializer>
8849 Deserializer& deserializer)
8850{
8852 obj.destination_address = serde::Deserializable<decltype(obj.destination_address)>::deserialize(deserializer);
8853 obj.size_address = serde::Deserializable<decltype(obj.size_address)>::deserialize(deserializer);
8854 obj.offset_address = serde::Deserializable<decltype(obj.offset_address)>::deserialize(deserializer);
8855 return obj;
8856}
8857
8858namespace Acir {
8859
8860inline bool operator==(const BrilligOpcode::Call& lhs, const BrilligOpcode::Call& rhs)
8861{
8862 if (!(lhs.location == rhs.location)) {
8863 return false;
8864 }
8865 return true;
8866}
8867
8868inline std::vector<uint8_t> BrilligOpcode::Call::bincodeSerialize() const
8869{
8870 auto serializer = serde::BincodeSerializer();
8872 return std::move(serializer).bytes();
8873}
8874
8876{
8877 auto deserializer = serde::BincodeDeserializer(input);
8879 if (deserializer.get_buffer_offset() < input.size()) {
8880 throw_or_abort("Some input bytes were not read");
8881 }
8882 return value;
8883}
8884
8885} // end of namespace Acir
8886
8887template <>
8888template <typename Serializer>
8890 Serializer& serializer)
8891{
8892 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8893}
8894
8895template <>
8896template <typename Deserializer>
8898{
8900 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8901 return obj;
8902}
8903
8904namespace Acir {
8905
8906inline bool operator==(const BrilligOpcode::Const& lhs, const BrilligOpcode::Const& rhs)
8907{
8908 if (!(lhs.destination == rhs.destination)) {
8909 return false;
8910 }
8911 if (!(lhs.bit_size == rhs.bit_size)) {
8912 return false;
8913 }
8914 if (!(lhs.value == rhs.value)) {
8915 return false;
8916 }
8917 return true;
8918}
8919
8920inline std::vector<uint8_t> BrilligOpcode::Const::bincodeSerialize() const
8921{
8922 auto serializer = serde::BincodeSerializer();
8924 return std::move(serializer).bytes();
8925}
8926
8928{
8929 auto deserializer = serde::BincodeDeserializer(input);
8931 if (deserializer.get_buffer_offset() < input.size()) {
8932 throw_or_abort("Some input bytes were not read");
8933 }
8934 return value;
8935}
8936
8937} // end of namespace Acir
8938
8939template <>
8940template <typename Serializer>
8942 Serializer& serializer)
8943{
8944 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8945 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8946 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8947}
8948
8949template <>
8950template <typename Deserializer>
8952{
8954 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8955 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8956 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8957 return obj;
8958}
8959
8960namespace Acir {
8961
8963{
8964 if (!(lhs.destination_pointer == rhs.destination_pointer)) {
8965 return false;
8966 }
8967 if (!(lhs.bit_size == rhs.bit_size)) {
8968 return false;
8969 }
8970 if (!(lhs.value == rhs.value)) {
8971 return false;
8972 }
8973 return true;
8974}
8975
8976inline std::vector<uint8_t> BrilligOpcode::IndirectConst::bincodeSerialize() const
8977{
8978 auto serializer = serde::BincodeSerializer();
8980 return std::move(serializer).bytes();
8981}
8982
8984{
8985 auto deserializer = serde::BincodeDeserializer(input);
8987 if (deserializer.get_buffer_offset() < input.size()) {
8988 throw_or_abort("Some input bytes were not read");
8989 }
8990 return value;
8991}
8992
8993} // end of namespace Acir
8994
8995template <>
8996template <typename Serializer>
8998 Serializer& serializer)
8999{
9000 serde::Serializable<decltype(obj.destination_pointer)>::serialize(obj.destination_pointer, serializer);
9001 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
9002 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9003}
9004
9005template <>
9006template <typename Deserializer>
9008 Deserializer& deserializer)
9009{
9011 obj.destination_pointer = serde::Deserializable<decltype(obj.destination_pointer)>::deserialize(deserializer);
9012 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
9013 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9014 return obj;
9015}
9016
9017namespace Acir {
9018
9019inline bool operator==(const BrilligOpcode::Return& lhs, const BrilligOpcode::Return& rhs)
9020{
9021 return true;
9022}
9023
9024inline std::vector<uint8_t> BrilligOpcode::Return::bincodeSerialize() const
9025{
9026 auto serializer = serde::BincodeSerializer();
9028 return std::move(serializer).bytes();
9029}
9030
9032{
9033 auto deserializer = serde::BincodeDeserializer(input);
9035 if (deserializer.get_buffer_offset() < input.size()) {
9036 throw_or_abort("Some input bytes were not read");
9037 }
9038 return value;
9039}
9040
9041} // end of namespace Acir
9042
9043template <>
9044template <typename Serializer>
9048
9049template <>
9050template <typename Deserializer>
9056
9057namespace Acir {
9058
9060{
9061 if (!(lhs.function == rhs.function)) {
9062 return false;
9063 }
9064 if (!(lhs.destinations == rhs.destinations)) {
9065 return false;
9066 }
9068 return false;
9069 }
9070 if (!(lhs.inputs == rhs.inputs)) {
9071 return false;
9072 }
9073 if (!(lhs.input_value_types == rhs.input_value_types)) {
9074 return false;
9075 }
9076 return true;
9077}
9078
9079inline std::vector<uint8_t> BrilligOpcode::ForeignCall::bincodeSerialize() const
9080{
9081 auto serializer = serde::BincodeSerializer();
9083 return std::move(serializer).bytes();
9084}
9085
9087{
9088 auto deserializer = serde::BincodeDeserializer(input);
9090 if (deserializer.get_buffer_offset() < input.size()) {
9091 throw_or_abort("Some input bytes were not read");
9092 }
9093 return value;
9094}
9095
9096} // end of namespace Acir
9097
9098template <>
9099template <typename Serializer>
9101 Serializer& serializer)
9102{
9103 serde::Serializable<decltype(obj.function)>::serialize(obj.function, serializer);
9104 serde::Serializable<decltype(obj.destinations)>::serialize(obj.destinations, serializer);
9105 serde::Serializable<decltype(obj.destination_value_types)>::serialize(obj.destination_value_types, serializer);
9106 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
9107 serde::Serializable<decltype(obj.input_value_types)>::serialize(obj.input_value_types, serializer);
9108}
9109
9110template <>
9111template <typename Deserializer>
9113 Deserializer& deserializer)
9114{
9116 obj.function = serde::Deserializable<decltype(obj.function)>::deserialize(deserializer);
9117 obj.destinations = serde::Deserializable<decltype(obj.destinations)>::deserialize(deserializer);
9119 serde::Deserializable<decltype(obj.destination_value_types)>::deserialize(deserializer);
9120 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
9121 obj.input_value_types = serde::Deserializable<decltype(obj.input_value_types)>::deserialize(deserializer);
9122 return obj;
9123}
9124
9125namespace Acir {
9126
9127inline bool operator==(const BrilligOpcode::Mov& lhs, const BrilligOpcode::Mov& rhs)
9128{
9129 if (!(lhs.destination == rhs.destination)) {
9130 return false;
9131 }
9132 if (!(lhs.source == rhs.source)) {
9133 return false;
9134 }
9135 return true;
9136}
9137
9138inline std::vector<uint8_t> BrilligOpcode::Mov::bincodeSerialize() const
9139{
9140 auto serializer = serde::BincodeSerializer();
9142 return std::move(serializer).bytes();
9143}
9144
9146{
9147 auto deserializer = serde::BincodeDeserializer(input);
9149 if (deserializer.get_buffer_offset() < input.size()) {
9150 throw_or_abort("Some input bytes were not read");
9151 }
9152 return value;
9153}
9154
9155} // end of namespace Acir
9156
9157template <>
9158template <typename Serializer>
9160 Serializer& serializer)
9161{
9162 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9163 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
9164}
9165
9166template <>
9167template <typename Deserializer>
9169{
9171 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9172 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
9173 return obj;
9174}
9175
9176namespace Acir {
9177
9179{
9180 if (!(lhs.destination == rhs.destination)) {
9181 return false;
9182 }
9183 if (!(lhs.source_a == rhs.source_a)) {
9184 return false;
9185 }
9186 if (!(lhs.source_b == rhs.source_b)) {
9187 return false;
9188 }
9189 if (!(lhs.condition == rhs.condition)) {
9190 return false;
9191 }
9192 return true;
9193}
9194
9195inline std::vector<uint8_t> BrilligOpcode::ConditionalMov::bincodeSerialize() const
9196{
9197 auto serializer = serde::BincodeSerializer();
9199 return std::move(serializer).bytes();
9200}
9201
9203{
9204 auto deserializer = serde::BincodeDeserializer(input);
9206 if (deserializer.get_buffer_offset() < input.size()) {
9207 throw_or_abort("Some input bytes were not read");
9208 }
9209 return value;
9210}
9211
9212} // end of namespace Acir
9213
9214template <>
9215template <typename Serializer>
9217 Serializer& serializer)
9218{
9219 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9220 serde::Serializable<decltype(obj.source_a)>::serialize(obj.source_a, serializer);
9221 serde::Serializable<decltype(obj.source_b)>::serialize(obj.source_b, serializer);
9222 serde::Serializable<decltype(obj.condition)>::serialize(obj.condition, serializer);
9223}
9224
9225template <>
9226template <typename Deserializer>
9228 Deserializer& deserializer)
9229{
9231 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9232 obj.source_a = serde::Deserializable<decltype(obj.source_a)>::deserialize(deserializer);
9233 obj.source_b = serde::Deserializable<decltype(obj.source_b)>::deserialize(deserializer);
9234 obj.condition = serde::Deserializable<decltype(obj.condition)>::deserialize(deserializer);
9235 return obj;
9236}
9237
9238namespace Acir {
9239
9240inline bool operator==(const BrilligOpcode::Load& lhs, const BrilligOpcode::Load& rhs)
9241{
9242 if (!(lhs.destination == rhs.destination)) {
9243 return false;
9244 }
9245 if (!(lhs.source_pointer == rhs.source_pointer)) {
9246 return false;
9247 }
9248 return true;
9249}
9250
9251inline std::vector<uint8_t> BrilligOpcode::Load::bincodeSerialize() const
9252{
9253 auto serializer = serde::BincodeSerializer();
9255 return std::move(serializer).bytes();
9256}
9257
9259{
9260 auto deserializer = serde::BincodeDeserializer(input);
9262 if (deserializer.get_buffer_offset() < input.size()) {
9263 throw_or_abort("Some input bytes were not read");
9264 }
9265 return value;
9266}
9267
9268} // end of namespace Acir
9269
9270template <>
9271template <typename Serializer>
9273 Serializer& serializer)
9274{
9275 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9276 serde::Serializable<decltype(obj.source_pointer)>::serialize(obj.source_pointer, serializer);
9277}
9278
9279template <>
9280template <typename Deserializer>
9282{
9284 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9285 obj.source_pointer = serde::Deserializable<decltype(obj.source_pointer)>::deserialize(deserializer);
9286 return obj;
9287}
9288
9289namespace Acir {
9290
9291inline bool operator==(const BrilligOpcode::Store& lhs, const BrilligOpcode::Store& rhs)
9292{
9293 if (!(lhs.destination_pointer == rhs.destination_pointer)) {
9294 return false;
9295 }
9296 if (!(lhs.source == rhs.source)) {
9297 return false;
9298 }
9299 return true;
9300}
9301
9302inline std::vector<uint8_t> BrilligOpcode::Store::bincodeSerialize() const
9303{
9304 auto serializer = serde::BincodeSerializer();
9306 return std::move(serializer).bytes();
9307}
9308
9309inline BrilligOpcode::Store BrilligOpcode::Store::bincodeDeserialize(std::vector<uint8_t> input)
9310{
9311 auto deserializer = serde::BincodeDeserializer(input);
9313 if (deserializer.get_buffer_offset() < input.size()) {
9314 throw_or_abort("Some input bytes were not read");
9315 }
9316 return value;
9317}
9318
9319} // end of namespace Acir
9320
9321template <>
9322template <typename Serializer>
9324 Serializer& serializer)
9325{
9326 serde::Serializable<decltype(obj.destination_pointer)>::serialize(obj.destination_pointer, serializer);
9327 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
9328}
9329
9330template <>
9331template <typename Deserializer>
9333{
9335 obj.destination_pointer = serde::Deserializable<decltype(obj.destination_pointer)>::deserialize(deserializer);
9336 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
9337 return obj;
9338}
9339
9340namespace Acir {
9341
9343{
9344 if (!(lhs.value == rhs.value)) {
9345 return false;
9346 }
9347 return true;
9348}
9349
9350inline std::vector<uint8_t> BrilligOpcode::BlackBox::bincodeSerialize() const
9351{
9352 auto serializer = serde::BincodeSerializer();
9354 return std::move(serializer).bytes();
9355}
9356
9358{
9359 auto deserializer = serde::BincodeDeserializer(input);
9361 if (deserializer.get_buffer_offset() < input.size()) {
9362 throw_or_abort("Some input bytes were not read");
9363 }
9364 return value;
9365}
9366
9367} // end of namespace Acir
9368
9369template <>
9370template <typename Serializer>
9372 Serializer& serializer)
9373{
9374 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9375}
9376
9377template <>
9378template <typename Deserializer>
9380 Deserializer& deserializer)
9381{
9383 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9384 return obj;
9385}
9386
9387namespace Acir {
9388
9389inline bool operator==(const BrilligOpcode::Trap& lhs, const BrilligOpcode::Trap& rhs)
9390{
9391 if (!(lhs.revert_data == rhs.revert_data)) {
9392 return false;
9393 }
9394 return true;
9395}
9396
9397inline std::vector<uint8_t> BrilligOpcode::Trap::bincodeSerialize() const
9398{
9399 auto serializer = serde::BincodeSerializer();
9401 return std::move(serializer).bytes();
9402}
9403
9405{
9406 auto deserializer = serde::BincodeDeserializer(input);
9408 if (deserializer.get_buffer_offset() < input.size()) {
9409 throw_or_abort("Some input bytes were not read");
9410 }
9411 return value;
9412}
9413
9414} // end of namespace Acir
9415
9416template <>
9417template <typename Serializer>
9419 Serializer& serializer)
9420{
9421 serde::Serializable<decltype(obj.revert_data)>::serialize(obj.revert_data, serializer);
9422}
9423
9424template <>
9425template <typename Deserializer>
9427{
9429 obj.revert_data = serde::Deserializable<decltype(obj.revert_data)>::deserialize(deserializer);
9430 return obj;
9431}
9432
9433namespace Acir {
9434
9435inline bool operator==(const BrilligOpcode::Stop& lhs, const BrilligOpcode::Stop& rhs)
9436{
9437 if (!(lhs.return_data == rhs.return_data)) {
9438 return false;
9439 }
9440 return true;
9441}
9442
9443inline std::vector<uint8_t> BrilligOpcode::Stop::bincodeSerialize() const
9444{
9445 auto serializer = serde::BincodeSerializer();
9447 return std::move(serializer).bytes();
9448}
9449
9451{
9452 auto deserializer = serde::BincodeDeserializer(input);
9454 if (deserializer.get_buffer_offset() < input.size()) {
9455 throw_or_abort("Some input bytes were not read");
9456 }
9457 return value;
9458}
9459
9460} // end of namespace Acir
9461
9462template <>
9463template <typename Serializer>
9465 Serializer& serializer)
9466{
9467 serde::Serializable<decltype(obj.return_data)>::serialize(obj.return_data, serializer);
9468}
9469
9470template <>
9471template <typename Deserializer>
9473{
9475 obj.return_data = serde::Deserializable<decltype(obj.return_data)>::deserialize(deserializer);
9476 return obj;
9477}
9478
9479namespace Acir {
9480
9481inline bool operator==(const BrilligOutputs& lhs, const BrilligOutputs& rhs)
9482{
9483 if (!(lhs.value == rhs.value)) {
9484 return false;
9485 }
9486 return true;
9487}
9488
9489inline std::vector<uint8_t> BrilligOutputs::bincodeSerialize() const
9490{
9491 auto serializer = serde::BincodeSerializer();
9493 return std::move(serializer).bytes();
9494}
9495
9496inline BrilligOutputs BrilligOutputs::bincodeDeserialize(std::vector<uint8_t> input)
9497{
9498 auto deserializer = serde::BincodeDeserializer(input);
9500 if (deserializer.get_buffer_offset() < input.size()) {
9501 throw_or_abort("Some input bytes were not read");
9502 }
9503 return value;
9504}
9505
9506} // end of namespace Acir
9507
9508template <>
9509template <typename Serializer>
9511{
9512 serializer.increase_container_depth();
9513 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9514 serializer.decrease_container_depth();
9515}
9516
9517template <>
9518template <typename Deserializer>
9520{
9521 deserializer.increase_container_depth();
9523 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9524 deserializer.decrease_container_depth();
9525 return obj;
9526}
9527
9528namespace Acir {
9529
9531{
9532 if (!(lhs.value == rhs.value)) {
9533 return false;
9534 }
9535 return true;
9536}
9537
9538inline std::vector<uint8_t> BrilligOutputs::Simple::bincodeSerialize() const
9539{
9540 auto serializer = serde::BincodeSerializer();
9542 return std::move(serializer).bytes();
9543}
9544
9546{
9547 auto deserializer = serde::BincodeDeserializer(input);
9549 if (deserializer.get_buffer_offset() < input.size()) {
9550 throw_or_abort("Some input bytes were not read");
9551 }
9552 return value;
9553}
9554
9555} // end of namespace Acir
9556
9557template <>
9558template <typename Serializer>
9560 Serializer& serializer)
9561{
9562 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9563}
9564
9565template <>
9566template <typename Deserializer>
9568 Deserializer& deserializer)
9569{
9571 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9572 return obj;
9573}
9574
9575namespace Acir {
9576
9577inline bool operator==(const BrilligOutputs::Array& lhs, const BrilligOutputs::Array& rhs)
9578{
9579 if (!(lhs.value == rhs.value)) {
9580 return false;
9581 }
9582 return true;
9583}
9584
9585inline std::vector<uint8_t> BrilligOutputs::Array::bincodeSerialize() const
9586{
9587 auto serializer = serde::BincodeSerializer();
9589 return std::move(serializer).bytes();
9590}
9591
9593{
9594 auto deserializer = serde::BincodeDeserializer(input);
9596 if (deserializer.get_buffer_offset() < input.size()) {
9597 throw_or_abort("Some input bytes were not read");
9598 }
9599 return value;
9600}
9601
9602} // end of namespace Acir
9603
9604template <>
9605template <typename Serializer>
9607 Serializer& serializer)
9608{
9609 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9610}
9611
9612template <>
9613template <typename Deserializer>
9615{
9617 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9618 return obj;
9619}
9620
9621namespace Acir {
9622
9623inline bool operator==(const Circuit& lhs, const Circuit& rhs)
9624{
9625 if (!(lhs.function_name == rhs.function_name)) {
9626 return false;
9627 }
9628 if (!(lhs.current_witness_index == rhs.current_witness_index)) {
9629 return false;
9630 }
9631 if (!(lhs.opcodes == rhs.opcodes)) {
9632 return false;
9633 }
9634 if (!(lhs.private_parameters == rhs.private_parameters)) {
9635 return false;
9636 }
9637 if (!(lhs.public_parameters == rhs.public_parameters)) {
9638 return false;
9639 }
9640 if (!(lhs.return_values == rhs.return_values)) {
9641 return false;
9642 }
9643 if (!(lhs.assert_messages == rhs.assert_messages)) {
9644 return false;
9645 }
9646 return true;
9647}
9648
9649inline std::vector<uint8_t> Circuit::bincodeSerialize() const
9650{
9651 auto serializer = serde::BincodeSerializer();
9652 serde::Serializable<Circuit>::serialize(*this, serializer);
9653 return std::move(serializer).bytes();
9654}
9655
9656inline Circuit Circuit::bincodeDeserialize(std::vector<uint8_t> input)
9657{
9658 auto deserializer = serde::BincodeDeserializer(input);
9660 if (deserializer.get_buffer_offset() < input.size()) {
9661 throw_or_abort("Some input bytes were not read");
9662 }
9663 return value;
9664}
9665
9666} // end of namespace Acir
9667
9668template <>
9669template <typename Serializer>
9670void serde::Serializable<Acir::Circuit>::serialize(const Acir::Circuit& obj, Serializer& serializer)
9671{
9672 serializer.increase_container_depth();
9673 serde::Serializable<decltype(obj.function_name)>::serialize(obj.function_name, serializer);
9674 serde::Serializable<decltype(obj.current_witness_index)>::serialize(obj.current_witness_index, serializer);
9675 serde::Serializable<decltype(obj.opcodes)>::serialize(obj.opcodes, serializer);
9676 serde::Serializable<decltype(obj.private_parameters)>::serialize(obj.private_parameters, serializer);
9677 serde::Serializable<decltype(obj.public_parameters)>::serialize(obj.public_parameters, serializer);
9678 serde::Serializable<decltype(obj.return_values)>::serialize(obj.return_values, serializer);
9679 serde::Serializable<decltype(obj.assert_messages)>::serialize(obj.assert_messages, serializer);
9680 serializer.decrease_container_depth();
9681}
9682
9683template <>
9684template <typename Deserializer>
9686{
9687 deserializer.increase_container_depth();
9688 Acir::Circuit obj;
9689 obj.function_name = serde::Deserializable<decltype(obj.function_name)>::deserialize(deserializer);
9690 obj.current_witness_index = serde::Deserializable<decltype(obj.current_witness_index)>::deserialize(deserializer);
9691 obj.opcodes = serde::Deserializable<decltype(obj.opcodes)>::deserialize(deserializer);
9692 obj.private_parameters = serde::Deserializable<decltype(obj.private_parameters)>::deserialize(deserializer);
9693 obj.public_parameters = serde::Deserializable<decltype(obj.public_parameters)>::deserialize(deserializer);
9694 obj.return_values = serde::Deserializable<decltype(obj.return_values)>::deserialize(deserializer);
9695 obj.assert_messages = serde::Deserializable<decltype(obj.assert_messages)>::deserialize(deserializer);
9696 deserializer.decrease_container_depth();
9697 return obj;
9698}
9699
9700namespace Acir {
9701
9702inline bool operator==(const Expression& lhs, const Expression& rhs)
9703{
9704 if (!(lhs.mul_terms == rhs.mul_terms)) {
9705 return false;
9706 }
9707 if (!(lhs.linear_combinations == rhs.linear_combinations)) {
9708 return false;
9709 }
9710 if (!(lhs.q_c == rhs.q_c)) {
9711 return false;
9712 }
9713 return true;
9714}
9715
9716inline std::vector<uint8_t> Expression::bincodeSerialize() const
9717{
9718 auto serializer = serde::BincodeSerializer();
9720 return std::move(serializer).bytes();
9721}
9722
9723inline Expression Expression::bincodeDeserialize(std::vector<uint8_t> input)
9724{
9725 auto deserializer = serde::BincodeDeserializer(input);
9727 if (deserializer.get_buffer_offset() < input.size()) {
9728 throw_or_abort("Some input bytes were not read");
9729 }
9730 return value;
9731}
9732
9733} // end of namespace Acir
9734
9735template <>
9736template <typename Serializer>
9738{
9739 serializer.increase_container_depth();
9740 serde::Serializable<decltype(obj.mul_terms)>::serialize(obj.mul_terms, serializer);
9741 serde::Serializable<decltype(obj.linear_combinations)>::serialize(obj.linear_combinations, serializer);
9742 serde::Serializable<decltype(obj.q_c)>::serialize(obj.q_c, serializer);
9743 serializer.decrease_container_depth();
9744}
9745
9746template <>
9747template <typename Deserializer>
9749{
9750 deserializer.increase_container_depth();
9751 Acir::Expression obj;
9752 obj.mul_terms = serde::Deserializable<decltype(obj.mul_terms)>::deserialize(deserializer);
9753 obj.linear_combinations = serde::Deserializable<decltype(obj.linear_combinations)>::deserialize(deserializer);
9754 obj.q_c = serde::Deserializable<decltype(obj.q_c)>::deserialize(deserializer);
9755 deserializer.decrease_container_depth();
9756 return obj;
9757}
9758
9759namespace Acir {
9760
9761inline bool operator==(const ExpressionOrMemory& lhs, const ExpressionOrMemory& rhs)
9762{
9763 if (!(lhs.value == rhs.value)) {
9764 return false;
9765 }
9766 return true;
9767}
9768
9769inline std::vector<uint8_t> ExpressionOrMemory::bincodeSerialize() const
9770{
9771 auto serializer = serde::BincodeSerializer();
9773 return std::move(serializer).bytes();
9774}
9775
9777{
9778 auto deserializer = serde::BincodeDeserializer(input);
9780 if (deserializer.get_buffer_offset() < input.size()) {
9781 throw_or_abort("Some input bytes were not read");
9782 }
9783 return value;
9784}
9785
9786} // end of namespace Acir
9787
9788template <>
9789template <typename Serializer>
9791 Serializer& serializer)
9792{
9793 serializer.increase_container_depth();
9794 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9795 serializer.decrease_container_depth();
9796}
9797
9798template <>
9799template <typename Deserializer>
9801{
9802 deserializer.increase_container_depth();
9804 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9805 deserializer.decrease_container_depth();
9806 return obj;
9807}
9808
9809namespace Acir {
9810
9812{
9813 if (!(lhs.value == rhs.value)) {
9814 return false;
9815 }
9816 return true;
9817}
9818
9819inline std::vector<uint8_t> ExpressionOrMemory::Expression::bincodeSerialize() const
9820{
9821 auto serializer = serde::BincodeSerializer();
9823 return std::move(serializer).bytes();
9824}
9825
9827{
9828 auto deserializer = serde::BincodeDeserializer(input);
9830 if (deserializer.get_buffer_offset() < input.size()) {
9831 throw_or_abort("Some input bytes were not read");
9832 }
9833 return value;
9834}
9835
9836} // end of namespace Acir
9837
9838template <>
9839template <typename Serializer>
9841 const Acir::ExpressionOrMemory::Expression& obj, Serializer& serializer)
9842{
9843 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9844}
9845
9846template <>
9847template <typename Deserializer>
9849 Deserializer& deserializer)
9850{
9852 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9853 return obj;
9854}
9855
9856namespace Acir {
9857
9859{
9860 if (!(lhs.value == rhs.value)) {
9861 return false;
9862 }
9863 return true;
9864}
9865
9866inline std::vector<uint8_t> ExpressionOrMemory::Memory::bincodeSerialize() const
9867{
9868 auto serializer = serde::BincodeSerializer();
9870 return std::move(serializer).bytes();
9871}
9872
9874{
9875 auto deserializer = serde::BincodeDeserializer(input);
9877 if (deserializer.get_buffer_offset() < input.size()) {
9878 throw_or_abort("Some input bytes were not read");
9879 }
9880 return value;
9881}
9882
9883} // end of namespace Acir
9884
9885template <>
9886template <typename Serializer>
9888 Serializer& serializer)
9889{
9890 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9891}
9892
9893template <>
9894template <typename Deserializer>
9896 Deserializer& deserializer)
9897{
9899 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9900 return obj;
9901}
9902
9903namespace Acir {
9904
9905inline bool operator==(const ExpressionWidth& lhs, const ExpressionWidth& rhs)
9906{
9907 if (!(lhs.value == rhs.value)) {
9908 return false;
9909 }
9910 return true;
9911}
9912
9913inline std::vector<uint8_t> ExpressionWidth::bincodeSerialize() const
9914{
9915 auto serializer = serde::BincodeSerializer();
9917 return std::move(serializer).bytes();
9918}
9919
9921{
9922 auto deserializer = serde::BincodeDeserializer(input);
9924 if (deserializer.get_buffer_offset() < input.size()) {
9925 throw_or_abort("Some input bytes were not read");
9926 }
9927 return value;
9928}
9929
9930} // end of namespace Acir
9931
9932template <>
9933template <typename Serializer>
9935{
9936 serializer.increase_container_depth();
9937 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9938 serializer.decrease_container_depth();
9939}
9940
9941template <>
9942template <typename Deserializer>
9944{
9945 deserializer.increase_container_depth();
9947 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9948 deserializer.decrease_container_depth();
9949 return obj;
9950}
9951
9952namespace Acir {
9953
9955{
9956 return true;
9957}
9958
9959inline std::vector<uint8_t> ExpressionWidth::Unbounded::bincodeSerialize() const
9960{
9961 auto serializer = serde::BincodeSerializer();
9963 return std::move(serializer).bytes();
9964}
9965
9967{
9968 auto deserializer = serde::BincodeDeserializer(input);
9970 if (deserializer.get_buffer_offset() < input.size()) {
9971 throw_or_abort("Some input bytes were not read");
9972 }
9973 return value;
9974}
9975
9976} // end of namespace Acir
9977
9978template <>
9979template <typename Serializer>
9983
9984template <>
9985template <typename Deserializer>
9992
9993namespace Acir {
9994
9996{
9997 if (!(lhs.width == rhs.width)) {
9998 return false;
9999 }
10000 return true;
10001}
10002
10003inline std::vector<uint8_t> ExpressionWidth::Bounded::bincodeSerialize() const
10004{
10005 auto serializer = serde::BincodeSerializer();
10007 return std::move(serializer).bytes();
10008}
10009
10011{
10012 auto deserializer = serde::BincodeDeserializer(input);
10014 if (deserializer.get_buffer_offset() < input.size()) {
10015 throw_or_abort("Some input bytes were not read");
10016 }
10017 return value;
10018}
10019
10020} // end of namespace Acir
10021
10022template <>
10023template <typename Serializer>
10025 Serializer& serializer)
10026{
10027 serde::Serializable<decltype(obj.width)>::serialize(obj.width, serializer);
10028}
10029
10030template <>
10031template <typename Deserializer>
10033 Deserializer& deserializer)
10034{
10036 obj.width = serde::Deserializable<decltype(obj.width)>::deserialize(deserializer);
10037 return obj;
10038}
10039
10040namespace Acir {
10041
10042inline bool operator==(const FunctionInput& lhs, const FunctionInput& rhs)
10043{
10044 if (!(lhs.value == rhs.value)) {
10045 return false;
10046 }
10047 return true;
10048}
10049
10050inline std::vector<uint8_t> FunctionInput::bincodeSerialize() const
10051{
10052 auto serializer = serde::BincodeSerializer();
10054 return std::move(serializer).bytes();
10055}
10056
10057inline FunctionInput FunctionInput::bincodeDeserialize(std::vector<uint8_t> input)
10058{
10059 auto deserializer = serde::BincodeDeserializer(input);
10061 if (deserializer.get_buffer_offset() < input.size()) {
10062 throw_or_abort("Some input bytes were not read");
10063 }
10064 return value;
10065}
10066
10067} // end of namespace Acir
10068
10069template <>
10070template <typename Serializer>
10072{
10073 serializer.increase_container_depth();
10074 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10075 serializer.decrease_container_depth();
10076}
10077
10078template <>
10079template <typename Deserializer>
10081{
10082 deserializer.increase_container_depth();
10084 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10085 deserializer.decrease_container_depth();
10086 return obj;
10087}
10088
10089namespace Acir {
10090
10092{
10093 if (!(lhs.value == rhs.value)) {
10094 return false;
10095 }
10096 return true;
10097}
10098
10099inline std::vector<uint8_t> FunctionInput::Constant::bincodeSerialize() const
10100{
10101 auto serializer = serde::BincodeSerializer();
10103 return std::move(serializer).bytes();
10104}
10105
10107{
10108 auto deserializer = serde::BincodeDeserializer(input);
10110 if (deserializer.get_buffer_offset() < input.size()) {
10111 throw_or_abort("Some input bytes were not read");
10112 }
10113 return value;
10114}
10115
10116} // end of namespace Acir
10117
10118template <>
10119template <typename Serializer>
10121 Serializer& serializer)
10122{
10123 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10124}
10125
10126template <>
10127template <typename Deserializer>
10129 Deserializer& deserializer)
10130{
10132 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10133 return obj;
10134}
10135
10136namespace Acir {
10137
10139{
10140 if (!(lhs.value == rhs.value)) {
10141 return false;
10142 }
10143 return true;
10144}
10145
10146inline std::vector<uint8_t> FunctionInput::Witness::bincodeSerialize() const
10147{
10148 auto serializer = serde::BincodeSerializer();
10150 return std::move(serializer).bytes();
10151}
10152
10154{
10155 auto deserializer = serde::BincodeDeserializer(input);
10157 if (deserializer.get_buffer_offset() < input.size()) {
10158 throw_or_abort("Some input bytes were not read");
10159 }
10160 return value;
10161}
10162
10163} // end of namespace Acir
10164
10165template <>
10166template <typename Serializer>
10168 Serializer& serializer)
10169{
10170 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10171}
10172
10173template <>
10174template <typename Deserializer>
10176 Deserializer& deserializer)
10177{
10179 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10180 return obj;
10181}
10182
10183namespace Acir {
10184
10185inline bool operator==(const HeapArray& lhs, const HeapArray& rhs)
10186{
10187 if (!(lhs.pointer == rhs.pointer)) {
10188 return false;
10189 }
10190 if (!(lhs.size == rhs.size)) {
10191 return false;
10192 }
10193 return true;
10194}
10195
10196inline std::vector<uint8_t> HeapArray::bincodeSerialize() const
10197{
10198 auto serializer = serde::BincodeSerializer();
10200 return std::move(serializer).bytes();
10201}
10202
10203inline HeapArray HeapArray::bincodeDeserialize(std::vector<uint8_t> input)
10204{
10205 auto deserializer = serde::BincodeDeserializer(input);
10207 if (deserializer.get_buffer_offset() < input.size()) {
10208 throw_or_abort("Some input bytes were not read");
10209 }
10210 return value;
10211}
10212
10213} // end of namespace Acir
10214
10215template <>
10216template <typename Serializer>
10218{
10219 serializer.increase_container_depth();
10220 serde::Serializable<decltype(obj.pointer)>::serialize(obj.pointer, serializer);
10221 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10222 serializer.decrease_container_depth();
10223}
10224
10225template <>
10226template <typename Deserializer>
10228{
10229 deserializer.increase_container_depth();
10230 Acir::HeapArray obj;
10231 obj.pointer = serde::Deserializable<decltype(obj.pointer)>::deserialize(deserializer);
10232 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10233 deserializer.decrease_container_depth();
10234 return obj;
10235}
10236
10237namespace Acir {
10238
10239inline bool operator==(const HeapValueType& lhs, const HeapValueType& rhs)
10240{
10241 if (!(lhs.value == rhs.value)) {
10242 return false;
10243 }
10244 return true;
10245}
10246
10247inline std::vector<uint8_t> HeapValueType::bincodeSerialize() const
10248{
10249 auto serializer = serde::BincodeSerializer();
10251 return std::move(serializer).bytes();
10252}
10253
10254inline HeapValueType HeapValueType::bincodeDeserialize(std::vector<uint8_t> input)
10255{
10256 auto deserializer = serde::BincodeDeserializer(input);
10258 if (deserializer.get_buffer_offset() < input.size()) {
10259 throw_or_abort("Some input bytes were not read");
10260 }
10261 return value;
10262}
10263
10264} // end of namespace Acir
10265
10266template <>
10267template <typename Serializer>
10269{
10270 serializer.increase_container_depth();
10271 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10272 serializer.decrease_container_depth();
10273}
10274
10275template <>
10276template <typename Deserializer>
10278{
10279 deserializer.increase_container_depth();
10281 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10282 deserializer.decrease_container_depth();
10283 return obj;
10284}
10285
10286namespace Acir {
10287
10288inline bool operator==(const HeapValueType::Simple& lhs, const HeapValueType::Simple& rhs)
10289{
10290 if (!(lhs.value == rhs.value)) {
10291 return false;
10292 }
10293 return true;
10294}
10295
10296inline std::vector<uint8_t> HeapValueType::Simple::bincodeSerialize() const
10297{
10298 auto serializer = serde::BincodeSerializer();
10300 return std::move(serializer).bytes();
10301}
10302
10304{
10305 auto deserializer = serde::BincodeDeserializer(input);
10307 if (deserializer.get_buffer_offset() < input.size()) {
10308 throw_or_abort("Some input bytes were not read");
10309 }
10310 return value;
10311}
10312
10313} // end of namespace Acir
10314
10315template <>
10316template <typename Serializer>
10318 Serializer& serializer)
10319{
10320 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10321}
10322
10323template <>
10324template <typename Deserializer>
10326{
10328 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10329 return obj;
10330}
10331
10332namespace Acir {
10333
10334inline bool operator==(const HeapValueType::Array& lhs, const HeapValueType::Array& rhs)
10335{
10336 if (!(lhs.value_types == rhs.value_types)) {
10337 return false;
10338 }
10339 if (!(lhs.size == rhs.size)) {
10340 return false;
10341 }
10342 return true;
10343}
10344
10345inline std::vector<uint8_t> HeapValueType::Array::bincodeSerialize() const
10346{
10347 auto serializer = serde::BincodeSerializer();
10349 return std::move(serializer).bytes();
10350}
10351
10353{
10354 auto deserializer = serde::BincodeDeserializer(input);
10356 if (deserializer.get_buffer_offset() < input.size()) {
10357 throw_or_abort("Some input bytes were not read");
10358 }
10359 return value;
10360}
10361
10362} // end of namespace Acir
10363
10364template <>
10365template <typename Serializer>
10367 Serializer& serializer)
10368{
10369 serde::Serializable<decltype(obj.value_types)>::serialize(obj.value_types, serializer);
10370 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10371}
10372
10373template <>
10374template <typename Deserializer>
10376{
10378 obj.value_types = serde::Deserializable<decltype(obj.value_types)>::deserialize(deserializer);
10379 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10380 return obj;
10381}
10382
10383namespace Acir {
10384
10385inline bool operator==(const HeapValueType::Vector& lhs, const HeapValueType::Vector& rhs)
10386{
10387 if (!(lhs.value_types == rhs.value_types)) {
10388 return false;
10389 }
10390 return true;
10391}
10392
10393inline std::vector<uint8_t> HeapValueType::Vector::bincodeSerialize() const
10394{
10395 auto serializer = serde::BincodeSerializer();
10397 return std::move(serializer).bytes();
10398}
10399
10401{
10402 auto deserializer = serde::BincodeDeserializer(input);
10404 if (deserializer.get_buffer_offset() < input.size()) {
10405 throw_or_abort("Some input bytes were not read");
10406 }
10407 return value;
10408}
10409
10410} // end of namespace Acir
10411
10412template <>
10413template <typename Serializer>
10415 Serializer& serializer)
10416{
10417 serde::Serializable<decltype(obj.value_types)>::serialize(obj.value_types, serializer);
10418}
10419
10420template <>
10421template <typename Deserializer>
10423{
10425 obj.value_types = serde::Deserializable<decltype(obj.value_types)>::deserialize(deserializer);
10426 return obj;
10427}
10428
10429namespace Acir {
10430
10431inline bool operator==(const HeapVector& lhs, const HeapVector& rhs)
10432{
10433 if (!(lhs.pointer == rhs.pointer)) {
10434 return false;
10435 }
10436 if (!(lhs.size == rhs.size)) {
10437 return false;
10438 }
10439 return true;
10440}
10441
10442inline std::vector<uint8_t> HeapVector::bincodeSerialize() const
10443{
10444 auto serializer = serde::BincodeSerializer();
10446 return std::move(serializer).bytes();
10447}
10448
10449inline HeapVector HeapVector::bincodeDeserialize(std::vector<uint8_t> input)
10450{
10451 auto deserializer = serde::BincodeDeserializer(input);
10453 if (deserializer.get_buffer_offset() < input.size()) {
10454 throw_or_abort("Some input bytes were not read");
10455 }
10456 return value;
10457}
10458
10459} // end of namespace Acir
10460
10461template <>
10462template <typename Serializer>
10464{
10465 serializer.increase_container_depth();
10466 serde::Serializable<decltype(obj.pointer)>::serialize(obj.pointer, serializer);
10467 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10468 serializer.decrease_container_depth();
10469}
10470
10471template <>
10472template <typename Deserializer>
10474{
10475 deserializer.increase_container_depth();
10476 Acir::HeapVector obj;
10477 obj.pointer = serde::Deserializable<decltype(obj.pointer)>::deserialize(deserializer);
10478 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10479 deserializer.decrease_container_depth();
10480 return obj;
10481}
10482
10483namespace Acir {
10484
10485inline bool operator==(const IntegerBitSize& lhs, const IntegerBitSize& rhs)
10486{
10487 if (!(lhs.value == rhs.value)) {
10488 return false;
10489 }
10490 return true;
10491}
10492
10493inline std::vector<uint8_t> IntegerBitSize::bincodeSerialize() const
10494{
10495 auto serializer = serde::BincodeSerializer();
10497 return std::move(serializer).bytes();
10498}
10499
10500inline IntegerBitSize IntegerBitSize::bincodeDeserialize(std::vector<uint8_t> input)
10501{
10502 auto deserializer = serde::BincodeDeserializer(input);
10504 if (deserializer.get_buffer_offset() < input.size()) {
10505 throw_or_abort("Some input bytes were not read");
10506 }
10507 return value;
10508}
10509
10510} // end of namespace Acir
10511
10512template <>
10513template <typename Serializer>
10515{
10516 serializer.increase_container_depth();
10517 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10518 serializer.decrease_container_depth();
10519}
10520
10521template <>
10522template <typename Deserializer>
10524{
10525 deserializer.increase_container_depth();
10527 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10528 deserializer.decrease_container_depth();
10529 return obj;
10530}
10531
10532namespace Acir {
10533
10534inline bool operator==(const IntegerBitSize::U1& lhs, const IntegerBitSize::U1& rhs)
10535{
10536 return true;
10537}
10538
10539inline std::vector<uint8_t> IntegerBitSize::U1::bincodeSerialize() const
10540{
10541 auto serializer = serde::BincodeSerializer();
10543 return std::move(serializer).bytes();
10544}
10545
10547{
10548 auto deserializer = serde::BincodeDeserializer(input);
10550 if (deserializer.get_buffer_offset() < input.size()) {
10551 throw_or_abort("Some input bytes were not read");
10552 }
10553 return value;
10554}
10555
10556} // end of namespace Acir
10557
10558template <>
10559template <typename Serializer>
10561 Serializer& serializer)
10562{}
10563
10564template <>
10565template <typename Deserializer>
10571
10572namespace Acir {
10573
10574inline bool operator==(const IntegerBitSize::U8& lhs, const IntegerBitSize::U8& rhs)
10575{
10576 return true;
10577}
10578
10579inline std::vector<uint8_t> IntegerBitSize::U8::bincodeSerialize() const
10580{
10581 auto serializer = serde::BincodeSerializer();
10583 return std::move(serializer).bytes();
10584}
10585
10587{
10588 auto deserializer = serde::BincodeDeserializer(input);
10590 if (deserializer.get_buffer_offset() < input.size()) {
10591 throw_or_abort("Some input bytes were not read");
10592 }
10593 return value;
10594}
10595
10596} // end of namespace Acir
10597
10598template <>
10599template <typename Serializer>
10601 Serializer& serializer)
10602{}
10603
10604template <>
10605template <typename Deserializer>
10611
10612namespace Acir {
10613
10614inline bool operator==(const IntegerBitSize::U16& lhs, const IntegerBitSize::U16& rhs)
10615{
10616 return true;
10617}
10618
10619inline std::vector<uint8_t> IntegerBitSize::U16::bincodeSerialize() const
10620{
10621 auto serializer = serde::BincodeSerializer();
10623 return std::move(serializer).bytes();
10624}
10625
10627{
10628 auto deserializer = serde::BincodeDeserializer(input);
10630 if (deserializer.get_buffer_offset() < input.size()) {
10631 throw_or_abort("Some input bytes were not read");
10632 }
10633 return value;
10634}
10635
10636} // end of namespace Acir
10637
10638template <>
10639template <typename Serializer>
10641 Serializer& serializer)
10642{}
10643
10644template <>
10645template <typename Deserializer>
10651
10652namespace Acir {
10653
10654inline bool operator==(const IntegerBitSize::U32& lhs, const IntegerBitSize::U32& rhs)
10655{
10656 return true;
10657}
10658
10659inline std::vector<uint8_t> IntegerBitSize::U32::bincodeSerialize() const
10660{
10661 auto serializer = serde::BincodeSerializer();
10663 return std::move(serializer).bytes();
10664}
10665
10667{
10668 auto deserializer = serde::BincodeDeserializer(input);
10670 if (deserializer.get_buffer_offset() < input.size()) {
10671 throw_or_abort("Some input bytes were not read");
10672 }
10673 return value;
10674}
10675
10676} // end of namespace Acir
10677
10678template <>
10679template <typename Serializer>
10681 Serializer& serializer)
10682{}
10683
10684template <>
10685template <typename Deserializer>
10691
10692namespace Acir {
10693
10694inline bool operator==(const IntegerBitSize::U64& lhs, const IntegerBitSize::U64& rhs)
10695{
10696 return true;
10697}
10698
10699inline std::vector<uint8_t> IntegerBitSize::U64::bincodeSerialize() const
10700{
10701 auto serializer = serde::BincodeSerializer();
10703 return std::move(serializer).bytes();
10704}
10705
10707{
10708 auto deserializer = serde::BincodeDeserializer(input);
10710 if (deserializer.get_buffer_offset() < input.size()) {
10711 throw_or_abort("Some input bytes were not read");
10712 }
10713 return value;
10714}
10715
10716} // end of namespace Acir
10717
10718template <>
10719template <typename Serializer>
10721 Serializer& serializer)
10722{}
10723
10724template <>
10725template <typename Deserializer>
10731
10732namespace Acir {
10733
10734inline bool operator==(const IntegerBitSize::U128& lhs, const IntegerBitSize::U128& rhs)
10735{
10736 return true;
10737}
10738
10739inline std::vector<uint8_t> IntegerBitSize::U128::bincodeSerialize() const
10740{
10741 auto serializer = serde::BincodeSerializer();
10743 return std::move(serializer).bytes();
10744}
10745
10747{
10748 auto deserializer = serde::BincodeDeserializer(input);
10750 if (deserializer.get_buffer_offset() < input.size()) {
10751 throw_or_abort("Some input bytes were not read");
10752 }
10753 return value;
10754}
10755
10756} // end of namespace Acir
10757
10758template <>
10759template <typename Serializer>
10763
10764template <>
10765template <typename Deserializer>
10771
10772namespace Acir {
10773
10774inline bool operator==(const MemOp& lhs, const MemOp& rhs)
10775{
10776 if (!(lhs.operation == rhs.operation)) {
10777 return false;
10778 }
10779 if (!(lhs.index == rhs.index)) {
10780 return false;
10781 }
10782 if (!(lhs.value == rhs.value)) {
10783 return false;
10784 }
10785 return true;
10786}
10787
10788inline std::vector<uint8_t> MemOp::bincodeSerialize() const
10789{
10790 auto serializer = serde::BincodeSerializer();
10791 serde::Serializable<MemOp>::serialize(*this, serializer);
10792 return std::move(serializer).bytes();
10793}
10794
10795inline MemOp MemOp::bincodeDeserialize(std::vector<uint8_t> input)
10796{
10797 auto deserializer = serde::BincodeDeserializer(input);
10799 if (deserializer.get_buffer_offset() < input.size()) {
10800 throw_or_abort("Some input bytes were not read");
10801 }
10802 return value;
10803}
10804
10805} // end of namespace Acir
10806
10807template <>
10808template <typename Serializer>
10809void serde::Serializable<Acir::MemOp>::serialize(const Acir::MemOp& obj, Serializer& serializer)
10810{
10811 serializer.increase_container_depth();
10812 serde::Serializable<decltype(obj.operation)>::serialize(obj.operation, serializer);
10813 serde::Serializable<decltype(obj.index)>::serialize(obj.index, serializer);
10814 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10815 serializer.decrease_container_depth();
10816}
10817
10818template <>
10819template <typename Deserializer>
10821{
10822 deserializer.increase_container_depth();
10823 Acir::MemOp obj;
10824 obj.operation = serde::Deserializable<decltype(obj.operation)>::deserialize(deserializer);
10825 obj.index = serde::Deserializable<decltype(obj.index)>::deserialize(deserializer);
10826 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10827 deserializer.decrease_container_depth();
10828 return obj;
10829}
10830
10831namespace Acir {
10832
10833inline bool operator==(const MemoryAddress& lhs, const MemoryAddress& rhs)
10834{
10835 if (!(lhs.value == rhs.value)) {
10836 return false;
10837 }
10838 return true;
10839}
10840
10841inline std::vector<uint8_t> MemoryAddress::bincodeSerialize() const
10842{
10843 auto serializer = serde::BincodeSerializer();
10845 return std::move(serializer).bytes();
10846}
10847
10848inline MemoryAddress MemoryAddress::bincodeDeserialize(std::vector<uint8_t> input)
10849{
10850 auto deserializer = serde::BincodeDeserializer(input);
10852 if (deserializer.get_buffer_offset() < input.size()) {
10853 throw_or_abort("Some input bytes were not read");
10854 }
10855 return value;
10856}
10857
10858} // end of namespace Acir
10859
10860template <>
10861template <typename Serializer>
10863{
10864 serializer.increase_container_depth();
10865 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10866 serializer.decrease_container_depth();
10867}
10868
10869template <>
10870template <typename Deserializer>
10872{
10873 deserializer.increase_container_depth();
10875 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10876 deserializer.decrease_container_depth();
10877 return obj;
10878}
10879
10880namespace Acir {
10881
10882inline bool operator==(const MemoryAddress::Direct& lhs, const MemoryAddress::Direct& rhs)
10883{
10884 if (!(lhs.value == rhs.value)) {
10885 return false;
10886 }
10887 return true;
10888}
10889
10890inline std::vector<uint8_t> MemoryAddress::Direct::bincodeSerialize() const
10891{
10892 auto serializer = serde::BincodeSerializer();
10894 return std::move(serializer).bytes();
10895}
10896
10898{
10899 auto deserializer = serde::BincodeDeserializer(input);
10901 if (deserializer.get_buffer_offset() < input.size()) {
10902 throw_or_abort("Some input bytes were not read");
10903 }
10904 return value;
10905}
10906
10907} // end of namespace Acir
10908
10909template <>
10910template <typename Serializer>
10912 Serializer& serializer)
10913{
10914 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10915}
10916
10917template <>
10918template <typename Deserializer>
10920{
10922 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10923 return obj;
10924}
10925
10926namespace Acir {
10927
10929{
10930 if (!(lhs.value == rhs.value)) {
10931 return false;
10932 }
10933 return true;
10934}
10935
10936inline std::vector<uint8_t> MemoryAddress::Relative::bincodeSerialize() const
10937{
10938 auto serializer = serde::BincodeSerializer();
10940 return std::move(serializer).bytes();
10941}
10942
10944{
10945 auto deserializer = serde::BincodeDeserializer(input);
10947 if (deserializer.get_buffer_offset() < input.size()) {
10948 throw_or_abort("Some input bytes were not read");
10949 }
10950 return value;
10951}
10952
10953} // end of namespace Acir
10954
10955template <>
10956template <typename Serializer>
10958 Serializer& serializer)
10959{
10960 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10961}
10962
10963template <>
10964template <typename Deserializer>
10966 Deserializer& deserializer)
10967{
10969 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10970 return obj;
10971}
10972
10973namespace Acir {
10974
10975inline bool operator==(const Opcode& lhs, const Opcode& rhs)
10976{
10977 if (!(lhs.value == rhs.value)) {
10978 return false;
10979 }
10980 return true;
10981}
10982
10983inline std::vector<uint8_t> Opcode::bincodeSerialize() const
10984{
10985 auto serializer = serde::BincodeSerializer();
10986 serde::Serializable<Opcode>::serialize(*this, serializer);
10987 return std::move(serializer).bytes();
10988}
10989
10990inline Opcode Opcode::bincodeDeserialize(std::vector<uint8_t> input)
10991{
10992 auto deserializer = serde::BincodeDeserializer(input);
10994 if (deserializer.get_buffer_offset() < input.size()) {
10995 throw_or_abort("Some input bytes were not read");
10996 }
10997 return value;
10998}
10999
11000} // end of namespace Acir
11001
11002template <>
11003template <typename Serializer>
11004void serde::Serializable<Acir::Opcode>::serialize(const Acir::Opcode& obj, Serializer& serializer)
11005{
11006 serializer.increase_container_depth();
11007 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11008 serializer.decrease_container_depth();
11009}
11010
11011template <>
11012template <typename Deserializer>
11014{
11015 deserializer.increase_container_depth();
11016 Acir::Opcode obj;
11017 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11018 deserializer.decrease_container_depth();
11019 return obj;
11020}
11021
11022namespace Acir {
11023
11024inline bool operator==(const Opcode::AssertZero& lhs, const Opcode::AssertZero& rhs)
11025{
11026 if (!(lhs.value == rhs.value)) {
11027 return false;
11028 }
11029 return true;
11030}
11031
11032inline std::vector<uint8_t> Opcode::AssertZero::bincodeSerialize() const
11033{
11034 auto serializer = serde::BincodeSerializer();
11036 return std::move(serializer).bytes();
11037}
11038
11040{
11041 auto deserializer = serde::BincodeDeserializer(input);
11043 if (deserializer.get_buffer_offset() < input.size()) {
11044 throw_or_abort("Some input bytes were not read");
11045 }
11046 return value;
11047}
11048
11049} // end of namespace Acir
11050
11051template <>
11052template <typename Serializer>
11054 Serializer& serializer)
11055{
11056 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11057}
11058
11059template <>
11060template <typename Deserializer>
11062{
11064 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11065 return obj;
11066}
11067
11068namespace Acir {
11069
11071{
11072 if (!(lhs.value == rhs.value)) {
11073 return false;
11074 }
11075 return true;
11076}
11077
11078inline std::vector<uint8_t> Opcode::BlackBoxFuncCall::bincodeSerialize() const
11079{
11080 auto serializer = serde::BincodeSerializer();
11082 return std::move(serializer).bytes();
11083}
11084
11086{
11087 auto deserializer = serde::BincodeDeserializer(input);
11089 if (deserializer.get_buffer_offset() < input.size()) {
11090 throw_or_abort("Some input bytes were not read");
11091 }
11092 return value;
11093}
11094
11095} // end of namespace Acir
11096
11097template <>
11098template <typename Serializer>
11100 Serializer& serializer)
11101{
11102 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11103}
11104
11105template <>
11106template <typename Deserializer>
11108 Deserializer& deserializer)
11109{
11111 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11112 return obj;
11113}
11114
11115namespace Acir {
11116
11117inline bool operator==(const Opcode::MemoryOp& lhs, const Opcode::MemoryOp& rhs)
11118{
11119 if (!(lhs.block_id == rhs.block_id)) {
11120 return false;
11121 }
11122 if (!(lhs.op == rhs.op)) {
11123 return false;
11124 }
11125 return true;
11126}
11127
11128inline std::vector<uint8_t> Opcode::MemoryOp::bincodeSerialize() const
11129{
11130 auto serializer = serde::BincodeSerializer();
11132 return std::move(serializer).bytes();
11133}
11134
11136{
11137 auto deserializer = serde::BincodeDeserializer(input);
11139 if (deserializer.get_buffer_offset() < input.size()) {
11140 throw_or_abort("Some input bytes were not read");
11141 }
11142 return value;
11143}
11144
11145} // end of namespace Acir
11146
11147template <>
11148template <typename Serializer>
11150{
11151 serde::Serializable<decltype(obj.block_id)>::serialize(obj.block_id, serializer);
11152 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
11153}
11154
11155template <>
11156template <typename Deserializer>
11158{
11160 obj.block_id = serde::Deserializable<decltype(obj.block_id)>::deserialize(deserializer);
11161 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
11162 return obj;
11163}
11164
11165namespace Acir {
11166
11167inline bool operator==(const Opcode::MemoryInit& lhs, const Opcode::MemoryInit& rhs)
11168{
11169 if (!(lhs.block_id == rhs.block_id)) {
11170 return false;
11171 }
11172 if (!(lhs.init == rhs.init)) {
11173 return false;
11174 }
11175 if (!(lhs.block_type == rhs.block_type)) {
11176 return false;
11177 }
11178 return true;
11179}
11180
11181inline std::vector<uint8_t> Opcode::MemoryInit::bincodeSerialize() const
11182{
11183 auto serializer = serde::BincodeSerializer();
11185 return std::move(serializer).bytes();
11186}
11187
11189{
11190 auto deserializer = serde::BincodeDeserializer(input);
11192 if (deserializer.get_buffer_offset() < input.size()) {
11193 throw_or_abort("Some input bytes were not read");
11194 }
11195 return value;
11196}
11197
11198} // end of namespace Acir
11199
11200template <>
11201template <typename Serializer>
11203 Serializer& serializer)
11204{
11205 serde::Serializable<decltype(obj.block_id)>::serialize(obj.block_id, serializer);
11206 serde::Serializable<decltype(obj.init)>::serialize(obj.init, serializer);
11207 serde::Serializable<decltype(obj.block_type)>::serialize(obj.block_type, serializer);
11208}
11209
11210template <>
11211template <typename Deserializer>
11213{
11215 obj.block_id = serde::Deserializable<decltype(obj.block_id)>::deserialize(deserializer);
11216 obj.init = serde::Deserializable<decltype(obj.init)>::deserialize(deserializer);
11217 obj.block_type = serde::Deserializable<decltype(obj.block_type)>::deserialize(deserializer);
11218 return obj;
11219}
11220
11221namespace Acir {
11222
11223inline bool operator==(const Opcode::BrilligCall& lhs, const Opcode::BrilligCall& rhs)
11224{
11225 if (!(lhs.id == rhs.id)) {
11226 return false;
11227 }
11228 if (!(lhs.inputs == rhs.inputs)) {
11229 return false;
11230 }
11231 if (!(lhs.outputs == rhs.outputs)) {
11232 return false;
11233 }
11234 if (!(lhs.predicate == rhs.predicate)) {
11235 return false;
11236 }
11237 return true;
11238}
11239
11240inline std::vector<uint8_t> Opcode::BrilligCall::bincodeSerialize() const
11241{
11242 auto serializer = serde::BincodeSerializer();
11244 return std::move(serializer).bytes();
11245}
11246
11248{
11249 auto deserializer = serde::BincodeDeserializer(input);
11251 if (deserializer.get_buffer_offset() < input.size()) {
11252 throw_or_abort("Some input bytes were not read");
11253 }
11254 return value;
11255}
11256
11257} // end of namespace Acir
11258
11259template <>
11260template <typename Serializer>
11262 Serializer& serializer)
11263{
11264 serde::Serializable<decltype(obj.id)>::serialize(obj.id, serializer);
11265 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
11266 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
11267 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
11268}
11269
11270template <>
11271template <typename Deserializer>
11273{
11275 obj.id = serde::Deserializable<decltype(obj.id)>::deserialize(deserializer);
11276 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
11277 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
11278 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
11279 return obj;
11280}
11281
11282namespace Acir {
11283
11284inline bool operator==(const Opcode::Call& lhs, const Opcode::Call& rhs)
11285{
11286 if (!(lhs.id == rhs.id)) {
11287 return false;
11288 }
11289 if (!(lhs.inputs == rhs.inputs)) {
11290 return false;
11291 }
11292 if (!(lhs.outputs == rhs.outputs)) {
11293 return false;
11294 }
11295 if (!(lhs.predicate == rhs.predicate)) {
11296 return false;
11297 }
11298 return true;
11299}
11300
11301inline std::vector<uint8_t> Opcode::Call::bincodeSerialize() const
11302{
11303 auto serializer = serde::BincodeSerializer();
11305 return std::move(serializer).bytes();
11306}
11307
11308inline Opcode::Call Opcode::Call::bincodeDeserialize(std::vector<uint8_t> input)
11309{
11310 auto deserializer = serde::BincodeDeserializer(input);
11312 if (deserializer.get_buffer_offset() < input.size()) {
11313 throw_or_abort("Some input bytes were not read");
11314 }
11315 return value;
11316}
11317
11318} // end of namespace Acir
11319
11320template <>
11321template <typename Serializer>
11323{
11324 serde::Serializable<decltype(obj.id)>::serialize(obj.id, serializer);
11325 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
11326 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
11327 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
11328}
11329
11330template <>
11331template <typename Deserializer>
11333{
11335 obj.id = serde::Deserializable<decltype(obj.id)>::deserialize(deserializer);
11336 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
11337 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
11338 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
11339 return obj;
11340}
11341
11342namespace Acir {
11343
11344inline bool operator==(const OpcodeLocation& lhs, const OpcodeLocation& rhs)
11345{
11346 if (!(lhs.value == rhs.value)) {
11347 return false;
11348 }
11349 return true;
11350}
11351
11352inline std::vector<uint8_t> OpcodeLocation::bincodeSerialize() const
11353{
11354 auto serializer = serde::BincodeSerializer();
11356 return std::move(serializer).bytes();
11357}
11358
11359inline OpcodeLocation OpcodeLocation::bincodeDeserialize(std::vector<uint8_t> input)
11360{
11361 auto deserializer = serde::BincodeDeserializer(input);
11363 if (deserializer.get_buffer_offset() < input.size()) {
11364 throw_or_abort("Some input bytes were not read");
11365 }
11366 return value;
11367}
11368
11369} // end of namespace Acir
11370
11371template <>
11372template <typename Serializer>
11374{
11375 serializer.increase_container_depth();
11376 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11377 serializer.decrease_container_depth();
11378}
11379
11380template <>
11381template <typename Deserializer>
11383{
11384 deserializer.increase_container_depth();
11386 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11387 deserializer.decrease_container_depth();
11388 return obj;
11389}
11390
11391namespace Acir {
11392
11393inline bool operator==(const OpcodeLocation::Acir& lhs, const OpcodeLocation::Acir& rhs)
11394{
11395 if (!(lhs.value == rhs.value)) {
11396 return false;
11397 }
11398 return true;
11399}
11400
11401inline std::vector<uint8_t> OpcodeLocation::Acir::bincodeSerialize() const
11402{
11403 auto serializer = serde::BincodeSerializer();
11405 return std::move(serializer).bytes();
11406}
11407
11409{
11410 auto deserializer = serde::BincodeDeserializer(input);
11412 if (deserializer.get_buffer_offset() < input.size()) {
11413 throw_or_abort("Some input bytes were not read");
11414 }
11415 return value;
11416}
11417
11418} // end of namespace Acir
11419
11420template <>
11421template <typename Serializer>
11423 Serializer& serializer)
11424{
11425 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11426}
11427
11428template <>
11429template <typename Deserializer>
11431{
11433 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11434 return obj;
11435}
11436
11437namespace Acir {
11438
11440{
11441 if (!(lhs.acir_index == rhs.acir_index)) {
11442 return false;
11443 }
11444 if (!(lhs.brillig_index == rhs.brillig_index)) {
11445 return false;
11446 }
11447 return true;
11448}
11449
11450inline std::vector<uint8_t> OpcodeLocation::Brillig::bincodeSerialize() const
11451{
11452 auto serializer = serde::BincodeSerializer();
11454 return std::move(serializer).bytes();
11455}
11456
11458{
11459 auto deserializer = serde::BincodeDeserializer(input);
11461 if (deserializer.get_buffer_offset() < input.size()) {
11462 throw_or_abort("Some input bytes were not read");
11463 }
11464 return value;
11465}
11466
11467} // end of namespace Acir
11468
11469template <>
11470template <typename Serializer>
11472 Serializer& serializer)
11473{
11474 serde::Serializable<decltype(obj.acir_index)>::serialize(obj.acir_index, serializer);
11475 serde::Serializable<decltype(obj.brillig_index)>::serialize(obj.brillig_index, serializer);
11476}
11477
11478template <>
11479template <typename Deserializer>
11481 Deserializer& deserializer)
11482{
11484 obj.acir_index = serde::Deserializable<decltype(obj.acir_index)>::deserialize(deserializer);
11485 obj.brillig_index = serde::Deserializable<decltype(obj.brillig_index)>::deserialize(deserializer);
11486 return obj;
11487}
11488
11489namespace Acir {
11490
11491inline bool operator==(const Program& lhs, const Program& rhs)
11492{
11493 if (!(lhs.functions == rhs.functions)) {
11494 return false;
11495 }
11497 return false;
11498 }
11499 return true;
11500}
11501
11502inline std::vector<uint8_t> Program::bincodeSerialize() const
11503{
11504 auto serializer = serde::BincodeSerializer();
11505 serde::Serializable<Program>::serialize(*this, serializer);
11506 return std::move(serializer).bytes();
11507}
11508
11509inline Program Program::bincodeDeserialize(std::vector<uint8_t> input)
11510{
11511 auto deserializer = serde::BincodeDeserializer(input);
11513 if (deserializer.get_buffer_offset() < input.size()) {
11514 throw_or_abort("Some input bytes were not read");
11515 }
11516 return value;
11517}
11518
11519} // end of namespace Acir
11520
11521template <>
11522template <typename Serializer>
11523void serde::Serializable<Acir::Program>::serialize(const Acir::Program& obj, Serializer& serializer)
11524{
11525 serializer.increase_container_depth();
11526 serde::Serializable<decltype(obj.functions)>::serialize(obj.functions, serializer);
11527 serde::Serializable<decltype(obj.unconstrained_functions)>::serialize(obj.unconstrained_functions, serializer);
11528 serializer.decrease_container_depth();
11529}
11530
11531template <>
11532template <typename Deserializer>
11534{
11535 deserializer.increase_container_depth();
11536 Acir::Program obj;
11537 obj.functions = serde::Deserializable<decltype(obj.functions)>::deserialize(deserializer);
11539 serde::Deserializable<decltype(obj.unconstrained_functions)>::deserialize(deserializer);
11540 deserializer.decrease_container_depth();
11541 return obj;
11542}
11543
11544namespace Acir {
11545
11546inline bool operator==(const ProgramWithoutBrillig& lhs, const ProgramWithoutBrillig& rhs)
11547{
11548 if (!(lhs.functions == rhs.functions)) {
11549 return false;
11550 }
11552 return false;
11553 }
11554 return true;
11555}
11556
11557inline std::vector<uint8_t> ProgramWithoutBrillig::bincodeSerialize() const
11558{
11559 auto serializer = serde::BincodeSerializer();
11561 return std::move(serializer).bytes();
11562}
11563
11565{
11566 auto deserializer = serde::BincodeDeserializer(input);
11568 if (deserializer.get_buffer_offset() < input.size()) {
11569 throw_or_abort("Some input bytes were not read");
11570 }
11571 return value;
11572}
11573
11574} // end of namespace Acir
11575
11576template <>
11577template <typename Serializer>
11579 Serializer& serializer)
11580{
11581 serializer.increase_container_depth();
11582 serde::Serializable<decltype(obj.functions)>::serialize(obj.functions, serializer);
11583 serde::Serializable<decltype(obj.unconstrained_functions)>::serialize(obj.unconstrained_functions, serializer);
11584 serializer.decrease_container_depth();
11585}
11586
11587template <>
11588template <typename Deserializer>
11590{
11591 deserializer.increase_container_depth();
11593 obj.functions = serde::Deserializable<decltype(obj.functions)>::deserialize(deserializer);
11595 serde::Deserializable<decltype(obj.unconstrained_functions)>::deserialize(deserializer);
11596 deserializer.decrease_container_depth();
11597 return obj;
11598}
11599
11600namespace Acir {
11601
11602inline bool operator==(const PublicInputs& lhs, const PublicInputs& rhs)
11603{
11604 if (!(lhs.value == rhs.value)) {
11605 return false;
11606 }
11607 return true;
11608}
11609
11610inline std::vector<uint8_t> PublicInputs::bincodeSerialize() const
11611{
11612 auto serializer = serde::BincodeSerializer();
11614 return std::move(serializer).bytes();
11615}
11616
11617inline PublicInputs PublicInputs::bincodeDeserialize(std::vector<uint8_t> input)
11618{
11619 auto deserializer = serde::BincodeDeserializer(input);
11621 if (deserializer.get_buffer_offset() < input.size()) {
11622 throw_or_abort("Some input bytes were not read");
11623 }
11624 return value;
11625}
11626
11627} // end of namespace Acir
11628
11629template <>
11630template <typename Serializer>
11632{
11633 serializer.increase_container_depth();
11634 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11635 serializer.decrease_container_depth();
11636}
11637
11638template <>
11639template <typename Deserializer>
11641{
11642 deserializer.increase_container_depth();
11644 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11645 deserializer.decrease_container_depth();
11646 return obj;
11647}
11648
11649namespace Acir {
11650
11651inline bool operator==(const ValueOrArray& lhs, const ValueOrArray& rhs)
11652{
11653 if (!(lhs.value == rhs.value)) {
11654 return false;
11655 }
11656 return true;
11657}
11658
11659inline std::vector<uint8_t> ValueOrArray::bincodeSerialize() const
11660{
11661 auto serializer = serde::BincodeSerializer();
11663 return std::move(serializer).bytes();
11664}
11665
11666inline ValueOrArray ValueOrArray::bincodeDeserialize(std::vector<uint8_t> input)
11667{
11668 auto deserializer = serde::BincodeDeserializer(input);
11670 if (deserializer.get_buffer_offset() < input.size()) {
11671 throw_or_abort("Some input bytes were not read");
11672 }
11673 return value;
11674}
11675
11676} // end of namespace Acir
11677
11678template <>
11679template <typename Serializer>
11681{
11682 serializer.increase_container_depth();
11683 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11684 serializer.decrease_container_depth();
11685}
11686
11687template <>
11688template <typename Deserializer>
11690{
11691 deserializer.increase_container_depth();
11693 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11694 deserializer.decrease_container_depth();
11695 return obj;
11696}
11697
11698namespace Acir {
11699
11701{
11702 if (!(lhs.value == rhs.value)) {
11703 return false;
11704 }
11705 return true;
11706}
11707
11708inline std::vector<uint8_t> ValueOrArray::MemoryAddress::bincodeSerialize() const
11709{
11710 auto serializer = serde::BincodeSerializer();
11712 return std::move(serializer).bytes();
11713}
11714
11716{
11717 auto deserializer = serde::BincodeDeserializer(input);
11719 if (deserializer.get_buffer_offset() < input.size()) {
11720 throw_or_abort("Some input bytes were not read");
11721 }
11722 return value;
11723}
11724
11725} // end of namespace Acir
11726
11727template <>
11728template <typename Serializer>
11730 Serializer& serializer)
11731{
11732 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11733}
11734
11735template <>
11736template <typename Deserializer>
11738 Deserializer& deserializer)
11739{
11741 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11742 return obj;
11743}
11744
11745namespace Acir {
11746
11748{
11749 if (!(lhs.value == rhs.value)) {
11750 return false;
11751 }
11752 return true;
11753}
11754
11755inline std::vector<uint8_t> ValueOrArray::HeapArray::bincodeSerialize() const
11756{
11757 auto serializer = serde::BincodeSerializer();
11759 return std::move(serializer).bytes();
11760}
11761
11763{
11764 auto deserializer = serde::BincodeDeserializer(input);
11766 if (deserializer.get_buffer_offset() < input.size()) {
11767 throw_or_abort("Some input bytes were not read");
11768 }
11769 return value;
11770}
11771
11772} // end of namespace Acir
11773
11774template <>
11775template <typename Serializer>
11777 Serializer& serializer)
11778{
11779 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11780}
11781
11782template <>
11783template <typename Deserializer>
11785 Deserializer& deserializer)
11786{
11788 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11789 return obj;
11790}
11791
11792namespace Acir {
11793
11795{
11796 if (!(lhs.value == rhs.value)) {
11797 return false;
11798 }
11799 return true;
11800}
11801
11802inline std::vector<uint8_t> ValueOrArray::HeapVector::bincodeSerialize() const
11803{
11804 auto serializer = serde::BincodeSerializer();
11806 return std::move(serializer).bytes();
11807}
11808
11810{
11811 auto deserializer = serde::BincodeDeserializer(input);
11813 if (deserializer.get_buffer_offset() < input.size()) {
11814 throw_or_abort("Some input bytes were not read");
11815 }
11816 return value;
11817}
11818
11819} // end of namespace Acir
11820
11821template <>
11822template <typename Serializer>
11824 Serializer& serializer)
11825{
11826 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11827}
11828
11829template <>
11830template <typename Deserializer>
11832 Deserializer& deserializer)
11833{
11835 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11836 return obj;
11837}
11838
11839namespace Acir {
11840
11841inline bool operator==(const Witness& lhs, const Witness& rhs)
11842{
11843 if (!(lhs.value == rhs.value)) {
11844 return false;
11845 }
11846 return true;
11847}
11848
11849inline std::vector<uint8_t> Witness::bincodeSerialize() const
11850{
11851 auto serializer = serde::BincodeSerializer();
11852 serde::Serializable<Witness>::serialize(*this, serializer);
11853 return std::move(serializer).bytes();
11854}
11855
11856inline Witness Witness::bincodeDeserialize(std::vector<uint8_t> input)
11857{
11858 auto deserializer = serde::BincodeDeserializer(input);
11860 if (deserializer.get_buffer_offset() < input.size()) {
11861 throw_or_abort("Some input bytes were not read");
11862 }
11863 return value;
11864}
11865
11866} // end of namespace Acir
11867
11868template <>
11869template <typename Serializer>
11870void serde::Serializable<Acir::Witness>::serialize(const Acir::Witness& obj, Serializer& serializer)
11871{
11872 serializer.increase_container_depth();
11873 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11874 serializer.decrease_container_depth();
11875}
11876
11877template <>
11878template <typename Deserializer>
11880{
11881 deserializer.increase_container_depth();
11882 Acir::Witness obj;
11883 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11884 deserializer.decrease_container_depth();
11885 return obj;
11886}
Serves as a key-value node store for merkle trees. Caches all changes in memory before persisting the...
const std::vector< MemoryValue > data
Definition acir.hpp:7
bool operator==(const AssertionPayload &lhs, const AssertionPayload &rhs)
Definition acir.hpp:5267
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::string to_string(bb::avm2::ValueTag tag)
static AssertionPayload bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5285
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5278
uint64_t error_selector
Definition acir.hpp:4813
std::vector< Acir::ExpressionOrMemory > payload
Definition acir.hpp:4814
friend bool operator==(const AssertionPayload &, const AssertionPayload &)
Definition acir.hpp:5267
void msgpack_pack(auto &packer) const
Definition acir.hpp:4820
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4827
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:78
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5375
void msgpack_pack(auto &packer) const
Definition acir.hpp:77
static Add bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5382
friend bool operator==(const Add &, const Add &)
Definition acir.hpp:5370
void msgpack_pack(auto &packer) const
Definition acir.hpp:104
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:105
friend bool operator==(const Div &, const Div &)
Definition acir.hpp:5490
static Div bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5502
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5495
void msgpack_pack(auto &packer) const
Definition acir.hpp:122
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5576
static Equals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5583
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:123
friend bool operator==(const Equals &, const Equals &)
Definition acir.hpp:5571
static IntegerDiv bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5542
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5535
friend bool operator==(const IntegerDiv &, const IntegerDiv &)
Definition acir.hpp:5530
void msgpack_pack(auto &packer) const
Definition acir.hpp:113
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:114
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5657
friend bool operator==(const LessThanEquals &, const LessThanEquals &)
Definition acir.hpp:5652
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:141
void msgpack_pack(auto &packer) const
Definition acir.hpp:140
static LessThanEquals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5664
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:132
static LessThan bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5623
void msgpack_pack(auto &packer) const
Definition acir.hpp:131
friend bool operator==(const LessThan &, const LessThan &)
Definition acir.hpp:5611
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5616
void msgpack_pack(auto &packer) const
Definition acir.hpp:95
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:96
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5455
friend bool operator==(const Mul &, const Mul &)
Definition acir.hpp:5450
static Mul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5462
void msgpack_pack(auto &packer) const
Definition acir.hpp:86
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:87
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5415
friend bool operator==(const Sub &, const Sub &)
Definition acir.hpp:5410
static Sub bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5422
std::variant< Add, Sub, Mul, Div, IntegerDiv, Equals, LessThan, LessThanEquals > value
Definition acir.hpp:144
void msgpack_pack(auto &packer) const
Definition acir.hpp:150
static BinaryFieldOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5336
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:204
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5329
friend bool operator==(const BinaryFieldOp &, const BinaryFieldOp &)
Definition acir.hpp:5321
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5747
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:264
static Add bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5754
friend bool operator==(const Add &, const Add &)
Definition acir.hpp:5742
void msgpack_pack(auto &packer) const
Definition acir.hpp:263
void msgpack_pack(auto &packer) const
Definition acir.hpp:326
static And bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6031
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6024
friend bool operator==(const And &, const And &)
Definition acir.hpp:6019
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:327
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:291
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5864
static Div bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5871
friend bool operator==(const Div &, const Div &)
Definition acir.hpp:5859
void msgpack_pack(auto &packer) const
Definition acir.hpp:290
void msgpack_pack(auto &packer) const
Definition acir.hpp:299
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:300
static Equals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5910
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5903
friend bool operator==(const Equals &, const Equals &)
Definition acir.hpp:5898
friend bool operator==(const LessThanEquals &, const LessThanEquals &)
Definition acir.hpp:5978
static LessThanEquals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5990
void msgpack_pack(auto &packer) const
Definition acir.hpp:317
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5983
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:318
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5943
static LessThan bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5950
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:309
friend bool operator==(const LessThan &, const LessThan &)
Definition acir.hpp:5938
void msgpack_pack(auto &packer) const
Definition acir.hpp:308
void msgpack_pack(auto &packer) const
Definition acir.hpp:281
friend bool operator==(const Mul &, const Mul &)
Definition acir.hpp:5820
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5825
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:282
static Mul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5832
static Or bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6070
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6063
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:336
void msgpack_pack(auto &packer) const
Definition acir.hpp:335
friend bool operator==(const Or &, const Or &)
Definition acir.hpp:6058
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6141
friend bool operator==(const Shl &, const Shl &)
Definition acir.hpp:6136
static Shl bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6148
void msgpack_pack(auto &packer) const
Definition acir.hpp:353
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:354
void msgpack_pack(auto &packer) const
Definition acir.hpp:362
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:363
friend bool operator==(const Shr &, const Shr &)
Definition acir.hpp:6175
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6180
static Shr bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6187
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:273
void msgpack_pack(auto &packer) const
Definition acir.hpp:272
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5786
static Sub bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5793
friend bool operator==(const Sub &, const Sub &)
Definition acir.hpp:5781
friend bool operator==(const Xor &, const Xor &)
Definition acir.hpp:6097
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:345
void msgpack_pack(auto &packer) const
Definition acir.hpp:344
static Xor bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6109
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6102
void msgpack_pack(auto &packer) const
Definition acir.hpp:372
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5701
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:442
static BinaryIntOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5708
std::variant< Add, Sub, Mul, Div, Equals, LessThan, LessThanEquals, And, Or, Xor, Shl, Shr > value
Definition acir.hpp:366
friend bool operator==(const BinaryIntOp &, const BinaryIntOp &)
Definition acir.hpp:5693
static Field bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6275
friend bool operator==(const Field &, const Field &)
Definition acir.hpp:6263
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:668
void msgpack_pack(auto &packer) const
Definition acir.hpp:667
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6268
Acir::IntegerBitSize value
Definition acir.hpp:672
static Integer bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6317
friend bool operator==(const Integer &, const Integer &)
Definition acir.hpp:6302
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6310
void msgpack_pack(auto &packer) const
Definition acir.hpp:678
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:680
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6222
std::variant< Field, Integer > value
Definition acir.hpp:691
static BitSize bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6229
friend bool operator==(const BitSize &, const BitSize &)
Definition acir.hpp:6214
void msgpack_pack(auto &packer) const
Definition acir.hpp:697
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:727
void msgpack_pack(auto &packer) const
Definition acir.hpp:3058
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > key
Definition acir.hpp:3051
std::vector< Acir::Witness > outputs
Definition acir.hpp:3052
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6413
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3049
friend bool operator==(const AES128Encrypt &, const AES128Encrypt &)
Definition acir.hpp:6396
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3067
static AES128Encrypt bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6420
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > iv
Definition acir.hpp:3050
friend bool operator==(const AND &, const AND &)
Definition acir.hpp:6458
static AND bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6482
Acir::FunctionInput lhs
Definition acir.hpp:3089
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3107
Acir::FunctionInput rhs
Definition acir.hpp:3090
void msgpack_pack(auto &packer) const
Definition acir.hpp:3098
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6475
std::shared_ptr< std::array< Acir::Witness, 32 > > outputs
Definition acir.hpp:3202
static Blake2s bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6650
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6643
void msgpack_pack(auto &packer) const
Definition acir.hpp:3208
friend bool operator==(const Blake2s &, const Blake2s &)
Definition acir.hpp:6632
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3201
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3215
void msgpack_pack(auto &packer) const
Definition acir.hpp:3240
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3247
static Blake3 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6702
std::shared_ptr< std::array< Acir::Witness, 32 > > outputs
Definition acir.hpp:3234
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6695
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3233
friend bool operator==(const Blake3 &, const Blake3 &)
Definition acir.hpp:6684
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6759
static EcdsaSecp256k1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6766
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_x
Definition acir.hpp:3265
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > hashed_message
Definition acir.hpp:3268
void msgpack_pack(auto &packer) const
Definition acir.hpp:3276
friend bool operator==(const EcdsaSecp256k1 &, const EcdsaSecp256k1 &)
Definition acir.hpp:6736
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_y
Definition acir.hpp:3266
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3287
std::shared_ptr< std::array< Acir::FunctionInput, 64 > > signature
Definition acir.hpp:3267
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_x
Definition acir.hpp:3313
static EcdsaSecp256r1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6838
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6831
friend bool operator==(const EcdsaSecp256r1 &, const EcdsaSecp256r1 &)
Definition acir.hpp:6808
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3335
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > hashed_message
Definition acir.hpp:3316
void msgpack_pack(auto &packer) const
Definition acir.hpp:3324
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_y
Definition acir.hpp:3314
std::shared_ptr< std::array< Acir::FunctionInput, 64 > > signature
Definition acir.hpp:3315
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6959
std::shared_ptr< std::array< Acir::Witness, 3 > > outputs
Definition acir.hpp:3404
friend bool operator==(const EmbeddedCurveAdd &, const EmbeddedCurveAdd &)
Definition acir.hpp:6942
void msgpack_pack(auto &packer) const
Definition acir.hpp:3410
std::shared_ptr< std::array< Acir::FunctionInput, 3 > > input2
Definition acir.hpp:3402
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3419
std::shared_ptr< std::array< Acir::FunctionInput, 3 > > input1
Definition acir.hpp:3401
static EmbeddedCurveAdd bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6966
std::shared_ptr< std::array< Acir::FunctionInput, 25 > > inputs
Definition acir.hpp:3441
friend bool operator==(const Keccakf1600 &, const Keccakf1600 &)
Definition acir.hpp:7005
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3455
static Keccakf1600 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7023
void msgpack_pack(auto &packer) const
Definition acir.hpp:3448
std::shared_ptr< std::array< Acir::Witness, 25 > > outputs
Definition acir.hpp:3442
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7016
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6897
std::vector< Acir::FunctionInput > scalars
Definition acir.hpp:3362
std::vector< Acir::FunctionInput > points
Definition acir.hpp:3361
std::shared_ptr< std::array< Acir::Witness, 3 > > outputs
Definition acir.hpp:3364
static MultiScalarMul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6904
friend bool operator==(const MultiScalarMul &, const MultiScalarMul &)
Definition acir.hpp:6880
void msgpack_pack(auto &packer) const
Definition acir.hpp:3370
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3379
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7143
std::vector< Acir::Witness > outputs
Definition acir.hpp:3522
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3521
static Poseidon2Permutation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7150
void msgpack_pack(auto &packer) const
Definition acir.hpp:3528
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3535
friend bool operator==(const Poseidon2Permutation &, const Poseidon2Permutation &)
Definition acir.hpp:7131
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3183
friend bool operator==(const RANGE &, const RANGE &)
Definition acir.hpp:6580
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6591
void msgpack_pack(auto &packer) const
Definition acir.hpp:3176
static RANGE bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6598
Acir::FunctionInput input
Definition acir.hpp:3169
std::vector< Acir::FunctionInput > verification_key
Definition acir.hpp:3473
std::vector< Acir::FunctionInput > proof
Definition acir.hpp:3474
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7081
void msgpack_pack(auto &packer) const
Definition acir.hpp:3484
std::vector< Acir::FunctionInput > public_inputs
Definition acir.hpp:3475
static RecursiveAggregation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7088
friend bool operator==(const RecursiveAggregation &, const RecursiveAggregation &)
Definition acir.hpp:7057
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3495
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3569
static Sha256Compression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7206
std::shared_ptr< std::array< Acir::FunctionInput, 8 > > hash_values
Definition acir.hpp:3554
friend bool operator==(const Sha256Compression &, const Sha256Compression &)
Definition acir.hpp:7185
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > inputs
Definition acir.hpp:3553
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7199
std::shared_ptr< std::array< Acir::Witness, 8 > > outputs
Definition acir.hpp:3555
void msgpack_pack(auto &packer) const
Definition acir.hpp:3561
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3147
Acir::FunctionInput rhs
Definition acir.hpp:3130
Acir::FunctionInput lhs
Definition acir.hpp:3129
static XOR bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6543
void msgpack_pack(auto &packer) const
Definition acir.hpp:3138
friend bool operator==(const XOR &, const XOR &)
Definition acir.hpp:6519
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6536
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6355
void msgpack_pack(auto &packer) const
Definition acir.hpp:3608
friend bool operator==(const BlackBoxFuncCall &, const BlackBoxFuncCall &)
Definition acir.hpp:6347
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3686
std::variant< AES128Encrypt, AND, XOR, RANGE, Blake2s, Blake3, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Keccakf1600, RecursiveAggregation, Poseidon2Permutation, Sha256Compression > value
Definition acir.hpp:3602
static BlackBoxFuncCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6362
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:979
void msgpack_pack(auto &packer) const
Definition acir.hpp:970
Acir::HeapVector outputs
Definition acir.hpp:964
friend bool operator==(const AES128Encrypt &, const AES128Encrypt &)
Definition acir.hpp:7292
Acir::HeapVector inputs
Definition acir.hpp:961
static AES128Encrypt bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7316
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7309
Acir::HeapVector message
Definition acir.hpp:1001
static Blake2s bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7372
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7365
Acir::HeapArray output
Definition acir.hpp:1002
friend bool operator==(const Blake2s &, const Blake2s &)
Definition acir.hpp:7354
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1015
void msgpack_pack(auto &packer) const
Definition acir.hpp:1008
Acir::HeapArray output
Definition acir.hpp:1034
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7416
void msgpack_pack(auto &packer) const
Definition acir.hpp:1040
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1047
Acir::HeapVector message
Definition acir.hpp:1033
static Blake3 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7423
friend bool operator==(const Blake3 &, const Blake3 &)
Definition acir.hpp:7405
Acir::MemoryAddress result
Definition acir.hpp:1101
static EcdsaSecp256k1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7535
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7528
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1117
Acir::HeapVector hashed_msg
Definition acir.hpp:1097
friend bool operator==(const EcdsaSecp256k1 &, const EcdsaSecp256k1 &)
Definition acir.hpp:7508
void msgpack_pack(auto &packer) const
Definition acir.hpp:1107
Acir::MemoryAddress result
Definition acir.hpp:1145
Acir::HeapVector hashed_msg
Definition acir.hpp:1141
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1161
friend bool operator==(const EcdsaSecp256r1 &, const EcdsaSecp256r1 &)
Definition acir.hpp:7575
void msgpack_pack(auto &packer) const
Definition acir.hpp:1151
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7595
static EcdsaSecp256r1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7602
static EmbeddedCurveAdd bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7732
Acir::MemoryAddress input1_x
Definition acir.hpp:1221
friend bool operator==(const EmbeddedCurveAdd &, const EmbeddedCurveAdd &)
Definition acir.hpp:7699
Acir::MemoryAddress input2_infinite
Definition acir.hpp:1226
Acir::MemoryAddress input1_y
Definition acir.hpp:1222
Acir::MemoryAddress input1_infinite
Definition acir.hpp:1223
Acir::MemoryAddress input2_x
Definition acir.hpp:1224
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7725
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1245
void msgpack_pack(auto &packer) const
Definition acir.hpp:1233
Acir::MemoryAddress input2_y
Definition acir.hpp:1225
static Keccakf1600 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7474
friend bool operator==(const Keccakf1600 &, const Keccakf1600 &)
Definition acir.hpp:7456
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7467
void msgpack_pack(auto &packer) const
Definition acir.hpp:1072
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1079
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7656
friend bool operator==(const MultiScalarMul &, const MultiScalarMul &)
Definition acir.hpp:7642
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1201
void msgpack_pack(auto &packer) const
Definition acir.hpp:1193
static MultiScalarMul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7663
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7787
static Poseidon2Permutation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7794
void msgpack_pack(auto &packer) const
Definition acir.hpp:1280
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1287
friend bool operator==(const Poseidon2Permutation &, const Poseidon2Permutation &)
Definition acir.hpp:7776
friend bool operator==(const Sha256Compression &, const Sha256Compression &)
Definition acir.hpp:7828
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7842
void msgpack_pack(auto &packer) const
Definition acir.hpp:1313
static Sha256Compression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7849
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1321
friend bool operator==(const ToRadix &, const ToRadix &)
Definition acir.hpp:7885
Acir::MemoryAddress output_pointer
Definition acir.hpp:1343
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7905
static ToRadix bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7912
Acir::MemoryAddress radix
Definition acir.hpp:1342
Acir::MemoryAddress output_bits
Definition acir.hpp:1345
Acir::MemoryAddress input
Definition acir.hpp:1341
Acir::MemoryAddress num_limbs
Definition acir.hpp:1344
void msgpack_pack(auto &packer) const
Definition acir.hpp:1351
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1361
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1467
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7251
void msgpack_pack(auto &packer) const
Definition acir.hpp:1401
friend bool operator==(const BlackBoxOp &, const BlackBoxOp &)
Definition acir.hpp:7243
std::variant< AES128Encrypt, Blake2s, Blake3, Keccakf1600, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Poseidon2Permutation, Sha256Compression, ToRadix > value
Definition acir.hpp:1395
static BlackBoxOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7258
void msgpack_pack(auto &packer) const
Definition acir.hpp:3861
friend bool operator==(const BlockId &, const BlockId &)
Definition acir.hpp:7951
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3863
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7959
static BlockId bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7966
uint32_t value
Definition acir.hpp:3855
static CallData bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8103
friend bool operator==(const CallData &, const CallData &)
Definition acir.hpp:8088
void msgpack_pack(auto &packer) const
Definition acir.hpp:3892
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8096
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3894
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3882
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8054
friend bool operator==(const Memory &, const Memory &)
Definition acir.hpp:8049
void msgpack_pack(auto &packer) const
Definition acir.hpp:3881
static Memory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8061
static ReturnData bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8146
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3911
friend bool operator==(const ReturnData &, const ReturnData &)
Definition acir.hpp:8134
void msgpack_pack(auto &packer) const
Definition acir.hpp:3910
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8139
void msgpack_pack(auto &packer) const
Definition acir.hpp:3920
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8008
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3954
static BlockType bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8015
std::variant< Memory, CallData, ReturnData > value
Definition acir.hpp:3914
friend bool operator==(const BlockType &, const BlockType &)
Definition acir.hpp:8000
void msgpack_pack(auto &packer) const
Definition acir.hpp:5062
static BrilligBytecode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8192
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8185
friend bool operator==(const BrilligBytecode &, const BrilligBytecode &)
Definition acir.hpp:8174
std::vector< Acir::BrilligOpcode > bytecode
Definition acir.hpp:5056
std::string function_name
Definition acir.hpp:5055
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5069
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4065
void msgpack_pack(auto &packer) const
Definition acir.hpp:4063
std::vector< Acir::Expression > value
Definition acir.hpp:4057
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8338
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8331
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:8323
static MemoryArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8384
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8377
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4085
void msgpack_pack(auto &packer) const
Definition acir.hpp:4083
friend bool operator==(const MemoryArray &, const MemoryArray &)
Definition acir.hpp:8369
Acir::Expression value
Definition acir.hpp:4037
static Single bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8292
friend bool operator==(const Single &, const Single &)
Definition acir.hpp:8277
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4045
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8285
void msgpack_pack(auto &packer) const
Definition acir.hpp:4043
static BrilligInputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8243
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4136
std::variant< Single, Array, MemoryArray > value
Definition acir.hpp:4096
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8236
void msgpack_pack(auto &packer) const
Definition acir.hpp:4102
friend bool operator==(const BrilligInputs &, const BrilligInputs &)
Definition acir.hpp:8228
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8482
static BinaryFieldOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8489
void msgpack_pack(auto &packer) const
Definition acir.hpp:1959
friend bool operator==(const BinaryFieldOp &, const BinaryFieldOp &)
Definition acir.hpp:8465
Acir::MemoryAddress destination
Definition acir.hpp:1950
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1968
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2010
Acir::MemoryAddress destination
Definition acir.hpp:1990
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8547
Acir::MemoryAddress rhs
Definition acir.hpp:1994
static BinaryIntOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8554
void msgpack_pack(auto &packer) const
Definition acir.hpp:2000
friend bool operator==(const BinaryIntOp &, const BinaryIntOp &)
Definition acir.hpp:8527
Acir::IntegerBitSize bit_size
Definition acir.hpp:1992
Acir::MemoryAddress lhs
Definition acir.hpp:1993
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2499
static BlackBox bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9357
Acir::BlackBoxOp value
Definition acir.hpp:2491
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9350
friend bool operator==(const BlackBox &, const BlackBox &)
Definition acir.hpp:9342
void msgpack_pack(auto &packer) const
Definition acir.hpp:2497
void msgpack_pack(auto &packer) const
Definition acir.hpp:2208
static Call bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8875
friend bool operator==(const Call &, const Call &)
Definition acir.hpp:8860
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8868
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2214
Acir::MemoryAddress offset_address
Definition acir.hpp:2168
static CalldataCopy bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8824
friend bool operator==(const CalldataCopy &, const CalldataCopy &)
Definition acir.hpp:8803
Acir::MemoryAddress destination_address
Definition acir.hpp:2166
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8817
void msgpack_pack(auto &packer) const
Definition acir.hpp:2174
Acir::MemoryAddress size_address
Definition acir.hpp:2167
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2182
Acir::MemoryAddress source
Definition acir.hpp:2071
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2086
void msgpack_pack(auto &packer) const
Definition acir.hpp:2078
Acir::MemoryAddress destination
Definition acir.hpp:2070
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8664
static Cast bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8671
Acir::BitSize bit_size
Definition acir.hpp:2072
friend bool operator==(const Cast &, const Cast &)
Definition acir.hpp:8650
Acir::MemoryAddress source_b
Definition acir.hpp:2389
static ConditionalMov bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9202
friend bool operator==(const ConditionalMov &, const ConditionalMov &)
Definition acir.hpp:9178
Acir::MemoryAddress source_a
Definition acir.hpp:2388
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2405
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9195
void msgpack_pack(auto &packer) const
Definition acir.hpp:2396
Acir::MemoryAddress destination
Definition acir.hpp:2387
Acir::MemoryAddress condition
Definition acir.hpp:2390
static Const bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8927
Acir::BitSize bit_size
Definition acir.hpp:2231
friend bool operator==(const Const &, const Const &)
Definition acir.hpp:8906
std::vector< uint8_t > value
Definition acir.hpp:2232
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2246
void msgpack_pack(auto &packer) const
Definition acir.hpp:2238
Acir::MemoryAddress destination
Definition acir.hpp:2230
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8920
std::vector< Acir::HeapValueType > input_value_types
Definition acir.hpp:2315
std::vector< Acir::HeapValueType > destination_value_types
Definition acir.hpp:2313
static ForeignCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9086
std::vector< Acir::ValueOrArray > destinations
Definition acir.hpp:2312
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9079
friend bool operator==(const ForeignCall &, const ForeignCall &)
Definition acir.hpp:9059
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2331
void msgpack_pack(auto &packer) const
Definition acir.hpp:2321
std::vector< Acir::ValueOrArray > inputs
Definition acir.hpp:2314
std::vector< uint8_t > value
Definition acir.hpp:2268
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8976
void msgpack_pack(auto &packer) const
Definition acir.hpp:2274
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2282
static IndirectConst bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8983
friend bool operator==(const IndirectConst &, const IndirectConst &)
Definition acir.hpp:8962
Acir::MemoryAddress destination_pointer
Definition acir.hpp:2266
void msgpack_pack(auto &packer) const
Definition acir.hpp:2144
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8765
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2150
friend bool operator==(const Jump &, const Jump &)
Definition acir.hpp:8757
static Jump bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8772
void msgpack_pack(auto &packer) const
Definition acir.hpp:2113
Acir::MemoryAddress condition
Definition acir.hpp:2106
static JumpIf bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8724
friend bool operator==(const JumpIf &, const JumpIf &)
Definition acir.hpp:8706
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8717
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2120
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2441
static Load bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9258
Acir::MemoryAddress destination
Definition acir.hpp:2427
Acir::MemoryAddress source_pointer
Definition acir.hpp:2428
friend bool operator==(const Load &, const Load &)
Definition acir.hpp:9240
void msgpack_pack(auto &packer) const
Definition acir.hpp:2434
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9251
Acir::MemoryAddress destination
Definition acir.hpp:2355
friend bool operator==(const Mov &, const Mov &)
Definition acir.hpp:9127
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2369
static Mov bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9145
Acir::MemoryAddress source
Definition acir.hpp:2356
void msgpack_pack(auto &packer) const
Definition acir.hpp:2362
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9138
friend bool operator==(const Not &, const Not &)
Definition acir.hpp:8594
Acir::MemoryAddress source
Definition acir.hpp:2035
void msgpack_pack(auto &packer) const
Definition acir.hpp:2042
static Not bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8615
Acir::IntegerBitSize bit_size
Definition acir.hpp:2036
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8608
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2050
Acir::MemoryAddress destination
Definition acir.hpp:2034
friend bool operator==(const Return &, const Return &)
Definition acir.hpp:9019
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2307
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9024
void msgpack_pack(auto &packer) const
Definition acir.hpp:2306
static Return bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9031
friend bool operator==(const Stop &, const Stop &)
Definition acir.hpp:9435
static Stop bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9450
void msgpack_pack(auto &packer) const
Definition acir.hpp:2545
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9443
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2551
Acir::HeapVector return_data
Definition acir.hpp:2539
static Store bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9309
friend bool operator==(const Store &, const Store &)
Definition acir.hpp:9291
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2473
Acir::MemoryAddress source
Definition acir.hpp:2460
Acir::MemoryAddress destination_pointer
Definition acir.hpp:2459
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9302
void msgpack_pack(auto &packer) const
Definition acir.hpp:2466
friend bool operator==(const Trap &, const Trap &)
Definition acir.hpp:9389
void msgpack_pack(auto &packer) const
Definition acir.hpp:2517
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2523
Acir::HeapVector revert_data
Definition acir.hpp:2511
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9397
static Trap bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9404
static BrilligOpcode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8431
std::variant< BinaryFieldOp, BinaryIntOp, Not, Cast, JumpIf, Jump, CalldataCopy, Call, Const, IndirectConst, Return, ForeignCall, Mov, ConditionalMov, Load, Store, BlackBox, Trap, Stop > value
Definition acir.hpp:2585
friend bool operator==(const BrilligOpcode &, const BrilligOpcode &)
Definition acir.hpp:8416
void msgpack_pack(auto &packer) const
Definition acir.hpp:2591
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8424
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2689
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9592
void msgpack_pack(auto &packer) const
Definition acir.hpp:4223
std::vector< Acir::Witness > value
Definition acir.hpp:4217
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9585
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:9577
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4225
void msgpack_pack(auto &packer) const
Definition acir.hpp:4203
friend bool operator==(const Simple &, const Simple &)
Definition acir.hpp:9530
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4205
static Simple bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9545
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9538
friend bool operator==(const BrilligOutputs &, const BrilligOutputs &)
Definition acir.hpp:9481
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9489
void msgpack_pack(auto &packer) const
Definition acir.hpp:4242
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4272
static BrilligOutputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9496
std::variant< Simple, Array > value
Definition acir.hpp:4236
Acir::PublicInputs return_values
Definition acir.hpp:5008
static Circuit bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9656
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9649
void msgpack_pack(auto &packer) const
Definition acir.hpp:5015
std::vector< Acir::Opcode > opcodes
Definition acir.hpp:5005
friend bool operator==(const Circuit &, const Circuit &)
Definition acir.hpp:9623
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5027
uint32_t current_witness_index
Definition acir.hpp:5004
std::vector< Acir::Witness > private_parameters
Definition acir.hpp:5006
Acir::PublicInputs public_parameters
Definition acir.hpp:5007
std::string function_name
Definition acir.hpp:5003
std::vector< std::tuple< Acir::OpcodeLocation, Acir::AssertionPayload > > assert_messages
Definition acir.hpp:5009
static Expression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9723
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness > > linear_combinations
Definition acir.hpp:4000
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9716
std::vector< uint8_t > q_c
Definition acir.hpp:4001
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness, Acir::Witness > > mul_terms
Definition acir.hpp:3999
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4015
void msgpack_pack(auto &packer) const
Definition acir.hpp:4007
friend bool operator==(const Expression &, const Expression &)
Definition acir.hpp:9702
void msgpack_pack(auto &packer) const
Definition acir.hpp:4695
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4697
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9819
static Expression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9826
friend bool operator==(const Expression &, const Expression &)
Definition acir.hpp:9811
void msgpack_pack(auto &packer) const
Definition acir.hpp:4715
friend bool operator==(const Memory &, const Memory &)
Definition acir.hpp:9858
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9866
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4717
static Memory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9873
std::variant< Expression, Memory > value
Definition acir.hpp:4728
void msgpack_pack(auto &packer) const
Definition acir.hpp:4734
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9769
static ExpressionOrMemory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9776
friend bool operator==(const ExpressionOrMemory &, const ExpressionOrMemory &)
Definition acir.hpp:9761
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4764
void msgpack_pack(auto &packer) const
Definition acir.hpp:5165
friend bool operator==(const Bounded &, const Bounded &)
Definition acir.hpp:9995
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5171
static Bounded bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10010
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10003
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9959
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5155
static Unbounded bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9966
friend bool operator==(const Unbounded &, const Unbounded &)
Definition acir.hpp:9954
void msgpack_pack(auto &packer) const
Definition acir.hpp:5154
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9913
std::variant< Unbounded, Bounded > value
Definition acir.hpp:5186
void msgpack_pack(auto &packer) const
Definition acir.hpp:5192
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5222
friend bool operator==(const ExpressionWidth &, const ExpressionWidth &)
Definition acir.hpp:9905
static ExpressionWidth bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9920
std::vector< uint8_t > value
Definition acir.hpp:2923
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2931
static Constant bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10106
friend bool operator==(const Constant &, const Constant &)
Definition acir.hpp:10091
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10099
void msgpack_pack(auto &packer) const
Definition acir.hpp:2929
static Witness bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10153
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10146
void msgpack_pack(auto &packer) const
Definition acir.hpp:2949
friend bool operator==(const Witness &, const Witness &)
Definition acir.hpp:10138
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2951
static FunctionInput bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10057
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2998
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10050
void msgpack_pack(auto &packer) const
Definition acir.hpp:2968
std::variant< Constant, Witness > value
Definition acir.hpp:2962
friend bool operator==(const FunctionInput &, const FunctionInput &)
Definition acir.hpp:10042
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10196
void msgpack_pack(auto &packer) const
Definition acir.hpp:902
uint64_t size
Definition acir.hpp:896
static HeapArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10203
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:909
friend bool operator==(const HeapArray &, const HeapArray &)
Definition acir.hpp:10185
Acir::MemoryAddress pointer
Definition acir.hpp:895
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10345
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1644
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10352
void msgpack_pack(auto &packer) const
Definition acir.hpp:1637
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:10334
std::vector< Acir::HeapValueType > value_types
Definition acir.hpp:1630
void msgpack_pack(auto &packer) const
Definition acir.hpp:1616
friend bool operator==(const Simple &, const Simple &)
Definition acir.hpp:10288
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10296
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1618
static Simple bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10303
static Vector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10400
friend bool operator==(const Vector &, const Vector &)
Definition acir.hpp:10385
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1674
void msgpack_pack(auto &packer) const
Definition acir.hpp:1668
std::vector< Acir::HeapValueType > value_types
Definition acir.hpp:1662
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10393
static HeapValueType bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10254
void msgpack_pack(auto &packer) const
Definition acir.hpp:1695
friend bool operator==(const HeapValueType &, const HeapValueType &)
Definition acir.hpp:10239
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10247
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1729
std::variant< Simple, Array, Vector > value
Definition acir.hpp:1689
void msgpack_pack(auto &packer) const
Definition acir.hpp:934
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:941
static HeapVector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10449
friend bool operator==(const HeapVector &, const HeapVector &)
Definition acir.hpp:10431
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10442
Acir::MemoryAddress size
Definition acir.hpp:928
Acir::MemoryAddress pointer
Definition acir.hpp:927
static void conv_fld_from_kvmap(std::map< std::string, msgpack::object const * > const &kvmap, std::string const &struct_name, std::string const &field_name, T &field, bool is_optional)
Definition acir.hpp:28
static std::map< std::string, msgpack::object const * > make_kvmap(msgpack::object const &o, std::string const &name)
Definition acir.hpp:9
static void conv_fld_from_array(msgpack::object_array const &array, std::string const &struct_name, std::string const &field_name, T &field, uint32_t index)
Definition acir.hpp:48
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10739
friend bool operator==(const U128 &, const U128 &)
Definition acir.hpp:10734
static U128 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10746
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:559
void msgpack_pack(auto &packer) const
Definition acir.hpp:558
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:532
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10619
friend bool operator==(const U16 &, const U16 &)
Definition acir.hpp:10614
static U16 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10626
void msgpack_pack(auto &packer) const
Definition acir.hpp:531
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10539
static U1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10546
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:514
void msgpack_pack(auto &packer) const
Definition acir.hpp:513
friend bool operator==(const U1 &, const U1 &)
Definition acir.hpp:10534
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10659
void msgpack_pack(auto &packer) const
Definition acir.hpp:540
friend bool operator==(const U32 &, const U32 &)
Definition acir.hpp:10654
static U32 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10666
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:541
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10699
static U64 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10706
void msgpack_pack(auto &packer) const
Definition acir.hpp:549
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:550
friend bool operator==(const U64 &, const U64 &)
Definition acir.hpp:10694
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10579
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:523
void msgpack_pack(auto &packer) const
Definition acir.hpp:522
static U8 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10586
friend bool operator==(const U8 &, const U8 &)
Definition acir.hpp:10574
static IntegerBitSize bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10500
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:614
friend bool operator==(const IntegerBitSize &, const IntegerBitSize &)
Definition acir.hpp:10485
std::variant< U1, U8, U16, U32, U64, U128 > value
Definition acir.hpp:562
void msgpack_pack(auto &packer) const
Definition acir.hpp:568
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10493
Acir::Expression value
Definition acir.hpp:4323
friend bool operator==(const MemOp &, const MemOp &)
Definition acir.hpp:10774
void msgpack_pack(auto &packer) const
Definition acir.hpp:4329
static MemOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10795
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4337
Acir::Expression operation
Definition acir.hpp:4321
Acir::Expression index
Definition acir.hpp:4322
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10788
static Direct bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10897
void msgpack_pack(auto &packer) const
Definition acir.hpp:777
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10890
friend bool operator==(const Direct &, const Direct &)
Definition acir.hpp:10882
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:779
void msgpack_pack(auto &packer) const
Definition acir.hpp:797
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10936
static Relative bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10943
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:799
friend bool operator==(const Relative &, const Relative &)
Definition acir.hpp:10928
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10841
static MemoryAddress bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10848
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:846
friend bool operator==(const MemoryAddress &, const MemoryAddress &)
Definition acir.hpp:10833
void msgpack_pack(auto &packer) const
Definition acir.hpp:816
std::variant< Direct, Relative > value
Definition acir.hpp:810
void msgpack_pack(auto &packer) const
Definition acir.hpp:4365
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4367
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11032
Acir::Expression value
Definition acir.hpp:4359
static AssertZero bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11039
friend bool operator==(const AssertZero &, const AssertZero &)
Definition acir.hpp:11024
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11078
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4387
Acir::BlackBoxFuncCall value
Definition acir.hpp:4379
static BlackBoxFuncCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11085
friend bool operator==(const BlackBoxFuncCall &, const BlackBoxFuncCall &)
Definition acir.hpp:11070
void msgpack_pack(auto &packer) const
Definition acir.hpp:4385
std::optional< Acir::Expression > predicate
Definition acir.hpp:4470
friend bool operator==(const BrilligCall &, const BrilligCall &)
Definition acir.hpp:11223
static BrilligCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11247
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11240
std::vector< Acir::BrilligInputs > inputs
Definition acir.hpp:4468
void msgpack_pack(auto &packer) const
Definition acir.hpp:4476
std::vector< Acir::BrilligOutputs > outputs
Definition acir.hpp:4469
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4485
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4525
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11301
friend bool operator==(const Call &, const Call &)
Definition acir.hpp:11284
void msgpack_pack(auto &packer) const
Definition acir.hpp:4516
std::vector< Acir::Witness > outputs
Definition acir.hpp:4509
std::optional< Acir::Expression > predicate
Definition acir.hpp:4510
std::vector< Acir::Witness > inputs
Definition acir.hpp:4508
static Call bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11308
Acir::BlockId block_id
Definition acir.hpp:4431
static MemoryInit bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11188
std::vector< Acir::Witness > init
Definition acir.hpp:4432
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11181
Acir::BlockType block_type
Definition acir.hpp:4433
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4447
void msgpack_pack(auto &packer) const
Definition acir.hpp:4439
friend bool operator==(const MemoryInit &, const MemoryInit &)
Definition acir.hpp:11167
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11128
friend bool operator==(const MemoryOp &, const MemoryOp &)
Definition acir.hpp:11117
static MemoryOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11135
void msgpack_pack(auto &packer) const
Definition acir.hpp:4406
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4413
Acir::BlockId block_id
Definition acir.hpp:4399
static Opcode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10990
std::variant< AssertZero, BlackBoxFuncCall, MemoryOp, MemoryInit, BrilligCall, Call > value
Definition acir.hpp:4546
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4598
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10983
friend bool operator==(const Opcode &, const Opcode &)
Definition acir.hpp:10975
void msgpack_pack(auto &packer) const
Definition acir.hpp:4552
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4855
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11401
static Acir bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11408
friend bool operator==(const Acir &, const Acir &)
Definition acir.hpp:11393
void msgpack_pack(auto &packer) const
Definition acir.hpp:4853
friend bool operator==(const Brillig &, const Brillig &)
Definition acir.hpp:11439
void msgpack_pack(auto &packer) const
Definition acir.hpp:4874
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11450
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4881
static Brillig bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11457
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11352
friend bool operator==(const OpcodeLocation &, const OpcodeLocation &)
Definition acir.hpp:11344
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4934
static OpcodeLocation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11359
std::variant< Acir, Brillig > value
Definition acir.hpp:4898
void msgpack_pack(auto &packer) const
Definition acir.hpp:4904
void msgpack_pack(auto &packer) const
Definition acir.hpp:5094
std::vector< Acir::Circuit > functions
Definition acir.hpp:5087
friend bool operator==(const Program &, const Program &)
Definition acir.hpp:11491
static Program bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11509
std::vector< Acir::BrilligBytecode > unconstrained_functions
Definition acir.hpp:5088
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11502
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5101
void msgpack_pack(auto &packer) const
Definition acir.hpp:5126
std::vector< Acir::Circuit > functions
Definition acir.hpp:5119
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5132
std::monostate unconstrained_functions
Definition acir.hpp:5120
static ProgramWithoutBrillig bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11564
friend bool operator==(const ProgramWithoutBrillig &, const ProgramWithoutBrillig &)
Definition acir.hpp:11546
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11557
friend bool operator==(const PublicInputs &, const PublicInputs &)
Definition acir.hpp:11602
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11610
static PublicInputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11617
std::vector< Acir::Witness > value
Definition acir.hpp:4983
void msgpack_pack(auto &packer) const
Definition acir.hpp:4989
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4991
static HeapArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11762
void msgpack_pack(auto &packer) const
Definition acir.hpp:1816
friend bool operator==(const HeapArray &, const HeapArray &)
Definition acir.hpp:11747
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1818
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11755
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1838
void msgpack_pack(auto &packer) const
Definition acir.hpp:1836
friend bool operator==(const HeapVector &, const HeapVector &)
Definition acir.hpp:11794
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11802
static HeapVector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11809
void msgpack_pack(auto &packer) const
Definition acir.hpp:1796
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11708
static MemoryAddress bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11715
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1798
friend bool operator==(const MemoryAddress &, const MemoryAddress &)
Definition acir.hpp:11700
Acir::MemoryAddress value
Definition acir.hpp:1790
void msgpack_pack(auto &packer) const
Definition acir.hpp:1855
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1889
std::variant< MemoryAddress, HeapArray, HeapVector > value
Definition acir.hpp:1849
static ValueOrArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11666
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11659
friend bool operator==(const ValueOrArray &, const ValueOrArray &)
Definition acir.hpp:11651
uint32_t value
Definition acir.hpp:2901
void msgpack_pack(auto &packer) const
Definition acir.hpp:2907
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2909
static Witness bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11856
friend bool operator==(const Witness &, const Witness &)
Definition acir.hpp:11841
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11849
static T deserialize(Deserializer &deserializer)
static void serialize(const T &value, Serializer &serializer)
void throw_or_abort(std::string const &err)