Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
acir.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
10#include "bincode.hpp"
11#include "serde.hpp"
12
13namespace Acir {
14struct Helpers {
15 static std::map<std::string, msgpack::object const*> make_kvmap(msgpack::object const& o, std::string const& name)
16 {
17 if (o.type != msgpack::type::MAP) {
18 std::cerr << o << std::endl;
19 throw_or_abort("expected MAP for " + name);
20 }
22 for (uint32_t i = 0; i < o.via.map.size; ++i) {
23 if (o.via.map.ptr[i].key.type != msgpack::type::STR) {
24 std::cerr << o << std::endl;
25 throw_or_abort("expected STR for keys of " + name);
26 }
27 kvmap.emplace(std::string(o.via.map.ptr[i].key.via.str.ptr, o.via.map.ptr[i].key.via.str.size),
28 &o.via.map.ptr[i].val);
29 }
30 return kvmap;
31 }
32
33 template <typename T>
35 std::string const& struct_name,
36 std::string const& field_name,
37 T& field,
38 bool is_optional)
39 {
40 auto it = kvmap.find(field_name);
41 if (it != kvmap.end()) {
42 try {
43 it->second->convert(field);
44 } catch (const msgpack::type_error&) {
45 std::cerr << *it->second << std::endl;
46 throw_or_abort("error converting into field " + struct_name + "::" + field_name);
47 }
48 } else if (!is_optional) {
49 throw_or_abort("missing field: " + struct_name + "::" + field_name);
50 }
51 }
52
53 template <typename T>
54 static void conv_fld_from_array(msgpack::object_array const& array,
55 std::string const& struct_name,
56 std::string const& field_name,
57 T& field,
58 uint32_t index)
59 {
60 if (index >= array.size) {
61 throw_or_abort("index out of bounds: " + struct_name + "::" + field_name + " at " + std::to_string(index));
62 }
63 auto element = array.ptr[index];
64 try {
65 element.convert(field);
66 } catch (const msgpack::type_error&) {
67 std::cerr << element << std::endl;
68 throw_or_abort("error converting into field " + struct_name + "::" + field_name);
69 }
70 }
71};
72} // namespace Acir
73
74namespace Acir {
75
77
78 struct Add {
79 friend bool operator==(const Add&, const Add&);
80 std::vector<uint8_t> bincodeSerialize() const;
81 static Add bincodeDeserialize(std::vector<uint8_t>);
82
83 void msgpack_pack(auto& packer) const {}
84 void msgpack_unpack(msgpack::object const& o) {}
85 };
86
87 struct Sub {
88 friend bool operator==(const Sub&, const Sub&);
89 std::vector<uint8_t> bincodeSerialize() const;
90 static Sub bincodeDeserialize(std::vector<uint8_t>);
91
92 void msgpack_pack(auto& packer) const {}
93 void msgpack_unpack(msgpack::object const& o) {}
94 };
95
96 struct Mul {
97 friend bool operator==(const Mul&, const Mul&);
98 std::vector<uint8_t> bincodeSerialize() const;
99 static Mul bincodeDeserialize(std::vector<uint8_t>);
100
101 void msgpack_pack(auto& packer) const {}
102 void msgpack_unpack(msgpack::object const& o) {}
103 };
104
105 struct Div {
106 friend bool operator==(const Div&, const Div&);
107 std::vector<uint8_t> bincodeSerialize() const;
108 static Div bincodeDeserialize(std::vector<uint8_t>);
109
110 void msgpack_pack(auto& packer) const {}
111 void msgpack_unpack(msgpack::object const& o) {}
112 };
113
114 struct IntegerDiv {
115 friend bool operator==(const IntegerDiv&, const IntegerDiv&);
116 std::vector<uint8_t> bincodeSerialize() const;
117 static IntegerDiv bincodeDeserialize(std::vector<uint8_t>);
118
119 void msgpack_pack(auto& packer) const {}
120 void msgpack_unpack(msgpack::object const& o) {}
121 };
122
123 struct Equals {
124 friend bool operator==(const Equals&, const Equals&);
125 std::vector<uint8_t> bincodeSerialize() const;
126 static Equals bincodeDeserialize(std::vector<uint8_t>);
127
128 void msgpack_pack(auto& packer) const {}
129 void msgpack_unpack(msgpack::object const& o) {}
130 };
131
132 struct LessThan {
133 friend bool operator==(const LessThan&, const LessThan&);
134 std::vector<uint8_t> bincodeSerialize() const;
135 static LessThan bincodeDeserialize(std::vector<uint8_t>);
136
137 void msgpack_pack(auto& packer) const {}
138 void msgpack_unpack(msgpack::object const& o) {}
139 };
140
142 friend bool operator==(const LessThanEquals&, const LessThanEquals&);
143 std::vector<uint8_t> bincodeSerialize() const;
144 static LessThanEquals bincodeDeserialize(std::vector<uint8_t>);
145
146 void msgpack_pack(auto& packer) const {}
147 void msgpack_unpack(msgpack::object const& o) {}
148 };
149
151
152 friend bool operator==(const BinaryFieldOp&, const BinaryFieldOp&);
153 std::vector<uint8_t> bincodeSerialize() const;
154 static BinaryFieldOp bincodeDeserialize(std::vector<uint8_t>);
155
156 void msgpack_pack(auto& packer) const
157 {
158 std::string tag;
159 bool is_unit;
160 switch (value.index()) {
161
162 case 0:
163 tag = "Add";
164 is_unit = true;
165 break;
166 case 1:
167 tag = "Sub";
168 is_unit = true;
169 break;
170 case 2:
171 tag = "Mul";
172 is_unit = true;
173 break;
174 case 3:
175 tag = "Div";
176 is_unit = true;
177 break;
178 case 4:
179 tag = "IntegerDiv";
180 is_unit = true;
181 break;
182 case 5:
183 tag = "Equals";
184 is_unit = true;
185 break;
186 case 6:
187 tag = "LessThan";
188 is_unit = true;
189 break;
190 case 7:
191 tag = "LessThanEquals";
192 is_unit = true;
193 break;
194 default:
195 throw_or_abort("unknown enum 'BinaryFieldOp' variant index: " + std::to_string(value.index()));
196 }
197 if (is_unit) {
198 packer.pack(tag);
199 } else {
200 std::visit(
201 [&packer, tag](const auto& arg) {
203 data[tag] = msgpack::object(arg);
204 packer.pack(data);
205 },
206 value);
207 }
208 }
209
210 void msgpack_unpack(msgpack::object const& o)
211 {
212
213 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
214 std::cerr << o << std::endl;
215 throw_or_abort("expected MAP or STR for enum 'BinaryFieldOp'; got type " + std::to_string(o.type));
216 }
217 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
218 throw_or_abort("expected 1 entry for enum 'BinaryFieldOp'; got " + std::to_string(o.via.map.size));
219 }
220 std::string tag;
221 try {
222 if (o.type == msgpack::type::object_type::MAP) {
223 o.via.map.ptr[0].key.convert(tag);
224 } else {
225 o.convert(tag);
226 }
227 } catch (const msgpack::type_error&) {
228 std::cerr << o << std::endl;
229 throw_or_abort("error converting tag to string for enum 'BinaryFieldOp'");
230 }
231 if (tag == "Add") {
232 Add v;
233 value = v;
234 } else if (tag == "Sub") {
235 Sub v;
236 value = v;
237 } else if (tag == "Mul") {
238 Mul v;
239 value = v;
240 } else if (tag == "Div") {
241 Div v;
242 value = v;
243 } else if (tag == "IntegerDiv") {
244 IntegerDiv v;
245 value = v;
246 } else if (tag == "Equals") {
247 Equals v;
248 value = v;
249 } else if (tag == "LessThan") {
250 LessThan v;
251 value = v;
252 } else if (tag == "LessThanEquals") {
254 value = v;
255 } else {
256 std::cerr << o << std::endl;
257 throw_or_abort("unknown 'BinaryFieldOp' enum variant: " + tag);
258 }
259 }
260};
261
263
264 struct Add {
265 friend bool operator==(const Add&, const Add&);
266 std::vector<uint8_t> bincodeSerialize() const;
267 static Add bincodeDeserialize(std::vector<uint8_t>);
268
269 void msgpack_pack(auto& packer) const {}
270 void msgpack_unpack(msgpack::object const& o) {}
271 };
272
273 struct Sub {
274 friend bool operator==(const Sub&, const Sub&);
275 std::vector<uint8_t> bincodeSerialize() const;
276 static Sub bincodeDeserialize(std::vector<uint8_t>);
277
278 void msgpack_pack(auto& packer) const {}
279 void msgpack_unpack(msgpack::object const& o) {}
280 };
281
282 struct Mul {
283 friend bool operator==(const Mul&, const Mul&);
284 std::vector<uint8_t> bincodeSerialize() const;
285 static Mul bincodeDeserialize(std::vector<uint8_t>);
286
287 void msgpack_pack(auto& packer) const {}
288 void msgpack_unpack(msgpack::object const& o) {}
289 };
290
291 struct Div {
292 friend bool operator==(const Div&, const Div&);
293 std::vector<uint8_t> bincodeSerialize() const;
294 static Div bincodeDeserialize(std::vector<uint8_t>);
295
296 void msgpack_pack(auto& packer) const {}
297 void msgpack_unpack(msgpack::object const& o) {}
298 };
299
300 struct Equals {
301 friend bool operator==(const Equals&, const Equals&);
302 std::vector<uint8_t> bincodeSerialize() const;
303 static Equals bincodeDeserialize(std::vector<uint8_t>);
304
305 void msgpack_pack(auto& packer) const {}
306 void msgpack_unpack(msgpack::object const& o) {}
307 };
308
309 struct LessThan {
310 friend bool operator==(const LessThan&, const LessThan&);
311 std::vector<uint8_t> bincodeSerialize() const;
312 static LessThan bincodeDeserialize(std::vector<uint8_t>);
313
314 void msgpack_pack(auto& packer) const {}
315 void msgpack_unpack(msgpack::object const& o) {}
316 };
317
319 friend bool operator==(const LessThanEquals&, const LessThanEquals&);
320 std::vector<uint8_t> bincodeSerialize() const;
321 static LessThanEquals bincodeDeserialize(std::vector<uint8_t>);
322
323 void msgpack_pack(auto& packer) const {}
324 void msgpack_unpack(msgpack::object const& o) {}
325 };
326
327 struct And {
328 friend bool operator==(const And&, const And&);
329 std::vector<uint8_t> bincodeSerialize() const;
330 static And bincodeDeserialize(std::vector<uint8_t>);
331
332 void msgpack_pack(auto& packer) const {}
333 void msgpack_unpack(msgpack::object const& o) {}
334 };
335
336 struct Or {
337 friend bool operator==(const Or&, const Or&);
338 std::vector<uint8_t> bincodeSerialize() const;
339 static Or bincodeDeserialize(std::vector<uint8_t>);
340
341 void msgpack_pack(auto& packer) const {}
342 void msgpack_unpack(msgpack::object const& o) {}
343 };
344
345 struct Xor {
346 friend bool operator==(const Xor&, const Xor&);
347 std::vector<uint8_t> bincodeSerialize() const;
348 static Xor bincodeDeserialize(std::vector<uint8_t>);
349
350 void msgpack_pack(auto& packer) const {}
351 void msgpack_unpack(msgpack::object const& o) {}
352 };
353
354 struct Shl {
355 friend bool operator==(const Shl&, const Shl&);
356 std::vector<uint8_t> bincodeSerialize() const;
357 static Shl bincodeDeserialize(std::vector<uint8_t>);
358
359 void msgpack_pack(auto& packer) const {}
360 void msgpack_unpack(msgpack::object const& o) {}
361 };
362
363 struct Shr {
364 friend bool operator==(const Shr&, const Shr&);
365 std::vector<uint8_t> bincodeSerialize() const;
366 static Shr bincodeDeserialize(std::vector<uint8_t>);
367
368 void msgpack_pack(auto& packer) const {}
369 void msgpack_unpack(msgpack::object const& o) {}
370 };
371
373
374 friend bool operator==(const BinaryIntOp&, const BinaryIntOp&);
375 std::vector<uint8_t> bincodeSerialize() const;
376 static BinaryIntOp bincodeDeserialize(std::vector<uint8_t>);
377
378 void msgpack_pack(auto& packer) const
379 {
380 std::string tag;
381 bool is_unit;
382 switch (value.index()) {
383
384 case 0:
385 tag = "Add";
386 is_unit = true;
387 break;
388 case 1:
389 tag = "Sub";
390 is_unit = true;
391 break;
392 case 2:
393 tag = "Mul";
394 is_unit = true;
395 break;
396 case 3:
397 tag = "Div";
398 is_unit = true;
399 break;
400 case 4:
401 tag = "Equals";
402 is_unit = true;
403 break;
404 case 5:
405 tag = "LessThan";
406 is_unit = true;
407 break;
408 case 6:
409 tag = "LessThanEquals";
410 is_unit = true;
411 break;
412 case 7:
413 tag = "And";
414 is_unit = true;
415 break;
416 case 8:
417 tag = "Or";
418 is_unit = true;
419 break;
420 case 9:
421 tag = "Xor";
422 is_unit = true;
423 break;
424 case 10:
425 tag = "Shl";
426 is_unit = true;
427 break;
428 case 11:
429 tag = "Shr";
430 is_unit = true;
431 break;
432 default:
433 throw_or_abort("unknown enum 'BinaryIntOp' variant index: " + std::to_string(value.index()));
434 }
435 if (is_unit) {
436 packer.pack(tag);
437 } else {
438 std::visit(
439 [&packer, tag](const auto& arg) {
441 data[tag] = msgpack::object(arg);
442 packer.pack(data);
443 },
444 value);
445 }
446 }
447
448 void msgpack_unpack(msgpack::object const& o)
449 {
450
451 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
452 std::cerr << o << std::endl;
453 throw_or_abort("expected MAP or STR for enum 'BinaryIntOp'; got type " + std::to_string(o.type));
454 }
455 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
456 throw_or_abort("expected 1 entry for enum 'BinaryIntOp'; got " + std::to_string(o.via.map.size));
457 }
458 std::string tag;
459 try {
460 if (o.type == msgpack::type::object_type::MAP) {
461 o.via.map.ptr[0].key.convert(tag);
462 } else {
463 o.convert(tag);
464 }
465 } catch (const msgpack::type_error&) {
466 std::cerr << o << std::endl;
467 throw_or_abort("error converting tag to string for enum 'BinaryIntOp'");
468 }
469 if (tag == "Add") {
470 Add v;
471 value = v;
472 } else if (tag == "Sub") {
473 Sub v;
474 value = v;
475 } else if (tag == "Mul") {
476 Mul v;
477 value = v;
478 } else if (tag == "Div") {
479 Div v;
480 value = v;
481 } else if (tag == "Equals") {
482 Equals v;
483 value = v;
484 } else if (tag == "LessThan") {
485 LessThan v;
486 value = v;
487 } else if (tag == "LessThanEquals") {
489 value = v;
490 } else if (tag == "And") {
491 And v;
492 value = v;
493 } else if (tag == "Or") {
494 Or v;
495 value = v;
496 } else if (tag == "Xor") {
497 Xor v;
498 value = v;
499 } else if (tag == "Shl") {
500 Shl v;
501 value = v;
502 } else if (tag == "Shr") {
503 Shr v;
504 value = v;
505 } else {
506 std::cerr << o << std::endl;
507 throw_or_abort("unknown 'BinaryIntOp' enum variant: " + tag);
508 }
509 }
510};
511
513
514 struct U1 {
515 friend bool operator==(const U1&, const U1&);
516 std::vector<uint8_t> bincodeSerialize() const;
517 static U1 bincodeDeserialize(std::vector<uint8_t>);
518
519 void msgpack_pack(auto& packer) const {}
520 void msgpack_unpack(msgpack::object const& o) {}
521 };
522
523 struct U8 {
524 friend bool operator==(const U8&, const U8&);
525 std::vector<uint8_t> bincodeSerialize() const;
526 static U8 bincodeDeserialize(std::vector<uint8_t>);
527
528 void msgpack_pack(auto& packer) const {}
529 void msgpack_unpack(msgpack::object const& o) {}
530 };
531
532 struct U16 {
533 friend bool operator==(const U16&, const U16&);
534 std::vector<uint8_t> bincodeSerialize() const;
535 static U16 bincodeDeserialize(std::vector<uint8_t>);
536
537 void msgpack_pack(auto& packer) const {}
538 void msgpack_unpack(msgpack::object const& o) {}
539 };
540
541 struct U32 {
542 friend bool operator==(const U32&, const U32&);
543 std::vector<uint8_t> bincodeSerialize() const;
544 static U32 bincodeDeserialize(std::vector<uint8_t>);
545
546 void msgpack_pack(auto& packer) const {}
547 void msgpack_unpack(msgpack::object const& o) {}
548 };
549
550 struct U64 {
551 friend bool operator==(const U64&, const U64&);
552 std::vector<uint8_t> bincodeSerialize() const;
553 static U64 bincodeDeserialize(std::vector<uint8_t>);
554
555 void msgpack_pack(auto& packer) const {}
556 void msgpack_unpack(msgpack::object const& o) {}
557 };
558
559 struct U128 {
560 friend bool operator==(const U128&, const U128&);
561 std::vector<uint8_t> bincodeSerialize() const;
562 static U128 bincodeDeserialize(std::vector<uint8_t>);
563
564 void msgpack_pack(auto& packer) const {}
565 void msgpack_unpack(msgpack::object const& o) {}
566 };
567
569
570 friend bool operator==(const IntegerBitSize&, const IntegerBitSize&);
571 std::vector<uint8_t> bincodeSerialize() const;
572 static IntegerBitSize bincodeDeserialize(std::vector<uint8_t>);
573
574 void msgpack_pack(auto& packer) const
575 {
576 std::string tag;
577 bool is_unit;
578 switch (value.index()) {
579
580 case 0:
581 tag = "U1";
582 is_unit = true;
583 break;
584 case 1:
585 tag = "U8";
586 is_unit = true;
587 break;
588 case 2:
589 tag = "U16";
590 is_unit = true;
591 break;
592 case 3:
593 tag = "U32";
594 is_unit = true;
595 break;
596 case 4:
597 tag = "U64";
598 is_unit = true;
599 break;
600 case 5:
601 tag = "U128";
602 is_unit = true;
603 break;
604 default:
605 throw_or_abort("unknown enum 'IntegerBitSize' variant index: " + std::to_string(value.index()));
606 }
607 if (is_unit) {
608 packer.pack(tag);
609 } else {
610 std::visit(
611 [&packer, tag](const auto& arg) {
613 data[tag] = msgpack::object(arg);
614 packer.pack(data);
615 },
616 value);
617 }
618 }
619
620 void msgpack_unpack(msgpack::object const& o)
621 {
622
623 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
624 std::cerr << o << std::endl;
625 throw_or_abort("expected MAP or STR for enum 'IntegerBitSize'; got type " + std::to_string(o.type));
626 }
627 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
628 throw_or_abort("expected 1 entry for enum 'IntegerBitSize'; got " + std::to_string(o.via.map.size));
629 }
630 std::string tag;
631 try {
632 if (o.type == msgpack::type::object_type::MAP) {
633 o.via.map.ptr[0].key.convert(tag);
634 } else {
635 o.convert(tag);
636 }
637 } catch (const msgpack::type_error&) {
638 std::cerr << o << std::endl;
639 throw_or_abort("error converting tag to string for enum 'IntegerBitSize'");
640 }
641 if (tag == "U1") {
642 U1 v;
643 value = v;
644 } else if (tag == "U8") {
645 U8 v;
646 value = v;
647 } else if (tag == "U16") {
648 U16 v;
649 value = v;
650 } else if (tag == "U32") {
651 U32 v;
652 value = v;
653 } else if (tag == "U64") {
654 U64 v;
655 value = v;
656 } else if (tag == "U128") {
657 U128 v;
658 value = v;
659 } else {
660 std::cerr << o << std::endl;
661 throw_or_abort("unknown 'IntegerBitSize' enum variant: " + tag);
662 }
663 }
664};
665
666struct BitSize {
667
668 struct Field {
669 friend bool operator==(const Field&, const Field&);
670 std::vector<uint8_t> bincodeSerialize() const;
671 static Field bincodeDeserialize(std::vector<uint8_t>);
672
673 void msgpack_pack(auto& packer) const {}
674 void msgpack_unpack(msgpack::object const& o) {}
675 };
676
677 struct Integer {
679
680 friend bool operator==(const Integer&, const Integer&);
681 std::vector<uint8_t> bincodeSerialize() const;
682 static Integer bincodeDeserialize(std::vector<uint8_t>);
683
684 void msgpack_pack(auto& packer) const { packer.pack(value); }
685
686 void msgpack_unpack(msgpack::object const& o)
687 {
688 try {
689 o.convert(value);
690 } catch (const msgpack::type_error&) {
691 std::cerr << o << std::endl;
692 throw_or_abort("error converting into newtype 'Integer'");
693 }
694 }
695 };
696
698
699 friend bool operator==(const BitSize&, const BitSize&);
700 std::vector<uint8_t> bincodeSerialize() const;
701 static BitSize bincodeDeserialize(std::vector<uint8_t>);
702
703 void msgpack_pack(auto& packer) const
704 {
705 std::string tag;
706 bool is_unit;
707 switch (value.index()) {
708
709 case 0:
710 tag = "Field";
711 is_unit = true;
712 break;
713 case 1:
714 tag = "Integer";
715 is_unit = false;
716 break;
717 default:
718 throw_or_abort("unknown enum 'BitSize' variant index: " + std::to_string(value.index()));
719 }
720 if (is_unit) {
721 packer.pack(tag);
722 } else {
723 std::visit(
724 [&packer, tag](const auto& arg) {
726 data[tag] = msgpack::object(arg);
727 packer.pack(data);
728 },
729 value);
730 }
731 }
732
733 void msgpack_unpack(msgpack::object const& o)
734 {
735
736 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
737 std::cerr << o << std::endl;
738 throw_or_abort("expected MAP or STR for enum 'BitSize'; got type " + std::to_string(o.type));
739 }
740 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
741 throw_or_abort("expected 1 entry for enum 'BitSize'; got " + std::to_string(o.via.map.size));
742 }
743 std::string tag;
744 try {
745 if (o.type == msgpack::type::object_type::MAP) {
746 o.via.map.ptr[0].key.convert(tag);
747 } else {
748 o.convert(tag);
749 }
750 } catch (const msgpack::type_error&) {
751 std::cerr << o << std::endl;
752 throw_or_abort("error converting tag to string for enum 'BitSize'");
753 }
754 if (tag == "Field") {
755 Field v;
756 value = v;
757 } else if (tag == "Integer") {
758 Integer v;
759 try {
760 o.via.map.ptr[0].val.convert(v);
761 } catch (const msgpack::type_error&) {
762 std::cerr << o << std::endl;
763 throw_or_abort("error converting into enum variant 'BitSize::Integer'");
764 }
765
766 value = v;
767 } else {
768 std::cerr << o << std::endl;
769 throw_or_abort("unknown 'BitSize' enum variant: " + tag);
770 }
771 }
772};
773
775
776 struct Direct {
777 uint64_t value;
778
779 friend bool operator==(const Direct&, const Direct&);
780 std::vector<uint8_t> bincodeSerialize() const;
781 static Direct bincodeDeserialize(std::vector<uint8_t>);
782
783 void msgpack_pack(auto& packer) const { packer.pack(value); }
784
785 void msgpack_unpack(msgpack::object const& o)
786 {
787 try {
788 o.convert(value);
789 } catch (const msgpack::type_error&) {
790 std::cerr << o << std::endl;
791 throw_or_abort("error converting into newtype 'Direct'");
792 }
793 }
794 };
795
796 struct Relative {
797 uint64_t value;
798
799 friend bool operator==(const Relative&, const Relative&);
800 std::vector<uint8_t> bincodeSerialize() const;
801 static Relative bincodeDeserialize(std::vector<uint8_t>);
802
803 void msgpack_pack(auto& packer) const { packer.pack(value); }
804
805 void msgpack_unpack(msgpack::object const& o)
806 {
807 try {
808 o.convert(value);
809 } catch (const msgpack::type_error&) {
810 std::cerr << o << std::endl;
811 throw_or_abort("error converting into newtype 'Relative'");
812 }
813 }
814 };
815
817
818 friend bool operator==(const MemoryAddress&, const MemoryAddress&);
819 std::vector<uint8_t> bincodeSerialize() const;
820 static MemoryAddress bincodeDeserialize(std::vector<uint8_t>);
821
822 void msgpack_pack(auto& packer) const
823 {
824 std::string tag;
825 bool is_unit;
826 switch (value.index()) {
827
828 case 0:
829 tag = "Direct";
830 is_unit = false;
831 break;
832 case 1:
833 tag = "Relative";
834 is_unit = false;
835 break;
836 default:
837 throw_or_abort("unknown enum 'MemoryAddress' variant index: " + std::to_string(value.index()));
838 }
839 if (is_unit) {
840 packer.pack(tag);
841 } else {
842 std::visit(
843 [&packer, tag](const auto& arg) {
845 data[tag] = msgpack::object(arg);
846 packer.pack(data);
847 },
848 value);
849 }
850 }
851
852 void msgpack_unpack(msgpack::object const& o)
853 {
854
855 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
856 std::cerr << o << std::endl;
857 throw_or_abort("expected MAP or STR for enum 'MemoryAddress'; got type " + std::to_string(o.type));
858 }
859 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
860 throw_or_abort("expected 1 entry for enum 'MemoryAddress'; got " + std::to_string(o.via.map.size));
861 }
862 std::string tag;
863 try {
864 if (o.type == msgpack::type::object_type::MAP) {
865 o.via.map.ptr[0].key.convert(tag);
866 } else {
867 o.convert(tag);
868 }
869 } catch (const msgpack::type_error&) {
870 std::cerr << o << std::endl;
871 throw_or_abort("error converting tag to string for enum 'MemoryAddress'");
872 }
873 if (tag == "Direct") {
874 Direct v;
875 try {
876 o.via.map.ptr[0].val.convert(v);
877 } catch (const msgpack::type_error&) {
878 std::cerr << o << std::endl;
879 throw_or_abort("error converting into enum variant 'MemoryAddress::Direct'");
880 }
881
882 value = v;
883 } else if (tag == "Relative") {
884 Relative v;
885 try {
886 o.via.map.ptr[0].val.convert(v);
887 } catch (const msgpack::type_error&) {
888 std::cerr << o << std::endl;
889 throw_or_abort("error converting into enum variant 'MemoryAddress::Relative'");
890 }
891
892 value = v;
893 } else {
894 std::cerr << o << std::endl;
895 throw_or_abort("unknown 'MemoryAddress' enum variant: " + tag);
896 }
897 }
898};
899
900struct HeapArray {
902 uint64_t size;
903
904 friend bool operator==(const HeapArray&, const HeapArray&);
905 std::vector<uint8_t> bincodeSerialize() const;
906 static HeapArray bincodeDeserialize(std::vector<uint8_t>);
907
908 void msgpack_pack(auto& packer) const
909 {
910 packer.pack_map(2);
911 packer.pack(std::make_pair("pointer", pointer));
912 packer.pack(std::make_pair("size", size));
913 }
914
915 void msgpack_unpack(msgpack::object const& o)
916 {
917 std::string name = "HeapArray";
918 if (o.type == msgpack::type::MAP) {
919 auto kvmap = Helpers::make_kvmap(o, name);
920 Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false);
921 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
922 } else if (o.type == msgpack::type::ARRAY) {
923 auto array = o.via.array;
924 Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0);
925 Helpers::conv_fld_from_array(array, name, "size", size, 1);
926 } else {
927 throw_or_abort("expected MAP or ARRAY for " + name);
928 }
929 }
930};
931
935
936 friend bool operator==(const HeapVector&, const HeapVector&);
937 std::vector<uint8_t> bincodeSerialize() const;
938 static HeapVector bincodeDeserialize(std::vector<uint8_t>);
939
940 void msgpack_pack(auto& packer) const
941 {
942 packer.pack_map(2);
943 packer.pack(std::make_pair("pointer", pointer));
944 packer.pack(std::make_pair("size", size));
945 }
946
947 void msgpack_unpack(msgpack::object const& o)
948 {
949 std::string name = "HeapVector";
950 if (o.type == msgpack::type::MAP) {
951 auto kvmap = Helpers::make_kvmap(o, name);
952 Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false);
953 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
954 } else if (o.type == msgpack::type::ARRAY) {
955 auto array = o.via.array;
956 Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0);
957 Helpers::conv_fld_from_array(array, name, "size", size, 1);
958 } else {
959 throw_or_abort("expected MAP or ARRAY for " + name);
960 }
961 }
962};
963
965
971
972 friend bool operator==(const AES128Encrypt&, const AES128Encrypt&);
973 std::vector<uint8_t> bincodeSerialize() const;
974 static AES128Encrypt bincodeDeserialize(std::vector<uint8_t>);
975
976 void msgpack_pack(auto& packer) const
977 {
978 packer.pack_map(4);
979 packer.pack(std::make_pair("inputs", inputs));
980 packer.pack(std::make_pair("iv", iv));
981 packer.pack(std::make_pair("key", key));
982 packer.pack(std::make_pair("outputs", outputs));
983 }
984
985 void msgpack_unpack(msgpack::object const& o)
986 {
987 std::string name = "AES128Encrypt";
988 if (o.type == msgpack::type::MAP) {
989 auto kvmap = Helpers::make_kvmap(o, name);
990 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
991 Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false);
992 Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false);
993 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
994 } else if (o.type == msgpack::type::ARRAY) {
995 auto array = o.via.array;
996 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
997 Helpers::conv_fld_from_array(array, name, "iv", iv, 1);
998 Helpers::conv_fld_from_array(array, name, "key", key, 2);
999 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
1000 } else {
1001 throw_or_abort("expected MAP or ARRAY for " + name);
1002 }
1003 }
1004 };
1005
1006 struct Blake2s {
1009
1010 friend bool operator==(const Blake2s&, const Blake2s&);
1011 std::vector<uint8_t> bincodeSerialize() const;
1012 static Blake2s bincodeDeserialize(std::vector<uint8_t>);
1013
1014 void msgpack_pack(auto& packer) const
1015 {
1016 packer.pack_map(2);
1017 packer.pack(std::make_pair("message", message));
1018 packer.pack(std::make_pair("output", output));
1019 }
1020
1021 void msgpack_unpack(msgpack::object const& o)
1022 {
1023 std::string name = "Blake2s";
1024 if (o.type == msgpack::type::MAP) {
1025 auto kvmap = Helpers::make_kvmap(o, name);
1026 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1027 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1028 } else if (o.type == msgpack::type::ARRAY) {
1029 auto array = o.via.array;
1030 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1031 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1032 } else {
1033 throw_or_abort("expected MAP or ARRAY for " + name);
1034 }
1035 }
1036 };
1037
1038 struct Blake3 {
1041
1042 friend bool operator==(const Blake3&, const Blake3&);
1043 std::vector<uint8_t> bincodeSerialize() const;
1044 static Blake3 bincodeDeserialize(std::vector<uint8_t>);
1045
1046 void msgpack_pack(auto& packer) const
1047 {
1048 packer.pack_map(2);
1049 packer.pack(std::make_pair("message", message));
1050 packer.pack(std::make_pair("output", output));
1051 }
1052
1053 void msgpack_unpack(msgpack::object const& o)
1054 {
1055 std::string name = "Blake3";
1056 if (o.type == msgpack::type::MAP) {
1057 auto kvmap = Helpers::make_kvmap(o, name);
1058 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1059 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1060 } else if (o.type == msgpack::type::ARRAY) {
1061 auto array = o.via.array;
1062 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1063 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1064 } else {
1065 throw_or_abort("expected MAP or ARRAY for " + name);
1066 }
1067 }
1068 };
1069
1073
1074 friend bool operator==(const Keccakf1600&, const Keccakf1600&);
1075 std::vector<uint8_t> bincodeSerialize() const;
1076 static Keccakf1600 bincodeDeserialize(std::vector<uint8_t>);
1077
1078 void msgpack_pack(auto& packer) const
1079 {
1080 packer.pack_map(2);
1081 packer.pack(std::make_pair("input", input));
1082 packer.pack(std::make_pair("output", output));
1083 }
1084
1085 void msgpack_unpack(msgpack::object const& o)
1086 {
1087 std::string name = "Keccakf1600";
1088 if (o.type == msgpack::type::MAP) {
1089 auto kvmap = Helpers::make_kvmap(o, name);
1090 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1091 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1092 } else if (o.type == msgpack::type::ARRAY) {
1093 auto array = o.via.array;
1094 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1095 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1096 } else {
1097 throw_or_abort("expected MAP or ARRAY for " + name);
1098 }
1099 }
1100 };
1101
1108
1109 friend bool operator==(const EcdsaSecp256k1&, const EcdsaSecp256k1&);
1110 std::vector<uint8_t> bincodeSerialize() const;
1111 static EcdsaSecp256k1 bincodeDeserialize(std::vector<uint8_t>);
1112
1113 void msgpack_pack(auto& packer) const
1114 {
1115 packer.pack_map(5);
1116 packer.pack(std::make_pair("hashed_msg", hashed_msg));
1117 packer.pack(std::make_pair("public_key_x", public_key_x));
1118 packer.pack(std::make_pair("public_key_y", public_key_y));
1119 packer.pack(std::make_pair("signature", signature));
1120 packer.pack(std::make_pair("result", result));
1121 }
1122
1123 void msgpack_unpack(msgpack::object const& o)
1124 {
1125 std::string name = "EcdsaSecp256k1";
1126 if (o.type == msgpack::type::MAP) {
1127 auto kvmap = Helpers::make_kvmap(o, name);
1128 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false);
1129 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
1130 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
1131 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
1132 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1133 } else if (o.type == msgpack::type::ARRAY) {
1134 auto array = o.via.array;
1135 Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0);
1136 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1);
1137 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2);
1138 Helpers::conv_fld_from_array(array, name, "signature", signature, 3);
1139 Helpers::conv_fld_from_array(array, name, "result", result, 4);
1140 } else {
1141 throw_or_abort("expected MAP or ARRAY for " + name);
1142 }
1143 }
1144 };
1145
1152
1153 friend bool operator==(const EcdsaSecp256r1&, const EcdsaSecp256r1&);
1154 std::vector<uint8_t> bincodeSerialize() const;
1155 static EcdsaSecp256r1 bincodeDeserialize(std::vector<uint8_t>);
1156
1157 void msgpack_pack(auto& packer) const
1158 {
1159 packer.pack_map(5);
1160 packer.pack(std::make_pair("hashed_msg", hashed_msg));
1161 packer.pack(std::make_pair("public_key_x", public_key_x));
1162 packer.pack(std::make_pair("public_key_y", public_key_y));
1163 packer.pack(std::make_pair("signature", signature));
1164 packer.pack(std::make_pair("result", result));
1165 }
1166
1167 void msgpack_unpack(msgpack::object const& o)
1168 {
1169 std::string name = "EcdsaSecp256r1";
1170 if (o.type == msgpack::type::MAP) {
1171 auto kvmap = Helpers::make_kvmap(o, name);
1172 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false);
1173 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
1174 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
1175 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
1176 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1177 } else if (o.type == msgpack::type::ARRAY) {
1178 auto array = o.via.array;
1179 Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0);
1180 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1);
1181 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2);
1182 Helpers::conv_fld_from_array(array, name, "signature", signature, 3);
1183 Helpers::conv_fld_from_array(array, name, "result", result, 4);
1184 } else {
1185 throw_or_abort("expected MAP or ARRAY for " + name);
1186 }
1187 }
1188 };
1189
1194
1195 friend bool operator==(const MultiScalarMul&, const MultiScalarMul&);
1196 std::vector<uint8_t> bincodeSerialize() const;
1197 static MultiScalarMul bincodeDeserialize(std::vector<uint8_t>);
1198
1199 void msgpack_pack(auto& packer) const
1200 {
1201 packer.pack_map(3);
1202 packer.pack(std::make_pair("points", points));
1203 packer.pack(std::make_pair("scalars", scalars));
1204 packer.pack(std::make_pair("outputs", outputs));
1205 }
1206
1207 void msgpack_unpack(msgpack::object const& o)
1208 {
1209 std::string name = "MultiScalarMul";
1210 if (o.type == msgpack::type::MAP) {
1211 auto kvmap = Helpers::make_kvmap(o, name);
1212 Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false);
1213 Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false);
1214 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
1215 } else if (o.type == msgpack::type::ARRAY) {
1216 auto array = o.via.array;
1217 Helpers::conv_fld_from_array(array, name, "points", points, 0);
1218 Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1);
1219 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
1220 } else {
1221 throw_or_abort("expected MAP or ARRAY for " + name);
1222 }
1223 }
1224 };
1225
1234
1235 friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&);
1236 std::vector<uint8_t> bincodeSerialize() const;
1237 static EmbeddedCurveAdd bincodeDeserialize(std::vector<uint8_t>);
1238
1239 void msgpack_pack(auto& packer) const
1240 {
1241 packer.pack_map(7);
1242 packer.pack(std::make_pair("input1_x", input1_x));
1243 packer.pack(std::make_pair("input1_y", input1_y));
1244 packer.pack(std::make_pair("input1_infinite", input1_infinite));
1245 packer.pack(std::make_pair("input2_x", input2_x));
1246 packer.pack(std::make_pair("input2_y", input2_y));
1247 packer.pack(std::make_pair("input2_infinite", input2_infinite));
1248 packer.pack(std::make_pair("result", result));
1249 }
1250
1251 void msgpack_unpack(msgpack::object const& o)
1252 {
1253 std::string name = "EmbeddedCurveAdd";
1254 if (o.type == msgpack::type::MAP) {
1255 auto kvmap = Helpers::make_kvmap(o, name);
1256 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_x", input1_x, false);
1257 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_y", input1_y, false);
1258 Helpers::conv_fld_from_kvmap(kvmap, name, "input1_infinite", input1_infinite, false);
1259 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_x", input2_x, false);
1260 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_y", input2_y, false);
1261 Helpers::conv_fld_from_kvmap(kvmap, name, "input2_infinite", input2_infinite, false);
1262 Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false);
1263 } else if (o.type == msgpack::type::ARRAY) {
1264 auto array = o.via.array;
1265 Helpers::conv_fld_from_array(array, name, "input1_x", input1_x, 0);
1266 Helpers::conv_fld_from_array(array, name, "input1_y", input1_y, 1);
1267 Helpers::conv_fld_from_array(array, name, "input1_infinite", input1_infinite, 2);
1268 Helpers::conv_fld_from_array(array, name, "input2_x", input2_x, 3);
1269 Helpers::conv_fld_from_array(array, name, "input2_y", input2_y, 4);
1270 Helpers::conv_fld_from_array(array, name, "input2_infinite", input2_infinite, 5);
1271 Helpers::conv_fld_from_array(array, name, "result", result, 6);
1272 } else {
1273 throw_or_abort("expected MAP or ARRAY for " + name);
1274 }
1275 }
1276 };
1277
1281
1282 friend bool operator==(const Poseidon2Permutation&, const Poseidon2Permutation&);
1283 std::vector<uint8_t> bincodeSerialize() const;
1284 static Poseidon2Permutation bincodeDeserialize(std::vector<uint8_t>);
1285
1286 void msgpack_pack(auto& packer) const
1287 {
1288 packer.pack_map(2);
1289 packer.pack(std::make_pair("message", message));
1290 packer.pack(std::make_pair("output", output));
1291 }
1292
1293 void msgpack_unpack(msgpack::object const& o)
1294 {
1295 std::string name = "Poseidon2Permutation";
1296 if (o.type == msgpack::type::MAP) {
1297 auto kvmap = Helpers::make_kvmap(o, name);
1298 Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false);
1299 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1300 } else if (o.type == msgpack::type::ARRAY) {
1301 auto array = o.via.array;
1302 Helpers::conv_fld_from_array(array, name, "message", message, 0);
1303 Helpers::conv_fld_from_array(array, name, "output", output, 1);
1304 } else {
1305 throw_or_abort("expected MAP or ARRAY for " + name);
1306 }
1307 }
1308 };
1309
1314
1315 friend bool operator==(const Sha256Compression&, const Sha256Compression&);
1316 std::vector<uint8_t> bincodeSerialize() const;
1317 static Sha256Compression bincodeDeserialize(std::vector<uint8_t>);
1318
1319 void msgpack_pack(auto& packer) const
1320 {
1321 packer.pack_map(3);
1322 packer.pack(std::make_pair("input", input));
1323 packer.pack(std::make_pair("hash_values", hash_values));
1324 packer.pack(std::make_pair("output", output));
1325 }
1326
1327 void msgpack_unpack(msgpack::object const& o)
1328 {
1329 std::string name = "Sha256Compression";
1330 if (o.type == msgpack::type::MAP) {
1331 auto kvmap = Helpers::make_kvmap(o, name);
1332 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1333 Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false);
1334 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
1335 } else if (o.type == msgpack::type::ARRAY) {
1336 auto array = o.via.array;
1337 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1338 Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1);
1339 Helpers::conv_fld_from_array(array, name, "output", output, 2);
1340 } else {
1341 throw_or_abort("expected MAP or ARRAY for " + name);
1342 }
1343 }
1344 };
1345
1346 struct ToRadix {
1352
1353 friend bool operator==(const ToRadix&, const ToRadix&);
1354 std::vector<uint8_t> bincodeSerialize() const;
1355 static ToRadix bincodeDeserialize(std::vector<uint8_t>);
1356
1357 void msgpack_pack(auto& packer) const
1358 {
1359 packer.pack_map(5);
1360 packer.pack(std::make_pair("input", input));
1361 packer.pack(std::make_pair("radix", radix));
1362 packer.pack(std::make_pair("output_pointer", output_pointer));
1363 packer.pack(std::make_pair("num_limbs", num_limbs));
1364 packer.pack(std::make_pair("output_bits", output_bits));
1365 }
1366
1367 void msgpack_unpack(msgpack::object const& o)
1368 {
1369 std::string name = "ToRadix";
1370 if (o.type == msgpack::type::MAP) {
1371 auto kvmap = Helpers::make_kvmap(o, name);
1372 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
1373 Helpers::conv_fld_from_kvmap(kvmap, name, "radix", radix, false);
1374 Helpers::conv_fld_from_kvmap(kvmap, name, "output_pointer", output_pointer, false);
1375 Helpers::conv_fld_from_kvmap(kvmap, name, "num_limbs", num_limbs, false);
1376 Helpers::conv_fld_from_kvmap(kvmap, name, "output_bits", output_bits, false);
1377 } else if (o.type == msgpack::type::ARRAY) {
1378 auto array = o.via.array;
1379 Helpers::conv_fld_from_array(array, name, "input", input, 0);
1380 Helpers::conv_fld_from_array(array, name, "radix", radix, 1);
1381 Helpers::conv_fld_from_array(array, name, "output_pointer", output_pointer, 2);
1382 Helpers::conv_fld_from_array(array, name, "num_limbs", num_limbs, 3);
1383 Helpers::conv_fld_from_array(array, name, "output_bits", output_bits, 4);
1384 } else {
1385 throw_or_abort("expected MAP or ARRAY for " + name);
1386 }
1387 }
1388 };
1389
1390 std::variant<AES128Encrypt,
1391 Blake2s,
1392 Blake3,
1393 Keccakf1600,
1394 EcdsaSecp256k1,
1395 EcdsaSecp256r1,
1396 MultiScalarMul,
1397 EmbeddedCurveAdd,
1398 Poseidon2Permutation,
1399 Sha256Compression,
1400 ToRadix>
1402
1403 friend bool operator==(const BlackBoxOp&, const BlackBoxOp&);
1404 std::vector<uint8_t> bincodeSerialize() const;
1405 static BlackBoxOp bincodeDeserialize(std::vector<uint8_t>);
1406
1407 void msgpack_pack(auto& packer) const
1408 {
1409 std::string tag;
1410 bool is_unit;
1411 switch (value.index()) {
1412
1413 case 0:
1414 tag = "AES128Encrypt";
1415 is_unit = false;
1416 break;
1417 case 1:
1418 tag = "Blake2s";
1419 is_unit = false;
1420 break;
1421 case 2:
1422 tag = "Blake3";
1423 is_unit = false;
1424 break;
1425 case 3:
1426 tag = "Keccakf1600";
1427 is_unit = false;
1428 break;
1429 case 4:
1430 tag = "EcdsaSecp256k1";
1431 is_unit = false;
1432 break;
1433 case 5:
1434 tag = "EcdsaSecp256r1";
1435 is_unit = false;
1436 break;
1437 case 6:
1438 tag = "MultiScalarMul";
1439 is_unit = false;
1440 break;
1441 case 7:
1442 tag = "EmbeddedCurveAdd";
1443 is_unit = false;
1444 break;
1445 case 8:
1446 tag = "Poseidon2Permutation";
1447 is_unit = false;
1448 break;
1449 case 9:
1450 tag = "Sha256Compression";
1451 is_unit = false;
1452 break;
1453 case 10:
1454 tag = "ToRadix";
1455 is_unit = false;
1456 break;
1457 default:
1458 throw_or_abort("unknown enum 'BlackBoxOp' variant index: " + std::to_string(value.index()));
1459 }
1460 if (is_unit) {
1461 packer.pack(tag);
1462 } else {
1463 std::visit(
1464 [&packer, tag](const auto& arg) {
1466 data[tag] = msgpack::object(arg);
1467 packer.pack(data);
1468 },
1469 value);
1470 }
1471 }
1472
1473 void msgpack_unpack(msgpack::object const& o)
1474 {
1475
1476 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1477 std::cerr << o << std::endl;
1478 throw_or_abort("expected MAP or STR for enum 'BlackBoxOp'; got type " + std::to_string(o.type));
1479 }
1480 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1481 throw_or_abort("expected 1 entry for enum 'BlackBoxOp'; got " + std::to_string(o.via.map.size));
1482 }
1483 std::string tag;
1484 try {
1485 if (o.type == msgpack::type::object_type::MAP) {
1486 o.via.map.ptr[0].key.convert(tag);
1487 } else {
1488 o.convert(tag);
1489 }
1490 } catch (const msgpack::type_error&) {
1491 std::cerr << o << std::endl;
1492 throw_or_abort("error converting tag to string for enum 'BlackBoxOp'");
1493 }
1494 if (tag == "AES128Encrypt") {
1495 AES128Encrypt v;
1496 try {
1497 o.via.map.ptr[0].val.convert(v);
1498 } catch (const msgpack::type_error&) {
1499 std::cerr << o << std::endl;
1500 throw_or_abort("error converting into enum variant 'BlackBoxOp::AES128Encrypt'");
1501 }
1502
1503 value = v;
1504 } else if (tag == "Blake2s") {
1505 Blake2s v;
1506 try {
1507 o.via.map.ptr[0].val.convert(v);
1508 } catch (const msgpack::type_error&) {
1509 std::cerr << o << std::endl;
1510 throw_or_abort("error converting into enum variant 'BlackBoxOp::Blake2s'");
1511 }
1512
1513 value = v;
1514 } else if (tag == "Blake3") {
1515 Blake3 v;
1516 try {
1517 o.via.map.ptr[0].val.convert(v);
1518 } catch (const msgpack::type_error&) {
1519 std::cerr << o << std::endl;
1520 throw_or_abort("error converting into enum variant 'BlackBoxOp::Blake3'");
1521 }
1522
1523 value = v;
1524 } else if (tag == "Keccakf1600") {
1525 Keccakf1600 v;
1526 try {
1527 o.via.map.ptr[0].val.convert(v);
1528 } catch (const msgpack::type_error&) {
1529 std::cerr << o << std::endl;
1530 throw_or_abort("error converting into enum variant 'BlackBoxOp::Keccakf1600'");
1531 }
1532
1533 value = v;
1534 } else if (tag == "EcdsaSecp256k1") {
1536 try {
1537 o.via.map.ptr[0].val.convert(v);
1538 } catch (const msgpack::type_error&) {
1539 std::cerr << o << std::endl;
1540 throw_or_abort("error converting into enum variant 'BlackBoxOp::EcdsaSecp256k1'");
1541 }
1542
1543 value = v;
1544 } else if (tag == "EcdsaSecp256r1") {
1546 try {
1547 o.via.map.ptr[0].val.convert(v);
1548 } catch (const msgpack::type_error&) {
1549 std::cerr << o << std::endl;
1550 throw_or_abort("error converting into enum variant 'BlackBoxOp::EcdsaSecp256r1'");
1551 }
1552
1553 value = v;
1554 } else if (tag == "MultiScalarMul") {
1556 try {
1557 o.via.map.ptr[0].val.convert(v);
1558 } catch (const msgpack::type_error&) {
1559 std::cerr << o << std::endl;
1560 throw_or_abort("error converting into enum variant 'BlackBoxOp::MultiScalarMul'");
1561 }
1562
1563 value = v;
1564 } else if (tag == "EmbeddedCurveAdd") {
1566 try {
1567 o.via.map.ptr[0].val.convert(v);
1568 } catch (const msgpack::type_error&) {
1569 std::cerr << o << std::endl;
1570 throw_or_abort("error converting into enum variant 'BlackBoxOp::EmbeddedCurveAdd'");
1571 }
1572
1573 value = v;
1574 } else if (tag == "Poseidon2Permutation") {
1576 try {
1577 o.via.map.ptr[0].val.convert(v);
1578 } catch (const msgpack::type_error&) {
1579 std::cerr << o << std::endl;
1580 throw_or_abort("error converting into enum variant 'BlackBoxOp::Poseidon2Permutation'");
1581 }
1582
1583 value = v;
1584 } else if (tag == "Sha256Compression") {
1586 try {
1587 o.via.map.ptr[0].val.convert(v);
1588 } catch (const msgpack::type_error&) {
1589 std::cerr << o << std::endl;
1590 throw_or_abort("error converting into enum variant 'BlackBoxOp::Sha256Compression'");
1591 }
1592
1593 value = v;
1594 } else if (tag == "ToRadix") {
1595 ToRadix v;
1596 try {
1597 o.via.map.ptr[0].val.convert(v);
1598 } catch (const msgpack::type_error&) {
1599 std::cerr << o << std::endl;
1600 throw_or_abort("error converting into enum variant 'BlackBoxOp::ToRadix'");
1601 }
1602
1603 value = v;
1604 } else {
1605 std::cerr << o << std::endl;
1606 throw_or_abort("unknown 'BlackBoxOp' enum variant: " + tag);
1607 }
1608 }
1609};
1610
1611struct HeapValueType;
1612
1614
1615 struct Simple {
1617
1618 friend bool operator==(const Simple&, const Simple&);
1619 std::vector<uint8_t> bincodeSerialize() const;
1620 static Simple bincodeDeserialize(std::vector<uint8_t>);
1621
1622 void msgpack_pack(auto& packer) const { packer.pack(value); }
1623
1624 void msgpack_unpack(msgpack::object const& o)
1625 {
1626 try {
1627 o.convert(value);
1628 } catch (const msgpack::type_error&) {
1629 std::cerr << o << std::endl;
1630 throw_or_abort("error converting into newtype 'Simple'");
1631 }
1632 }
1633 };
1634
1635 struct Array {
1636 std::vector<Acir::HeapValueType> value_types;
1637 uint64_t size;
1638
1639 friend bool operator==(const Array&, const Array&);
1640 std::vector<uint8_t> bincodeSerialize() const;
1641 static Array bincodeDeserialize(std::vector<uint8_t>);
1642
1643 void msgpack_pack(auto& packer) const
1644 {
1645 packer.pack_map(2);
1646 packer.pack(std::make_pair("value_types", value_types));
1647 packer.pack(std::make_pair("size", size));
1648 }
1649
1650 void msgpack_unpack(msgpack::object const& o)
1651 {
1652 std::string name = "Array";
1653 if (o.type == msgpack::type::MAP) {
1654 auto kvmap = Helpers::make_kvmap(o, name);
1655 Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false);
1656 Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false);
1657 } else if (o.type == msgpack::type::ARRAY) {
1658 auto array = o.via.array;
1659 Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0);
1660 Helpers::conv_fld_from_array(array, name, "size", size, 1);
1661 } else {
1662 throw_or_abort("expected MAP or ARRAY for " + name);
1663 }
1664 }
1665 };
1666
1667 struct Vector {
1668 std::vector<Acir::HeapValueType> value_types;
1669
1670 friend bool operator==(const Vector&, const Vector&);
1671 std::vector<uint8_t> bincodeSerialize() const;
1672 static Vector bincodeDeserialize(std::vector<uint8_t>);
1673
1674 void msgpack_pack(auto& packer) const
1675 {
1676 packer.pack_map(1);
1677 packer.pack(std::make_pair("value_types", value_types));
1678 }
1679
1680 void msgpack_unpack(msgpack::object const& o)
1681 {
1682 std::string name = "Vector";
1683 if (o.type == msgpack::type::MAP) {
1684 auto kvmap = Helpers::make_kvmap(o, name);
1685 Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false);
1686 } else if (o.type == msgpack::type::ARRAY) {
1687 auto array = o.via.array;
1688 Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0);
1689 } else {
1690 throw_or_abort("expected MAP or ARRAY for " + name);
1691 }
1692 }
1693 };
1694
1696
1697 friend bool operator==(const HeapValueType&, const HeapValueType&);
1698 std::vector<uint8_t> bincodeSerialize() const;
1699 static HeapValueType bincodeDeserialize(std::vector<uint8_t>);
1700
1701 void msgpack_pack(auto& packer) const
1702 {
1703 std::string tag;
1704 bool is_unit;
1705 switch (value.index()) {
1706
1707 case 0:
1708 tag = "Simple";
1709 is_unit = false;
1710 break;
1711 case 1:
1712 tag = "Array";
1713 is_unit = false;
1714 break;
1715 case 2:
1716 tag = "Vector";
1717 is_unit = false;
1718 break;
1719 default:
1720 throw_or_abort("unknown enum 'HeapValueType' variant index: " + std::to_string(value.index()));
1721 }
1722 if (is_unit) {
1723 packer.pack(tag);
1724 } else {
1725 std::visit(
1726 [&packer, tag](const auto& arg) {
1728 data[tag] = msgpack::object(arg);
1729 packer.pack(data);
1730 },
1731 value);
1732 }
1733 }
1734
1735 void msgpack_unpack(msgpack::object const& o)
1736 {
1737
1738 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1739 std::cerr << o << std::endl;
1740 throw_or_abort("expected MAP or STR for enum 'HeapValueType'; got type " + std::to_string(o.type));
1741 }
1742 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1743 throw_or_abort("expected 1 entry for enum 'HeapValueType'; got " + std::to_string(o.via.map.size));
1744 }
1745 std::string tag;
1746 try {
1747 if (o.type == msgpack::type::object_type::MAP) {
1748 o.via.map.ptr[0].key.convert(tag);
1749 } else {
1750 o.convert(tag);
1751 }
1752 } catch (const msgpack::type_error&) {
1753 std::cerr << o << std::endl;
1754 throw_or_abort("error converting tag to string for enum 'HeapValueType'");
1755 }
1756 if (tag == "Simple") {
1757 Simple v;
1758 try {
1759 o.via.map.ptr[0].val.convert(v);
1760 } catch (const msgpack::type_error&) {
1761 std::cerr << o << std::endl;
1762 throw_or_abort("error converting into enum variant 'HeapValueType::Simple'");
1763 }
1764
1765 value = v;
1766 } else if (tag == "Array") {
1767 Array v;
1768 try {
1769 o.via.map.ptr[0].val.convert(v);
1770 } catch (const msgpack::type_error&) {
1771 std::cerr << o << std::endl;
1772 throw_or_abort("error converting into enum variant 'HeapValueType::Array'");
1773 }
1774
1775 value = v;
1776 } else if (tag == "Vector") {
1777 Vector v;
1778 try {
1779 o.via.map.ptr[0].val.convert(v);
1780 } catch (const msgpack::type_error&) {
1781 std::cerr << o << std::endl;
1782 throw_or_abort("error converting into enum variant 'HeapValueType::Vector'");
1783 }
1784
1785 value = v;
1786 } else {
1787 std::cerr << o << std::endl;
1788 throw_or_abort("unknown 'HeapValueType' enum variant: " + tag);
1789 }
1790 }
1791};
1792
1794
1797
1798 friend bool operator==(const MemoryAddress&, const MemoryAddress&);
1799 std::vector<uint8_t> bincodeSerialize() const;
1800 static MemoryAddress bincodeDeserialize(std::vector<uint8_t>);
1801
1802 void msgpack_pack(auto& packer) const { packer.pack(value); }
1803
1804 void msgpack_unpack(msgpack::object const& o)
1805 {
1806 try {
1807 o.convert(value);
1808 } catch (const msgpack::type_error&) {
1809 std::cerr << o << std::endl;
1810 throw_or_abort("error converting into newtype 'MemoryAddress'");
1811 }
1812 }
1813 };
1814
1815 struct HeapArray {
1817
1818 friend bool operator==(const HeapArray&, const HeapArray&);
1819 std::vector<uint8_t> bincodeSerialize() const;
1820 static HeapArray bincodeDeserialize(std::vector<uint8_t>);
1821
1822 void msgpack_pack(auto& packer) const { packer.pack(value); }
1823
1824 void msgpack_unpack(msgpack::object const& o)
1825 {
1826 try {
1827 o.convert(value);
1828 } catch (const msgpack::type_error&) {
1829 std::cerr << o << std::endl;
1830 throw_or_abort("error converting into newtype 'HeapArray'");
1831 }
1832 }
1833 };
1834
1835 struct HeapVector {
1837
1838 friend bool operator==(const HeapVector&, const HeapVector&);
1839 std::vector<uint8_t> bincodeSerialize() const;
1840 static HeapVector bincodeDeserialize(std::vector<uint8_t>);
1841
1842 void msgpack_pack(auto& packer) const { packer.pack(value); }
1843
1844 void msgpack_unpack(msgpack::object const& o)
1845 {
1846 try {
1847 o.convert(value);
1848 } catch (const msgpack::type_error&) {
1849 std::cerr << o << std::endl;
1850 throw_or_abort("error converting into newtype 'HeapVector'");
1851 }
1852 }
1853 };
1854
1856
1857 friend bool operator==(const ValueOrArray&, const ValueOrArray&);
1858 std::vector<uint8_t> bincodeSerialize() const;
1859 static ValueOrArray bincodeDeserialize(std::vector<uint8_t>);
1860
1861 void msgpack_pack(auto& packer) const
1862 {
1863 std::string tag;
1864 bool is_unit;
1865 switch (value.index()) {
1866
1867 case 0:
1868 tag = "MemoryAddress";
1869 is_unit = false;
1870 break;
1871 case 1:
1872 tag = "HeapArray";
1873 is_unit = false;
1874 break;
1875 case 2:
1876 tag = "HeapVector";
1877 is_unit = false;
1878 break;
1879 default:
1880 throw_or_abort("unknown enum 'ValueOrArray' variant index: " + std::to_string(value.index()));
1881 }
1882 if (is_unit) {
1883 packer.pack(tag);
1884 } else {
1885 std::visit(
1886 [&packer, tag](const auto& arg) {
1888 data[tag] = msgpack::object(arg);
1889 packer.pack(data);
1890 },
1891 value);
1892 }
1893 }
1894
1895 void msgpack_unpack(msgpack::object const& o)
1896 {
1897
1898 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
1899 std::cerr << o << std::endl;
1900 throw_or_abort("expected MAP or STR for enum 'ValueOrArray'; got type " + std::to_string(o.type));
1901 }
1902 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
1903 throw_or_abort("expected 1 entry for enum 'ValueOrArray'; got " + std::to_string(o.via.map.size));
1904 }
1905 std::string tag;
1906 try {
1907 if (o.type == msgpack::type::object_type::MAP) {
1908 o.via.map.ptr[0].key.convert(tag);
1909 } else {
1910 o.convert(tag);
1911 }
1912 } catch (const msgpack::type_error&) {
1913 std::cerr << o << std::endl;
1914 throw_or_abort("error converting tag to string for enum 'ValueOrArray'");
1915 }
1916 if (tag == "MemoryAddress") {
1917 MemoryAddress v;
1918 try {
1919 o.via.map.ptr[0].val.convert(v);
1920 } catch (const msgpack::type_error&) {
1921 std::cerr << o << std::endl;
1922 throw_or_abort("error converting into enum variant 'ValueOrArray::MemoryAddress'");
1923 }
1924
1925 value = v;
1926 } else if (tag == "HeapArray") {
1927 HeapArray v;
1928 try {
1929 o.via.map.ptr[0].val.convert(v);
1930 } catch (const msgpack::type_error&) {
1931 std::cerr << o << std::endl;
1932 throw_or_abort("error converting into enum variant 'ValueOrArray::HeapArray'");
1933 }
1934
1935 value = v;
1936 } else if (tag == "HeapVector") {
1937 HeapVector v;
1938 try {
1939 o.via.map.ptr[0].val.convert(v);
1940 } catch (const msgpack::type_error&) {
1941 std::cerr << o << std::endl;
1942 throw_or_abort("error converting into enum variant 'ValueOrArray::HeapVector'");
1943 }
1944
1945 value = v;
1946 } else {
1947 std::cerr << o << std::endl;
1948 throw_or_abort("unknown 'ValueOrArray' enum variant: " + tag);
1949 }
1950 }
1951};
1952
1954
1960
1961 friend bool operator==(const BinaryFieldOp&, const BinaryFieldOp&);
1962 std::vector<uint8_t> bincodeSerialize() const;
1963 static BinaryFieldOp bincodeDeserialize(std::vector<uint8_t>);
1964
1965 void msgpack_pack(auto& packer) const
1966 {
1967 packer.pack_map(4);
1968 packer.pack(std::make_pair("destination", destination));
1969 packer.pack(std::make_pair("op", op));
1970 packer.pack(std::make_pair("lhs", lhs));
1971 packer.pack(std::make_pair("rhs", rhs));
1972 }
1973
1974 void msgpack_unpack(msgpack::object const& o)
1975 {
1976 std::string name = "BinaryFieldOp";
1977 if (o.type == msgpack::type::MAP) {
1978 auto kvmap = Helpers::make_kvmap(o, name);
1979 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
1980 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
1981 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
1982 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
1983 } else if (o.type == msgpack::type::ARRAY) {
1984 auto array = o.via.array;
1985 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
1986 Helpers::conv_fld_from_array(array, name, "op", op, 1);
1987 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 2);
1988 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 3);
1989 } else {
1990 throw_or_abort("expected MAP or ARRAY for " + name);
1991 }
1992 }
1993 };
1994
2001
2002 friend bool operator==(const BinaryIntOp&, const BinaryIntOp&);
2003 std::vector<uint8_t> bincodeSerialize() const;
2004 static BinaryIntOp bincodeDeserialize(std::vector<uint8_t>);
2005
2006 void msgpack_pack(auto& packer) const
2007 {
2008 packer.pack_map(5);
2009 packer.pack(std::make_pair("destination", destination));
2010 packer.pack(std::make_pair("op", op));
2011 packer.pack(std::make_pair("bit_size", bit_size));
2012 packer.pack(std::make_pair("lhs", lhs));
2013 packer.pack(std::make_pair("rhs", rhs));
2014 }
2015
2016 void msgpack_unpack(msgpack::object const& o)
2017 {
2018 std::string name = "BinaryIntOp";
2019 if (o.type == msgpack::type::MAP) {
2020 auto kvmap = Helpers::make_kvmap(o, name);
2021 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2022 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
2023 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2024 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
2025 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
2026 } else if (o.type == msgpack::type::ARRAY) {
2027 auto array = o.via.array;
2028 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2029 Helpers::conv_fld_from_array(array, name, "op", op, 1);
2030 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2031 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 3);
2032 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 4);
2033 } else {
2034 throw_or_abort("expected MAP or ARRAY for " + name);
2035 }
2036 }
2037 };
2038
2039 struct Not {
2043
2044 friend bool operator==(const Not&, const Not&);
2045 std::vector<uint8_t> bincodeSerialize() const;
2046 static Not bincodeDeserialize(std::vector<uint8_t>);
2047
2048 void msgpack_pack(auto& packer) const
2049 {
2050 packer.pack_map(3);
2051 packer.pack(std::make_pair("destination", destination));
2052 packer.pack(std::make_pair("source", source));
2053 packer.pack(std::make_pair("bit_size", bit_size));
2054 }
2055
2056 void msgpack_unpack(msgpack::object const& o)
2057 {
2058 std::string name = "Not";
2059 if (o.type == msgpack::type::MAP) {
2060 auto kvmap = Helpers::make_kvmap(o, name);
2061 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2062 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2063 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2064 } else if (o.type == msgpack::type::ARRAY) {
2065 auto array = o.via.array;
2066 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2067 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2068 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2069 } else {
2070 throw_or_abort("expected MAP or ARRAY for " + name);
2071 }
2072 }
2073 };
2074
2075 struct Cast {
2079
2080 friend bool operator==(const Cast&, const Cast&);
2081 std::vector<uint8_t> bincodeSerialize() const;
2082 static Cast bincodeDeserialize(std::vector<uint8_t>);
2083
2084 void msgpack_pack(auto& packer) const
2085 {
2086 packer.pack_map(3);
2087 packer.pack(std::make_pair("destination", destination));
2088 packer.pack(std::make_pair("source", source));
2089 packer.pack(std::make_pair("bit_size", bit_size));
2090 }
2091
2092 void msgpack_unpack(msgpack::object const& o)
2093 {
2094 std::string name = "Cast";
2095 if (o.type == msgpack::type::MAP) {
2096 auto kvmap = Helpers::make_kvmap(o, name);
2097 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2098 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2099 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2100 } else if (o.type == msgpack::type::ARRAY) {
2101 auto array = o.via.array;
2102 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2103 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2104 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2);
2105 } else {
2106 throw_or_abort("expected MAP or ARRAY for " + name);
2107 }
2108 }
2109 };
2110
2111 struct JumpIf {
2113 uint64_t location;
2114
2115 friend bool operator==(const JumpIf&, const JumpIf&);
2116 std::vector<uint8_t> bincodeSerialize() const;
2117 static JumpIf bincodeDeserialize(std::vector<uint8_t>);
2118
2119 void msgpack_pack(auto& packer) const
2120 {
2121 packer.pack_map(2);
2122 packer.pack(std::make_pair("condition", condition));
2123 packer.pack(std::make_pair("location", location));
2124 }
2125
2126 void msgpack_unpack(msgpack::object const& o)
2127 {
2128 std::string name = "JumpIf";
2129 if (o.type == msgpack::type::MAP) {
2130 auto kvmap = Helpers::make_kvmap(o, name);
2131 Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false);
2132 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2133 } else if (o.type == msgpack::type::ARRAY) {
2134 auto array = o.via.array;
2135 Helpers::conv_fld_from_array(array, name, "condition", condition, 0);
2136 Helpers::conv_fld_from_array(array, name, "location", location, 1);
2137 } else {
2138 throw_or_abort("expected MAP or ARRAY for " + name);
2139 }
2140 }
2141 };
2142
2143 struct Jump {
2144 uint64_t location;
2145
2146 friend bool operator==(const Jump&, const Jump&);
2147 std::vector<uint8_t> bincodeSerialize() const;
2148 static Jump bincodeDeserialize(std::vector<uint8_t>);
2149
2150 void msgpack_pack(auto& packer) const
2151 {
2152 packer.pack_map(1);
2153 packer.pack(std::make_pair("location", location));
2154 }
2155
2156 void msgpack_unpack(msgpack::object const& o)
2157 {
2158 std::string name = "Jump";
2159 if (o.type == msgpack::type::MAP) {
2160 auto kvmap = Helpers::make_kvmap(o, name);
2161 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2162 } else if (o.type == msgpack::type::ARRAY) {
2163 auto array = o.via.array;
2164 Helpers::conv_fld_from_array(array, name, "location", location, 0);
2165 } else {
2166 throw_or_abort("expected MAP or ARRAY for " + name);
2167 }
2168 }
2169 };
2170
2175
2176 friend bool operator==(const CalldataCopy&, const CalldataCopy&);
2177 std::vector<uint8_t> bincodeSerialize() const;
2178 static CalldataCopy bincodeDeserialize(std::vector<uint8_t>);
2179
2180 void msgpack_pack(auto& packer) const
2181 {
2182 packer.pack_map(3);
2183 packer.pack(std::make_pair("destination_address", destination_address));
2184 packer.pack(std::make_pair("size_address", size_address));
2185 packer.pack(std::make_pair("offset_address", offset_address));
2186 }
2187
2188 void msgpack_unpack(msgpack::object const& o)
2189 {
2190 std::string name = "CalldataCopy";
2191 if (o.type == msgpack::type::MAP) {
2192 auto kvmap = Helpers::make_kvmap(o, name);
2193 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_address", destination_address, false);
2194 Helpers::conv_fld_from_kvmap(kvmap, name, "size_address", size_address, false);
2195 Helpers::conv_fld_from_kvmap(kvmap, name, "offset_address", offset_address, false);
2196 } else if (o.type == msgpack::type::ARRAY) {
2197 auto array = o.via.array;
2198 Helpers::conv_fld_from_array(array, name, "destination_address", destination_address, 0);
2199 Helpers::conv_fld_from_array(array, name, "size_address", size_address, 1);
2200 Helpers::conv_fld_from_array(array, name, "offset_address", offset_address, 2);
2201 } else {
2202 throw_or_abort("expected MAP or ARRAY for " + name);
2203 }
2204 }
2205 };
2206
2207 struct Call {
2208 uint64_t location;
2209
2210 friend bool operator==(const Call&, const Call&);
2211 std::vector<uint8_t> bincodeSerialize() const;
2212 static Call bincodeDeserialize(std::vector<uint8_t>);
2213
2214 void msgpack_pack(auto& packer) const
2215 {
2216 packer.pack_map(1);
2217 packer.pack(std::make_pair("location", location));
2218 }
2219
2220 void msgpack_unpack(msgpack::object const& o)
2221 {
2222 std::string name = "Call";
2223 if (o.type == msgpack::type::MAP) {
2224 auto kvmap = Helpers::make_kvmap(o, name);
2225 Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false);
2226 } else if (o.type == msgpack::type::ARRAY) {
2227 auto array = o.via.array;
2228 Helpers::conv_fld_from_array(array, name, "location", location, 0);
2229 } else {
2230 throw_or_abort("expected MAP or ARRAY for " + name);
2231 }
2232 }
2233 };
2234
2235 struct Const {
2238 std::vector<uint8_t> value;
2239
2240 friend bool operator==(const Const&, const Const&);
2241 std::vector<uint8_t> bincodeSerialize() const;
2242 static Const bincodeDeserialize(std::vector<uint8_t>);
2243
2244 void msgpack_pack(auto& packer) const
2245 {
2246 packer.pack_map(3);
2247 packer.pack(std::make_pair("destination", destination));
2248 packer.pack(std::make_pair("bit_size", bit_size));
2249 packer.pack(std::make_pair("value", value));
2250 }
2251
2252 void msgpack_unpack(msgpack::object const& o)
2253 {
2254 std::string name = "Const";
2255 if (o.type == msgpack::type::MAP) {
2256 auto kvmap = Helpers::make_kvmap(o, name);
2257 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2258 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2259 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
2260 } else if (o.type == msgpack::type::ARRAY) {
2261 auto array = o.via.array;
2262 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2263 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1);
2264 Helpers::conv_fld_from_array(array, name, "value", value, 2);
2265 } else {
2266 throw_or_abort("expected MAP or ARRAY for " + name);
2267 }
2268 }
2269 };
2270
2274 std::vector<uint8_t> value;
2275
2276 friend bool operator==(const IndirectConst&, const IndirectConst&);
2277 std::vector<uint8_t> bincodeSerialize() const;
2278 static IndirectConst bincodeDeserialize(std::vector<uint8_t>);
2279
2280 void msgpack_pack(auto& packer) const
2281 {
2282 packer.pack_map(3);
2283 packer.pack(std::make_pair("destination_pointer", destination_pointer));
2284 packer.pack(std::make_pair("bit_size", bit_size));
2285 packer.pack(std::make_pair("value", value));
2286 }
2287
2288 void msgpack_unpack(msgpack::object const& o)
2289 {
2290 std::string name = "IndirectConst";
2291 if (o.type == msgpack::type::MAP) {
2292 auto kvmap = Helpers::make_kvmap(o, name);
2293 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false);
2294 Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false);
2295 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
2296 } else if (o.type == msgpack::type::ARRAY) {
2297 auto array = o.via.array;
2298 Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0);
2299 Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1);
2300 Helpers::conv_fld_from_array(array, name, "value", value, 2);
2301 } else {
2302 throw_or_abort("expected MAP or ARRAY for " + name);
2303 }
2304 }
2305 };
2306
2307 struct Return {
2308 friend bool operator==(const Return&, const Return&);
2309 std::vector<uint8_t> bincodeSerialize() const;
2310 static Return bincodeDeserialize(std::vector<uint8_t>);
2311
2312 void msgpack_pack(auto& packer) const {}
2313 void msgpack_unpack(msgpack::object const& o) {}
2314 };
2315
2317 std::string function;
2318 std::vector<Acir::ValueOrArray> destinations;
2319 std::vector<Acir::HeapValueType> destination_value_types;
2320 std::vector<Acir::ValueOrArray> inputs;
2321 std::vector<Acir::HeapValueType> input_value_types;
2322
2323 friend bool operator==(const ForeignCall&, const ForeignCall&);
2324 std::vector<uint8_t> bincodeSerialize() const;
2325 static ForeignCall bincodeDeserialize(std::vector<uint8_t>);
2326
2327 void msgpack_pack(auto& packer) const
2328 {
2329 packer.pack_map(5);
2330 packer.pack(std::make_pair("function", function));
2331 packer.pack(std::make_pair("destinations", destinations));
2332 packer.pack(std::make_pair("destination_value_types", destination_value_types));
2333 packer.pack(std::make_pair("inputs", inputs));
2334 packer.pack(std::make_pair("input_value_types", input_value_types));
2335 }
2336
2337 void msgpack_unpack(msgpack::object const& o)
2338 {
2339 std::string name = "ForeignCall";
2340 if (o.type == msgpack::type::MAP) {
2341 auto kvmap = Helpers::make_kvmap(o, name);
2342 Helpers::conv_fld_from_kvmap(kvmap, name, "function", function, false);
2343 Helpers::conv_fld_from_kvmap(kvmap, name, "destinations", destinations, false);
2344 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_value_types", destination_value_types, false);
2345 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
2346 Helpers::conv_fld_from_kvmap(kvmap, name, "input_value_types", input_value_types, false);
2347 } else if (o.type == msgpack::type::ARRAY) {
2348 auto array = o.via.array;
2349 Helpers::conv_fld_from_array(array, name, "function", function, 0);
2350 Helpers::conv_fld_from_array(array, name, "destinations", destinations, 1);
2351 Helpers::conv_fld_from_array(array, name, "destination_value_types", destination_value_types, 2);
2352 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 3);
2353 Helpers::conv_fld_from_array(array, name, "input_value_types", input_value_types, 4);
2354 } else {
2355 throw_or_abort("expected MAP or ARRAY for " + name);
2356 }
2357 }
2358 };
2359
2360 struct Mov {
2363
2364 friend bool operator==(const Mov&, const Mov&);
2365 std::vector<uint8_t> bincodeSerialize() const;
2366 static Mov bincodeDeserialize(std::vector<uint8_t>);
2367
2368 void msgpack_pack(auto& packer) const
2369 {
2370 packer.pack_map(2);
2371 packer.pack(std::make_pair("destination", destination));
2372 packer.pack(std::make_pair("source", source));
2373 }
2374
2375 void msgpack_unpack(msgpack::object const& o)
2376 {
2377 std::string name = "Mov";
2378 if (o.type == msgpack::type::MAP) {
2379 auto kvmap = Helpers::make_kvmap(o, name);
2380 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2381 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2382 } else if (o.type == msgpack::type::ARRAY) {
2383 auto array = o.via.array;
2384 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2385 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2386 } else {
2387 throw_or_abort("expected MAP or ARRAY for " + name);
2388 }
2389 }
2390 };
2391
2397
2398 friend bool operator==(const ConditionalMov&, const ConditionalMov&);
2399 std::vector<uint8_t> bincodeSerialize() const;
2400 static ConditionalMov bincodeDeserialize(std::vector<uint8_t>);
2401
2402 void msgpack_pack(auto& packer) const
2403 {
2404 packer.pack_map(4);
2405 packer.pack(std::make_pair("destination", destination));
2406 packer.pack(std::make_pair("source_a", source_a));
2407 packer.pack(std::make_pair("source_b", source_b));
2408 packer.pack(std::make_pair("condition", condition));
2409 }
2410
2411 void msgpack_unpack(msgpack::object const& o)
2412 {
2413 std::string name = "ConditionalMov";
2414 if (o.type == msgpack::type::MAP) {
2415 auto kvmap = Helpers::make_kvmap(o, name);
2416 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2417 Helpers::conv_fld_from_kvmap(kvmap, name, "source_a", source_a, false);
2418 Helpers::conv_fld_from_kvmap(kvmap, name, "source_b", source_b, false);
2419 Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false);
2420 } else if (o.type == msgpack::type::ARRAY) {
2421 auto array = o.via.array;
2422 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2423 Helpers::conv_fld_from_array(array, name, "source_a", source_a, 1);
2424 Helpers::conv_fld_from_array(array, name, "source_b", source_b, 2);
2425 Helpers::conv_fld_from_array(array, name, "condition", condition, 3);
2426 } else {
2427 throw_or_abort("expected MAP or ARRAY for " + name);
2428 }
2429 }
2430 };
2431
2432 struct Load {
2435
2436 friend bool operator==(const Load&, const Load&);
2437 std::vector<uint8_t> bincodeSerialize() const;
2438 static Load bincodeDeserialize(std::vector<uint8_t>);
2439
2440 void msgpack_pack(auto& packer) const
2441 {
2442 packer.pack_map(2);
2443 packer.pack(std::make_pair("destination", destination));
2444 packer.pack(std::make_pair("source_pointer", source_pointer));
2445 }
2446
2447 void msgpack_unpack(msgpack::object const& o)
2448 {
2449 std::string name = "Load";
2450 if (o.type == msgpack::type::MAP) {
2451 auto kvmap = Helpers::make_kvmap(o, name);
2452 Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false);
2453 Helpers::conv_fld_from_kvmap(kvmap, name, "source_pointer", source_pointer, false);
2454 } else if (o.type == msgpack::type::ARRAY) {
2455 auto array = o.via.array;
2456 Helpers::conv_fld_from_array(array, name, "destination", destination, 0);
2457 Helpers::conv_fld_from_array(array, name, "source_pointer", source_pointer, 1);
2458 } else {
2459 throw_or_abort("expected MAP or ARRAY for " + name);
2460 }
2461 }
2462 };
2463
2464 struct Store {
2467
2468 friend bool operator==(const Store&, const Store&);
2469 std::vector<uint8_t> bincodeSerialize() const;
2470 static Store bincodeDeserialize(std::vector<uint8_t>);
2471
2472 void msgpack_pack(auto& packer) const
2473 {
2474 packer.pack_map(2);
2475 packer.pack(std::make_pair("destination_pointer", destination_pointer));
2476 packer.pack(std::make_pair("source", source));
2477 }
2478
2479 void msgpack_unpack(msgpack::object const& o)
2480 {
2481 std::string name = "Store";
2482 if (o.type == msgpack::type::MAP) {
2483 auto kvmap = Helpers::make_kvmap(o, name);
2484 Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false);
2485 Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false);
2486 } else if (o.type == msgpack::type::ARRAY) {
2487 auto array = o.via.array;
2488 Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0);
2489 Helpers::conv_fld_from_array(array, name, "source", source, 1);
2490 } else {
2491 throw_or_abort("expected MAP or ARRAY for " + name);
2492 }
2493 }
2494 };
2495
2496 struct BlackBox {
2498
2499 friend bool operator==(const BlackBox&, const BlackBox&);
2500 std::vector<uint8_t> bincodeSerialize() const;
2501 static BlackBox bincodeDeserialize(std::vector<uint8_t>);
2502
2503 void msgpack_pack(auto& packer) const { packer.pack(value); }
2504
2505 void msgpack_unpack(msgpack::object const& o)
2506 {
2507 try {
2508 o.convert(value);
2509 } catch (const msgpack::type_error&) {
2510 std::cerr << o << std::endl;
2511 throw_or_abort("error converting into newtype 'BlackBox'");
2512 }
2513 }
2514 };
2515
2516 struct Trap {
2518
2519 friend bool operator==(const Trap&, const Trap&);
2520 std::vector<uint8_t> bincodeSerialize() const;
2521 static Trap bincodeDeserialize(std::vector<uint8_t>);
2522
2523 void msgpack_pack(auto& packer) const
2524 {
2525 packer.pack_map(1);
2526 packer.pack(std::make_pair("revert_data", revert_data));
2527 }
2528
2529 void msgpack_unpack(msgpack::object const& o)
2530 {
2531 std::string name = "Trap";
2532 if (o.type == msgpack::type::MAP) {
2533 auto kvmap = Helpers::make_kvmap(o, name);
2534 Helpers::conv_fld_from_kvmap(kvmap, name, "revert_data", revert_data, false);
2535 } else if (o.type == msgpack::type::ARRAY) {
2536 auto array = o.via.array;
2537 Helpers::conv_fld_from_array(array, name, "revert_data", revert_data, 0);
2538 } else {
2539 throw_or_abort("expected MAP or ARRAY for " + name);
2540 }
2541 }
2542 };
2543
2544 struct Stop {
2546
2547 friend bool operator==(const Stop&, const Stop&);
2548 std::vector<uint8_t> bincodeSerialize() const;
2549 static Stop bincodeDeserialize(std::vector<uint8_t>);
2550
2551 void msgpack_pack(auto& packer) const
2552 {
2553 packer.pack_map(1);
2554 packer.pack(std::make_pair("return_data", return_data));
2555 }
2556
2557 void msgpack_unpack(msgpack::object const& o)
2558 {
2559 std::string name = "Stop";
2560 if (o.type == msgpack::type::MAP) {
2561 auto kvmap = Helpers::make_kvmap(o, name);
2562 Helpers::conv_fld_from_kvmap(kvmap, name, "return_data", return_data, false);
2563 } else if (o.type == msgpack::type::ARRAY) {
2564 auto array = o.via.array;
2565 Helpers::conv_fld_from_array(array, name, "return_data", return_data, 0);
2566 } else {
2567 throw_or_abort("expected MAP or ARRAY for " + name);
2568 }
2569 }
2570 };
2571
2574 Not,
2575 Cast,
2576 JumpIf,
2577 Jump,
2578 CalldataCopy,
2579 Call,
2580 Const,
2581 IndirectConst,
2582 Return,
2583 ForeignCall,
2584 Mov,
2585 ConditionalMov,
2586 Load,
2587 Store,
2588 BlackBox,
2589 Trap,
2590 Stop>
2592
2593 friend bool operator==(const BrilligOpcode&, const BrilligOpcode&);
2594 std::vector<uint8_t> bincodeSerialize() const;
2595 static BrilligOpcode bincodeDeserialize(std::vector<uint8_t>);
2596
2597 void msgpack_pack(auto& packer) const
2598 {
2599 std::string tag;
2600 bool is_unit;
2601 switch (value.index()) {
2602
2603 case 0:
2604 tag = "BinaryFieldOp";
2605 is_unit = false;
2606 break;
2607 case 1:
2608 tag = "BinaryIntOp";
2609 is_unit = false;
2610 break;
2611 case 2:
2612 tag = "Not";
2613 is_unit = false;
2614 break;
2615 case 3:
2616 tag = "Cast";
2617 is_unit = false;
2618 break;
2619 case 4:
2620 tag = "JumpIf";
2621 is_unit = false;
2622 break;
2623 case 5:
2624 tag = "Jump";
2625 is_unit = false;
2626 break;
2627 case 6:
2628 tag = "CalldataCopy";
2629 is_unit = false;
2630 break;
2631 case 7:
2632 tag = "Call";
2633 is_unit = false;
2634 break;
2635 case 8:
2636 tag = "Const";
2637 is_unit = false;
2638 break;
2639 case 9:
2640 tag = "IndirectConst";
2641 is_unit = false;
2642 break;
2643 case 10:
2644 tag = "Return";
2645 is_unit = true;
2646 break;
2647 case 11:
2648 tag = "ForeignCall";
2649 is_unit = false;
2650 break;
2651 case 12:
2652 tag = "Mov";
2653 is_unit = false;
2654 break;
2655 case 13:
2656 tag = "ConditionalMov";
2657 is_unit = false;
2658 break;
2659 case 14:
2660 tag = "Load";
2661 is_unit = false;
2662 break;
2663 case 15:
2664 tag = "Store";
2665 is_unit = false;
2666 break;
2667 case 16:
2668 tag = "BlackBox";
2669 is_unit = false;
2670 break;
2671 case 17:
2672 tag = "Trap";
2673 is_unit = false;
2674 break;
2675 case 18:
2676 tag = "Stop";
2677 is_unit = false;
2678 break;
2679 default:
2680 throw_or_abort("unknown enum 'BrilligOpcode' variant index: " + std::to_string(value.index()));
2681 }
2682 if (is_unit) {
2683 packer.pack(tag);
2684 } else {
2685 std::visit(
2686 [&packer, tag](const auto& arg) {
2688 data[tag] = msgpack::object(arg);
2689 packer.pack(data);
2690 },
2691 value);
2692 }
2693 }
2694
2695 void msgpack_unpack(msgpack::object const& o)
2696 {
2697
2698 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
2699 std::cerr << o << std::endl;
2700 throw_or_abort("expected MAP or STR for enum 'BrilligOpcode'; got type " + std::to_string(o.type));
2701 }
2702 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
2703 throw_or_abort("expected 1 entry for enum 'BrilligOpcode'; got " + std::to_string(o.via.map.size));
2704 }
2705 std::string tag;
2706 try {
2707 if (o.type == msgpack::type::object_type::MAP) {
2708 o.via.map.ptr[0].key.convert(tag);
2709 } else {
2710 o.convert(tag);
2711 }
2712 } catch (const msgpack::type_error&) {
2713 std::cerr << o << std::endl;
2714 throw_or_abort("error converting tag to string for enum 'BrilligOpcode'");
2715 }
2716 if (tag == "BinaryFieldOp") {
2717 BinaryFieldOp v;
2718 try {
2719 o.via.map.ptr[0].val.convert(v);
2720 } catch (const msgpack::type_error&) {
2721 std::cerr << o << std::endl;
2722 throw_or_abort("error converting into enum variant 'BrilligOpcode::BinaryFieldOp'");
2723 }
2724
2725 value = v;
2726 } else if (tag == "BinaryIntOp") {
2727 BinaryIntOp v;
2728 try {
2729 o.via.map.ptr[0].val.convert(v);
2730 } catch (const msgpack::type_error&) {
2731 std::cerr << o << std::endl;
2732 throw_or_abort("error converting into enum variant 'BrilligOpcode::BinaryIntOp'");
2733 }
2734
2735 value = v;
2736 } else if (tag == "Not") {
2737 Not v;
2738 try {
2739 o.via.map.ptr[0].val.convert(v);
2740 } catch (const msgpack::type_error&) {
2741 std::cerr << o << std::endl;
2742 throw_or_abort("error converting into enum variant 'BrilligOpcode::Not'");
2743 }
2744
2745 value = v;
2746 } else if (tag == "Cast") {
2747 Cast v;
2748 try {
2749 o.via.map.ptr[0].val.convert(v);
2750 } catch (const msgpack::type_error&) {
2751 std::cerr << o << std::endl;
2752 throw_or_abort("error converting into enum variant 'BrilligOpcode::Cast'");
2753 }
2754
2755 value = v;
2756 } else if (tag == "JumpIf") {
2757 JumpIf v;
2758 try {
2759 o.via.map.ptr[0].val.convert(v);
2760 } catch (const msgpack::type_error&) {
2761 std::cerr << o << std::endl;
2762 throw_or_abort("error converting into enum variant 'BrilligOpcode::JumpIf'");
2763 }
2764
2765 value = v;
2766 } else if (tag == "Jump") {
2767 Jump v;
2768 try {
2769 o.via.map.ptr[0].val.convert(v);
2770 } catch (const msgpack::type_error&) {
2771 std::cerr << o << std::endl;
2772 throw_or_abort("error converting into enum variant 'BrilligOpcode::Jump'");
2773 }
2774
2775 value = v;
2776 } else if (tag == "CalldataCopy") {
2777 CalldataCopy v;
2778 try {
2779 o.via.map.ptr[0].val.convert(v);
2780 } catch (const msgpack::type_error&) {
2781 std::cerr << o << std::endl;
2782 throw_or_abort("error converting into enum variant 'BrilligOpcode::CalldataCopy'");
2783 }
2784
2785 value = v;
2786 } else if (tag == "Call") {
2787 Call v;
2788 try {
2789 o.via.map.ptr[0].val.convert(v);
2790 } catch (const msgpack::type_error&) {
2791 std::cerr << o << std::endl;
2792 throw_or_abort("error converting into enum variant 'BrilligOpcode::Call'");
2793 }
2794
2795 value = v;
2796 } else if (tag == "Const") {
2797 Const v;
2798 try {
2799 o.via.map.ptr[0].val.convert(v);
2800 } catch (const msgpack::type_error&) {
2801 std::cerr << o << std::endl;
2802 throw_or_abort("error converting into enum variant 'BrilligOpcode::Const'");
2803 }
2804
2805 value = v;
2806 } else if (tag == "IndirectConst") {
2807 IndirectConst v;
2808 try {
2809 o.via.map.ptr[0].val.convert(v);
2810 } catch (const msgpack::type_error&) {
2811 std::cerr << o << std::endl;
2812 throw_or_abort("error converting into enum variant 'BrilligOpcode::IndirectConst'");
2813 }
2814
2815 value = v;
2816 } else if (tag == "Return") {
2817 Return v;
2818 value = v;
2819 } else if (tag == "ForeignCall") {
2820 ForeignCall v;
2821 try {
2822 o.via.map.ptr[0].val.convert(v);
2823 } catch (const msgpack::type_error&) {
2824 std::cerr << o << std::endl;
2825 throw_or_abort("error converting into enum variant 'BrilligOpcode::ForeignCall'");
2826 }
2827
2828 value = v;
2829 } else if (tag == "Mov") {
2830 Mov v;
2831 try {
2832 o.via.map.ptr[0].val.convert(v);
2833 } catch (const msgpack::type_error&) {
2834 std::cerr << o << std::endl;
2835 throw_or_abort("error converting into enum variant 'BrilligOpcode::Mov'");
2836 }
2837
2838 value = v;
2839 } else if (tag == "ConditionalMov") {
2841 try {
2842 o.via.map.ptr[0].val.convert(v);
2843 } catch (const msgpack::type_error&) {
2844 std::cerr << o << std::endl;
2845 throw_or_abort("error converting into enum variant 'BrilligOpcode::ConditionalMov'");
2846 }
2847
2848 value = v;
2849 } else if (tag == "Load") {
2850 Load v;
2851 try {
2852 o.via.map.ptr[0].val.convert(v);
2853 } catch (const msgpack::type_error&) {
2854 std::cerr << o << std::endl;
2855 throw_or_abort("error converting into enum variant 'BrilligOpcode::Load'");
2856 }
2857
2858 value = v;
2859 } else if (tag == "Store") {
2860 Store v;
2861 try {
2862 o.via.map.ptr[0].val.convert(v);
2863 } catch (const msgpack::type_error&) {
2864 std::cerr << o << std::endl;
2865 throw_or_abort("error converting into enum variant 'BrilligOpcode::Store'");
2866 }
2867
2868 value = v;
2869 } else if (tag == "BlackBox") {
2870 BlackBox v;
2871 try {
2872 o.via.map.ptr[0].val.convert(v);
2873 } catch (const msgpack::type_error&) {
2874 std::cerr << o << std::endl;
2875 throw_or_abort("error converting into enum variant 'BrilligOpcode::BlackBox'");
2876 }
2877
2878 value = v;
2879 } else if (tag == "Trap") {
2880 Trap v;
2881 try {
2882 o.via.map.ptr[0].val.convert(v);
2883 } catch (const msgpack::type_error&) {
2884 std::cerr << o << std::endl;
2885 throw_or_abort("error converting into enum variant 'BrilligOpcode::Trap'");
2886 }
2887
2888 value = v;
2889 } else if (tag == "Stop") {
2890 Stop v;
2891 try {
2892 o.via.map.ptr[0].val.convert(v);
2893 } catch (const msgpack::type_error&) {
2894 std::cerr << o << std::endl;
2895 throw_or_abort("error converting into enum variant 'BrilligOpcode::Stop'");
2896 }
2897
2898 value = v;
2899 } else {
2900 std::cerr << o << std::endl;
2901 throw_or_abort("unknown 'BrilligOpcode' enum variant: " + tag);
2902 }
2903 }
2904};
2905
2906struct Witness {
2907 uint32_t value;
2908
2909 friend bool operator==(const Witness&, const Witness&);
2910 std::vector<uint8_t> bincodeSerialize() const;
2911 static Witness bincodeDeserialize(std::vector<uint8_t>);
2912
2913 void msgpack_pack(auto& packer) const { packer.pack(value); }
2914
2915 void msgpack_unpack(msgpack::object const& o)
2916 {
2917 try {
2918 o.convert(value);
2919 } catch (const msgpack::type_error&) {
2920 std::cerr << o << std::endl;
2921 throw_or_abort("error converting into newtype 'Witness'");
2922 }
2923 }
2924};
2925
2927
2928 struct Constant {
2929 std::vector<uint8_t> value;
2930
2931 friend bool operator==(const Constant&, const Constant&);
2932 std::vector<uint8_t> bincodeSerialize() const;
2933 static Constant bincodeDeserialize(std::vector<uint8_t>);
2934
2935 void msgpack_pack(auto& packer) const { packer.pack(value); }
2936
2937 void msgpack_unpack(msgpack::object const& o)
2938 {
2939 try {
2940 o.convert(value);
2941 } catch (const msgpack::type_error&) {
2942 std::cerr << o << std::endl;
2943 throw_or_abort("error converting into newtype 'Constant'");
2944 }
2945 }
2946 };
2947
2948 struct Witness {
2950
2951 friend bool operator==(const Witness&, const Witness&);
2952 std::vector<uint8_t> bincodeSerialize() const;
2953 static Witness bincodeDeserialize(std::vector<uint8_t>);
2954
2955 void msgpack_pack(auto& packer) const { packer.pack(value); }
2956
2957 void msgpack_unpack(msgpack::object const& o)
2958 {
2959 try {
2960 o.convert(value);
2961 } catch (const msgpack::type_error&) {
2962 std::cerr << o << std::endl;
2963 throw_or_abort("error converting into newtype 'Witness'");
2964 }
2965 }
2966 };
2967
2969
2970 friend bool operator==(const FunctionInput&, const FunctionInput&);
2971 std::vector<uint8_t> bincodeSerialize() const;
2972 static FunctionInput bincodeDeserialize(std::vector<uint8_t>);
2973
2974 void msgpack_pack(auto& packer) const
2975 {
2976 std::string tag;
2977 bool is_unit;
2978 switch (value.index()) {
2979
2980 case 0:
2981 tag = "Constant";
2982 is_unit = false;
2983 break;
2984 case 1:
2985 tag = "Witness";
2986 is_unit = false;
2987 break;
2988 default:
2989 throw_or_abort("unknown enum 'FunctionInput' variant index: " + std::to_string(value.index()));
2990 }
2991 if (is_unit) {
2992 packer.pack(tag);
2993 } else {
2994 std::visit(
2995 [&packer, tag](const auto& arg) {
2997 data[tag] = msgpack::object(arg);
2998 packer.pack(data);
2999 },
3000 value);
3001 }
3002 }
3003
3004 void msgpack_unpack(msgpack::object const& o)
3005 {
3006
3007 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3008 std::cerr << o << std::endl;
3009 throw_or_abort("expected MAP or STR for enum 'FunctionInput'; got type " + std::to_string(o.type));
3010 }
3011 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3012 throw_or_abort("expected 1 entry for enum 'FunctionInput'; got " + std::to_string(o.via.map.size));
3013 }
3014 std::string tag;
3015 try {
3016 if (o.type == msgpack::type::object_type::MAP) {
3017 o.via.map.ptr[0].key.convert(tag);
3018 } else {
3019 o.convert(tag);
3020 }
3021 } catch (const msgpack::type_error&) {
3022 std::cerr << o << std::endl;
3023 throw_or_abort("error converting tag to string for enum 'FunctionInput'");
3024 }
3025 if (tag == "Constant") {
3026 Constant v;
3027 try {
3028 o.via.map.ptr[0].val.convert(v);
3029 } catch (const msgpack::type_error&) {
3030 std::cerr << o << std::endl;
3031 throw_or_abort("error converting into enum variant 'FunctionInput::Constant'");
3032 }
3033
3034 value = v;
3035 } else if (tag == "Witness") {
3036 Witness v;
3037 try {
3038 o.via.map.ptr[0].val.convert(v);
3039 } catch (const msgpack::type_error&) {
3040 std::cerr << o << std::endl;
3041 throw_or_abort("error converting into enum variant 'FunctionInput::Witness'");
3042 }
3043
3044 value = v;
3045 } else {
3046 std::cerr << o << std::endl;
3047 throw_or_abort("unknown 'FunctionInput' enum variant: " + tag);
3048 }
3049 }
3050};
3051
3053
3055 std::vector<Acir::FunctionInput> inputs;
3058 std::vector<Acir::Witness> outputs;
3059
3060 friend bool operator==(const AES128Encrypt&, const AES128Encrypt&);
3061 std::vector<uint8_t> bincodeSerialize() const;
3062 static AES128Encrypt bincodeDeserialize(std::vector<uint8_t>);
3063
3064 void msgpack_pack(auto& packer) const
3065 {
3066 packer.pack_map(4);
3067 packer.pack(std::make_pair("inputs", inputs));
3068 packer.pack(std::make_pair("iv", iv));
3069 packer.pack(std::make_pair("key", key));
3070 packer.pack(std::make_pair("outputs", outputs));
3071 }
3072
3073 void msgpack_unpack(msgpack::object const& o)
3074 {
3075 std::string name = "AES128Encrypt";
3076 if (o.type == msgpack::type::MAP) {
3077 auto kvmap = Helpers::make_kvmap(o, name);
3078 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3079 Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false);
3080 Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false);
3081 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3082 } else if (o.type == msgpack::type::ARRAY) {
3083 auto array = o.via.array;
3084 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3085 Helpers::conv_fld_from_array(array, name, "iv", iv, 1);
3086 Helpers::conv_fld_from_array(array, name, "key", key, 2);
3087 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3088 } else {
3089 throw_or_abort("expected MAP or ARRAY for " + name);
3090 }
3091 }
3092 };
3093
3094 struct AND {
3097 uint32_t num_bits;
3099
3100 friend bool operator==(const AND&, const AND&);
3101 std::vector<uint8_t> bincodeSerialize() const;
3102 static AND bincodeDeserialize(std::vector<uint8_t>);
3103
3104 void msgpack_pack(auto& packer) const
3105 {
3106 packer.pack_map(4);
3107 packer.pack(std::make_pair("lhs", lhs));
3108 packer.pack(std::make_pair("rhs", rhs));
3109 packer.pack(std::make_pair("num_bits", num_bits));
3110 packer.pack(std::make_pair("output", output));
3111 }
3112
3113 void msgpack_unpack(msgpack::object const& o)
3114 {
3115 std::string name = "AND";
3116 if (o.type == msgpack::type::MAP) {
3117 auto kvmap = Helpers::make_kvmap(o, name);
3118 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
3119 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
3120 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3121 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3122 } else if (o.type == msgpack::type::ARRAY) {
3123 auto array = o.via.array;
3124 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0);
3125 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1);
3126 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2);
3127 Helpers::conv_fld_from_array(array, name, "output", output, 3);
3128 } else {
3129 throw_or_abort("expected MAP or ARRAY for " + name);
3130 }
3131 }
3132 };
3133
3134 struct XOR {
3137 uint32_t num_bits;
3139
3140 friend bool operator==(const XOR&, const XOR&);
3141 std::vector<uint8_t> bincodeSerialize() const;
3142 static XOR bincodeDeserialize(std::vector<uint8_t>);
3143
3144 void msgpack_pack(auto& packer) const
3145 {
3146 packer.pack_map(4);
3147 packer.pack(std::make_pair("lhs", lhs));
3148 packer.pack(std::make_pair("rhs", rhs));
3149 packer.pack(std::make_pair("num_bits", num_bits));
3150 packer.pack(std::make_pair("output", output));
3151 }
3152
3153 void msgpack_unpack(msgpack::object const& o)
3154 {
3155 std::string name = "XOR";
3156 if (o.type == msgpack::type::MAP) {
3157 auto kvmap = Helpers::make_kvmap(o, name);
3158 Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false);
3159 Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false);
3160 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3161 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3162 } else if (o.type == msgpack::type::ARRAY) {
3163 auto array = o.via.array;
3164 Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0);
3165 Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1);
3166 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2);
3167 Helpers::conv_fld_from_array(array, name, "output", output, 3);
3168 } else {
3169 throw_or_abort("expected MAP or ARRAY for " + name);
3170 }
3171 }
3172 };
3173
3174 struct RANGE {
3176 uint32_t num_bits;
3177
3178 friend bool operator==(const RANGE&, const RANGE&);
3179 std::vector<uint8_t> bincodeSerialize() const;
3180 static RANGE bincodeDeserialize(std::vector<uint8_t>);
3181
3182 void msgpack_pack(auto& packer) const
3183 {
3184 packer.pack_map(2);
3185 packer.pack(std::make_pair("input", input));
3186 packer.pack(std::make_pair("num_bits", num_bits));
3187 }
3188
3189 void msgpack_unpack(msgpack::object const& o)
3190 {
3191 std::string name = "RANGE";
3192 if (o.type == msgpack::type::MAP) {
3193 auto kvmap = Helpers::make_kvmap(o, name);
3194 Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false);
3195 Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false);
3196 } else if (o.type == msgpack::type::ARRAY) {
3197 auto array = o.via.array;
3198 Helpers::conv_fld_from_array(array, name, "input", input, 0);
3199 Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 1);
3200 } else {
3201 throw_or_abort("expected MAP or ARRAY for " + name);
3202 }
3203 }
3204 };
3205
3206 struct Blake2s {
3207 std::vector<Acir::FunctionInput> inputs;
3209
3210 friend bool operator==(const Blake2s&, const Blake2s&);
3211 std::vector<uint8_t> bincodeSerialize() const;
3212 static Blake2s bincodeDeserialize(std::vector<uint8_t>);
3213
3214 void msgpack_pack(auto& packer) const
3215 {
3216 packer.pack_map(2);
3217 packer.pack(std::make_pair("inputs", inputs));
3218 packer.pack(std::make_pair("outputs", outputs));
3219 }
3220
3221 void msgpack_unpack(msgpack::object const& o)
3222 {
3223 std::string name = "Blake2s";
3224 if (o.type == msgpack::type::MAP) {
3225 auto kvmap = Helpers::make_kvmap(o, name);
3226 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3227 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3228 } else if (o.type == msgpack::type::ARRAY) {
3229 auto array = o.via.array;
3230 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3231 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3232 } else {
3233 throw_or_abort("expected MAP or ARRAY for " + name);
3234 }
3235 }
3236 };
3237
3238 struct Blake3 {
3239 std::vector<Acir::FunctionInput> inputs;
3241
3242 friend bool operator==(const Blake3&, const Blake3&);
3243 std::vector<uint8_t> bincodeSerialize() const;
3244 static Blake3 bincodeDeserialize(std::vector<uint8_t>);
3245
3246 void msgpack_pack(auto& packer) const
3247 {
3248 packer.pack_map(2);
3249 packer.pack(std::make_pair("inputs", inputs));
3250 packer.pack(std::make_pair("outputs", outputs));
3251 }
3252
3253 void msgpack_unpack(msgpack::object const& o)
3254 {
3255 std::string name = "Blake3";
3256 if (o.type == msgpack::type::MAP) {
3257 auto kvmap = Helpers::make_kvmap(o, name);
3258 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3259 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3260 } else if (o.type == msgpack::type::ARRAY) {
3261 auto array = o.via.array;
3262 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3263 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3264 } else {
3265 throw_or_abort("expected MAP or ARRAY for " + name);
3266 }
3267 }
3268 };
3269
3277
3278 friend bool operator==(const EcdsaSecp256k1&, const EcdsaSecp256k1&);
3279 std::vector<uint8_t> bincodeSerialize() const;
3280 static EcdsaSecp256k1 bincodeDeserialize(std::vector<uint8_t>);
3281
3282 void msgpack_pack(auto& packer) const
3283 {
3284 packer.pack_map(6);
3285 packer.pack(std::make_pair("public_key_x", public_key_x));
3286 packer.pack(std::make_pair("public_key_y", public_key_y));
3287 packer.pack(std::make_pair("signature", signature));
3288 packer.pack(std::make_pair("hashed_message", hashed_message));
3289 packer.pack(std::make_pair("predicate", predicate));
3290 packer.pack(std::make_pair("output", output));
3291 }
3292
3293 void msgpack_unpack(msgpack::object const& o)
3294 {
3295 std::string name = "EcdsaSecp256k1";
3296 if (o.type == msgpack::type::MAP) {
3297 auto kvmap = Helpers::make_kvmap(o, name);
3298 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
3299 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
3300 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
3301 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false);
3302 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3303 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3304 } else if (o.type == msgpack::type::ARRAY) {
3305 auto array = o.via.array;
3306 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0);
3307 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1);
3308 Helpers::conv_fld_from_array(array, name, "signature", signature, 2);
3309 Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3);
3310 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4);
3311 Helpers::conv_fld_from_array(array, name, "output", output, 5);
3312 } else {
3313 throw_or_abort("expected MAP or ARRAY for " + name);
3314 }
3315 }
3316 };
3317
3325
3326 friend bool operator==(const EcdsaSecp256r1&, const EcdsaSecp256r1&);
3327 std::vector<uint8_t> bincodeSerialize() const;
3328 static EcdsaSecp256r1 bincodeDeserialize(std::vector<uint8_t>);
3329
3330 void msgpack_pack(auto& packer) const
3331 {
3332 packer.pack_map(6);
3333 packer.pack(std::make_pair("public_key_x", public_key_x));
3334 packer.pack(std::make_pair("public_key_y", public_key_y));
3335 packer.pack(std::make_pair("signature", signature));
3336 packer.pack(std::make_pair("hashed_message", hashed_message));
3337 packer.pack(std::make_pair("predicate", predicate));
3338 packer.pack(std::make_pair("output", output));
3339 }
3340
3341 void msgpack_unpack(msgpack::object const& o)
3342 {
3343 std::string name = "EcdsaSecp256r1";
3344 if (o.type == msgpack::type::MAP) {
3345 auto kvmap = Helpers::make_kvmap(o, name);
3346 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false);
3347 Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false);
3348 Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false);
3349 Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false);
3350 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3351 Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false);
3352 } else if (o.type == msgpack::type::ARRAY) {
3353 auto array = o.via.array;
3354 Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0);
3355 Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1);
3356 Helpers::conv_fld_from_array(array, name, "signature", signature, 2);
3357 Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3);
3358 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4);
3359 Helpers::conv_fld_from_array(array, name, "output", output, 5);
3360 } else {
3361 throw_or_abort("expected MAP or ARRAY for " + name);
3362 }
3363 }
3364 };
3365
3367 std::vector<Acir::FunctionInput> points;
3368 std::vector<Acir::FunctionInput> scalars;
3371
3372 friend bool operator==(const MultiScalarMul&, const MultiScalarMul&);
3373 std::vector<uint8_t> bincodeSerialize() const;
3374 static MultiScalarMul bincodeDeserialize(std::vector<uint8_t>);
3375
3376 void msgpack_pack(auto& packer) const
3377 {
3378 packer.pack_map(4);
3379 packer.pack(std::make_pair("points", points));
3380 packer.pack(std::make_pair("scalars", scalars));
3381 packer.pack(std::make_pair("predicate", predicate));
3382 packer.pack(std::make_pair("outputs", outputs));
3383 }
3384
3385 void msgpack_unpack(msgpack::object const& o)
3386 {
3387 std::string name = "MultiScalarMul";
3388 if (o.type == msgpack::type::MAP) {
3389 auto kvmap = Helpers::make_kvmap(o, name);
3390 Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false);
3391 Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false);
3392 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3393 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3394 } else if (o.type == msgpack::type::ARRAY) {
3395 auto array = o.via.array;
3396 Helpers::conv_fld_from_array(array, name, "points", points, 0);
3397 Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1);
3398 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2);
3399 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3400 } else {
3401 throw_or_abort("expected MAP or ARRAY for " + name);
3402 }
3403 }
3404 };
3405
3411
3412 friend bool operator==(const EmbeddedCurveAdd&, const EmbeddedCurveAdd&);
3413 std::vector<uint8_t> bincodeSerialize() const;
3414 static EmbeddedCurveAdd bincodeDeserialize(std::vector<uint8_t>);
3415
3416 void msgpack_pack(auto& packer) const
3417 {
3418 packer.pack_map(4);
3419 packer.pack(std::make_pair("input1", input1));
3420 packer.pack(std::make_pair("input2", input2));
3421 packer.pack(std::make_pair("predicate", predicate));
3422 packer.pack(std::make_pair("outputs", outputs));
3423 }
3424
3425 void msgpack_unpack(msgpack::object const& o)
3426 {
3427 std::string name = "EmbeddedCurveAdd";
3428 if (o.type == msgpack::type::MAP) {
3429 auto kvmap = Helpers::make_kvmap(o, name);
3430 Helpers::conv_fld_from_kvmap(kvmap, name, "input1", input1, false);
3431 Helpers::conv_fld_from_kvmap(kvmap, name, "input2", input2, false);
3432 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3433 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3434 } else if (o.type == msgpack::type::ARRAY) {
3435 auto array = o.via.array;
3436 Helpers::conv_fld_from_array(array, name, "input1", input1, 0);
3437 Helpers::conv_fld_from_array(array, name, "input2", input2, 1);
3438 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2);
3439 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3);
3440 } else {
3441 throw_or_abort("expected MAP or ARRAY for " + name);
3442 }
3443 }
3444 };
3445
3449
3450 friend bool operator==(const Keccakf1600&, const Keccakf1600&);
3451 std::vector<uint8_t> bincodeSerialize() const;
3452 static Keccakf1600 bincodeDeserialize(std::vector<uint8_t>);
3453
3454 void msgpack_pack(auto& packer) const
3455 {
3456 packer.pack_map(2);
3457 packer.pack(std::make_pair("inputs", inputs));
3458 packer.pack(std::make_pair("outputs", outputs));
3459 }
3460
3461 void msgpack_unpack(msgpack::object const& o)
3462 {
3463 std::string name = "Keccakf1600";
3464 if (o.type == msgpack::type::MAP) {
3465 auto kvmap = Helpers::make_kvmap(o, name);
3466 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3467 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3468 } else if (o.type == msgpack::type::ARRAY) {
3469 auto array = o.via.array;
3470 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3471 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3472 } else {
3473 throw_or_abort("expected MAP or ARRAY for " + name);
3474 }
3475 }
3476 };
3477
3479 std::vector<Acir::FunctionInput> verification_key;
3480 std::vector<Acir::FunctionInput> proof;
3481 std::vector<Acir::FunctionInput> public_inputs;
3483 uint32_t proof_type;
3485
3486 friend bool operator==(const RecursiveAggregation&, const RecursiveAggregation&);
3487 std::vector<uint8_t> bincodeSerialize() const;
3488 static RecursiveAggregation bincodeDeserialize(std::vector<uint8_t>);
3489
3490 void msgpack_pack(auto& packer) const
3491 {
3492 packer.pack_map(6);
3493 packer.pack(std::make_pair("verification_key", verification_key));
3494 packer.pack(std::make_pair("proof", proof));
3495 packer.pack(std::make_pair("public_inputs", public_inputs));
3496 packer.pack(std::make_pair("key_hash", key_hash));
3497 packer.pack(std::make_pair("proof_type", proof_type));
3498 packer.pack(std::make_pair("predicate", predicate));
3499 }
3500
3501 void msgpack_unpack(msgpack::object const& o)
3502 {
3503 std::string name = "RecursiveAggregation";
3504 if (o.type == msgpack::type::MAP) {
3505 auto kvmap = Helpers::make_kvmap(o, name);
3506 Helpers::conv_fld_from_kvmap(kvmap, name, "verification_key", verification_key, false);
3507 Helpers::conv_fld_from_kvmap(kvmap, name, "proof", proof, false);
3508 Helpers::conv_fld_from_kvmap(kvmap, name, "public_inputs", public_inputs, false);
3509 Helpers::conv_fld_from_kvmap(kvmap, name, "key_hash", key_hash, false);
3510 Helpers::conv_fld_from_kvmap(kvmap, name, "proof_type", proof_type, false);
3511 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false);
3512 } else if (o.type == msgpack::type::ARRAY) {
3513 auto array = o.via.array;
3514 Helpers::conv_fld_from_array(array, name, "verification_key", verification_key, 0);
3515 Helpers::conv_fld_from_array(array, name, "proof", proof, 1);
3516 Helpers::conv_fld_from_array(array, name, "public_inputs", public_inputs, 2);
3517 Helpers::conv_fld_from_array(array, name, "key_hash", key_hash, 3);
3518 Helpers::conv_fld_from_array(array, name, "proof_type", proof_type, 4);
3519 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 5);
3520 } else {
3521 throw_or_abort("expected MAP or ARRAY for " + name);
3522 }
3523 }
3524 };
3525
3527 std::vector<Acir::FunctionInput> inputs;
3528 std::vector<Acir::Witness> outputs;
3529
3530 friend bool operator==(const Poseidon2Permutation&, const Poseidon2Permutation&);
3531 std::vector<uint8_t> bincodeSerialize() const;
3532 static Poseidon2Permutation bincodeDeserialize(std::vector<uint8_t>);
3533
3534 void msgpack_pack(auto& packer) const
3535 {
3536 packer.pack_map(2);
3537 packer.pack(std::make_pair("inputs", inputs));
3538 packer.pack(std::make_pair("outputs", outputs));
3539 }
3540
3541 void msgpack_unpack(msgpack::object const& o)
3542 {
3543 std::string name = "Poseidon2Permutation";
3544 if (o.type == msgpack::type::MAP) {
3545 auto kvmap = Helpers::make_kvmap(o, name);
3546 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3547 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3548 } else if (o.type == msgpack::type::ARRAY) {
3549 auto array = o.via.array;
3550 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3551 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1);
3552 } else {
3553 throw_or_abort("expected MAP or ARRAY for " + name);
3554 }
3555 }
3556 };
3557
3562
3563 friend bool operator==(const Sha256Compression&, const Sha256Compression&);
3564 std::vector<uint8_t> bincodeSerialize() const;
3565 static Sha256Compression bincodeDeserialize(std::vector<uint8_t>);
3566
3567 void msgpack_pack(auto& packer) const
3568 {
3569 packer.pack_map(3);
3570 packer.pack(std::make_pair("inputs", inputs));
3571 packer.pack(std::make_pair("hash_values", hash_values));
3572 packer.pack(std::make_pair("outputs", outputs));
3573 }
3574
3575 void msgpack_unpack(msgpack::object const& o)
3576 {
3577 std::string name = "Sha256Compression";
3578 if (o.type == msgpack::type::MAP) {
3579 auto kvmap = Helpers::make_kvmap(o, name);
3580 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
3581 Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false);
3582 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
3583 } else if (o.type == msgpack::type::ARRAY) {
3584 auto array = o.via.array;
3585 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0);
3586 Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1);
3587 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
3588 } else {
3589 throw_or_abort("expected MAP or ARRAY for " + name);
3590 }
3591 }
3592 };
3593
3594 std::variant<AES128Encrypt,
3595 AND,
3596 XOR,
3597 RANGE,
3598 Blake2s,
3599 Blake3,
3600 EcdsaSecp256k1,
3601 EcdsaSecp256r1,
3602 MultiScalarMul,
3603 EmbeddedCurveAdd,
3604 Keccakf1600,
3605 RecursiveAggregation,
3606 Poseidon2Permutation,
3607 Sha256Compression>
3609
3610 friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&);
3611 std::vector<uint8_t> bincodeSerialize() const;
3612 static BlackBoxFuncCall bincodeDeserialize(std::vector<uint8_t>);
3613
3614 void msgpack_pack(auto& packer) const
3615 {
3616 std::string tag;
3617 bool is_unit;
3618 switch (value.index()) {
3619
3620 case 0:
3621 tag = "AES128Encrypt";
3622 is_unit = false;
3623 break;
3624 case 1:
3625 tag = "AND";
3626 is_unit = false;
3627 break;
3628 case 2:
3629 tag = "XOR";
3630 is_unit = false;
3631 break;
3632 case 3:
3633 tag = "RANGE";
3634 is_unit = false;
3635 break;
3636 case 4:
3637 tag = "Blake2s";
3638 is_unit = false;
3639 break;
3640 case 5:
3641 tag = "Blake3";
3642 is_unit = false;
3643 break;
3644 case 6:
3645 tag = "EcdsaSecp256k1";
3646 is_unit = false;
3647 break;
3648 case 7:
3649 tag = "EcdsaSecp256r1";
3650 is_unit = false;
3651 break;
3652 case 8:
3653 tag = "MultiScalarMul";
3654 is_unit = false;
3655 break;
3656 case 9:
3657 tag = "EmbeddedCurveAdd";
3658 is_unit = false;
3659 break;
3660 case 10:
3661 tag = "Keccakf1600";
3662 is_unit = false;
3663 break;
3664 case 11:
3665 tag = "RecursiveAggregation";
3666 is_unit = false;
3667 break;
3668 case 12:
3669 tag = "Poseidon2Permutation";
3670 is_unit = false;
3671 break;
3672 case 13:
3673 tag = "Sha256Compression";
3674 is_unit = false;
3675 break;
3676 default:
3677 throw_or_abort("unknown enum 'BlackBoxFuncCall' variant index: " + std::to_string(value.index()));
3678 }
3679 if (is_unit) {
3680 packer.pack(tag);
3681 } else {
3682 std::visit(
3683 [&packer, tag](const auto& arg) {
3685 data[tag] = msgpack::object(arg);
3686 packer.pack(data);
3687 },
3688 value);
3689 }
3690 }
3691
3692 void msgpack_unpack(msgpack::object const& o)
3693 {
3694
3695 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3696 std::cerr << o << std::endl;
3697 throw_or_abort("expected MAP or STR for enum 'BlackBoxFuncCall'; got type " + std::to_string(o.type));
3698 }
3699 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3700 throw_or_abort("expected 1 entry for enum 'BlackBoxFuncCall'; got " + std::to_string(o.via.map.size));
3701 }
3702 std::string tag;
3703 try {
3704 if (o.type == msgpack::type::object_type::MAP) {
3705 o.via.map.ptr[0].key.convert(tag);
3706 } else {
3707 o.convert(tag);
3708 }
3709 } catch (const msgpack::type_error&) {
3710 std::cerr << o << std::endl;
3711 throw_or_abort("error converting tag to string for enum 'BlackBoxFuncCall'");
3712 }
3713 if (tag == "AES128Encrypt") {
3714 AES128Encrypt v;
3715 try {
3716 o.via.map.ptr[0].val.convert(v);
3717 } catch (const msgpack::type_error&) {
3718 std::cerr << o << std::endl;
3719 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::AES128Encrypt'");
3720 }
3721
3722 value = v;
3723 } else if (tag == "AND") {
3724 AND v;
3725 try {
3726 o.via.map.ptr[0].val.convert(v);
3727 } catch (const msgpack::type_error&) {
3728 std::cerr << o << std::endl;
3729 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::AND'");
3730 }
3731
3732 value = v;
3733 } else if (tag == "XOR") {
3734 XOR v;
3735 try {
3736 o.via.map.ptr[0].val.convert(v);
3737 } catch (const msgpack::type_error&) {
3738 std::cerr << o << std::endl;
3739 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::XOR'");
3740 }
3741
3742 value = v;
3743 } else if (tag == "RANGE") {
3744 RANGE v;
3745 try {
3746 o.via.map.ptr[0].val.convert(v);
3747 } catch (const msgpack::type_error&) {
3748 std::cerr << o << std::endl;
3749 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::RANGE'");
3750 }
3751
3752 value = v;
3753 } else if (tag == "Blake2s") {
3754 Blake2s v;
3755 try {
3756 o.via.map.ptr[0].val.convert(v);
3757 } catch (const msgpack::type_error&) {
3758 std::cerr << o << std::endl;
3759 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Blake2s'");
3760 }
3761
3762 value = v;
3763 } else if (tag == "Blake3") {
3764 Blake3 v;
3765 try {
3766 o.via.map.ptr[0].val.convert(v);
3767 } catch (const msgpack::type_error&) {
3768 std::cerr << o << std::endl;
3769 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Blake3'");
3770 }
3771
3772 value = v;
3773 } else if (tag == "EcdsaSecp256k1") {
3775 try {
3776 o.via.map.ptr[0].val.convert(v);
3777 } catch (const msgpack::type_error&) {
3778 std::cerr << o << std::endl;
3779 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EcdsaSecp256k1'");
3780 }
3781
3782 value = v;
3783 } else if (tag == "EcdsaSecp256r1") {
3785 try {
3786 o.via.map.ptr[0].val.convert(v);
3787 } catch (const msgpack::type_error&) {
3788 std::cerr << o << std::endl;
3789 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EcdsaSecp256r1'");
3790 }
3791
3792 value = v;
3793 } else if (tag == "MultiScalarMul") {
3795 try {
3796 o.via.map.ptr[0].val.convert(v);
3797 } catch (const msgpack::type_error&) {
3798 std::cerr << o << std::endl;
3799 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::MultiScalarMul'");
3800 }
3801
3802 value = v;
3803 } else if (tag == "EmbeddedCurveAdd") {
3805 try {
3806 o.via.map.ptr[0].val.convert(v);
3807 } catch (const msgpack::type_error&) {
3808 std::cerr << o << std::endl;
3809 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::EmbeddedCurveAdd'");
3810 }
3811
3812 value = v;
3813 } else if (tag == "Keccakf1600") {
3814 Keccakf1600 v;
3815 try {
3816 o.via.map.ptr[0].val.convert(v);
3817 } catch (const msgpack::type_error&) {
3818 std::cerr << o << std::endl;
3819 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Keccakf1600'");
3820 }
3821
3822 value = v;
3823 } else if (tag == "RecursiveAggregation") {
3825 try {
3826 o.via.map.ptr[0].val.convert(v);
3827 } catch (const msgpack::type_error&) {
3828 std::cerr << o << std::endl;
3829 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::RecursiveAggregation'");
3830 }
3831
3832 value = v;
3833 } else if (tag == "Poseidon2Permutation") {
3835 try {
3836 o.via.map.ptr[0].val.convert(v);
3837 } catch (const msgpack::type_error&) {
3838 std::cerr << o << std::endl;
3839 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Poseidon2Permutation'");
3840 }
3841
3842 value = v;
3843 } else if (tag == "Sha256Compression") {
3845 try {
3846 o.via.map.ptr[0].val.convert(v);
3847 } catch (const msgpack::type_error&) {
3848 std::cerr << o << std::endl;
3849 throw_or_abort("error converting into enum variant 'BlackBoxFuncCall::Sha256Compression'");
3850 }
3851
3852 value = v;
3853 } else {
3854 std::cerr << o << std::endl;
3855 throw_or_abort("unknown 'BlackBoxFuncCall' enum variant: " + tag);
3856 }
3857 }
3858};
3859
3860struct BlockId {
3861 uint32_t value;
3862
3863 friend bool operator==(const BlockId&, const BlockId&);
3864 std::vector<uint8_t> bincodeSerialize() const;
3865 static BlockId bincodeDeserialize(std::vector<uint8_t>);
3866
3867 void msgpack_pack(auto& packer) const { packer.pack(value); }
3868
3869 void msgpack_unpack(msgpack::object const& o)
3870 {
3871 try {
3872 o.convert(value);
3873 } catch (const msgpack::type_error&) {
3874 std::cerr << o << std::endl;
3875 throw_or_abort("error converting into newtype 'BlockId'");
3876 }
3877 }
3878};
3879
3881
3882 struct Memory {
3883 friend bool operator==(const Memory&, const Memory&);
3884 std::vector<uint8_t> bincodeSerialize() const;
3885 static Memory bincodeDeserialize(std::vector<uint8_t>);
3886
3887 void msgpack_pack(auto& packer) const {}
3888 void msgpack_unpack(msgpack::object const& o) {}
3889 };
3890
3891 struct CallData {
3892 uint32_t value;
3893
3894 friend bool operator==(const CallData&, const CallData&);
3895 std::vector<uint8_t> bincodeSerialize() const;
3896 static CallData bincodeDeserialize(std::vector<uint8_t>);
3897
3898 void msgpack_pack(auto& packer) const { packer.pack(value); }
3899
3900 void msgpack_unpack(msgpack::object const& o)
3901 {
3902 try {
3903 o.convert(value);
3904 } catch (const msgpack::type_error&) {
3905 std::cerr << o << std::endl;
3906 throw_or_abort("error converting into newtype 'CallData'");
3907 }
3908 }
3909 };
3910
3911 struct ReturnData {
3912 friend bool operator==(const ReturnData&, const ReturnData&);
3913 std::vector<uint8_t> bincodeSerialize() const;
3914 static ReturnData bincodeDeserialize(std::vector<uint8_t>);
3915
3916 void msgpack_pack(auto& packer) const {}
3917 void msgpack_unpack(msgpack::object const& o) {}
3918 };
3919
3921
3922 friend bool operator==(const BlockType&, const BlockType&);
3923 std::vector<uint8_t> bincodeSerialize() const;
3924 static BlockType bincodeDeserialize(std::vector<uint8_t>);
3925
3926 void msgpack_pack(auto& packer) const
3927 {
3928 std::string tag;
3929 bool is_unit;
3930 switch (value.index()) {
3931
3932 case 0:
3933 tag = "Memory";
3934 is_unit = true;
3935 break;
3936 case 1:
3937 tag = "CallData";
3938 is_unit = false;
3939 break;
3940 case 2:
3941 tag = "ReturnData";
3942 is_unit = true;
3943 break;
3944 default:
3945 throw_or_abort("unknown enum 'BlockType' variant index: " + std::to_string(value.index()));
3946 }
3947 if (is_unit) {
3948 packer.pack(tag);
3949 } else {
3950 std::visit(
3951 [&packer, tag](const auto& arg) {
3953 data[tag] = msgpack::object(arg);
3954 packer.pack(data);
3955 },
3956 value);
3957 }
3958 }
3959
3960 void msgpack_unpack(msgpack::object const& o)
3961 {
3962
3963 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
3964 std::cerr << o << std::endl;
3965 throw_or_abort("expected MAP or STR for enum 'BlockType'; got type " + std::to_string(o.type));
3966 }
3967 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
3968 throw_or_abort("expected 1 entry for enum 'BlockType'; got " + std::to_string(o.via.map.size));
3969 }
3970 std::string tag;
3971 try {
3972 if (o.type == msgpack::type::object_type::MAP) {
3973 o.via.map.ptr[0].key.convert(tag);
3974 } else {
3975 o.convert(tag);
3976 }
3977 } catch (const msgpack::type_error&) {
3978 std::cerr << o << std::endl;
3979 throw_or_abort("error converting tag to string for enum 'BlockType'");
3980 }
3981 if (tag == "Memory") {
3982 Memory v;
3983 value = v;
3984 } else if (tag == "CallData") {
3985 CallData v;
3986 try {
3987 o.via.map.ptr[0].val.convert(v);
3988 } catch (const msgpack::type_error&) {
3989 std::cerr << o << std::endl;
3990 throw_or_abort("error converting into enum variant 'BlockType::CallData'");
3991 }
3992
3993 value = v;
3994 } else if (tag == "ReturnData") {
3995 ReturnData v;
3996 value = v;
3997 } else {
3998 std::cerr << o << std::endl;
3999 throw_or_abort("unknown 'BlockType' enum variant: " + tag);
4000 }
4001 }
4002};
4003
4007 std::vector<uint8_t> q_c;
4008
4009 friend bool operator==(const Expression&, const Expression&);
4010 std::vector<uint8_t> bincodeSerialize() const;
4011 static Expression bincodeDeserialize(std::vector<uint8_t>);
4012
4013 void msgpack_pack(auto& packer) const
4014 {
4015 packer.pack_map(3);
4016 packer.pack(std::make_pair("mul_terms", mul_terms));
4017 packer.pack(std::make_pair("linear_combinations", linear_combinations));
4018 packer.pack(std::make_pair("q_c", q_c));
4019 }
4020
4021 void msgpack_unpack(msgpack::object const& o)
4022 {
4023 std::string name = "Expression";
4024 if (o.type == msgpack::type::MAP) {
4025 auto kvmap = Helpers::make_kvmap(o, name);
4026 Helpers::conv_fld_from_kvmap(kvmap, name, "mul_terms", mul_terms, false);
4027 Helpers::conv_fld_from_kvmap(kvmap, name, "linear_combinations", linear_combinations, false);
4028 Helpers::conv_fld_from_kvmap(kvmap, name, "q_c", q_c, false);
4029 } else if (o.type == msgpack::type::ARRAY) {
4030 auto array = o.via.array;
4031 Helpers::conv_fld_from_array(array, name, "mul_terms", mul_terms, 0);
4032 Helpers::conv_fld_from_array(array, name, "linear_combinations", linear_combinations, 1);
4033 Helpers::conv_fld_from_array(array, name, "q_c", q_c, 2);
4034 } else {
4035 throw_or_abort("expected MAP or ARRAY for " + name);
4036 }
4037 }
4038};
4039
4041
4042 struct Single {
4044
4045 friend bool operator==(const Single&, const Single&);
4046 std::vector<uint8_t> bincodeSerialize() const;
4047 static Single bincodeDeserialize(std::vector<uint8_t>);
4048
4049 void msgpack_pack(auto& packer) const { packer.pack(value); }
4050
4051 void msgpack_unpack(msgpack::object const& o)
4052 {
4053 try {
4054 o.convert(value);
4055 } catch (const msgpack::type_error&) {
4056 std::cerr << o << std::endl;
4057 throw_or_abort("error converting into newtype 'Single'");
4058 }
4059 }
4060 };
4061
4062 struct Array {
4063 std::vector<Acir::Expression> value;
4064
4065 friend bool operator==(const Array&, const Array&);
4066 std::vector<uint8_t> bincodeSerialize() const;
4067 static Array bincodeDeserialize(std::vector<uint8_t>);
4068
4069 void msgpack_pack(auto& packer) const { packer.pack(value); }
4070
4071 void msgpack_unpack(msgpack::object const& o)
4072 {
4073 try {
4074 o.convert(value);
4075 } catch (const msgpack::type_error&) {
4076 std::cerr << o << std::endl;
4077 throw_or_abort("error converting into newtype 'Array'");
4078 }
4079 }
4080 };
4081
4084
4085 friend bool operator==(const MemoryArray&, const MemoryArray&);
4086 std::vector<uint8_t> bincodeSerialize() const;
4087 static MemoryArray bincodeDeserialize(std::vector<uint8_t>);
4088
4089 void msgpack_pack(auto& packer) const { packer.pack(value); }
4090
4091 void msgpack_unpack(msgpack::object const& o)
4092 {
4093 try {
4094 o.convert(value);
4095 } catch (const msgpack::type_error&) {
4096 std::cerr << o << std::endl;
4097 throw_or_abort("error converting into newtype 'MemoryArray'");
4098 }
4099 }
4100 };
4101
4103
4104 friend bool operator==(const BrilligInputs&, const BrilligInputs&);
4105 std::vector<uint8_t> bincodeSerialize() const;
4106 static BrilligInputs bincodeDeserialize(std::vector<uint8_t>);
4107
4108 void msgpack_pack(auto& packer) const
4109 {
4110 std::string tag;
4111 bool is_unit;
4112 switch (value.index()) {
4113
4114 case 0:
4115 tag = "Single";
4116 is_unit = false;
4117 break;
4118 case 1:
4119 tag = "Array";
4120 is_unit = false;
4121 break;
4122 case 2:
4123 tag = "MemoryArray";
4124 is_unit = false;
4125 break;
4126 default:
4127 throw_or_abort("unknown enum 'BrilligInputs' variant index: " + std::to_string(value.index()));
4128 }
4129 if (is_unit) {
4130 packer.pack(tag);
4131 } else {
4132 std::visit(
4133 [&packer, tag](const auto& arg) {
4135 data[tag] = msgpack::object(arg);
4136 packer.pack(data);
4137 },
4138 value);
4139 }
4140 }
4141
4142 void msgpack_unpack(msgpack::object const& o)
4143 {
4144
4145 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4146 std::cerr << o << std::endl;
4147 throw_or_abort("expected MAP or STR for enum 'BrilligInputs'; got type " + std::to_string(o.type));
4148 }
4149 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4150 throw_or_abort("expected 1 entry for enum 'BrilligInputs'; got " + std::to_string(o.via.map.size));
4151 }
4152 std::string tag;
4153 try {
4154 if (o.type == msgpack::type::object_type::MAP) {
4155 o.via.map.ptr[0].key.convert(tag);
4156 } else {
4157 o.convert(tag);
4158 }
4159 } catch (const msgpack::type_error&) {
4160 std::cerr << o << std::endl;
4161 throw_or_abort("error converting tag to string for enum 'BrilligInputs'");
4162 }
4163 if (tag == "Single") {
4164 Single v;
4165 try {
4166 o.via.map.ptr[0].val.convert(v);
4167 } catch (const msgpack::type_error&) {
4168 std::cerr << o << std::endl;
4169 throw_or_abort("error converting into enum variant 'BrilligInputs::Single'");
4170 }
4171
4172 value = v;
4173 } else if (tag == "Array") {
4174 Array v;
4175 try {
4176 o.via.map.ptr[0].val.convert(v);
4177 } catch (const msgpack::type_error&) {
4178 std::cerr << o << std::endl;
4179 throw_or_abort("error converting into enum variant 'BrilligInputs::Array'");
4180 }
4181
4182 value = v;
4183 } else if (tag == "MemoryArray") {
4184 MemoryArray v;
4185 try {
4186 o.via.map.ptr[0].val.convert(v);
4187 } catch (const msgpack::type_error&) {
4188 std::cerr << o << std::endl;
4189 throw_or_abort("error converting into enum variant 'BrilligInputs::MemoryArray'");
4190 }
4191
4192 value = v;
4193 } else {
4194 std::cerr << o << std::endl;
4195 throw_or_abort("unknown 'BrilligInputs' enum variant: " + tag);
4196 }
4197 }
4198};
4199
4201
4202 struct Simple {
4204
4205 friend bool operator==(const Simple&, const Simple&);
4206 std::vector<uint8_t> bincodeSerialize() const;
4207 static Simple bincodeDeserialize(std::vector<uint8_t>);
4208
4209 void msgpack_pack(auto& packer) const { packer.pack(value); }
4210
4211 void msgpack_unpack(msgpack::object const& o)
4212 {
4213 try {
4214 o.convert(value);
4215 } catch (const msgpack::type_error&) {
4216 std::cerr << o << std::endl;
4217 throw_or_abort("error converting into newtype 'Simple'");
4218 }
4219 }
4220 };
4221
4222 struct Array {
4223 std::vector<Acir::Witness> value;
4224
4225 friend bool operator==(const Array&, const Array&);
4226 std::vector<uint8_t> bincodeSerialize() const;
4227 static Array bincodeDeserialize(std::vector<uint8_t>);
4228
4229 void msgpack_pack(auto& packer) const { packer.pack(value); }
4230
4231 void msgpack_unpack(msgpack::object const& o)
4232 {
4233 try {
4234 o.convert(value);
4235 } catch (const msgpack::type_error&) {
4236 std::cerr << o << std::endl;
4237 throw_or_abort("error converting into newtype 'Array'");
4238 }
4239 }
4240 };
4241
4243
4244 friend bool operator==(const BrilligOutputs&, const BrilligOutputs&);
4245 std::vector<uint8_t> bincodeSerialize() const;
4246 static BrilligOutputs bincodeDeserialize(std::vector<uint8_t>);
4247
4248 void msgpack_pack(auto& packer) const
4249 {
4250 std::string tag;
4251 bool is_unit;
4252 switch (value.index()) {
4253
4254 case 0:
4255 tag = "Simple";
4256 is_unit = false;
4257 break;
4258 case 1:
4259 tag = "Array";
4260 is_unit = false;
4261 break;
4262 default:
4263 throw_or_abort("unknown enum 'BrilligOutputs' variant index: " + std::to_string(value.index()));
4264 }
4265 if (is_unit) {
4266 packer.pack(tag);
4267 } else {
4268 std::visit(
4269 [&packer, tag](const auto& arg) {
4271 data[tag] = msgpack::object(arg);
4272 packer.pack(data);
4273 },
4274 value);
4275 }
4276 }
4277
4278 void msgpack_unpack(msgpack::object const& o)
4279 {
4280
4281 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4282 std::cerr << o << std::endl;
4283 throw_or_abort("expected MAP or STR for enum 'BrilligOutputs'; got type " + std::to_string(o.type));
4284 }
4285 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4286 throw_or_abort("expected 1 entry for enum 'BrilligOutputs'; got " + std::to_string(o.via.map.size));
4287 }
4288 std::string tag;
4289 try {
4290 if (o.type == msgpack::type::object_type::MAP) {
4291 o.via.map.ptr[0].key.convert(tag);
4292 } else {
4293 o.convert(tag);
4294 }
4295 } catch (const msgpack::type_error&) {
4296 std::cerr << o << std::endl;
4297 throw_or_abort("error converting tag to string for enum 'BrilligOutputs'");
4298 }
4299 if (tag == "Simple") {
4300 Simple v;
4301 try {
4302 o.via.map.ptr[0].val.convert(v);
4303 } catch (const msgpack::type_error&) {
4304 std::cerr << o << std::endl;
4305 throw_or_abort("error converting into enum variant 'BrilligOutputs::Simple'");
4306 }
4307
4308 value = v;
4309 } else if (tag == "Array") {
4310 Array v;
4311 try {
4312 o.via.map.ptr[0].val.convert(v);
4313 } catch (const msgpack::type_error&) {
4314 std::cerr << o << std::endl;
4315 throw_or_abort("error converting into enum variant 'BrilligOutputs::Array'");
4316 }
4317
4318 value = v;
4319 } else {
4320 std::cerr << o << std::endl;
4321 throw_or_abort("unknown 'BrilligOutputs' enum variant: " + tag);
4322 }
4323 }
4324};
4325
4326struct MemOp {
4330
4331 friend bool operator==(const MemOp&, const MemOp&);
4332 std::vector<uint8_t> bincodeSerialize() const;
4333 static MemOp bincodeDeserialize(std::vector<uint8_t>);
4334
4335 void msgpack_pack(auto& packer) const
4336 {
4337 packer.pack_map(3);
4338 packer.pack(std::make_pair("operation", operation));
4339 packer.pack(std::make_pair("index", index));
4340 packer.pack(std::make_pair("value", value));
4341 }
4342
4343 void msgpack_unpack(msgpack::object const& o)
4344 {
4345 std::string name = "MemOp";
4346 if (o.type == msgpack::type::MAP) {
4347 auto kvmap = Helpers::make_kvmap(o, name);
4348 Helpers::conv_fld_from_kvmap(kvmap, name, "operation", operation, false);
4349 Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false);
4350 Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false);
4351 } else if (o.type == msgpack::type::ARRAY) {
4352 auto array = o.via.array;
4353 Helpers::conv_fld_from_array(array, name, "operation", operation, 0);
4354 Helpers::conv_fld_from_array(array, name, "index", index, 1);
4355 Helpers::conv_fld_from_array(array, name, "value", value, 2);
4356 } else {
4357 throw_or_abort("expected MAP or ARRAY for " + name);
4358 }
4359 }
4360};
4361
4362struct Opcode {
4363
4364 struct AssertZero {
4366
4367 friend bool operator==(const AssertZero&, const AssertZero&);
4368 std::vector<uint8_t> bincodeSerialize() const;
4369 static AssertZero bincodeDeserialize(std::vector<uint8_t>);
4370
4371 void msgpack_pack(auto& packer) const { packer.pack(value); }
4372
4373 void msgpack_unpack(msgpack::object const& o)
4374 {
4375 try {
4376 o.convert(value);
4377 } catch (const msgpack::type_error&) {
4378 std::cerr << o << std::endl;
4379 throw_or_abort("error converting into newtype 'AssertZero'");
4380 }
4381 }
4382 };
4383
4386
4387 friend bool operator==(const BlackBoxFuncCall&, const BlackBoxFuncCall&);
4388 std::vector<uint8_t> bincodeSerialize() const;
4389 static BlackBoxFuncCall bincodeDeserialize(std::vector<uint8_t>);
4390
4391 void msgpack_pack(auto& packer) const { packer.pack(value); }
4392
4393 void msgpack_unpack(msgpack::object const& o)
4394 {
4395 try {
4396 o.convert(value);
4397 } catch (const msgpack::type_error&) {
4398 std::cerr << o << std::endl;
4399 throw_or_abort("error converting into newtype 'BlackBoxFuncCall'");
4400 }
4401 }
4402 };
4403
4404 struct MemoryOp {
4407
4408 friend bool operator==(const MemoryOp&, const MemoryOp&);
4409 std::vector<uint8_t> bincodeSerialize() const;
4410 static MemoryOp bincodeDeserialize(std::vector<uint8_t>);
4411
4412 void msgpack_pack(auto& packer) const
4413 {
4414 packer.pack_map(2);
4415 packer.pack(std::make_pair("block_id", block_id));
4416 packer.pack(std::make_pair("op", op));
4417 }
4418
4419 void msgpack_unpack(msgpack::object const& o)
4420 {
4421 std::string name = "MemoryOp";
4422 if (o.type == msgpack::type::MAP) {
4423 auto kvmap = Helpers::make_kvmap(o, name);
4424 Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false);
4425 Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false);
4426 } else if (o.type == msgpack::type::ARRAY) {
4427 auto array = o.via.array;
4428 Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0);
4429 Helpers::conv_fld_from_array(array, name, "op", op, 1);
4430 } else {
4431 throw_or_abort("expected MAP or ARRAY for " + name);
4432 }
4433 }
4434 };
4435
4436 struct MemoryInit {
4438 std::vector<Acir::Witness> init;
4440
4441 friend bool operator==(const MemoryInit&, const MemoryInit&);
4442 std::vector<uint8_t> bincodeSerialize() const;
4443 static MemoryInit bincodeDeserialize(std::vector<uint8_t>);
4444
4445 void msgpack_pack(auto& packer) const
4446 {
4447 packer.pack_map(3);
4448 packer.pack(std::make_pair("block_id", block_id));
4449 packer.pack(std::make_pair("init", init));
4450 packer.pack(std::make_pair("block_type", block_type));
4451 }
4452
4453 void msgpack_unpack(msgpack::object const& o)
4454 {
4455 std::string name = "MemoryInit";
4456 if (o.type == msgpack::type::MAP) {
4457 auto kvmap = Helpers::make_kvmap(o, name);
4458 Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false);
4459 Helpers::conv_fld_from_kvmap(kvmap, name, "init", init, false);
4460 Helpers::conv_fld_from_kvmap(kvmap, name, "block_type", block_type, false);
4461 } else if (o.type == msgpack::type::ARRAY) {
4462 auto array = o.via.array;
4463 Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0);
4464 Helpers::conv_fld_from_array(array, name, "init", init, 1);
4465 Helpers::conv_fld_from_array(array, name, "block_type", block_type, 2);
4466 } else {
4467 throw_or_abort("expected MAP or ARRAY for " + name);
4468 }
4469 }
4470 };
4471
4473 uint32_t id;
4474 std::vector<Acir::BrilligInputs> inputs;
4475 std::vector<Acir::BrilligOutputs> outputs;
4477
4478 friend bool operator==(const BrilligCall&, const BrilligCall&);
4479 std::vector<uint8_t> bincodeSerialize() const;
4480 static BrilligCall bincodeDeserialize(std::vector<uint8_t>);
4481
4482 void msgpack_pack(auto& packer) const
4483 {
4484 packer.pack_map(4);
4485 packer.pack(std::make_pair("id", id));
4486 packer.pack(std::make_pair("inputs", inputs));
4487 packer.pack(std::make_pair("outputs", outputs));
4488 packer.pack(std::make_pair("predicate", predicate));
4489 }
4490
4491 void msgpack_unpack(msgpack::object const& o)
4492 {
4493 std::string name = "BrilligCall";
4494 if (o.type == msgpack::type::MAP) {
4495 auto kvmap = Helpers::make_kvmap(o, name);
4496 Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false);
4497 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
4498 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
4499 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true);
4500 } else if (o.type == msgpack::type::ARRAY) {
4501 auto array = o.via.array;
4502 Helpers::conv_fld_from_array(array, name, "id", id, 0);
4503 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1);
4504 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
4505 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3);
4506 } else {
4507 throw_or_abort("expected MAP or ARRAY for " + name);
4508 }
4509 }
4510 };
4511
4512 struct Call {
4513 uint32_t id;
4514 std::vector<Acir::Witness> inputs;
4515 std::vector<Acir::Witness> outputs;
4517
4518 friend bool operator==(const Call&, const Call&);
4519 std::vector<uint8_t> bincodeSerialize() const;
4520 static Call bincodeDeserialize(std::vector<uint8_t>);
4521
4522 void msgpack_pack(auto& packer) const
4523 {
4524 packer.pack_map(4);
4525 packer.pack(std::make_pair("id", id));
4526 packer.pack(std::make_pair("inputs", inputs));
4527 packer.pack(std::make_pair("outputs", outputs));
4528 packer.pack(std::make_pair("predicate", predicate));
4529 }
4530
4531 void msgpack_unpack(msgpack::object const& o)
4532 {
4533 std::string name = "Call";
4534 if (o.type == msgpack::type::MAP) {
4535 auto kvmap = Helpers::make_kvmap(o, name);
4536 Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false);
4537 Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false);
4538 Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false);
4539 Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true);
4540 } else if (o.type == msgpack::type::ARRAY) {
4541 auto array = o.via.array;
4542 Helpers::conv_fld_from_array(array, name, "id", id, 0);
4543 Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1);
4544 Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2);
4545 Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3);
4546 } else {
4547 throw_or_abort("expected MAP or ARRAY for " + name);
4548 }
4549 }
4550 };
4551
4553
4554 friend bool operator==(const Opcode&, const Opcode&);
4555 std::vector<uint8_t> bincodeSerialize() const;
4556 static Opcode bincodeDeserialize(std::vector<uint8_t>);
4557
4558 void msgpack_pack(auto& packer) const
4559 {
4560 std::string tag;
4561 bool is_unit;
4562 switch (value.index()) {
4563
4564 case 0:
4565 tag = "AssertZero";
4566 is_unit = false;
4567 break;
4568 case 1:
4569 tag = "BlackBoxFuncCall";
4570 is_unit = false;
4571 break;
4572 case 2:
4573 tag = "MemoryOp";
4574 is_unit = false;
4575 break;
4576 case 3:
4577 tag = "MemoryInit";
4578 is_unit = false;
4579 break;
4580 case 4:
4581 tag = "BrilligCall";
4582 is_unit = false;
4583 break;
4584 case 5:
4585 tag = "Call";
4586 is_unit = false;
4587 break;
4588 default:
4589 throw_or_abort("unknown enum 'Opcode' variant index: " + std::to_string(value.index()));
4590 }
4591 if (is_unit) {
4592 packer.pack(tag);
4593 } else {
4594 std::visit(
4595 [&packer, tag](const auto& arg) {
4597 data[tag] = msgpack::object(arg);
4598 packer.pack(data);
4599 },
4600 value);
4601 }
4602 }
4603
4604 void msgpack_unpack(msgpack::object const& o)
4605 {
4606
4607 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4608 std::cerr << o << std::endl;
4609 throw_or_abort("expected MAP or STR for enum 'Opcode'; got type " + std::to_string(o.type));
4610 }
4611 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4612 throw_or_abort("expected 1 entry for enum 'Opcode'; got " + std::to_string(o.via.map.size));
4613 }
4614 std::string tag;
4615 try {
4616 if (o.type == msgpack::type::object_type::MAP) {
4617 o.via.map.ptr[0].key.convert(tag);
4618 } else {
4619 o.convert(tag);
4620 }
4621 } catch (const msgpack::type_error&) {
4622 std::cerr << o << std::endl;
4623 throw_or_abort("error converting tag to string for enum 'Opcode'");
4624 }
4625 if (tag == "AssertZero") {
4626 AssertZero v;
4627 try {
4628 o.via.map.ptr[0].val.convert(v);
4629 } catch (const msgpack::type_error&) {
4630 std::cerr << o << std::endl;
4631 throw_or_abort("error converting into enum variant 'Opcode::AssertZero'");
4632 }
4633
4634 value = v;
4635 } else if (tag == "BlackBoxFuncCall") {
4637 try {
4638 o.via.map.ptr[0].val.convert(v);
4639 } catch (const msgpack::type_error&) {
4640 std::cerr << o << std::endl;
4641 throw_or_abort("error converting into enum variant 'Opcode::BlackBoxFuncCall'");
4642 }
4643
4644 value = v;
4645 } else if (tag == "MemoryOp") {
4646 MemoryOp v;
4647 try {
4648 o.via.map.ptr[0].val.convert(v);
4649 } catch (const msgpack::type_error&) {
4650 std::cerr << o << std::endl;
4651 throw_or_abort("error converting into enum variant 'Opcode::MemoryOp'");
4652 }
4653
4654 value = v;
4655 } else if (tag == "MemoryInit") {
4656 MemoryInit v;
4657 try {
4658 o.via.map.ptr[0].val.convert(v);
4659 } catch (const msgpack::type_error&) {
4660 std::cerr << o << std::endl;
4661 throw_or_abort("error converting into enum variant 'Opcode::MemoryInit'");
4662 }
4663
4664 value = v;
4665 } else if (tag == "BrilligCall") {
4666 BrilligCall v;
4667 try {
4668 o.via.map.ptr[0].val.convert(v);
4669 } catch (const msgpack::type_error&) {
4670 std::cerr << o << std::endl;
4671 throw_or_abort("error converting into enum variant 'Opcode::BrilligCall'");
4672 }
4673
4674 value = v;
4675 } else if (tag == "Call") {
4676 Call v;
4677 try {
4678 o.via.map.ptr[0].val.convert(v);
4679 } catch (const msgpack::type_error&) {
4680 std::cerr << o << std::endl;
4681 throw_or_abort("error converting into enum variant 'Opcode::Call'");
4682 }
4683
4684 value = v;
4685 } else {
4686 std::cerr << o << std::endl;
4687 throw_or_abort("unknown 'Opcode' enum variant: " + tag);
4688 }
4689 }
4690};
4691
4693
4694 struct Expression {
4696
4697 friend bool operator==(const Expression&, const Expression&);
4698 std::vector<uint8_t> bincodeSerialize() const;
4699 static Expression bincodeDeserialize(std::vector<uint8_t>);
4700
4701 void msgpack_pack(auto& packer) const { packer.pack(value); }
4702
4703 void msgpack_unpack(msgpack::object const& o)
4704 {
4705 try {
4706 o.convert(value);
4707 } catch (const msgpack::type_error&) {
4708 std::cerr << o << std::endl;
4709 throw_or_abort("error converting into newtype 'Expression'");
4710 }
4711 }
4712 };
4713
4714 struct Memory {
4716
4717 friend bool operator==(const Memory&, const Memory&);
4718 std::vector<uint8_t> bincodeSerialize() const;
4719 static Memory bincodeDeserialize(std::vector<uint8_t>);
4720
4721 void msgpack_pack(auto& packer) const { packer.pack(value); }
4722
4723 void msgpack_unpack(msgpack::object const& o)
4724 {
4725 try {
4726 o.convert(value);
4727 } catch (const msgpack::type_error&) {
4728 std::cerr << o << std::endl;
4729 throw_or_abort("error converting into newtype 'Memory'");
4730 }
4731 }
4732 };
4733
4735
4736 friend bool operator==(const ExpressionOrMemory&, const ExpressionOrMemory&);
4737 std::vector<uint8_t> bincodeSerialize() const;
4738 static ExpressionOrMemory bincodeDeserialize(std::vector<uint8_t>);
4739
4740 void msgpack_pack(auto& packer) const
4741 {
4742 std::string tag;
4743 bool is_unit;
4744 switch (value.index()) {
4745
4746 case 0:
4747 tag = "Expression";
4748 is_unit = false;
4749 break;
4750 case 1:
4751 tag = "Memory";
4752 is_unit = false;
4753 break;
4754 default:
4755 throw_or_abort("unknown enum 'ExpressionOrMemory' variant index: " + std::to_string(value.index()));
4756 }
4757 if (is_unit) {
4758 packer.pack(tag);
4759 } else {
4760 std::visit(
4761 [&packer, tag](const auto& arg) {
4763 data[tag] = msgpack::object(arg);
4764 packer.pack(data);
4765 },
4766 value);
4767 }
4768 }
4769
4770 void msgpack_unpack(msgpack::object const& o)
4771 {
4772
4773 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4774 std::cerr << o << std::endl;
4775 throw_or_abort("expected MAP or STR for enum 'ExpressionOrMemory'; got type " + std::to_string(o.type));
4776 }
4777 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4778 throw_or_abort("expected 1 entry for enum 'ExpressionOrMemory'; got " + std::to_string(o.via.map.size));
4779 }
4780 std::string tag;
4781 try {
4782 if (o.type == msgpack::type::object_type::MAP) {
4783 o.via.map.ptr[0].key.convert(tag);
4784 } else {
4785 o.convert(tag);
4786 }
4787 } catch (const msgpack::type_error&) {
4788 std::cerr << o << std::endl;
4789 throw_or_abort("error converting tag to string for enum 'ExpressionOrMemory'");
4790 }
4791 if (tag == "Expression") {
4792 Expression v;
4793 try {
4794 o.via.map.ptr[0].val.convert(v);
4795 } catch (const msgpack::type_error&) {
4796 std::cerr << o << std::endl;
4797 throw_or_abort("error converting into enum variant 'ExpressionOrMemory::Expression'");
4798 }
4799
4800 value = v;
4801 } else if (tag == "Memory") {
4802 Memory v;
4803 try {
4804 o.via.map.ptr[0].val.convert(v);
4805 } catch (const msgpack::type_error&) {
4806 std::cerr << o << std::endl;
4807 throw_or_abort("error converting into enum variant 'ExpressionOrMemory::Memory'");
4808 }
4809
4810 value = v;
4811 } else {
4812 std::cerr << o << std::endl;
4813 throw_or_abort("unknown 'ExpressionOrMemory' enum variant: " + tag);
4814 }
4815 }
4816};
4817
4820 std::vector<Acir::ExpressionOrMemory> payload;
4821
4822 friend bool operator==(const AssertionPayload&, const AssertionPayload&);
4823 std::vector<uint8_t> bincodeSerialize() const;
4824 static AssertionPayload bincodeDeserialize(std::vector<uint8_t>);
4825
4826 void msgpack_pack(auto& packer) const
4827 {
4828 packer.pack_map(2);
4829 packer.pack(std::make_pair("error_selector", error_selector));
4830 packer.pack(std::make_pair("payload", payload));
4831 }
4832
4833 void msgpack_unpack(msgpack::object const& o)
4834 {
4835 std::string name = "AssertionPayload";
4836 if (o.type == msgpack::type::MAP) {
4837 auto kvmap = Helpers::make_kvmap(o, name);
4838 Helpers::conv_fld_from_kvmap(kvmap, name, "error_selector", error_selector, false);
4839 Helpers::conv_fld_from_kvmap(kvmap, name, "payload", payload, false);
4840 } else if (o.type == msgpack::type::ARRAY) {
4841 auto array = o.via.array;
4842 Helpers::conv_fld_from_array(array, name, "error_selector", error_selector, 0);
4843 Helpers::conv_fld_from_array(array, name, "payload", payload, 1);
4844 } else {
4845 throw_or_abort("expected MAP or ARRAY for " + name);
4846 }
4847 }
4848};
4849
4851
4852 struct Acir {
4853 uint64_t value;
4854
4855 friend bool operator==(const Acir&, const Acir&);
4856 std::vector<uint8_t> bincodeSerialize() const;
4857 static Acir bincodeDeserialize(std::vector<uint8_t>);
4858
4859 void msgpack_pack(auto& packer) const { packer.pack(value); }
4860
4861 void msgpack_unpack(msgpack::object const& o)
4862 {
4863 try {
4864 o.convert(value);
4865 } catch (const msgpack::type_error&) {
4866 std::cerr << o << std::endl;
4867 throw_or_abort("error converting into newtype 'Acir'");
4868 }
4869 }
4870 };
4871
4872 struct Brillig {
4873 uint64_t acir_index;
4875
4876 friend bool operator==(const Brillig&, const Brillig&);
4877 std::vector<uint8_t> bincodeSerialize() const;
4878 static Brillig bincodeDeserialize(std::vector<uint8_t>);
4879
4880 void msgpack_pack(auto& packer) const
4881 {
4882 packer.pack_map(2);
4883 packer.pack(std::make_pair("acir_index", acir_index));
4884 packer.pack(std::make_pair("brillig_index", brillig_index));
4885 }
4886
4887 void msgpack_unpack(msgpack::object const& o)
4888 {
4889 std::string name = "Brillig";
4890 if (o.type == msgpack::type::MAP) {
4891 auto kvmap = Helpers::make_kvmap(o, name);
4892 Helpers::conv_fld_from_kvmap(kvmap, name, "acir_index", acir_index, false);
4893 Helpers::conv_fld_from_kvmap(kvmap, name, "brillig_index", brillig_index, false);
4894 } else if (o.type == msgpack::type::ARRAY) {
4895 auto array = o.via.array;
4896 Helpers::conv_fld_from_array(array, name, "acir_index", acir_index, 0);
4897 Helpers::conv_fld_from_array(array, name, "brillig_index", brillig_index, 1);
4898 } else {
4899 throw_or_abort("expected MAP or ARRAY for " + name);
4900 }
4901 }
4902 };
4903
4905
4906 friend bool operator==(const OpcodeLocation&, const OpcodeLocation&);
4907 std::vector<uint8_t> bincodeSerialize() const;
4908 static OpcodeLocation bincodeDeserialize(std::vector<uint8_t>);
4909
4910 void msgpack_pack(auto& packer) const
4911 {
4912 std::string tag;
4913 bool is_unit;
4914 switch (value.index()) {
4915
4916 case 0:
4917 tag = "Acir";
4918 is_unit = false;
4919 break;
4920 case 1:
4921 tag = "Brillig";
4922 is_unit = false;
4923 break;
4924 default:
4925 throw_or_abort("unknown enum 'OpcodeLocation' variant index: " + std::to_string(value.index()));
4926 }
4927 if (is_unit) {
4928 packer.pack(tag);
4929 } else {
4930 std::visit(
4931 [&packer, tag](const auto& arg) {
4933 data[tag] = msgpack::object(arg);
4934 packer.pack(data);
4935 },
4936 value);
4937 }
4938 }
4939
4940 void msgpack_unpack(msgpack::object const& o)
4941 {
4942
4943 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
4944 std::cerr << o << std::endl;
4945 throw_or_abort("expected MAP or STR for enum 'OpcodeLocation'; got type " + std::to_string(o.type));
4946 }
4947 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
4948 throw_or_abort("expected 1 entry for enum 'OpcodeLocation'; got " + std::to_string(o.via.map.size));
4949 }
4950 std::string tag;
4951 try {
4952 if (o.type == msgpack::type::object_type::MAP) {
4953 o.via.map.ptr[0].key.convert(tag);
4954 } else {
4955 o.convert(tag);
4956 }
4957 } catch (const msgpack::type_error&) {
4958 std::cerr << o << std::endl;
4959 throw_or_abort("error converting tag to string for enum 'OpcodeLocation'");
4960 }
4961 if (tag == "Acir") {
4962 Acir v;
4963 try {
4964 o.via.map.ptr[0].val.convert(v);
4965 } catch (const msgpack::type_error&) {
4966 std::cerr << o << std::endl;
4967 throw_or_abort("error converting into enum variant 'OpcodeLocation::Acir'");
4968 }
4969
4970 value = v;
4971 } else if (tag == "Brillig") {
4972 Brillig v;
4973 try {
4974 o.via.map.ptr[0].val.convert(v);
4975 } catch (const msgpack::type_error&) {
4976 std::cerr << o << std::endl;
4977 throw_or_abort("error converting into enum variant 'OpcodeLocation::Brillig'");
4978 }
4979
4980 value = v;
4981 } else {
4982 std::cerr << o << std::endl;
4983 throw_or_abort("unknown 'OpcodeLocation' enum variant: " + tag);
4984 }
4985 }
4986};
4987
4989 std::vector<Acir::Witness> value;
4990
4991 friend bool operator==(const PublicInputs&, const PublicInputs&);
4992 std::vector<uint8_t> bincodeSerialize() const;
4993 static PublicInputs bincodeDeserialize(std::vector<uint8_t>);
4994
4995 void msgpack_pack(auto& packer) const { packer.pack(value); }
4996
4997 void msgpack_unpack(msgpack::object const& o)
4998 {
4999 try {
5000 o.convert(value);
5001 } catch (const msgpack::type_error&) {
5002 std::cerr << o << std::endl;
5003 throw_or_abort("error converting into newtype 'PublicInputs'");
5004 }
5005 }
5006};
5007
5008struct Circuit {
5009 std::string function_name;
5011 std::vector<Acir::Opcode> opcodes;
5012 std::vector<Acir::Witness> private_parameters;
5016
5017 friend bool operator==(const Circuit&, const Circuit&);
5018 std::vector<uint8_t> bincodeSerialize() const;
5019 static Circuit bincodeDeserialize(std::vector<uint8_t>);
5020
5021 void msgpack_pack(auto& packer) const
5022 {
5023 packer.pack_map(7);
5024 packer.pack(std::make_pair("function_name", function_name));
5025 packer.pack(std::make_pair("current_witness_index", current_witness_index));
5026 packer.pack(std::make_pair("opcodes", opcodes));
5027 packer.pack(std::make_pair("private_parameters", private_parameters));
5028 packer.pack(std::make_pair("public_parameters", public_parameters));
5029 packer.pack(std::make_pair("return_values", return_values));
5030 packer.pack(std::make_pair("assert_messages", assert_messages));
5031 }
5032
5033 void msgpack_unpack(msgpack::object const& o)
5034 {
5035 std::string name = "Circuit";
5036 if (o.type == msgpack::type::MAP) {
5037 auto kvmap = Helpers::make_kvmap(o, name);
5038 Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false);
5039 Helpers::conv_fld_from_kvmap(kvmap, name, "current_witness_index", current_witness_index, false);
5040 Helpers::conv_fld_from_kvmap(kvmap, name, "opcodes", opcodes, false);
5041 Helpers::conv_fld_from_kvmap(kvmap, name, "private_parameters", private_parameters, false);
5042 Helpers::conv_fld_from_kvmap(kvmap, name, "public_parameters", public_parameters, false);
5043 Helpers::conv_fld_from_kvmap(kvmap, name, "return_values", return_values, false);
5044 Helpers::conv_fld_from_kvmap(kvmap, name, "assert_messages", assert_messages, false);
5045 } else if (o.type == msgpack::type::ARRAY) {
5046 auto array = o.via.array;
5047 Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0);
5048 Helpers::conv_fld_from_array(array, name, "current_witness_index", current_witness_index, 1);
5049 Helpers::conv_fld_from_array(array, name, "opcodes", opcodes, 2);
5050 Helpers::conv_fld_from_array(array, name, "private_parameters", private_parameters, 3);
5051 Helpers::conv_fld_from_array(array, name, "public_parameters", public_parameters, 4);
5052 Helpers::conv_fld_from_array(array, name, "return_values", return_values, 5);
5053 Helpers::conv_fld_from_array(array, name, "assert_messages", assert_messages, 6);
5054 } else {
5055 throw_or_abort("expected MAP or ARRAY for " + name);
5056 }
5057 }
5058};
5059
5061 std::string function_name;
5062 std::vector<Acir::BrilligOpcode> bytecode;
5063
5064 friend bool operator==(const BrilligBytecode&, const BrilligBytecode&);
5065 std::vector<uint8_t> bincodeSerialize() const;
5066 static BrilligBytecode bincodeDeserialize(std::vector<uint8_t>);
5067
5068 void msgpack_pack(auto& packer) const
5069 {
5070 packer.pack_map(2);
5071 packer.pack(std::make_pair("function_name", function_name));
5072 packer.pack(std::make_pair("bytecode", bytecode));
5073 }
5074
5075 void msgpack_unpack(msgpack::object const& o)
5076 {
5077 std::string name = "BrilligBytecode";
5078 if (o.type == msgpack::type::MAP) {
5079 auto kvmap = Helpers::make_kvmap(o, name);
5080 Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false);
5081 Helpers::conv_fld_from_kvmap(kvmap, name, "bytecode", bytecode, false);
5082 } else if (o.type == msgpack::type::ARRAY) {
5083 auto array = o.via.array;
5084 Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0);
5085 Helpers::conv_fld_from_array(array, name, "bytecode", bytecode, 1);
5086 } else {
5087 throw_or_abort("expected MAP or ARRAY for " + name);
5088 }
5089 }
5090};
5091
5092struct Program {
5093 std::vector<Acir::Circuit> functions;
5094 std::vector<Acir::BrilligBytecode> unconstrained_functions;
5095
5096 friend bool operator==(const Program&, const Program&);
5097 std::vector<uint8_t> bincodeSerialize() const;
5098 static Program bincodeDeserialize(std::vector<uint8_t>);
5099
5100 void msgpack_pack(auto& packer) const
5101 {
5102 packer.pack_map(2);
5103 packer.pack(std::make_pair("functions", functions));
5104 packer.pack(std::make_pair("unconstrained_functions", unconstrained_functions));
5105 }
5106
5107 void msgpack_unpack(msgpack::object const& o)
5108 {
5109 std::string name = "Program";
5110 if (o.type == msgpack::type::MAP) {
5111 auto kvmap = Helpers::make_kvmap(o, name);
5112 Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false);
5113 Helpers::conv_fld_from_kvmap(kvmap, name, "unconstrained_functions", unconstrained_functions, false);
5114 } else if (o.type == msgpack::type::ARRAY) {
5115 auto array = o.via.array;
5116 Helpers::conv_fld_from_array(array, name, "functions", functions, 0);
5117 Helpers::conv_fld_from_array(array, name, "unconstrained_functions", unconstrained_functions, 1);
5118 } else {
5119 throw_or_abort("expected MAP or ARRAY for " + name);
5120 }
5121 }
5122};
5123
5125 std::vector<Acir::Circuit> functions;
5127
5128 friend bool operator==(const ProgramWithoutBrillig&, const ProgramWithoutBrillig&);
5129 std::vector<uint8_t> bincodeSerialize() const;
5130 static ProgramWithoutBrillig bincodeDeserialize(std::vector<uint8_t>);
5131
5132 void msgpack_pack(auto& packer) const
5133 {
5134 packer.pack_map(1);
5135 packer.pack(std::make_pair("functions", functions));
5136 }
5137
5138 void msgpack_unpack(msgpack::object const& o)
5139 {
5140 std::string name = "ProgramWithoutBrillig";
5141 if (o.type == msgpack::type::MAP) {
5142 auto kvmap = Helpers::make_kvmap(o, name);
5143 Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false);
5144 } else if (o.type == msgpack::type::ARRAY) {
5145 auto array = o.via.array;
5146 Helpers::conv_fld_from_array(array, name, "functions", functions, 0);
5147 } else {
5148 throw_or_abort("expected MAP or ARRAY for " + name);
5149 }
5150 }
5151};
5152
5154
5155 struct Unbounded {
5156 friend bool operator==(const Unbounded&, const Unbounded&);
5157 std::vector<uint8_t> bincodeSerialize() const;
5158 static Unbounded bincodeDeserialize(std::vector<uint8_t>);
5159
5160 void msgpack_pack(auto& packer) const {}
5161 void msgpack_unpack(msgpack::object const& o) {}
5162 };
5163
5164 struct Bounded {
5165 uint64_t width;
5166
5167 friend bool operator==(const Bounded&, const Bounded&);
5168 std::vector<uint8_t> bincodeSerialize() const;
5169 static Bounded bincodeDeserialize(std::vector<uint8_t>);
5170
5171 void msgpack_pack(auto& packer) const
5172 {
5173 packer.pack_map(1);
5174 packer.pack(std::make_pair("width", width));
5175 }
5176
5177 void msgpack_unpack(msgpack::object const& o)
5178 {
5179 std::string name = "Bounded";
5180 if (o.type == msgpack::type::MAP) {
5181 auto kvmap = Helpers::make_kvmap(o, name);
5182 Helpers::conv_fld_from_kvmap(kvmap, name, "width", width, false);
5183 } else if (o.type == msgpack::type::ARRAY) {
5184 auto array = o.via.array;
5185 Helpers::conv_fld_from_array(array, name, "width", width, 0);
5186 } else {
5187 throw_or_abort("expected MAP or ARRAY for " + name);
5188 }
5189 }
5190 };
5191
5193
5194 friend bool operator==(const ExpressionWidth&, const ExpressionWidth&);
5195 std::vector<uint8_t> bincodeSerialize() const;
5196 static ExpressionWidth bincodeDeserialize(std::vector<uint8_t>);
5197
5198 void msgpack_pack(auto& packer) const
5199 {
5200 std::string tag;
5201 bool is_unit;
5202 switch (value.index()) {
5203
5204 case 0:
5205 tag = "Unbounded";
5206 is_unit = true;
5207 break;
5208 case 1:
5209 tag = "Bounded";
5210 is_unit = false;
5211 break;
5212 default:
5213 throw_or_abort("unknown enum 'ExpressionWidth' variant index: " + std::to_string(value.index()));
5214 }
5215 if (is_unit) {
5216 packer.pack(tag);
5217 } else {
5218 std::visit(
5219 [&packer, tag](const auto& arg) {
5221 data[tag] = msgpack::object(arg);
5222 packer.pack(data);
5223 },
5224 value);
5225 }
5226 }
5227
5228 void msgpack_unpack(msgpack::object const& o)
5229 {
5230
5231 if (o.type != msgpack::type::object_type::MAP && o.type != msgpack::type::object_type::STR) {
5232 std::cerr << o << std::endl;
5233 throw_or_abort("expected MAP or STR for enum 'ExpressionWidth'; got type " + std::to_string(o.type));
5234 }
5235 if (o.type == msgpack::type::object_type::MAP && o.via.map.size != 1) {
5236 throw_or_abort("expected 1 entry for enum 'ExpressionWidth'; got " + std::to_string(o.via.map.size));
5237 }
5238 std::string tag;
5239 try {
5240 if (o.type == msgpack::type::object_type::MAP) {
5241 o.via.map.ptr[0].key.convert(tag);
5242 } else {
5243 o.convert(tag);
5244 }
5245 } catch (const msgpack::type_error&) {
5246 std::cerr << o << std::endl;
5247 throw_or_abort("error converting tag to string for enum 'ExpressionWidth'");
5248 }
5249 if (tag == "Unbounded") {
5250 Unbounded v;
5251 value = v;
5252 } else if (tag == "Bounded") {
5253 Bounded v;
5254 try {
5255 o.via.map.ptr[0].val.convert(v);
5256 } catch (const msgpack::type_error&) {
5257 std::cerr << o << std::endl;
5258 throw_or_abort("error converting into enum variant 'ExpressionWidth::Bounded'");
5259 }
5260
5261 value = v;
5262 } else {
5263 std::cerr << o << std::endl;
5264 throw_or_abort("unknown 'ExpressionWidth' enum variant: " + tag);
5265 }
5266 }
5267};
5268
5269} // end of namespace Acir
5270
5271namespace Acir {
5272
5273inline bool operator==(const AssertionPayload& lhs, const AssertionPayload& rhs)
5274{
5275 if (!(lhs.error_selector == rhs.error_selector)) {
5276 return false;
5277 }
5278 if (!(lhs.payload == rhs.payload)) {
5279 return false;
5280 }
5281 return true;
5282}
5283
5284inline std::vector<uint8_t> AssertionPayload::bincodeSerialize() const
5285{
5286 auto serializer = serde::BincodeSerializer();
5288 return std::move(serializer).bytes();
5289}
5290
5292{
5293 auto deserializer = serde::BincodeDeserializer(input);
5295 if (deserializer.get_buffer_offset() < input.size()) {
5296 throw_or_abort("Some input bytes were not read");
5297 }
5298 return value;
5299}
5300
5301} // end of namespace Acir
5302
5303template <>
5304template <typename Serializer>
5306{
5307 serializer.increase_container_depth();
5308 serde::Serializable<decltype(obj.error_selector)>::serialize(obj.error_selector, serializer);
5309 serde::Serializable<decltype(obj.payload)>::serialize(obj.payload, serializer);
5310 serializer.decrease_container_depth();
5311}
5312
5313template <>
5314template <typename Deserializer>
5316{
5317 deserializer.increase_container_depth();
5319 obj.error_selector = serde::Deserializable<decltype(obj.error_selector)>::deserialize(deserializer);
5320 obj.payload = serde::Deserializable<decltype(obj.payload)>::deserialize(deserializer);
5321 deserializer.decrease_container_depth();
5322 return obj;
5323}
5324
5325namespace Acir {
5326
5327inline bool operator==(const BinaryFieldOp& lhs, const BinaryFieldOp& rhs)
5328{
5329 if (!(lhs.value == rhs.value)) {
5330 return false;
5331 }
5332 return true;
5333}
5334
5335inline std::vector<uint8_t> BinaryFieldOp::bincodeSerialize() const
5336{
5337 auto serializer = serde::BincodeSerializer();
5339 return std::move(serializer).bytes();
5340}
5341
5342inline BinaryFieldOp BinaryFieldOp::bincodeDeserialize(std::vector<uint8_t> input)
5343{
5344 auto deserializer = serde::BincodeDeserializer(input);
5346 if (deserializer.get_buffer_offset() < input.size()) {
5347 throw_or_abort("Some input bytes were not read");
5348 }
5349 return value;
5350}
5351
5352} // end of namespace Acir
5353
5354template <>
5355template <typename Serializer>
5357{
5358 serializer.increase_container_depth();
5359 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
5360 serializer.decrease_container_depth();
5361}
5362
5363template <>
5364template <typename Deserializer>
5366{
5367 deserializer.increase_container_depth();
5369 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
5370 deserializer.decrease_container_depth();
5371 return obj;
5372}
5373
5374namespace Acir {
5375
5376inline bool operator==(const BinaryFieldOp::Add& lhs, const BinaryFieldOp::Add& rhs)
5377{
5378 return true;
5379}
5380
5381inline std::vector<uint8_t> BinaryFieldOp::Add::bincodeSerialize() const
5382{
5383 auto serializer = serde::BincodeSerializer();
5385 return std::move(serializer).bytes();
5386}
5387
5389{
5390 auto deserializer = serde::BincodeDeserializer(input);
5392 if (deserializer.get_buffer_offset() < input.size()) {
5393 throw_or_abort("Some input bytes were not read");
5394 }
5395 return value;
5396}
5397
5398} // end of namespace Acir
5399
5400template <>
5401template <typename Serializer>
5405
5406template <>
5407template <typename Deserializer>
5413
5414namespace Acir {
5415
5416inline bool operator==(const BinaryFieldOp::Sub& lhs, const BinaryFieldOp::Sub& rhs)
5417{
5418 return true;
5419}
5420
5421inline std::vector<uint8_t> BinaryFieldOp::Sub::bincodeSerialize() const
5422{
5423 auto serializer = serde::BincodeSerializer();
5425 return std::move(serializer).bytes();
5426}
5427
5429{
5430 auto deserializer = serde::BincodeDeserializer(input);
5432 if (deserializer.get_buffer_offset() < input.size()) {
5433 throw_or_abort("Some input bytes were not read");
5434 }
5435 return value;
5436}
5437
5438} // end of namespace Acir
5439
5440template <>
5441template <typename Serializer>
5445
5446template <>
5447template <typename Deserializer>
5453
5454namespace Acir {
5455
5456inline bool operator==(const BinaryFieldOp::Mul& lhs, const BinaryFieldOp::Mul& rhs)
5457{
5458 return true;
5459}
5460
5461inline std::vector<uint8_t> BinaryFieldOp::Mul::bincodeSerialize() const
5462{
5463 auto serializer = serde::BincodeSerializer();
5465 return std::move(serializer).bytes();
5466}
5467
5469{
5470 auto deserializer = serde::BincodeDeserializer(input);
5472 if (deserializer.get_buffer_offset() < input.size()) {
5473 throw_or_abort("Some input bytes were not read");
5474 }
5475 return value;
5476}
5477
5478} // end of namespace Acir
5479
5480template <>
5481template <typename Serializer>
5485
5486template <>
5487template <typename Deserializer>
5493
5494namespace Acir {
5495
5496inline bool operator==(const BinaryFieldOp::Div& lhs, const BinaryFieldOp::Div& rhs)
5497{
5498 return true;
5499}
5500
5501inline std::vector<uint8_t> BinaryFieldOp::Div::bincodeSerialize() const
5502{
5503 auto serializer = serde::BincodeSerializer();
5505 return std::move(serializer).bytes();
5506}
5507
5509{
5510 auto deserializer = serde::BincodeDeserializer(input);
5512 if (deserializer.get_buffer_offset() < input.size()) {
5513 throw_or_abort("Some input bytes were not read");
5514 }
5515 return value;
5516}
5517
5518} // end of namespace Acir
5519
5520template <>
5521template <typename Serializer>
5525
5526template <>
5527template <typename Deserializer>
5533
5534namespace Acir {
5535
5537{
5538 return true;
5539}
5540
5541inline std::vector<uint8_t> BinaryFieldOp::IntegerDiv::bincodeSerialize() const
5542{
5543 auto serializer = serde::BincodeSerializer();
5545 return std::move(serializer).bytes();
5546}
5547
5549{
5550 auto deserializer = serde::BincodeDeserializer(input);
5552 if (deserializer.get_buffer_offset() < input.size()) {
5553 throw_or_abort("Some input bytes were not read");
5554 }
5555 return value;
5556}
5557
5558} // end of namespace Acir
5559
5560template <>
5561template <typename Serializer>
5565
5566template <>
5567template <typename Deserializer>
5574
5575namespace Acir {
5576
5577inline bool operator==(const BinaryFieldOp::Equals& lhs, const BinaryFieldOp::Equals& rhs)
5578{
5579 return true;
5580}
5581
5582inline std::vector<uint8_t> BinaryFieldOp::Equals::bincodeSerialize() const
5583{
5584 auto serializer = serde::BincodeSerializer();
5586 return std::move(serializer).bytes();
5587}
5588
5590{
5591 auto deserializer = serde::BincodeDeserializer(input);
5593 if (deserializer.get_buffer_offset() < input.size()) {
5594 throw_or_abort("Some input bytes were not read");
5595 }
5596 return value;
5597}
5598
5599} // end of namespace Acir
5600
5601template <>
5602template <typename Serializer>
5606
5607template <>
5608template <typename Deserializer>
5614
5615namespace Acir {
5616
5618{
5619 return true;
5620}
5621
5622inline std::vector<uint8_t> BinaryFieldOp::LessThan::bincodeSerialize() const
5623{
5624 auto serializer = serde::BincodeSerializer();
5626 return std::move(serializer).bytes();
5627}
5628
5630{
5631 auto deserializer = serde::BincodeDeserializer(input);
5633 if (deserializer.get_buffer_offset() < input.size()) {
5634 throw_or_abort("Some input bytes were not read");
5635 }
5636 return value;
5637}
5638
5639} // end of namespace Acir
5640
5641template <>
5642template <typename Serializer>
5646
5647template <>
5648template <typename Deserializer>
5655
5656namespace Acir {
5657
5659{
5660 return true;
5661}
5662
5663inline std::vector<uint8_t> BinaryFieldOp::LessThanEquals::bincodeSerialize() const
5664{
5665 auto serializer = serde::BincodeSerializer();
5667 return std::move(serializer).bytes();
5668}
5669
5671{
5672 auto deserializer = serde::BincodeDeserializer(input);
5674 if (deserializer.get_buffer_offset() < input.size()) {
5675 throw_or_abort("Some input bytes were not read");
5676 }
5677 return value;
5678}
5679
5680} // end of namespace Acir
5681
5682template <>
5683template <typename Serializer>
5687
5688template <>
5689template <typename Deserializer>
5696
5697namespace Acir {
5698
5699inline bool operator==(const BinaryIntOp& lhs, const BinaryIntOp& rhs)
5700{
5701 if (!(lhs.value == rhs.value)) {
5702 return false;
5703 }
5704 return true;
5705}
5706
5707inline std::vector<uint8_t> BinaryIntOp::bincodeSerialize() const
5708{
5709 auto serializer = serde::BincodeSerializer();
5711 return std::move(serializer).bytes();
5712}
5713
5714inline BinaryIntOp BinaryIntOp::bincodeDeserialize(std::vector<uint8_t> input)
5715{
5716 auto deserializer = serde::BincodeDeserializer(input);
5718 if (deserializer.get_buffer_offset() < input.size()) {
5719 throw_or_abort("Some input bytes were not read");
5720 }
5721 return value;
5722}
5723
5724} // end of namespace Acir
5725
5726template <>
5727template <typename Serializer>
5729{
5730 serializer.increase_container_depth();
5731 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
5732 serializer.decrease_container_depth();
5733}
5734
5735template <>
5736template <typename Deserializer>
5738{
5739 deserializer.increase_container_depth();
5741 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
5742 deserializer.decrease_container_depth();
5743 return obj;
5744}
5745
5746namespace Acir {
5747
5748inline bool operator==(const BinaryIntOp::Add& lhs, const BinaryIntOp::Add& rhs)
5749{
5750 return true;
5751}
5752
5753inline std::vector<uint8_t> BinaryIntOp::Add::bincodeSerialize() const
5754{
5755 auto serializer = serde::BincodeSerializer();
5757 return std::move(serializer).bytes();
5758}
5759
5761{
5762 auto deserializer = serde::BincodeDeserializer(input);
5764 if (deserializer.get_buffer_offset() < input.size()) {
5765 throw_or_abort("Some input bytes were not read");
5766 }
5767 return value;
5768}
5769
5770} // end of namespace Acir
5771
5772template <>
5773template <typename Serializer>
5776
5777template <>
5778template <typename Deserializer>
5784
5785namespace Acir {
5786
5787inline bool operator==(const BinaryIntOp::Sub& lhs, const BinaryIntOp::Sub& rhs)
5788{
5789 return true;
5790}
5791
5792inline std::vector<uint8_t> BinaryIntOp::Sub::bincodeSerialize() const
5793{
5794 auto serializer = serde::BincodeSerializer();
5796 return std::move(serializer).bytes();
5797}
5798
5800{
5801 auto deserializer = serde::BincodeDeserializer(input);
5803 if (deserializer.get_buffer_offset() < input.size()) {
5804 throw_or_abort("Some input bytes were not read");
5805 }
5806 return value;
5807}
5808
5809} // end of namespace Acir
5810
5811template <>
5812template <typename Serializer>
5815
5816template <>
5817template <typename Deserializer>
5823
5824namespace Acir {
5825
5826inline bool operator==(const BinaryIntOp::Mul& lhs, const BinaryIntOp::Mul& rhs)
5827{
5828 return true;
5829}
5830
5831inline std::vector<uint8_t> BinaryIntOp::Mul::bincodeSerialize() const
5832{
5833 auto serializer = serde::BincodeSerializer();
5835 return std::move(serializer).bytes();
5836}
5837
5839{
5840 auto deserializer = serde::BincodeDeserializer(input);
5842 if (deserializer.get_buffer_offset() < input.size()) {
5843 throw_or_abort("Some input bytes were not read");
5844 }
5845 return value;
5846}
5847
5848} // end of namespace Acir
5849
5850template <>
5851template <typename Serializer>
5854
5855template <>
5856template <typename Deserializer>
5862
5863namespace Acir {
5864
5865inline bool operator==(const BinaryIntOp::Div& lhs, const BinaryIntOp::Div& rhs)
5866{
5867 return true;
5868}
5869
5870inline std::vector<uint8_t> BinaryIntOp::Div::bincodeSerialize() const
5871{
5872 auto serializer = serde::BincodeSerializer();
5874 return std::move(serializer).bytes();
5875}
5876
5878{
5879 auto deserializer = serde::BincodeDeserializer(input);
5881 if (deserializer.get_buffer_offset() < input.size()) {
5882 throw_or_abort("Some input bytes were not read");
5883 }
5884 return value;
5885}
5886
5887} // end of namespace Acir
5888
5889template <>
5890template <typename Serializer>
5893
5894template <>
5895template <typename Deserializer>
5901
5902namespace Acir {
5903
5904inline bool operator==(const BinaryIntOp::Equals& lhs, const BinaryIntOp::Equals& rhs)
5905{
5906 return true;
5907}
5908
5909inline std::vector<uint8_t> BinaryIntOp::Equals::bincodeSerialize() const
5910{
5911 auto serializer = serde::BincodeSerializer();
5913 return std::move(serializer).bytes();
5914}
5915
5917{
5918 auto deserializer = serde::BincodeDeserializer(input);
5920 if (deserializer.get_buffer_offset() < input.size()) {
5921 throw_or_abort("Some input bytes were not read");
5922 }
5923 return value;
5924}
5925
5926} // end of namespace Acir
5927
5928template <>
5929template <typename Serializer>
5933
5934template <>
5935template <typename Deserializer>
5941
5942namespace Acir {
5943
5944inline bool operator==(const BinaryIntOp::LessThan& lhs, const BinaryIntOp::LessThan& rhs)
5945{
5946 return true;
5947}
5948
5949inline std::vector<uint8_t> BinaryIntOp::LessThan::bincodeSerialize() const
5950{
5951 auto serializer = serde::BincodeSerializer();
5953 return std::move(serializer).bytes();
5954}
5955
5957{
5958 auto deserializer = serde::BincodeDeserializer(input);
5960 if (deserializer.get_buffer_offset() < input.size()) {
5961 throw_or_abort("Some input bytes were not read");
5962 }
5963 return value;
5964}
5965
5966} // end of namespace Acir
5967
5968template <>
5969template <typename Serializer>
5973
5974template <>
5975template <typename Deserializer>
5981
5982namespace Acir {
5983
5985{
5986 return true;
5987}
5988
5989inline std::vector<uint8_t> BinaryIntOp::LessThanEquals::bincodeSerialize() const
5990{
5991 auto serializer = serde::BincodeSerializer();
5993 return std::move(serializer).bytes();
5994}
5995
5997{
5998 auto deserializer = serde::BincodeDeserializer(input);
6000 if (deserializer.get_buffer_offset() < input.size()) {
6001 throw_or_abort("Some input bytes were not read");
6002 }
6003 return value;
6004}
6005
6006} // end of namespace Acir
6007
6008template <>
6009template <typename Serializer>
6013
6014template <>
6015template <typename Deserializer>
6022
6023namespace Acir {
6024
6025inline bool operator==(const BinaryIntOp::And& lhs, const BinaryIntOp::And& rhs)
6026{
6027 return true;
6028}
6029
6030inline std::vector<uint8_t> BinaryIntOp::And::bincodeSerialize() const
6031{
6032 auto serializer = serde::BincodeSerializer();
6034 return std::move(serializer).bytes();
6035}
6036
6038{
6039 auto deserializer = serde::BincodeDeserializer(input);
6041 if (deserializer.get_buffer_offset() < input.size()) {
6042 throw_or_abort("Some input bytes were not read");
6043 }
6044 return value;
6045}
6046
6047} // end of namespace Acir
6048
6049template <>
6050template <typename Serializer>
6053
6054template <>
6055template <typename Deserializer>
6061
6062namespace Acir {
6063
6064inline bool operator==(const BinaryIntOp::Or& lhs, const BinaryIntOp::Or& rhs)
6065{
6066 return true;
6067}
6068
6069inline std::vector<uint8_t> BinaryIntOp::Or::bincodeSerialize() const
6070{
6071 auto serializer = serde::BincodeSerializer();
6073 return std::move(serializer).bytes();
6074}
6075
6077{
6078 auto deserializer = serde::BincodeDeserializer(input);
6080 if (deserializer.get_buffer_offset() < input.size()) {
6081 throw_or_abort("Some input bytes were not read");
6082 }
6083 return value;
6084}
6085
6086} // end of namespace Acir
6087
6088template <>
6089template <typename Serializer>
6092
6093template <>
6094template <typename Deserializer>
6096{
6098 return obj;
6099}
6100
6101namespace Acir {
6102
6103inline bool operator==(const BinaryIntOp::Xor& lhs, const BinaryIntOp::Xor& rhs)
6104{
6105 return true;
6106}
6107
6108inline std::vector<uint8_t> BinaryIntOp::Xor::bincodeSerialize() const
6109{
6110 auto serializer = serde::BincodeSerializer();
6112 return std::move(serializer).bytes();
6113}
6114
6116{
6117 auto deserializer = serde::BincodeDeserializer(input);
6119 if (deserializer.get_buffer_offset() < input.size()) {
6120 throw_or_abort("Some input bytes were not read");
6121 }
6122 return value;
6123}
6124
6125} // end of namespace Acir
6126
6127template <>
6128template <typename Serializer>
6131
6132template <>
6133template <typename Deserializer>
6139
6140namespace Acir {
6141
6142inline bool operator==(const BinaryIntOp::Shl& lhs, const BinaryIntOp::Shl& rhs)
6143{
6144 return true;
6145}
6146
6147inline std::vector<uint8_t> BinaryIntOp::Shl::bincodeSerialize() const
6148{
6149 auto serializer = serde::BincodeSerializer();
6151 return std::move(serializer).bytes();
6152}
6153
6155{
6156 auto deserializer = serde::BincodeDeserializer(input);
6158 if (deserializer.get_buffer_offset() < input.size()) {
6159 throw_or_abort("Some input bytes were not read");
6160 }
6161 return value;
6162}
6163
6164} // end of namespace Acir
6165
6166template <>
6167template <typename Serializer>
6170
6171template <>
6172template <typename Deserializer>
6178
6179namespace Acir {
6180
6181inline bool operator==(const BinaryIntOp::Shr& lhs, const BinaryIntOp::Shr& rhs)
6182{
6183 return true;
6184}
6185
6186inline std::vector<uint8_t> BinaryIntOp::Shr::bincodeSerialize() const
6187{
6188 auto serializer = serde::BincodeSerializer();
6190 return std::move(serializer).bytes();
6191}
6192
6194{
6195 auto deserializer = serde::BincodeDeserializer(input);
6197 if (deserializer.get_buffer_offset() < input.size()) {
6198 throw_or_abort("Some input bytes were not read");
6199 }
6200 return value;
6201}
6202
6203} // end of namespace Acir
6204
6205template <>
6206template <typename Serializer>
6209
6210template <>
6211template <typename Deserializer>
6217
6218namespace Acir {
6219
6220inline bool operator==(const BitSize& lhs, const BitSize& rhs)
6221{
6222 if (!(lhs.value == rhs.value)) {
6223 return false;
6224 }
6225 return true;
6226}
6227
6228inline std::vector<uint8_t> BitSize::bincodeSerialize() const
6229{
6230 auto serializer = serde::BincodeSerializer();
6231 serde::Serializable<BitSize>::serialize(*this, serializer);
6232 return std::move(serializer).bytes();
6233}
6234
6235inline BitSize BitSize::bincodeDeserialize(std::vector<uint8_t> input)
6236{
6237 auto deserializer = serde::BincodeDeserializer(input);
6239 if (deserializer.get_buffer_offset() < input.size()) {
6240 throw_or_abort("Some input bytes were not read");
6241 }
6242 return value;
6243}
6244
6245} // end of namespace Acir
6246
6247template <>
6248template <typename Serializer>
6249void serde::Serializable<Acir::BitSize>::serialize(const Acir::BitSize& obj, Serializer& serializer)
6250{
6251 serializer.increase_container_depth();
6252 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6253 serializer.decrease_container_depth();
6254}
6255
6256template <>
6257template <typename Deserializer>
6259{
6260 deserializer.increase_container_depth();
6261 Acir::BitSize obj;
6262 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6263 deserializer.decrease_container_depth();
6264 return obj;
6265}
6266
6267namespace Acir {
6268
6269inline bool operator==(const BitSize::Field& lhs, const BitSize::Field& rhs)
6270{
6271 return true;
6272}
6273
6274inline std::vector<uint8_t> BitSize::Field::bincodeSerialize() const
6275{
6276 auto serializer = serde::BincodeSerializer();
6278 return std::move(serializer).bytes();
6279}
6280
6281inline BitSize::Field BitSize::Field::bincodeDeserialize(std::vector<uint8_t> input)
6282{
6283 auto deserializer = serde::BincodeDeserializer(input);
6285 if (deserializer.get_buffer_offset() < input.size()) {
6286 throw_or_abort("Some input bytes were not read");
6287 }
6288 return value;
6289}
6290
6291} // end of namespace Acir
6292
6293template <>
6294template <typename Serializer>
6297
6298template <>
6299template <typename Deserializer>
6301{
6303 return obj;
6304}
6305
6306namespace Acir {
6307
6308inline bool operator==(const BitSize::Integer& lhs, const BitSize::Integer& rhs)
6309{
6310 if (!(lhs.value == rhs.value)) {
6311 return false;
6312 }
6313 return true;
6314}
6315
6316inline std::vector<uint8_t> BitSize::Integer::bincodeSerialize() const
6317{
6318 auto serializer = serde::BincodeSerializer();
6320 return std::move(serializer).bytes();
6321}
6322
6324{
6325 auto deserializer = serde::BincodeDeserializer(input);
6327 if (deserializer.get_buffer_offset() < input.size()) {
6328 throw_or_abort("Some input bytes were not read");
6329 }
6330 return value;
6331}
6332
6333} // end of namespace Acir
6334
6335template <>
6336template <typename Serializer>
6338{
6339 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6340}
6341
6342template <>
6343template <typename Deserializer>
6345{
6347 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6348 return obj;
6349}
6350
6351namespace Acir {
6352
6353inline bool operator==(const BlackBoxFuncCall& lhs, const BlackBoxFuncCall& rhs)
6354{
6355 if (!(lhs.value == rhs.value)) {
6356 return false;
6357 }
6358 return true;
6359}
6360
6361inline std::vector<uint8_t> BlackBoxFuncCall::bincodeSerialize() const
6362{
6363 auto serializer = serde::BincodeSerializer();
6365 return std::move(serializer).bytes();
6366}
6367
6369{
6370 auto deserializer = serde::BincodeDeserializer(input);
6372 if (deserializer.get_buffer_offset() < input.size()) {
6373 throw_or_abort("Some input bytes were not read");
6374 }
6375 return value;
6376}
6377
6378} // end of namespace Acir
6379
6380template <>
6381template <typename Serializer>
6383{
6384 serializer.increase_container_depth();
6385 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
6386 serializer.decrease_container_depth();
6387}
6388
6389template <>
6390template <typename Deserializer>
6392{
6393 deserializer.increase_container_depth();
6395 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
6396 deserializer.decrease_container_depth();
6397 return obj;
6398}
6399
6400namespace Acir {
6401
6403{
6404 if (!(lhs.inputs == rhs.inputs)) {
6405 return false;
6406 }
6407 if (!(lhs.iv == rhs.iv)) {
6408 return false;
6409 }
6410 if (!(lhs.key == rhs.key)) {
6411 return false;
6412 }
6413 if (!(lhs.outputs == rhs.outputs)) {
6414 return false;
6415 }
6416 return true;
6417}
6418
6419inline std::vector<uint8_t> BlackBoxFuncCall::AES128Encrypt::bincodeSerialize() const
6420{
6421 auto serializer = serde::BincodeSerializer();
6423 return std::move(serializer).bytes();
6424}
6425
6427{
6428 auto deserializer = serde::BincodeDeserializer(input);
6430 if (deserializer.get_buffer_offset() < input.size()) {
6431 throw_or_abort("Some input bytes were not read");
6432 }
6433 return value;
6434}
6435
6436} // end of namespace Acir
6437
6438template <>
6439template <typename Serializer>
6441 const Acir::BlackBoxFuncCall::AES128Encrypt& obj, Serializer& serializer)
6442{
6443 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6444 serde::Serializable<decltype(obj.iv)>::serialize(obj.iv, serializer);
6445 serde::Serializable<decltype(obj.key)>::serialize(obj.key, serializer);
6446 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6447}
6448
6449template <>
6450template <typename Deserializer>
6452 Deserializer& deserializer)
6453{
6455 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6456 obj.iv = serde::Deserializable<decltype(obj.iv)>::deserialize(deserializer);
6457 obj.key = serde::Deserializable<decltype(obj.key)>::deserialize(deserializer);
6458 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6459 return obj;
6460}
6461
6462namespace Acir {
6463
6464inline bool operator==(const BlackBoxFuncCall::AND& lhs, const BlackBoxFuncCall::AND& rhs)
6465{
6466 if (!(lhs.lhs == rhs.lhs)) {
6467 return false;
6468 }
6469 if (!(lhs.rhs == rhs.rhs)) {
6470 return false;
6471 }
6472 if (!(lhs.num_bits == rhs.num_bits)) {
6473 return false;
6474 }
6475 if (!(lhs.output == rhs.output)) {
6476 return false;
6477 }
6478 return true;
6479}
6480
6481inline std::vector<uint8_t> BlackBoxFuncCall::AND::bincodeSerialize() const
6482{
6483 auto serializer = serde::BincodeSerializer();
6485 return std::move(serializer).bytes();
6486}
6487
6489{
6490 auto deserializer = serde::BincodeDeserializer(input);
6492 if (deserializer.get_buffer_offset() < input.size()) {
6493 throw_or_abort("Some input bytes were not read");
6494 }
6495 return value;
6496}
6497
6498} // end of namespace Acir
6499
6500template <>
6501template <typename Serializer>
6503 Serializer& serializer)
6504{
6505 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
6506 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
6507 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6508 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6509}
6510
6511template <>
6512template <typename Deserializer>
6514{
6516 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
6517 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
6518 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6519 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6520 return obj;
6521}
6522
6523namespace Acir {
6524
6525inline bool operator==(const BlackBoxFuncCall::XOR& lhs, const BlackBoxFuncCall::XOR& rhs)
6526{
6527 if (!(lhs.lhs == rhs.lhs)) {
6528 return false;
6529 }
6530 if (!(lhs.rhs == rhs.rhs)) {
6531 return false;
6532 }
6533 if (!(lhs.num_bits == rhs.num_bits)) {
6534 return false;
6535 }
6536 if (!(lhs.output == rhs.output)) {
6537 return false;
6538 }
6539 return true;
6540}
6541
6542inline std::vector<uint8_t> BlackBoxFuncCall::XOR::bincodeSerialize() const
6543{
6544 auto serializer = serde::BincodeSerializer();
6546 return std::move(serializer).bytes();
6547}
6548
6550{
6551 auto deserializer = serde::BincodeDeserializer(input);
6553 if (deserializer.get_buffer_offset() < input.size()) {
6554 throw_or_abort("Some input bytes were not read");
6555 }
6556 return value;
6557}
6558
6559} // end of namespace Acir
6560
6561template <>
6562template <typename Serializer>
6564 Serializer& serializer)
6565{
6566 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
6567 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
6568 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6569 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6570}
6571
6572template <>
6573template <typename Deserializer>
6575{
6577 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
6578 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
6579 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6580 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6581 return obj;
6582}
6583
6584namespace Acir {
6585
6587{
6588 if (!(lhs.input == rhs.input)) {
6589 return false;
6590 }
6591 if (!(lhs.num_bits == rhs.num_bits)) {
6592 return false;
6593 }
6594 return true;
6595}
6596
6597inline std::vector<uint8_t> BlackBoxFuncCall::RANGE::bincodeSerialize() const
6598{
6599 auto serializer = serde::BincodeSerializer();
6601 return std::move(serializer).bytes();
6602}
6603
6605{
6606 auto deserializer = serde::BincodeDeserializer(input);
6608 if (deserializer.get_buffer_offset() < input.size()) {
6609 throw_or_abort("Some input bytes were not read");
6610 }
6611 return value;
6612}
6613
6614} // end of namespace Acir
6615
6616template <>
6617template <typename Serializer>
6619 Serializer& serializer)
6620{
6621 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
6622 serde::Serializable<decltype(obj.num_bits)>::serialize(obj.num_bits, serializer);
6623}
6624
6625template <>
6626template <typename Deserializer>
6628 Deserializer& deserializer)
6629{
6631 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
6632 obj.num_bits = serde::Deserializable<decltype(obj.num_bits)>::deserialize(deserializer);
6633 return obj;
6634}
6635
6636namespace Acir {
6637
6639{
6640 if (!(lhs.inputs == rhs.inputs)) {
6641 return false;
6642 }
6643 if (!(lhs.outputs == rhs.outputs)) {
6644 return false;
6645 }
6646 return true;
6647}
6648
6649inline std::vector<uint8_t> BlackBoxFuncCall::Blake2s::bincodeSerialize() const
6650{
6651 auto serializer = serde::BincodeSerializer();
6653 return std::move(serializer).bytes();
6654}
6655
6657{
6658 auto deserializer = serde::BincodeDeserializer(input);
6660 if (deserializer.get_buffer_offset() < input.size()) {
6661 throw_or_abort("Some input bytes were not read");
6662 }
6663 return value;
6664}
6665
6666} // end of namespace Acir
6667
6668template <>
6669template <typename Serializer>
6671 Serializer& serializer)
6672{
6673 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6674 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6675}
6676
6677template <>
6678template <typename Deserializer>
6680 Deserializer& deserializer)
6681{
6683 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6684 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6685 return obj;
6686}
6687
6688namespace Acir {
6689
6691{
6692 if (!(lhs.inputs == rhs.inputs)) {
6693 return false;
6694 }
6695 if (!(lhs.outputs == rhs.outputs)) {
6696 return false;
6697 }
6698 return true;
6699}
6700
6701inline std::vector<uint8_t> BlackBoxFuncCall::Blake3::bincodeSerialize() const
6702{
6703 auto serializer = serde::BincodeSerializer();
6705 return std::move(serializer).bytes();
6706}
6707
6709{
6710 auto deserializer = serde::BincodeDeserializer(input);
6712 if (deserializer.get_buffer_offset() < input.size()) {
6713 throw_or_abort("Some input bytes were not read");
6714 }
6715 return value;
6716}
6717
6718} // end of namespace Acir
6719
6720template <>
6721template <typename Serializer>
6723 Serializer& serializer)
6724{
6725 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
6726 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6727}
6728
6729template <>
6730template <typename Deserializer>
6732 Deserializer& deserializer)
6733{
6735 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
6736 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6737 return obj;
6738}
6739
6740namespace Acir {
6741
6743{
6744 if (!(lhs.public_key_x == rhs.public_key_x)) {
6745 return false;
6746 }
6747 if (!(lhs.public_key_y == rhs.public_key_y)) {
6748 return false;
6749 }
6750 if (!(lhs.signature == rhs.signature)) {
6751 return false;
6752 }
6753 if (!(lhs.hashed_message == rhs.hashed_message)) {
6754 return false;
6755 }
6756 if (!(lhs.predicate == rhs.predicate)) {
6757 return false;
6758 }
6759 if (!(lhs.output == rhs.output)) {
6760 return false;
6761 }
6762 return true;
6763}
6764
6766{
6767 auto serializer = serde::BincodeSerializer();
6769 return std::move(serializer).bytes();
6770}
6771
6773{
6774 auto deserializer = serde::BincodeDeserializer(input);
6776 if (deserializer.get_buffer_offset() < input.size()) {
6777 throw_or_abort("Some input bytes were not read");
6778 }
6779 return value;
6780}
6781
6782} // end of namespace Acir
6783
6784template <>
6785template <typename Serializer>
6787 const Acir::BlackBoxFuncCall::EcdsaSecp256k1& obj, Serializer& serializer)
6788{
6789 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
6790 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
6791 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
6792 serde::Serializable<decltype(obj.hashed_message)>::serialize(obj.hashed_message, serializer);
6793 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6794 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6795}
6796
6797template <>
6798template <typename Deserializer>
6800 Deserializer& deserializer)
6801{
6803 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
6804 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
6805 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
6806 obj.hashed_message = serde::Deserializable<decltype(obj.hashed_message)>::deserialize(deserializer);
6807 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6808 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6809 return obj;
6810}
6811
6812namespace Acir {
6813
6815{
6816 if (!(lhs.public_key_x == rhs.public_key_x)) {
6817 return false;
6818 }
6819 if (!(lhs.public_key_y == rhs.public_key_y)) {
6820 return false;
6821 }
6822 if (!(lhs.signature == rhs.signature)) {
6823 return false;
6824 }
6825 if (!(lhs.hashed_message == rhs.hashed_message)) {
6826 return false;
6827 }
6828 if (!(lhs.predicate == rhs.predicate)) {
6829 return false;
6830 }
6831 if (!(lhs.output == rhs.output)) {
6832 return false;
6833 }
6834 return true;
6835}
6836
6838{
6839 auto serializer = serde::BincodeSerializer();
6841 return std::move(serializer).bytes();
6842}
6843
6845{
6846 auto deserializer = serde::BincodeDeserializer(input);
6848 if (deserializer.get_buffer_offset() < input.size()) {
6849 throw_or_abort("Some input bytes were not read");
6850 }
6851 return value;
6852}
6853
6854} // end of namespace Acir
6855
6856template <>
6857template <typename Serializer>
6859 const Acir::BlackBoxFuncCall::EcdsaSecp256r1& obj, Serializer& serializer)
6860{
6861 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
6862 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
6863 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
6864 serde::Serializable<decltype(obj.hashed_message)>::serialize(obj.hashed_message, serializer);
6865 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6866 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
6867}
6868
6869template <>
6870template <typename Deserializer>
6872 Deserializer& deserializer)
6873{
6875 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
6876 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
6877 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
6878 obj.hashed_message = serde::Deserializable<decltype(obj.hashed_message)>::deserialize(deserializer);
6879 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6880 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
6881 return obj;
6882}
6883
6884namespace Acir {
6885
6887{
6888 if (!(lhs.points == rhs.points)) {
6889 return false;
6890 }
6891 if (!(lhs.scalars == rhs.scalars)) {
6892 return false;
6893 }
6894 if (!(lhs.predicate == rhs.predicate)) {
6895 return false;
6896 }
6897 if (!(lhs.outputs == rhs.outputs)) {
6898 return false;
6899 }
6900 return true;
6901}
6902
6904{
6905 auto serializer = serde::BincodeSerializer();
6907 return std::move(serializer).bytes();
6908}
6909
6911{
6912 auto deserializer = serde::BincodeDeserializer(input);
6914 if (deserializer.get_buffer_offset() < input.size()) {
6915 throw_or_abort("Some input bytes were not read");
6916 }
6917 return value;
6918}
6919
6920} // end of namespace Acir
6921
6922template <>
6923template <typename Serializer>
6925 const Acir::BlackBoxFuncCall::MultiScalarMul& obj, Serializer& serializer)
6926{
6927 serde::Serializable<decltype(obj.points)>::serialize(obj.points, serializer);
6928 serde::Serializable<decltype(obj.scalars)>::serialize(obj.scalars, serializer);
6929 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6930 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6931}
6932
6933template <>
6934template <typename Deserializer>
6936 Deserializer& deserializer)
6937{
6939 obj.points = serde::Deserializable<decltype(obj.points)>::deserialize(deserializer);
6940 obj.scalars = serde::Deserializable<decltype(obj.scalars)>::deserialize(deserializer);
6941 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
6942 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
6943 return obj;
6944}
6945
6946namespace Acir {
6947
6949{
6950 if (!(lhs.input1 == rhs.input1)) {
6951 return false;
6952 }
6953 if (!(lhs.input2 == rhs.input2)) {
6954 return false;
6955 }
6956 if (!(lhs.predicate == rhs.predicate)) {
6957 return false;
6958 }
6959 if (!(lhs.outputs == rhs.outputs)) {
6960 return false;
6961 }
6962 return true;
6963}
6964
6966{
6967 auto serializer = serde::BincodeSerializer();
6969 return std::move(serializer).bytes();
6970}
6971
6973 std::vector<uint8_t> input)
6974{
6975 auto deserializer = serde::BincodeDeserializer(input);
6977 if (deserializer.get_buffer_offset() < input.size()) {
6978 throw_or_abort("Some input bytes were not read");
6979 }
6980 return value;
6981}
6982
6983} // end of namespace Acir
6984
6985template <>
6986template <typename Serializer>
6988 const Acir::BlackBoxFuncCall::EmbeddedCurveAdd& obj, Serializer& serializer)
6989{
6990 serde::Serializable<decltype(obj.input1)>::serialize(obj.input1, serializer);
6991 serde::Serializable<decltype(obj.input2)>::serialize(obj.input2, serializer);
6992 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
6993 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
6994}
6995
6996template <>
6997template <typename Deserializer>
6999 Deserializer& deserializer)
7000{
7002 obj.input1 = serde::Deserializable<decltype(obj.input1)>::deserialize(deserializer);
7003 obj.input2 = serde::Deserializable<decltype(obj.input2)>::deserialize(deserializer);
7004 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
7005 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7006 return obj;
7007}
7008
7009namespace Acir {
7010
7012{
7013 if (!(lhs.inputs == rhs.inputs)) {
7014 return false;
7015 }
7016 if (!(lhs.outputs == rhs.outputs)) {
7017 return false;
7018 }
7019 return true;
7020}
7021
7022inline std::vector<uint8_t> BlackBoxFuncCall::Keccakf1600::bincodeSerialize() const
7023{
7024 auto serializer = serde::BincodeSerializer();
7026 return std::move(serializer).bytes();
7027}
7028
7030{
7031 auto deserializer = serde::BincodeDeserializer(input);
7033 if (deserializer.get_buffer_offset() < input.size()) {
7034 throw_or_abort("Some input bytes were not read");
7035 }
7036 return value;
7037}
7038
7039} // end of namespace Acir
7040
7041template <>
7042template <typename Serializer>
7044 Serializer& serializer)
7045{
7046 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7047 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7048}
7049
7050template <>
7051template <typename Deserializer>
7053 Deserializer& deserializer)
7054{
7056 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7057 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7058 return obj;
7059}
7060
7061namespace Acir {
7062
7065{
7066 if (!(lhs.verification_key == rhs.verification_key)) {
7067 return false;
7068 }
7069 if (!(lhs.proof == rhs.proof)) {
7070 return false;
7071 }
7072 if (!(lhs.public_inputs == rhs.public_inputs)) {
7073 return false;
7074 }
7075 if (!(lhs.key_hash == rhs.key_hash)) {
7076 return false;
7077 }
7078 if (!(lhs.proof_type == rhs.proof_type)) {
7079 return false;
7080 }
7081 if (!(lhs.predicate == rhs.predicate)) {
7082 return false;
7083 }
7084 return true;
7085}
7086
7088{
7089 auto serializer = serde::BincodeSerializer();
7091 return std::move(serializer).bytes();
7092}
7093
7095 std::vector<uint8_t> input)
7096{
7097 auto deserializer = serde::BincodeDeserializer(input);
7099 if (deserializer.get_buffer_offset() < input.size()) {
7100 throw_or_abort("Some input bytes were not read");
7101 }
7102 return value;
7103}
7104
7105} // end of namespace Acir
7106
7107template <>
7108template <typename Serializer>
7110 const Acir::BlackBoxFuncCall::RecursiveAggregation& obj, Serializer& serializer)
7111{
7112 serde::Serializable<decltype(obj.verification_key)>::serialize(obj.verification_key, serializer);
7113 serde::Serializable<decltype(obj.proof)>::serialize(obj.proof, serializer);
7114 serde::Serializable<decltype(obj.public_inputs)>::serialize(obj.public_inputs, serializer);
7115 serde::Serializable<decltype(obj.key_hash)>::serialize(obj.key_hash, serializer);
7116 serde::Serializable<decltype(obj.proof_type)>::serialize(obj.proof_type, serializer);
7117 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
7118}
7119
7120template <>
7121template <typename Deserializer>
7123 Acir::BlackBoxFuncCall::RecursiveAggregation>::deserialize(Deserializer& deserializer)
7124{
7126 obj.verification_key = serde::Deserializable<decltype(obj.verification_key)>::deserialize(deserializer);
7127 obj.proof = serde::Deserializable<decltype(obj.proof)>::deserialize(deserializer);
7128 obj.public_inputs = serde::Deserializable<decltype(obj.public_inputs)>::deserialize(deserializer);
7129 obj.key_hash = serde::Deserializable<decltype(obj.key_hash)>::deserialize(deserializer);
7130 obj.proof_type = serde::Deserializable<decltype(obj.proof_type)>::deserialize(deserializer);
7131 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
7132 return obj;
7133}
7134
7135namespace Acir {
7136
7139{
7140 if (!(lhs.inputs == rhs.inputs)) {
7141 return false;
7142 }
7143 if (!(lhs.outputs == rhs.outputs)) {
7144 return false;
7145 }
7146 return true;
7147}
7148
7150{
7151 auto serializer = serde::BincodeSerializer();
7153 return std::move(serializer).bytes();
7154}
7155
7157 std::vector<uint8_t> input)
7158{
7159 auto deserializer = serde::BincodeDeserializer(input);
7161 if (deserializer.get_buffer_offset() < input.size()) {
7162 throw_or_abort("Some input bytes were not read");
7163 }
7164 return value;
7165}
7166
7167} // end of namespace Acir
7168
7169template <>
7170template <typename Serializer>
7172 const Acir::BlackBoxFuncCall::Poseidon2Permutation& obj, Serializer& serializer)
7173{
7174 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7175 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7176}
7177
7178template <>
7179template <typename Deserializer>
7181 Acir::BlackBoxFuncCall::Poseidon2Permutation>::deserialize(Deserializer& deserializer)
7182{
7184 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7185 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7186 return obj;
7187}
7188
7189namespace Acir {
7190
7192{
7193 if (!(lhs.inputs == rhs.inputs)) {
7194 return false;
7195 }
7196 if (!(lhs.hash_values == rhs.hash_values)) {
7197 return false;
7198 }
7199 if (!(lhs.outputs == rhs.outputs)) {
7200 return false;
7201 }
7202 return true;
7203}
7204
7206{
7207 auto serializer = serde::BincodeSerializer();
7209 return std::move(serializer).bytes();
7210}
7211
7213 std::vector<uint8_t> input)
7214{
7215 auto deserializer = serde::BincodeDeserializer(input);
7217 if (deserializer.get_buffer_offset() < input.size()) {
7218 throw_or_abort("Some input bytes were not read");
7219 }
7220 return value;
7221}
7222
7223} // end of namespace Acir
7224
7225template <>
7226template <typename Serializer>
7228 const Acir::BlackBoxFuncCall::Sha256Compression& obj, Serializer& serializer)
7229{
7230 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7231 serde::Serializable<decltype(obj.hash_values)>::serialize(obj.hash_values, serializer);
7232 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7233}
7234
7235template <>
7236template <typename Deserializer>
7238 Deserializer& deserializer)
7239{
7241 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7242 obj.hash_values = serde::Deserializable<decltype(obj.hash_values)>::deserialize(deserializer);
7243 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7244 return obj;
7245}
7246
7247namespace Acir {
7248
7249inline bool operator==(const BlackBoxOp& lhs, const BlackBoxOp& rhs)
7250{
7251 if (!(lhs.value == rhs.value)) {
7252 return false;
7253 }
7254 return true;
7255}
7256
7257inline std::vector<uint8_t> BlackBoxOp::bincodeSerialize() const
7258{
7259 auto serializer = serde::BincodeSerializer();
7261 return std::move(serializer).bytes();
7262}
7263
7264inline BlackBoxOp BlackBoxOp::bincodeDeserialize(std::vector<uint8_t> input)
7265{
7266 auto deserializer = serde::BincodeDeserializer(input);
7268 if (deserializer.get_buffer_offset() < input.size()) {
7269 throw_or_abort("Some input bytes were not read");
7270 }
7271 return value;
7272}
7273
7274} // end of namespace Acir
7275
7276template <>
7277template <typename Serializer>
7279{
7280 serializer.increase_container_depth();
7281 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
7282 serializer.decrease_container_depth();
7283}
7284
7285template <>
7286template <typename Deserializer>
7288{
7289 deserializer.increase_container_depth();
7290 Acir::BlackBoxOp obj;
7291 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
7292 deserializer.decrease_container_depth();
7293 return obj;
7294}
7295
7296namespace Acir {
7297
7299{
7300 if (!(lhs.inputs == rhs.inputs)) {
7301 return false;
7302 }
7303 if (!(lhs.iv == rhs.iv)) {
7304 return false;
7305 }
7306 if (!(lhs.key == rhs.key)) {
7307 return false;
7308 }
7309 if (!(lhs.outputs == rhs.outputs)) {
7310 return false;
7311 }
7312 return true;
7313}
7314
7315inline std::vector<uint8_t> BlackBoxOp::AES128Encrypt::bincodeSerialize() const
7316{
7317 auto serializer = serde::BincodeSerializer();
7319 return std::move(serializer).bytes();
7320}
7321
7323{
7324 auto deserializer = serde::BincodeDeserializer(input);
7326 if (deserializer.get_buffer_offset() < input.size()) {
7327 throw_or_abort("Some input bytes were not read");
7328 }
7329 return value;
7330}
7331
7332} // end of namespace Acir
7333
7334template <>
7335template <typename Serializer>
7337 Serializer& serializer)
7338{
7339 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
7340 serde::Serializable<decltype(obj.iv)>::serialize(obj.iv, serializer);
7341 serde::Serializable<decltype(obj.key)>::serialize(obj.key, serializer);
7342 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7343}
7344
7345template <>
7346template <typename Deserializer>
7348 Deserializer& deserializer)
7349{
7351 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
7352 obj.iv = serde::Deserializable<decltype(obj.iv)>::deserialize(deserializer);
7353 obj.key = serde::Deserializable<decltype(obj.key)>::deserialize(deserializer);
7354 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7355 return obj;
7356}
7357
7358namespace Acir {
7359
7360inline bool operator==(const BlackBoxOp::Blake2s& lhs, const BlackBoxOp::Blake2s& rhs)
7361{
7362 if (!(lhs.message == rhs.message)) {
7363 return false;
7364 }
7365 if (!(lhs.output == rhs.output)) {
7366 return false;
7367 }
7368 return true;
7369}
7370
7371inline std::vector<uint8_t> BlackBoxOp::Blake2s::bincodeSerialize() const
7372{
7373 auto serializer = serde::BincodeSerializer();
7375 return std::move(serializer).bytes();
7376}
7377
7379{
7380 auto deserializer = serde::BincodeDeserializer(input);
7382 if (deserializer.get_buffer_offset() < input.size()) {
7383 throw_or_abort("Some input bytes were not read");
7384 }
7385 return value;
7386}
7387
7388} // end of namespace Acir
7389
7390template <>
7391template <typename Serializer>
7393 Serializer& serializer)
7394{
7395 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7396 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7397}
7398
7399template <>
7400template <typename Deserializer>
7402{
7404 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7405 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7406 return obj;
7407}
7408
7409namespace Acir {
7410
7411inline bool operator==(const BlackBoxOp::Blake3& lhs, const BlackBoxOp::Blake3& rhs)
7412{
7413 if (!(lhs.message == rhs.message)) {
7414 return false;
7415 }
7416 if (!(lhs.output == rhs.output)) {
7417 return false;
7418 }
7419 return true;
7420}
7421
7422inline std::vector<uint8_t> BlackBoxOp::Blake3::bincodeSerialize() const
7423{
7424 auto serializer = serde::BincodeSerializer();
7426 return std::move(serializer).bytes();
7427}
7428
7430{
7431 auto deserializer = serde::BincodeDeserializer(input);
7433 if (deserializer.get_buffer_offset() < input.size()) {
7434 throw_or_abort("Some input bytes were not read");
7435 }
7436 return value;
7437}
7438
7439} // end of namespace Acir
7440
7441template <>
7442template <typename Serializer>
7444 Serializer& serializer)
7445{
7446 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7447 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7448}
7449
7450template <>
7451template <typename Deserializer>
7453{
7455 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7456 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7457 return obj;
7458}
7459
7460namespace Acir {
7461
7463{
7464 if (!(lhs.input == rhs.input)) {
7465 return false;
7466 }
7467 if (!(lhs.output == rhs.output)) {
7468 return false;
7469 }
7470 return true;
7471}
7472
7473inline std::vector<uint8_t> BlackBoxOp::Keccakf1600::bincodeSerialize() const
7474{
7475 auto serializer = serde::BincodeSerializer();
7477 return std::move(serializer).bytes();
7478}
7479
7481{
7482 auto deserializer = serde::BincodeDeserializer(input);
7484 if (deserializer.get_buffer_offset() < input.size()) {
7485 throw_or_abort("Some input bytes were not read");
7486 }
7487 return value;
7488}
7489
7490} // end of namespace Acir
7491
7492template <>
7493template <typename Serializer>
7495 Serializer& serializer)
7496{
7497 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7498 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7499}
7500
7501template <>
7502template <typename Deserializer>
7504 Deserializer& deserializer)
7505{
7507 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7508 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7509 return obj;
7510}
7511
7512namespace Acir {
7513
7515{
7516 if (!(lhs.hashed_msg == rhs.hashed_msg)) {
7517 return false;
7518 }
7519 if (!(lhs.public_key_x == rhs.public_key_x)) {
7520 return false;
7521 }
7522 if (!(lhs.public_key_y == rhs.public_key_y)) {
7523 return false;
7524 }
7525 if (!(lhs.signature == rhs.signature)) {
7526 return false;
7527 }
7528 if (!(lhs.result == rhs.result)) {
7529 return false;
7530 }
7531 return true;
7532}
7533
7534inline std::vector<uint8_t> BlackBoxOp::EcdsaSecp256k1::bincodeSerialize() const
7535{
7536 auto serializer = serde::BincodeSerializer();
7538 return std::move(serializer).bytes();
7539}
7540
7542{
7543 auto deserializer = serde::BincodeDeserializer(input);
7545 if (deserializer.get_buffer_offset() < input.size()) {
7546 throw_or_abort("Some input bytes were not read");
7547 }
7548 return value;
7549}
7550
7551} // end of namespace Acir
7552
7553template <>
7554template <typename Serializer>
7556 Serializer& serializer)
7557{
7558 serde::Serializable<decltype(obj.hashed_msg)>::serialize(obj.hashed_msg, serializer);
7559 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
7560 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
7561 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
7562 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7563}
7564
7565template <>
7566template <typename Deserializer>
7568 Deserializer& deserializer)
7569{
7571 obj.hashed_msg = serde::Deserializable<decltype(obj.hashed_msg)>::deserialize(deserializer);
7572 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
7573 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
7574 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
7575 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7576 return obj;
7577}
7578
7579namespace Acir {
7580
7582{
7583 if (!(lhs.hashed_msg == rhs.hashed_msg)) {
7584 return false;
7585 }
7586 if (!(lhs.public_key_x == rhs.public_key_x)) {
7587 return false;
7588 }
7589 if (!(lhs.public_key_y == rhs.public_key_y)) {
7590 return false;
7591 }
7592 if (!(lhs.signature == rhs.signature)) {
7593 return false;
7594 }
7595 if (!(lhs.result == rhs.result)) {
7596 return false;
7597 }
7598 return true;
7599}
7600
7601inline std::vector<uint8_t> BlackBoxOp::EcdsaSecp256r1::bincodeSerialize() const
7602{
7603 auto serializer = serde::BincodeSerializer();
7605 return std::move(serializer).bytes();
7606}
7607
7609{
7610 auto deserializer = serde::BincodeDeserializer(input);
7612 if (deserializer.get_buffer_offset() < input.size()) {
7613 throw_or_abort("Some input bytes were not read");
7614 }
7615 return value;
7616}
7617
7618} // end of namespace Acir
7619
7620template <>
7621template <typename Serializer>
7623 Serializer& serializer)
7624{
7625 serde::Serializable<decltype(obj.hashed_msg)>::serialize(obj.hashed_msg, serializer);
7626 serde::Serializable<decltype(obj.public_key_x)>::serialize(obj.public_key_x, serializer);
7627 serde::Serializable<decltype(obj.public_key_y)>::serialize(obj.public_key_y, serializer);
7628 serde::Serializable<decltype(obj.signature)>::serialize(obj.signature, serializer);
7629 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7630}
7631
7632template <>
7633template <typename Deserializer>
7635 Deserializer& deserializer)
7636{
7638 obj.hashed_msg = serde::Deserializable<decltype(obj.hashed_msg)>::deserialize(deserializer);
7639 obj.public_key_x = serde::Deserializable<decltype(obj.public_key_x)>::deserialize(deserializer);
7640 obj.public_key_y = serde::Deserializable<decltype(obj.public_key_y)>::deserialize(deserializer);
7641 obj.signature = serde::Deserializable<decltype(obj.signature)>::deserialize(deserializer);
7642 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7643 return obj;
7644}
7645
7646namespace Acir {
7647
7649{
7650 if (!(lhs.points == rhs.points)) {
7651 return false;
7652 }
7653 if (!(lhs.scalars == rhs.scalars)) {
7654 return false;
7655 }
7656 if (!(lhs.outputs == rhs.outputs)) {
7657 return false;
7658 }
7659 return true;
7660}
7661
7662inline std::vector<uint8_t> BlackBoxOp::MultiScalarMul::bincodeSerialize() const
7663{
7664 auto serializer = serde::BincodeSerializer();
7666 return std::move(serializer).bytes();
7667}
7668
7670{
7671 auto deserializer = serde::BincodeDeserializer(input);
7673 if (deserializer.get_buffer_offset() < input.size()) {
7674 throw_or_abort("Some input bytes were not read");
7675 }
7676 return value;
7677}
7678
7679} // end of namespace Acir
7680
7681template <>
7682template <typename Serializer>
7684 Serializer& serializer)
7685{
7686 serde::Serializable<decltype(obj.points)>::serialize(obj.points, serializer);
7687 serde::Serializable<decltype(obj.scalars)>::serialize(obj.scalars, serializer);
7688 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
7689}
7690
7691template <>
7692template <typename Deserializer>
7694 Deserializer& deserializer)
7695{
7697 obj.points = serde::Deserializable<decltype(obj.points)>::deserialize(deserializer);
7698 obj.scalars = serde::Deserializable<decltype(obj.scalars)>::deserialize(deserializer);
7699 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
7700 return obj;
7701}
7702
7703namespace Acir {
7704
7706{
7707 if (!(lhs.input1_x == rhs.input1_x)) {
7708 return false;
7709 }
7710 if (!(lhs.input1_y == rhs.input1_y)) {
7711 return false;
7712 }
7713 if (!(lhs.input1_infinite == rhs.input1_infinite)) {
7714 return false;
7715 }
7716 if (!(lhs.input2_x == rhs.input2_x)) {
7717 return false;
7718 }
7719 if (!(lhs.input2_y == rhs.input2_y)) {
7720 return false;
7721 }
7722 if (!(lhs.input2_infinite == rhs.input2_infinite)) {
7723 return false;
7724 }
7725 if (!(lhs.result == rhs.result)) {
7726 return false;
7727 }
7728 return true;
7729}
7730
7731inline std::vector<uint8_t> BlackBoxOp::EmbeddedCurveAdd::bincodeSerialize() const
7732{
7733 auto serializer = serde::BincodeSerializer();
7735 return std::move(serializer).bytes();
7736}
7737
7739{
7740 auto deserializer = serde::BincodeDeserializer(input);
7742 if (deserializer.get_buffer_offset() < input.size()) {
7743 throw_or_abort("Some input bytes were not read");
7744 }
7745 return value;
7746}
7747
7748} // end of namespace Acir
7749
7750template <>
7751template <typename Serializer>
7753 Serializer& serializer)
7754{
7755 serde::Serializable<decltype(obj.input1_x)>::serialize(obj.input1_x, serializer);
7756 serde::Serializable<decltype(obj.input1_y)>::serialize(obj.input1_y, serializer);
7757 serde::Serializable<decltype(obj.input1_infinite)>::serialize(obj.input1_infinite, serializer);
7758 serde::Serializable<decltype(obj.input2_x)>::serialize(obj.input2_x, serializer);
7759 serde::Serializable<decltype(obj.input2_y)>::serialize(obj.input2_y, serializer);
7760 serde::Serializable<decltype(obj.input2_infinite)>::serialize(obj.input2_infinite, serializer);
7761 serde::Serializable<decltype(obj.result)>::serialize(obj.result, serializer);
7762}
7763
7764template <>
7765template <typename Deserializer>
7767 Deserializer& deserializer)
7768{
7770 obj.input1_x = serde::Deserializable<decltype(obj.input1_x)>::deserialize(deserializer);
7771 obj.input1_y = serde::Deserializable<decltype(obj.input1_y)>::deserialize(deserializer);
7772 obj.input1_infinite = serde::Deserializable<decltype(obj.input1_infinite)>::deserialize(deserializer);
7773 obj.input2_x = serde::Deserializable<decltype(obj.input2_x)>::deserialize(deserializer);
7774 obj.input2_y = serde::Deserializable<decltype(obj.input2_y)>::deserialize(deserializer);
7775 obj.input2_infinite = serde::Deserializable<decltype(obj.input2_infinite)>::deserialize(deserializer);
7776 obj.result = serde::Deserializable<decltype(obj.result)>::deserialize(deserializer);
7777 return obj;
7778}
7779
7780namespace Acir {
7781
7783{
7784 if (!(lhs.message == rhs.message)) {
7785 return false;
7786 }
7787 if (!(lhs.output == rhs.output)) {
7788 return false;
7789 }
7790 return true;
7791}
7792
7794{
7795 auto serializer = serde::BincodeSerializer();
7797 return std::move(serializer).bytes();
7798}
7799
7801{
7802 auto deserializer = serde::BincodeDeserializer(input);
7804 if (deserializer.get_buffer_offset() < input.size()) {
7805 throw_or_abort("Some input bytes were not read");
7806 }
7807 return value;
7808}
7809
7810} // end of namespace Acir
7811
7812template <>
7813template <typename Serializer>
7815 const Acir::BlackBoxOp::Poseidon2Permutation& obj, Serializer& serializer)
7816{
7817 serde::Serializable<decltype(obj.message)>::serialize(obj.message, serializer);
7818 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7819}
7820
7821template <>
7822template <typename Deserializer>
7824 Deserializer& deserializer)
7825{
7827 obj.message = serde::Deserializable<decltype(obj.message)>::deserialize(deserializer);
7828 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7829 return obj;
7830}
7831
7832namespace Acir {
7833
7835{
7836 if (!(lhs.input == rhs.input)) {
7837 return false;
7838 }
7839 if (!(lhs.hash_values == rhs.hash_values)) {
7840 return false;
7841 }
7842 if (!(lhs.output == rhs.output)) {
7843 return false;
7844 }
7845 return true;
7846}
7847
7848inline std::vector<uint8_t> BlackBoxOp::Sha256Compression::bincodeSerialize() const
7849{
7850 auto serializer = serde::BincodeSerializer();
7852 return std::move(serializer).bytes();
7853}
7854
7856{
7857 auto deserializer = serde::BincodeDeserializer(input);
7859 if (deserializer.get_buffer_offset() < input.size()) {
7860 throw_or_abort("Some input bytes were not read");
7861 }
7862 return value;
7863}
7864
7865} // end of namespace Acir
7866
7867template <>
7868template <typename Serializer>
7870 Serializer& serializer)
7871{
7872 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7873 serde::Serializable<decltype(obj.hash_values)>::serialize(obj.hash_values, serializer);
7874 serde::Serializable<decltype(obj.output)>::serialize(obj.output, serializer);
7875}
7876
7877template <>
7878template <typename Deserializer>
7880 Deserializer& deserializer)
7881{
7883 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7884 obj.hash_values = serde::Deserializable<decltype(obj.hash_values)>::deserialize(deserializer);
7885 obj.output = serde::Deserializable<decltype(obj.output)>::deserialize(deserializer);
7886 return obj;
7887}
7888
7889namespace Acir {
7890
7891inline bool operator==(const BlackBoxOp::ToRadix& lhs, const BlackBoxOp::ToRadix& rhs)
7892{
7893 if (!(lhs.input == rhs.input)) {
7894 return false;
7895 }
7896 if (!(lhs.radix == rhs.radix)) {
7897 return false;
7898 }
7899 if (!(lhs.output_pointer == rhs.output_pointer)) {
7900 return false;
7901 }
7902 if (!(lhs.num_limbs == rhs.num_limbs)) {
7903 return false;
7904 }
7905 if (!(lhs.output_bits == rhs.output_bits)) {
7906 return false;
7907 }
7908 return true;
7909}
7910
7911inline std::vector<uint8_t> BlackBoxOp::ToRadix::bincodeSerialize() const
7912{
7913 auto serializer = serde::BincodeSerializer();
7915 return std::move(serializer).bytes();
7916}
7917
7919{
7920 auto deserializer = serde::BincodeDeserializer(input);
7922 if (deserializer.get_buffer_offset() < input.size()) {
7923 throw_or_abort("Some input bytes were not read");
7924 }
7925 return value;
7926}
7927
7928} // end of namespace Acir
7929
7930template <>
7931template <typename Serializer>
7933 Serializer& serializer)
7934{
7935 serde::Serializable<decltype(obj.input)>::serialize(obj.input, serializer);
7936 serde::Serializable<decltype(obj.radix)>::serialize(obj.radix, serializer);
7937 serde::Serializable<decltype(obj.output_pointer)>::serialize(obj.output_pointer, serializer);
7938 serde::Serializable<decltype(obj.num_limbs)>::serialize(obj.num_limbs, serializer);
7939 serde::Serializable<decltype(obj.output_bits)>::serialize(obj.output_bits, serializer);
7940}
7941
7942template <>
7943template <typename Deserializer>
7945{
7947 obj.input = serde::Deserializable<decltype(obj.input)>::deserialize(deserializer);
7948 obj.radix = serde::Deserializable<decltype(obj.radix)>::deserialize(deserializer);
7949 obj.output_pointer = serde::Deserializable<decltype(obj.output_pointer)>::deserialize(deserializer);
7950 obj.num_limbs = serde::Deserializable<decltype(obj.num_limbs)>::deserialize(deserializer);
7951 obj.output_bits = serde::Deserializable<decltype(obj.output_bits)>::deserialize(deserializer);
7952 return obj;
7953}
7954
7955namespace Acir {
7956
7957inline bool operator==(const BlockId& lhs, const BlockId& rhs)
7958{
7959 if (!(lhs.value == rhs.value)) {
7960 return false;
7961 }
7962 return true;
7963}
7964
7965inline std::vector<uint8_t> BlockId::bincodeSerialize() const
7966{
7967 auto serializer = serde::BincodeSerializer();
7968 serde::Serializable<BlockId>::serialize(*this, serializer);
7969 return std::move(serializer).bytes();
7970}
7971
7972inline BlockId BlockId::bincodeDeserialize(std::vector<uint8_t> input)
7973{
7974 auto deserializer = serde::BincodeDeserializer(input);
7976 if (deserializer.get_buffer_offset() < input.size()) {
7977 throw_or_abort("Some input bytes were not read");
7978 }
7979 return value;
7980}
7981
7982} // end of namespace Acir
7983
7984template <>
7985template <typename Serializer>
7986void serde::Serializable<Acir::BlockId>::serialize(const Acir::BlockId& obj, Serializer& serializer)
7987{
7988 serializer.increase_container_depth();
7989 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
7990 serializer.decrease_container_depth();
7991}
7992
7993template <>
7994template <typename Deserializer>
7996{
7997 deserializer.increase_container_depth();
7998 Acir::BlockId obj;
7999 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8000 deserializer.decrease_container_depth();
8001 return obj;
8002}
8003
8004namespace Acir {
8005
8006inline bool operator==(const BlockType& lhs, const BlockType& rhs)
8007{
8008 if (!(lhs.value == rhs.value)) {
8009 return false;
8010 }
8011 return true;
8012}
8013
8014inline std::vector<uint8_t> BlockType::bincodeSerialize() const
8015{
8016 auto serializer = serde::BincodeSerializer();
8018 return std::move(serializer).bytes();
8019}
8020
8021inline BlockType BlockType::bincodeDeserialize(std::vector<uint8_t> input)
8022{
8023 auto deserializer = serde::BincodeDeserializer(input);
8025 if (deserializer.get_buffer_offset() < input.size()) {
8026 throw_or_abort("Some input bytes were not read");
8027 }
8028 return value;
8029}
8030
8031} // end of namespace Acir
8032
8033template <>
8034template <typename Serializer>
8036{
8037 serializer.increase_container_depth();
8038 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8039 serializer.decrease_container_depth();
8040}
8041
8042template <>
8043template <typename Deserializer>
8045{
8046 deserializer.increase_container_depth();
8047 Acir::BlockType obj;
8048 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8049 deserializer.decrease_container_depth();
8050 return obj;
8051}
8052
8053namespace Acir {
8054
8055inline bool operator==(const BlockType::Memory& lhs, const BlockType::Memory& rhs)
8056{
8057 return true;
8058}
8059
8060inline std::vector<uint8_t> BlockType::Memory::bincodeSerialize() const
8061{
8062 auto serializer = serde::BincodeSerializer();
8064 return std::move(serializer).bytes();
8065}
8066
8068{
8069 auto deserializer = serde::BincodeDeserializer(input);
8071 if (deserializer.get_buffer_offset() < input.size()) {
8072 throw_or_abort("Some input bytes were not read");
8073 }
8074 return value;
8075}
8076
8077} // end of namespace Acir
8078
8079template <>
8080template <typename Serializer>
8083
8084template <>
8085template <typename Deserializer>
8091
8092namespace Acir {
8093
8094inline bool operator==(const BlockType::CallData& lhs, const BlockType::CallData& rhs)
8095{
8096 if (!(lhs.value == rhs.value)) {
8097 return false;
8098 }
8099 return true;
8100}
8101
8102inline std::vector<uint8_t> BlockType::CallData::bincodeSerialize() const
8103{
8104 auto serializer = serde::BincodeSerializer();
8106 return std::move(serializer).bytes();
8107}
8108
8110{
8111 auto deserializer = serde::BincodeDeserializer(input);
8113 if (deserializer.get_buffer_offset() < input.size()) {
8114 throw_or_abort("Some input bytes were not read");
8115 }
8116 return value;
8117}
8118
8119} // end of namespace Acir
8120
8121template <>
8122template <typename Serializer>
8124 Serializer& serializer)
8125{
8126 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8127}
8128
8129template <>
8130template <typename Deserializer>
8132{
8134 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8135 return obj;
8136}
8137
8138namespace Acir {
8139
8140inline bool operator==(const BlockType::ReturnData& lhs, const BlockType::ReturnData& rhs)
8141{
8142 return true;
8143}
8144
8145inline std::vector<uint8_t> BlockType::ReturnData::bincodeSerialize() const
8146{
8147 auto serializer = serde::BincodeSerializer();
8149 return std::move(serializer).bytes();
8150}
8151
8153{
8154 auto deserializer = serde::BincodeDeserializer(input);
8156 if (deserializer.get_buffer_offset() < input.size()) {
8157 throw_or_abort("Some input bytes were not read");
8158 }
8159 return value;
8160}
8161
8162} // end of namespace Acir
8163
8164template <>
8165template <typename Serializer>
8169
8170template <>
8171template <typename Deserializer>
8177
8178namespace Acir {
8179
8180inline bool operator==(const BrilligBytecode& lhs, const BrilligBytecode& rhs)
8181{
8182 if (!(lhs.function_name == rhs.function_name)) {
8183 return false;
8184 }
8185 if (!(lhs.bytecode == rhs.bytecode)) {
8186 return false;
8187 }
8188 return true;
8189}
8190
8191inline std::vector<uint8_t> BrilligBytecode::bincodeSerialize() const
8192{
8193 auto serializer = serde::BincodeSerializer();
8195 return std::move(serializer).bytes();
8196}
8197
8199{
8200 auto deserializer = serde::BincodeDeserializer(input);
8202 if (deserializer.get_buffer_offset() < input.size()) {
8203 throw_or_abort("Some input bytes were not read");
8204 }
8205 return value;
8206}
8207
8208} // end of namespace Acir
8209
8210template <>
8211template <typename Serializer>
8213{
8214 serializer.increase_container_depth();
8215 serde::Serializable<decltype(obj.function_name)>::serialize(obj.function_name, serializer);
8216 serde::Serializable<decltype(obj.bytecode)>::serialize(obj.bytecode, serializer);
8217 serializer.decrease_container_depth();
8218}
8219
8220template <>
8221template <typename Deserializer>
8223{
8224 deserializer.increase_container_depth();
8226 obj.function_name = serde::Deserializable<decltype(obj.function_name)>::deserialize(deserializer);
8227 obj.bytecode = serde::Deserializable<decltype(obj.bytecode)>::deserialize(deserializer);
8228 deserializer.decrease_container_depth();
8229 return obj;
8230}
8231
8232namespace Acir {
8233
8234inline bool operator==(const BrilligInputs& lhs, const BrilligInputs& rhs)
8235{
8236 if (!(lhs.value == rhs.value)) {
8237 return false;
8238 }
8239 return true;
8240}
8241
8242inline std::vector<uint8_t> BrilligInputs::bincodeSerialize() const
8243{
8244 auto serializer = serde::BincodeSerializer();
8246 return std::move(serializer).bytes();
8247}
8248
8249inline BrilligInputs BrilligInputs::bincodeDeserialize(std::vector<uint8_t> input)
8250{
8251 auto deserializer = serde::BincodeDeserializer(input);
8253 if (deserializer.get_buffer_offset() < input.size()) {
8254 throw_or_abort("Some input bytes were not read");
8255 }
8256 return value;
8257}
8258
8259} // end of namespace Acir
8260
8261template <>
8262template <typename Serializer>
8264{
8265 serializer.increase_container_depth();
8266 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8267 serializer.decrease_container_depth();
8268}
8269
8270template <>
8271template <typename Deserializer>
8273{
8274 deserializer.increase_container_depth();
8276 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8277 deserializer.decrease_container_depth();
8278 return obj;
8279}
8280
8281namespace Acir {
8282
8283inline bool operator==(const BrilligInputs::Single& lhs, const BrilligInputs::Single& rhs)
8284{
8285 if (!(lhs.value == rhs.value)) {
8286 return false;
8287 }
8288 return true;
8289}
8290
8291inline std::vector<uint8_t> BrilligInputs::Single::bincodeSerialize() const
8292{
8293 auto serializer = serde::BincodeSerializer();
8295 return std::move(serializer).bytes();
8296}
8297
8299{
8300 auto deserializer = serde::BincodeDeserializer(input);
8302 if (deserializer.get_buffer_offset() < input.size()) {
8303 throw_or_abort("Some input bytes were not read");
8304 }
8305 return value;
8306}
8307
8308} // end of namespace Acir
8309
8310template <>
8311template <typename Serializer>
8313 Serializer& serializer)
8314{
8315 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8316}
8317
8318template <>
8319template <typename Deserializer>
8321{
8323 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8324 return obj;
8325}
8326
8327namespace Acir {
8328
8329inline bool operator==(const BrilligInputs::Array& lhs, const BrilligInputs::Array& rhs)
8330{
8331 if (!(lhs.value == rhs.value)) {
8332 return false;
8333 }
8334 return true;
8335}
8336
8337inline std::vector<uint8_t> BrilligInputs::Array::bincodeSerialize() const
8338{
8339 auto serializer = serde::BincodeSerializer();
8341 return std::move(serializer).bytes();
8342}
8343
8345{
8346 auto deserializer = serde::BincodeDeserializer(input);
8348 if (deserializer.get_buffer_offset() < input.size()) {
8349 throw_or_abort("Some input bytes were not read");
8350 }
8351 return value;
8352}
8353
8354} // end of namespace Acir
8355
8356template <>
8357template <typename Serializer>
8359 Serializer& serializer)
8360{
8361 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8362}
8363
8364template <>
8365template <typename Deserializer>
8367{
8369 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8370 return obj;
8371}
8372
8373namespace Acir {
8374
8376{
8377 if (!(lhs.value == rhs.value)) {
8378 return false;
8379 }
8380 return true;
8381}
8382
8383inline std::vector<uint8_t> BrilligInputs::MemoryArray::bincodeSerialize() const
8384{
8385 auto serializer = serde::BincodeSerializer();
8387 return std::move(serializer).bytes();
8388}
8389
8391{
8392 auto deserializer = serde::BincodeDeserializer(input);
8394 if (deserializer.get_buffer_offset() < input.size()) {
8395 throw_or_abort("Some input bytes were not read");
8396 }
8397 return value;
8398}
8399
8400} // end of namespace Acir
8401
8402template <>
8403template <typename Serializer>
8405 Serializer& serializer)
8406{
8407 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8408}
8409
8410template <>
8411template <typename Deserializer>
8413 Deserializer& deserializer)
8414{
8416 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8417 return obj;
8418}
8419
8420namespace Acir {
8421
8422inline bool operator==(const BrilligOpcode& lhs, const BrilligOpcode& rhs)
8423{
8424 if (!(lhs.value == rhs.value)) {
8425 return false;
8426 }
8427 return true;
8428}
8429
8430inline std::vector<uint8_t> BrilligOpcode::bincodeSerialize() const
8431{
8432 auto serializer = serde::BincodeSerializer();
8434 return std::move(serializer).bytes();
8435}
8436
8437inline BrilligOpcode BrilligOpcode::bincodeDeserialize(std::vector<uint8_t> input)
8438{
8439 auto deserializer = serde::BincodeDeserializer(input);
8441 if (deserializer.get_buffer_offset() < input.size()) {
8442 throw_or_abort("Some input bytes were not read");
8443 }
8444 return value;
8445}
8446
8447} // end of namespace Acir
8448
8449template <>
8450template <typename Serializer>
8452{
8453 serializer.increase_container_depth();
8454 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8455 serializer.decrease_container_depth();
8456}
8457
8458template <>
8459template <typename Deserializer>
8461{
8462 deserializer.increase_container_depth();
8464 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8465 deserializer.decrease_container_depth();
8466 return obj;
8467}
8468
8469namespace Acir {
8470
8472{
8473 if (!(lhs.destination == rhs.destination)) {
8474 return false;
8475 }
8476 if (!(lhs.op == rhs.op)) {
8477 return false;
8478 }
8479 if (!(lhs.lhs == rhs.lhs)) {
8480 return false;
8481 }
8482 if (!(lhs.rhs == rhs.rhs)) {
8483 return false;
8484 }
8485 return true;
8486}
8487
8488inline std::vector<uint8_t> BrilligOpcode::BinaryFieldOp::bincodeSerialize() const
8489{
8490 auto serializer = serde::BincodeSerializer();
8492 return std::move(serializer).bytes();
8493}
8494
8496{
8497 auto deserializer = serde::BincodeDeserializer(input);
8499 if (deserializer.get_buffer_offset() < input.size()) {
8500 throw_or_abort("Some input bytes were not read");
8501 }
8502 return value;
8503}
8504
8505} // end of namespace Acir
8506
8507template <>
8508template <typename Serializer>
8510 Serializer& serializer)
8511{
8512 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8513 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
8514 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
8515 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
8516}
8517
8518template <>
8519template <typename Deserializer>
8521 Deserializer& deserializer)
8522{
8524 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8525 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
8526 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
8527 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
8528 return obj;
8529}
8530
8531namespace Acir {
8532
8534{
8535 if (!(lhs.destination == rhs.destination)) {
8536 return false;
8537 }
8538 if (!(lhs.op == rhs.op)) {
8539 return false;
8540 }
8541 if (!(lhs.bit_size == rhs.bit_size)) {
8542 return false;
8543 }
8544 if (!(lhs.lhs == rhs.lhs)) {
8545 return false;
8546 }
8547 if (!(lhs.rhs == rhs.rhs)) {
8548 return false;
8549 }
8550 return true;
8551}
8552
8553inline std::vector<uint8_t> BrilligOpcode::BinaryIntOp::bincodeSerialize() const
8554{
8555 auto serializer = serde::BincodeSerializer();
8557 return std::move(serializer).bytes();
8558}
8559
8561{
8562 auto deserializer = serde::BincodeDeserializer(input);
8564 if (deserializer.get_buffer_offset() < input.size()) {
8565 throw_or_abort("Some input bytes were not read");
8566 }
8567 return value;
8568}
8569
8570} // end of namespace Acir
8571
8572template <>
8573template <typename Serializer>
8575 Serializer& serializer)
8576{
8577 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8578 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
8579 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8580 serde::Serializable<decltype(obj.lhs)>::serialize(obj.lhs, serializer);
8581 serde::Serializable<decltype(obj.rhs)>::serialize(obj.rhs, serializer);
8582}
8583
8584template <>
8585template <typename Deserializer>
8587 Deserializer& deserializer)
8588{
8590 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8591 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
8592 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8593 obj.lhs = serde::Deserializable<decltype(obj.lhs)>::deserialize(deserializer);
8594 obj.rhs = serde::Deserializable<decltype(obj.rhs)>::deserialize(deserializer);
8595 return obj;
8596}
8597
8598namespace Acir {
8599
8600inline bool operator==(const BrilligOpcode::Not& lhs, const BrilligOpcode::Not& rhs)
8601{
8602 if (!(lhs.destination == rhs.destination)) {
8603 return false;
8604 }
8605 if (!(lhs.source == rhs.source)) {
8606 return false;
8607 }
8608 if (!(lhs.bit_size == rhs.bit_size)) {
8609 return false;
8610 }
8611 return true;
8612}
8613
8614inline std::vector<uint8_t> BrilligOpcode::Not::bincodeSerialize() const
8615{
8616 auto serializer = serde::BincodeSerializer();
8618 return std::move(serializer).bytes();
8619}
8620
8622{
8623 auto deserializer = serde::BincodeDeserializer(input);
8625 if (deserializer.get_buffer_offset() < input.size()) {
8626 throw_or_abort("Some input bytes were not read");
8627 }
8628 return value;
8629}
8630
8631} // end of namespace Acir
8632
8633template <>
8634template <typename Serializer>
8636 Serializer& serializer)
8637{
8638 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8639 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
8640 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8641}
8642
8643template <>
8644template <typename Deserializer>
8646{
8648 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8649 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
8650 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8651 return obj;
8652}
8653
8654namespace Acir {
8655
8656inline bool operator==(const BrilligOpcode::Cast& lhs, const BrilligOpcode::Cast& rhs)
8657{
8658 if (!(lhs.destination == rhs.destination)) {
8659 return false;
8660 }
8661 if (!(lhs.source == rhs.source)) {
8662 return false;
8663 }
8664 if (!(lhs.bit_size == rhs.bit_size)) {
8665 return false;
8666 }
8667 return true;
8668}
8669
8670inline std::vector<uint8_t> BrilligOpcode::Cast::bincodeSerialize() const
8671{
8672 auto serializer = serde::BincodeSerializer();
8674 return std::move(serializer).bytes();
8675}
8676
8678{
8679 auto deserializer = serde::BincodeDeserializer(input);
8681 if (deserializer.get_buffer_offset() < input.size()) {
8682 throw_or_abort("Some input bytes were not read");
8683 }
8684 return value;
8685}
8686
8687} // end of namespace Acir
8688
8689template <>
8690template <typename Serializer>
8692 Serializer& serializer)
8693{
8694 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8695 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
8696 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8697}
8698
8699template <>
8700template <typename Deserializer>
8702{
8704 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8705 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
8706 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8707 return obj;
8708}
8709
8710namespace Acir {
8711
8712inline bool operator==(const BrilligOpcode::JumpIf& lhs, const BrilligOpcode::JumpIf& rhs)
8713{
8714 if (!(lhs.condition == rhs.condition)) {
8715 return false;
8716 }
8717 if (!(lhs.location == rhs.location)) {
8718 return false;
8719 }
8720 return true;
8721}
8722
8723inline std::vector<uint8_t> BrilligOpcode::JumpIf::bincodeSerialize() const
8724{
8725 auto serializer = serde::BincodeSerializer();
8727 return std::move(serializer).bytes();
8728}
8729
8731{
8732 auto deserializer = serde::BincodeDeserializer(input);
8734 if (deserializer.get_buffer_offset() < input.size()) {
8735 throw_or_abort("Some input bytes were not read");
8736 }
8737 return value;
8738}
8739
8740} // end of namespace Acir
8741
8742template <>
8743template <typename Serializer>
8745 Serializer& serializer)
8746{
8747 serde::Serializable<decltype(obj.condition)>::serialize(obj.condition, serializer);
8748 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8749}
8750
8751template <>
8752template <typename Deserializer>
8754{
8756 obj.condition = serde::Deserializable<decltype(obj.condition)>::deserialize(deserializer);
8757 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8758 return obj;
8759}
8760
8761namespace Acir {
8762
8763inline bool operator==(const BrilligOpcode::Jump& lhs, const BrilligOpcode::Jump& rhs)
8764{
8765 if (!(lhs.location == rhs.location)) {
8766 return false;
8767 }
8768 return true;
8769}
8770
8771inline std::vector<uint8_t> BrilligOpcode::Jump::bincodeSerialize() const
8772{
8773 auto serializer = serde::BincodeSerializer();
8775 return std::move(serializer).bytes();
8776}
8777
8779{
8780 auto deserializer = serde::BincodeDeserializer(input);
8782 if (deserializer.get_buffer_offset() < input.size()) {
8783 throw_or_abort("Some input bytes were not read");
8784 }
8785 return value;
8786}
8787
8788} // end of namespace Acir
8789
8790template <>
8791template <typename Serializer>
8793 Serializer& serializer)
8794{
8795 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8796}
8797
8798template <>
8799template <typename Deserializer>
8801{
8803 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8804 return obj;
8805}
8806
8807namespace Acir {
8808
8810{
8811 if (!(lhs.destination_address == rhs.destination_address)) {
8812 return false;
8813 }
8814 if (!(lhs.size_address == rhs.size_address)) {
8815 return false;
8816 }
8817 if (!(lhs.offset_address == rhs.offset_address)) {
8818 return false;
8819 }
8820 return true;
8821}
8822
8823inline std::vector<uint8_t> BrilligOpcode::CalldataCopy::bincodeSerialize() const
8824{
8825 auto serializer = serde::BincodeSerializer();
8827 return std::move(serializer).bytes();
8828}
8829
8831{
8832 auto deserializer = serde::BincodeDeserializer(input);
8834 if (deserializer.get_buffer_offset() < input.size()) {
8835 throw_or_abort("Some input bytes were not read");
8836 }
8837 return value;
8838}
8839
8840} // end of namespace Acir
8841
8842template <>
8843template <typename Serializer>
8845 Serializer& serializer)
8846{
8847 serde::Serializable<decltype(obj.destination_address)>::serialize(obj.destination_address, serializer);
8848 serde::Serializable<decltype(obj.size_address)>::serialize(obj.size_address, serializer);
8849 serde::Serializable<decltype(obj.offset_address)>::serialize(obj.offset_address, serializer);
8850}
8851
8852template <>
8853template <typename Deserializer>
8855 Deserializer& deserializer)
8856{
8858 obj.destination_address = serde::Deserializable<decltype(obj.destination_address)>::deserialize(deserializer);
8859 obj.size_address = serde::Deserializable<decltype(obj.size_address)>::deserialize(deserializer);
8860 obj.offset_address = serde::Deserializable<decltype(obj.offset_address)>::deserialize(deserializer);
8861 return obj;
8862}
8863
8864namespace Acir {
8865
8866inline bool operator==(const BrilligOpcode::Call& lhs, const BrilligOpcode::Call& rhs)
8867{
8868 if (!(lhs.location == rhs.location)) {
8869 return false;
8870 }
8871 return true;
8872}
8873
8874inline std::vector<uint8_t> BrilligOpcode::Call::bincodeSerialize() const
8875{
8876 auto serializer = serde::BincodeSerializer();
8878 return std::move(serializer).bytes();
8879}
8880
8882{
8883 auto deserializer = serde::BincodeDeserializer(input);
8885 if (deserializer.get_buffer_offset() < input.size()) {
8886 throw_or_abort("Some input bytes were not read");
8887 }
8888 return value;
8889}
8890
8891} // end of namespace Acir
8892
8893template <>
8894template <typename Serializer>
8896 Serializer& serializer)
8897{
8898 serde::Serializable<decltype(obj.location)>::serialize(obj.location, serializer);
8899}
8900
8901template <>
8902template <typename Deserializer>
8904{
8906 obj.location = serde::Deserializable<decltype(obj.location)>::deserialize(deserializer);
8907 return obj;
8908}
8909
8910namespace Acir {
8911
8912inline bool operator==(const BrilligOpcode::Const& lhs, const BrilligOpcode::Const& rhs)
8913{
8914 if (!(lhs.destination == rhs.destination)) {
8915 return false;
8916 }
8917 if (!(lhs.bit_size == rhs.bit_size)) {
8918 return false;
8919 }
8920 if (!(lhs.value == rhs.value)) {
8921 return false;
8922 }
8923 return true;
8924}
8925
8926inline std::vector<uint8_t> BrilligOpcode::Const::bincodeSerialize() const
8927{
8928 auto serializer = serde::BincodeSerializer();
8930 return std::move(serializer).bytes();
8931}
8932
8934{
8935 auto deserializer = serde::BincodeDeserializer(input);
8937 if (deserializer.get_buffer_offset() < input.size()) {
8938 throw_or_abort("Some input bytes were not read");
8939 }
8940 return value;
8941}
8942
8943} // end of namespace Acir
8944
8945template <>
8946template <typename Serializer>
8948 Serializer& serializer)
8949{
8950 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
8951 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
8952 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
8953}
8954
8955template <>
8956template <typename Deserializer>
8958{
8960 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
8961 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
8962 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
8963 return obj;
8964}
8965
8966namespace Acir {
8967
8969{
8970 if (!(lhs.destination_pointer == rhs.destination_pointer)) {
8971 return false;
8972 }
8973 if (!(lhs.bit_size == rhs.bit_size)) {
8974 return false;
8975 }
8976 if (!(lhs.value == rhs.value)) {
8977 return false;
8978 }
8979 return true;
8980}
8981
8982inline std::vector<uint8_t> BrilligOpcode::IndirectConst::bincodeSerialize() const
8983{
8984 auto serializer = serde::BincodeSerializer();
8986 return std::move(serializer).bytes();
8987}
8988
8990{
8991 auto deserializer = serde::BincodeDeserializer(input);
8993 if (deserializer.get_buffer_offset() < input.size()) {
8994 throw_or_abort("Some input bytes were not read");
8995 }
8996 return value;
8997}
8998
8999} // end of namespace Acir
9000
9001template <>
9002template <typename Serializer>
9004 Serializer& serializer)
9005{
9006 serde::Serializable<decltype(obj.destination_pointer)>::serialize(obj.destination_pointer, serializer);
9007 serde::Serializable<decltype(obj.bit_size)>::serialize(obj.bit_size, serializer);
9008 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9009}
9010
9011template <>
9012template <typename Deserializer>
9014 Deserializer& deserializer)
9015{
9017 obj.destination_pointer = serde::Deserializable<decltype(obj.destination_pointer)>::deserialize(deserializer);
9018 obj.bit_size = serde::Deserializable<decltype(obj.bit_size)>::deserialize(deserializer);
9019 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9020 return obj;
9021}
9022
9023namespace Acir {
9024
9025inline bool operator==(const BrilligOpcode::Return& lhs, const BrilligOpcode::Return& rhs)
9026{
9027 return true;
9028}
9029
9030inline std::vector<uint8_t> BrilligOpcode::Return::bincodeSerialize() const
9031{
9032 auto serializer = serde::BincodeSerializer();
9034 return std::move(serializer).bytes();
9035}
9036
9038{
9039 auto deserializer = serde::BincodeDeserializer(input);
9041 if (deserializer.get_buffer_offset() < input.size()) {
9042 throw_or_abort("Some input bytes were not read");
9043 }
9044 return value;
9045}
9046
9047} // end of namespace Acir
9048
9049template <>
9050template <typename Serializer>
9054
9055template <>
9056template <typename Deserializer>
9062
9063namespace Acir {
9064
9066{
9067 if (!(lhs.function == rhs.function)) {
9068 return false;
9069 }
9070 if (!(lhs.destinations == rhs.destinations)) {
9071 return false;
9072 }
9074 return false;
9075 }
9076 if (!(lhs.inputs == rhs.inputs)) {
9077 return false;
9078 }
9079 if (!(lhs.input_value_types == rhs.input_value_types)) {
9080 return false;
9081 }
9082 return true;
9083}
9084
9085inline std::vector<uint8_t> BrilligOpcode::ForeignCall::bincodeSerialize() const
9086{
9087 auto serializer = serde::BincodeSerializer();
9089 return std::move(serializer).bytes();
9090}
9091
9093{
9094 auto deserializer = serde::BincodeDeserializer(input);
9096 if (deserializer.get_buffer_offset() < input.size()) {
9097 throw_or_abort("Some input bytes were not read");
9098 }
9099 return value;
9100}
9101
9102} // end of namespace Acir
9103
9104template <>
9105template <typename Serializer>
9107 Serializer& serializer)
9108{
9109 serde::Serializable<decltype(obj.function)>::serialize(obj.function, serializer);
9110 serde::Serializable<decltype(obj.destinations)>::serialize(obj.destinations, serializer);
9111 serde::Serializable<decltype(obj.destination_value_types)>::serialize(obj.destination_value_types, serializer);
9112 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
9113 serde::Serializable<decltype(obj.input_value_types)>::serialize(obj.input_value_types, serializer);
9114}
9115
9116template <>
9117template <typename Deserializer>
9119 Deserializer& deserializer)
9120{
9122 obj.function = serde::Deserializable<decltype(obj.function)>::deserialize(deserializer);
9123 obj.destinations = serde::Deserializable<decltype(obj.destinations)>::deserialize(deserializer);
9125 serde::Deserializable<decltype(obj.destination_value_types)>::deserialize(deserializer);
9126 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
9127 obj.input_value_types = serde::Deserializable<decltype(obj.input_value_types)>::deserialize(deserializer);
9128 return obj;
9129}
9130
9131namespace Acir {
9132
9133inline bool operator==(const BrilligOpcode::Mov& lhs, const BrilligOpcode::Mov& rhs)
9134{
9135 if (!(lhs.destination == rhs.destination)) {
9136 return false;
9137 }
9138 if (!(lhs.source == rhs.source)) {
9139 return false;
9140 }
9141 return true;
9142}
9143
9144inline std::vector<uint8_t> BrilligOpcode::Mov::bincodeSerialize() const
9145{
9146 auto serializer = serde::BincodeSerializer();
9148 return std::move(serializer).bytes();
9149}
9150
9152{
9153 auto deserializer = serde::BincodeDeserializer(input);
9155 if (deserializer.get_buffer_offset() < input.size()) {
9156 throw_or_abort("Some input bytes were not read");
9157 }
9158 return value;
9159}
9160
9161} // end of namespace Acir
9162
9163template <>
9164template <typename Serializer>
9166 Serializer& serializer)
9167{
9168 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9169 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
9170}
9171
9172template <>
9173template <typename Deserializer>
9175{
9177 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9178 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
9179 return obj;
9180}
9181
9182namespace Acir {
9183
9185{
9186 if (!(lhs.destination == rhs.destination)) {
9187 return false;
9188 }
9189 if (!(lhs.source_a == rhs.source_a)) {
9190 return false;
9191 }
9192 if (!(lhs.source_b == rhs.source_b)) {
9193 return false;
9194 }
9195 if (!(lhs.condition == rhs.condition)) {
9196 return false;
9197 }
9198 return true;
9199}
9200
9201inline std::vector<uint8_t> BrilligOpcode::ConditionalMov::bincodeSerialize() const
9202{
9203 auto serializer = serde::BincodeSerializer();
9205 return std::move(serializer).bytes();
9206}
9207
9209{
9210 auto deserializer = serde::BincodeDeserializer(input);
9212 if (deserializer.get_buffer_offset() < input.size()) {
9213 throw_or_abort("Some input bytes were not read");
9214 }
9215 return value;
9216}
9217
9218} // end of namespace Acir
9219
9220template <>
9221template <typename Serializer>
9223 Serializer& serializer)
9224{
9225 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9226 serde::Serializable<decltype(obj.source_a)>::serialize(obj.source_a, serializer);
9227 serde::Serializable<decltype(obj.source_b)>::serialize(obj.source_b, serializer);
9228 serde::Serializable<decltype(obj.condition)>::serialize(obj.condition, serializer);
9229}
9230
9231template <>
9232template <typename Deserializer>
9234 Deserializer& deserializer)
9235{
9237 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9238 obj.source_a = serde::Deserializable<decltype(obj.source_a)>::deserialize(deserializer);
9239 obj.source_b = serde::Deserializable<decltype(obj.source_b)>::deserialize(deserializer);
9240 obj.condition = serde::Deserializable<decltype(obj.condition)>::deserialize(deserializer);
9241 return obj;
9242}
9243
9244namespace Acir {
9245
9246inline bool operator==(const BrilligOpcode::Load& lhs, const BrilligOpcode::Load& rhs)
9247{
9248 if (!(lhs.destination == rhs.destination)) {
9249 return false;
9250 }
9251 if (!(lhs.source_pointer == rhs.source_pointer)) {
9252 return false;
9253 }
9254 return true;
9255}
9256
9257inline std::vector<uint8_t> BrilligOpcode::Load::bincodeSerialize() const
9258{
9259 auto serializer = serde::BincodeSerializer();
9261 return std::move(serializer).bytes();
9262}
9263
9265{
9266 auto deserializer = serde::BincodeDeserializer(input);
9268 if (deserializer.get_buffer_offset() < input.size()) {
9269 throw_or_abort("Some input bytes were not read");
9270 }
9271 return value;
9272}
9273
9274} // end of namespace Acir
9275
9276template <>
9277template <typename Serializer>
9279 Serializer& serializer)
9280{
9281 serde::Serializable<decltype(obj.destination)>::serialize(obj.destination, serializer);
9282 serde::Serializable<decltype(obj.source_pointer)>::serialize(obj.source_pointer, serializer);
9283}
9284
9285template <>
9286template <typename Deserializer>
9288{
9290 obj.destination = serde::Deserializable<decltype(obj.destination)>::deserialize(deserializer);
9291 obj.source_pointer = serde::Deserializable<decltype(obj.source_pointer)>::deserialize(deserializer);
9292 return obj;
9293}
9294
9295namespace Acir {
9296
9297inline bool operator==(const BrilligOpcode::Store& lhs, const BrilligOpcode::Store& rhs)
9298{
9299 if (!(lhs.destination_pointer == rhs.destination_pointer)) {
9300 return false;
9301 }
9302 if (!(lhs.source == rhs.source)) {
9303 return false;
9304 }
9305 return true;
9306}
9307
9308inline std::vector<uint8_t> BrilligOpcode::Store::bincodeSerialize() const
9309{
9310 auto serializer = serde::BincodeSerializer();
9312 return std::move(serializer).bytes();
9313}
9314
9315inline BrilligOpcode::Store BrilligOpcode::Store::bincodeDeserialize(std::vector<uint8_t> input)
9316{
9317 auto deserializer = serde::BincodeDeserializer(input);
9319 if (deserializer.get_buffer_offset() < input.size()) {
9320 throw_or_abort("Some input bytes were not read");
9321 }
9322 return value;
9323}
9324
9325} // end of namespace Acir
9326
9327template <>
9328template <typename Serializer>
9330 Serializer& serializer)
9331{
9332 serde::Serializable<decltype(obj.destination_pointer)>::serialize(obj.destination_pointer, serializer);
9333 serde::Serializable<decltype(obj.source)>::serialize(obj.source, serializer);
9334}
9335
9336template <>
9337template <typename Deserializer>
9339{
9341 obj.destination_pointer = serde::Deserializable<decltype(obj.destination_pointer)>::deserialize(deserializer);
9342 obj.source = serde::Deserializable<decltype(obj.source)>::deserialize(deserializer);
9343 return obj;
9344}
9345
9346namespace Acir {
9347
9349{
9350 if (!(lhs.value == rhs.value)) {
9351 return false;
9352 }
9353 return true;
9354}
9355
9356inline std::vector<uint8_t> BrilligOpcode::BlackBox::bincodeSerialize() const
9357{
9358 auto serializer = serde::BincodeSerializer();
9360 return std::move(serializer).bytes();
9361}
9362
9364{
9365 auto deserializer = serde::BincodeDeserializer(input);
9367 if (deserializer.get_buffer_offset() < input.size()) {
9368 throw_or_abort("Some input bytes were not read");
9369 }
9370 return value;
9371}
9372
9373} // end of namespace Acir
9374
9375template <>
9376template <typename Serializer>
9378 Serializer& serializer)
9379{
9380 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9381}
9382
9383template <>
9384template <typename Deserializer>
9386 Deserializer& deserializer)
9387{
9389 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9390 return obj;
9391}
9392
9393namespace Acir {
9394
9395inline bool operator==(const BrilligOpcode::Trap& lhs, const BrilligOpcode::Trap& rhs)
9396{
9397 if (!(lhs.revert_data == rhs.revert_data)) {
9398 return false;
9399 }
9400 return true;
9401}
9402
9403inline std::vector<uint8_t> BrilligOpcode::Trap::bincodeSerialize() const
9404{
9405 auto serializer = serde::BincodeSerializer();
9407 return std::move(serializer).bytes();
9408}
9409
9411{
9412 auto deserializer = serde::BincodeDeserializer(input);
9414 if (deserializer.get_buffer_offset() < input.size()) {
9415 throw_or_abort("Some input bytes were not read");
9416 }
9417 return value;
9418}
9419
9420} // end of namespace Acir
9421
9422template <>
9423template <typename Serializer>
9425 Serializer& serializer)
9426{
9427 serde::Serializable<decltype(obj.revert_data)>::serialize(obj.revert_data, serializer);
9428}
9429
9430template <>
9431template <typename Deserializer>
9433{
9435 obj.revert_data = serde::Deserializable<decltype(obj.revert_data)>::deserialize(deserializer);
9436 return obj;
9437}
9438
9439namespace Acir {
9440
9441inline bool operator==(const BrilligOpcode::Stop& lhs, const BrilligOpcode::Stop& rhs)
9442{
9443 if (!(lhs.return_data == rhs.return_data)) {
9444 return false;
9445 }
9446 return true;
9447}
9448
9449inline std::vector<uint8_t> BrilligOpcode::Stop::bincodeSerialize() const
9450{
9451 auto serializer = serde::BincodeSerializer();
9453 return std::move(serializer).bytes();
9454}
9455
9457{
9458 auto deserializer = serde::BincodeDeserializer(input);
9460 if (deserializer.get_buffer_offset() < input.size()) {
9461 throw_or_abort("Some input bytes were not read");
9462 }
9463 return value;
9464}
9465
9466} // end of namespace Acir
9467
9468template <>
9469template <typename Serializer>
9471 Serializer& serializer)
9472{
9473 serde::Serializable<decltype(obj.return_data)>::serialize(obj.return_data, serializer);
9474}
9475
9476template <>
9477template <typename Deserializer>
9479{
9481 obj.return_data = serde::Deserializable<decltype(obj.return_data)>::deserialize(deserializer);
9482 return obj;
9483}
9484
9485namespace Acir {
9486
9487inline bool operator==(const BrilligOutputs& lhs, const BrilligOutputs& rhs)
9488{
9489 if (!(lhs.value == rhs.value)) {
9490 return false;
9491 }
9492 return true;
9493}
9494
9495inline std::vector<uint8_t> BrilligOutputs::bincodeSerialize() const
9496{
9497 auto serializer = serde::BincodeSerializer();
9499 return std::move(serializer).bytes();
9500}
9501
9502inline BrilligOutputs BrilligOutputs::bincodeDeserialize(std::vector<uint8_t> input)
9503{
9504 auto deserializer = serde::BincodeDeserializer(input);
9506 if (deserializer.get_buffer_offset() < input.size()) {
9507 throw_or_abort("Some input bytes were not read");
9508 }
9509 return value;
9510}
9511
9512} // end of namespace Acir
9513
9514template <>
9515template <typename Serializer>
9517{
9518 serializer.increase_container_depth();
9519 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9520 serializer.decrease_container_depth();
9521}
9522
9523template <>
9524template <typename Deserializer>
9526{
9527 deserializer.increase_container_depth();
9529 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9530 deserializer.decrease_container_depth();
9531 return obj;
9532}
9533
9534namespace Acir {
9535
9537{
9538 if (!(lhs.value == rhs.value)) {
9539 return false;
9540 }
9541 return true;
9542}
9543
9544inline std::vector<uint8_t> BrilligOutputs::Simple::bincodeSerialize() const
9545{
9546 auto serializer = serde::BincodeSerializer();
9548 return std::move(serializer).bytes();
9549}
9550
9552{
9553 auto deserializer = serde::BincodeDeserializer(input);
9555 if (deserializer.get_buffer_offset() < input.size()) {
9556 throw_or_abort("Some input bytes were not read");
9557 }
9558 return value;
9559}
9560
9561} // end of namespace Acir
9562
9563template <>
9564template <typename Serializer>
9566 Serializer& serializer)
9567{
9568 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9569}
9570
9571template <>
9572template <typename Deserializer>
9574 Deserializer& deserializer)
9575{
9577 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9578 return obj;
9579}
9580
9581namespace Acir {
9582
9583inline bool operator==(const BrilligOutputs::Array& lhs, const BrilligOutputs::Array& rhs)
9584{
9585 if (!(lhs.value == rhs.value)) {
9586 return false;
9587 }
9588 return true;
9589}
9590
9591inline std::vector<uint8_t> BrilligOutputs::Array::bincodeSerialize() const
9592{
9593 auto serializer = serde::BincodeSerializer();
9595 return std::move(serializer).bytes();
9596}
9597
9599{
9600 auto deserializer = serde::BincodeDeserializer(input);
9602 if (deserializer.get_buffer_offset() < input.size()) {
9603 throw_or_abort("Some input bytes were not read");
9604 }
9605 return value;
9606}
9607
9608} // end of namespace Acir
9609
9610template <>
9611template <typename Serializer>
9613 Serializer& serializer)
9614{
9615 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9616}
9617
9618template <>
9619template <typename Deserializer>
9621{
9623 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9624 return obj;
9625}
9626
9627namespace Acir {
9628
9629inline bool operator==(const Circuit& lhs, const Circuit& rhs)
9630{
9631 if (!(lhs.function_name == rhs.function_name)) {
9632 return false;
9633 }
9634 if (!(lhs.current_witness_index == rhs.current_witness_index)) {
9635 return false;
9636 }
9637 if (!(lhs.opcodes == rhs.opcodes)) {
9638 return false;
9639 }
9640 if (!(lhs.private_parameters == rhs.private_parameters)) {
9641 return false;
9642 }
9643 if (!(lhs.public_parameters == rhs.public_parameters)) {
9644 return false;
9645 }
9646 if (!(lhs.return_values == rhs.return_values)) {
9647 return false;
9648 }
9649 if (!(lhs.assert_messages == rhs.assert_messages)) {
9650 return false;
9651 }
9652 return true;
9653}
9654
9655inline std::vector<uint8_t> Circuit::bincodeSerialize() const
9656{
9657 auto serializer = serde::BincodeSerializer();
9658 serde::Serializable<Circuit>::serialize(*this, serializer);
9659 return std::move(serializer).bytes();
9660}
9661
9662inline Circuit Circuit::bincodeDeserialize(std::vector<uint8_t> input)
9663{
9664 auto deserializer = serde::BincodeDeserializer(input);
9666 if (deserializer.get_buffer_offset() < input.size()) {
9667 throw_or_abort("Some input bytes were not read");
9668 }
9669 return value;
9670}
9671
9672} // end of namespace Acir
9673
9674template <>
9675template <typename Serializer>
9676void serde::Serializable<Acir::Circuit>::serialize(const Acir::Circuit& obj, Serializer& serializer)
9677{
9678 serializer.increase_container_depth();
9679 serde::Serializable<decltype(obj.function_name)>::serialize(obj.function_name, serializer);
9680 serde::Serializable<decltype(obj.current_witness_index)>::serialize(obj.current_witness_index, serializer);
9681 serde::Serializable<decltype(obj.opcodes)>::serialize(obj.opcodes, serializer);
9682 serde::Serializable<decltype(obj.private_parameters)>::serialize(obj.private_parameters, serializer);
9683 serde::Serializable<decltype(obj.public_parameters)>::serialize(obj.public_parameters, serializer);
9684 serde::Serializable<decltype(obj.return_values)>::serialize(obj.return_values, serializer);
9685 serde::Serializable<decltype(obj.assert_messages)>::serialize(obj.assert_messages, serializer);
9686 serializer.decrease_container_depth();
9687}
9688
9689template <>
9690template <typename Deserializer>
9692{
9693 deserializer.increase_container_depth();
9694 Acir::Circuit obj;
9695 obj.function_name = serde::Deserializable<decltype(obj.function_name)>::deserialize(deserializer);
9696 obj.current_witness_index = serde::Deserializable<decltype(obj.current_witness_index)>::deserialize(deserializer);
9697 obj.opcodes = serde::Deserializable<decltype(obj.opcodes)>::deserialize(deserializer);
9698 obj.private_parameters = serde::Deserializable<decltype(obj.private_parameters)>::deserialize(deserializer);
9699 obj.public_parameters = serde::Deserializable<decltype(obj.public_parameters)>::deserialize(deserializer);
9700 obj.return_values = serde::Deserializable<decltype(obj.return_values)>::deserialize(deserializer);
9701 obj.assert_messages = serde::Deserializable<decltype(obj.assert_messages)>::deserialize(deserializer);
9702 deserializer.decrease_container_depth();
9703 return obj;
9704}
9705
9706namespace Acir {
9707
9708inline bool operator==(const Expression& lhs, const Expression& rhs)
9709{
9710 if (!(lhs.mul_terms == rhs.mul_terms)) {
9711 return false;
9712 }
9713 if (!(lhs.linear_combinations == rhs.linear_combinations)) {
9714 return false;
9715 }
9716 if (!(lhs.q_c == rhs.q_c)) {
9717 return false;
9718 }
9719 return true;
9720}
9721
9722inline std::vector<uint8_t> Expression::bincodeSerialize() const
9723{
9724 auto serializer = serde::BincodeSerializer();
9726 return std::move(serializer).bytes();
9727}
9728
9729inline Expression Expression::bincodeDeserialize(std::vector<uint8_t> input)
9730{
9731 auto deserializer = serde::BincodeDeserializer(input);
9733 if (deserializer.get_buffer_offset() < input.size()) {
9734 throw_or_abort("Some input bytes were not read");
9735 }
9736 return value;
9737}
9738
9739} // end of namespace Acir
9740
9741template <>
9742template <typename Serializer>
9744{
9745 serializer.increase_container_depth();
9746 serde::Serializable<decltype(obj.mul_terms)>::serialize(obj.mul_terms, serializer);
9747 serde::Serializable<decltype(obj.linear_combinations)>::serialize(obj.linear_combinations, serializer);
9748 serde::Serializable<decltype(obj.q_c)>::serialize(obj.q_c, serializer);
9749 serializer.decrease_container_depth();
9750}
9751
9752template <>
9753template <typename Deserializer>
9755{
9756 deserializer.increase_container_depth();
9757 Acir::Expression obj;
9758 obj.mul_terms = serde::Deserializable<decltype(obj.mul_terms)>::deserialize(deserializer);
9759 obj.linear_combinations = serde::Deserializable<decltype(obj.linear_combinations)>::deserialize(deserializer);
9760 obj.q_c = serde::Deserializable<decltype(obj.q_c)>::deserialize(deserializer);
9761 deserializer.decrease_container_depth();
9762 return obj;
9763}
9764
9765namespace Acir {
9766
9767inline bool operator==(const ExpressionOrMemory& lhs, const ExpressionOrMemory& rhs)
9768{
9769 if (!(lhs.value == rhs.value)) {
9770 return false;
9771 }
9772 return true;
9773}
9774
9775inline std::vector<uint8_t> ExpressionOrMemory::bincodeSerialize() const
9776{
9777 auto serializer = serde::BincodeSerializer();
9779 return std::move(serializer).bytes();
9780}
9781
9783{
9784 auto deserializer = serde::BincodeDeserializer(input);
9786 if (deserializer.get_buffer_offset() < input.size()) {
9787 throw_or_abort("Some input bytes were not read");
9788 }
9789 return value;
9790}
9791
9792} // end of namespace Acir
9793
9794template <>
9795template <typename Serializer>
9797 Serializer& serializer)
9798{
9799 serializer.increase_container_depth();
9800 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9801 serializer.decrease_container_depth();
9802}
9803
9804template <>
9805template <typename Deserializer>
9807{
9808 deserializer.increase_container_depth();
9810 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9811 deserializer.decrease_container_depth();
9812 return obj;
9813}
9814
9815namespace Acir {
9816
9818{
9819 if (!(lhs.value == rhs.value)) {
9820 return false;
9821 }
9822 return true;
9823}
9824
9825inline std::vector<uint8_t> ExpressionOrMemory::Expression::bincodeSerialize() const
9826{
9827 auto serializer = serde::BincodeSerializer();
9829 return std::move(serializer).bytes();
9830}
9831
9833{
9834 auto deserializer = serde::BincodeDeserializer(input);
9836 if (deserializer.get_buffer_offset() < input.size()) {
9837 throw_or_abort("Some input bytes were not read");
9838 }
9839 return value;
9840}
9841
9842} // end of namespace Acir
9843
9844template <>
9845template <typename Serializer>
9847 const Acir::ExpressionOrMemory::Expression& obj, Serializer& serializer)
9848{
9849 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9850}
9851
9852template <>
9853template <typename Deserializer>
9855 Deserializer& deserializer)
9856{
9858 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9859 return obj;
9860}
9861
9862namespace Acir {
9863
9865{
9866 if (!(lhs.value == rhs.value)) {
9867 return false;
9868 }
9869 return true;
9870}
9871
9872inline std::vector<uint8_t> ExpressionOrMemory::Memory::bincodeSerialize() const
9873{
9874 auto serializer = serde::BincodeSerializer();
9876 return std::move(serializer).bytes();
9877}
9878
9880{
9881 auto deserializer = serde::BincodeDeserializer(input);
9883 if (deserializer.get_buffer_offset() < input.size()) {
9884 throw_or_abort("Some input bytes were not read");
9885 }
9886 return value;
9887}
9888
9889} // end of namespace Acir
9890
9891template <>
9892template <typename Serializer>
9894 Serializer& serializer)
9895{
9896 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9897}
9898
9899template <>
9900template <typename Deserializer>
9902 Deserializer& deserializer)
9903{
9905 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9906 return obj;
9907}
9908
9909namespace Acir {
9910
9911inline bool operator==(const ExpressionWidth& lhs, const ExpressionWidth& rhs)
9912{
9913 if (!(lhs.value == rhs.value)) {
9914 return false;
9915 }
9916 return true;
9917}
9918
9919inline std::vector<uint8_t> ExpressionWidth::bincodeSerialize() const
9920{
9921 auto serializer = serde::BincodeSerializer();
9923 return std::move(serializer).bytes();
9924}
9925
9927{
9928 auto deserializer = serde::BincodeDeserializer(input);
9930 if (deserializer.get_buffer_offset() < input.size()) {
9931 throw_or_abort("Some input bytes were not read");
9932 }
9933 return value;
9934}
9935
9936} // end of namespace Acir
9937
9938template <>
9939template <typename Serializer>
9941{
9942 serializer.increase_container_depth();
9943 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
9944 serializer.decrease_container_depth();
9945}
9946
9947template <>
9948template <typename Deserializer>
9950{
9951 deserializer.increase_container_depth();
9953 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
9954 deserializer.decrease_container_depth();
9955 return obj;
9956}
9957
9958namespace Acir {
9959
9961{
9962 return true;
9963}
9964
9965inline std::vector<uint8_t> ExpressionWidth::Unbounded::bincodeSerialize() const
9966{
9967 auto serializer = serde::BincodeSerializer();
9969 return std::move(serializer).bytes();
9970}
9971
9973{
9974 auto deserializer = serde::BincodeDeserializer(input);
9976 if (deserializer.get_buffer_offset() < input.size()) {
9977 throw_or_abort("Some input bytes were not read");
9978 }
9979 return value;
9980}
9981
9982} // end of namespace Acir
9983
9984template <>
9985template <typename Serializer>
9989
9990template <>
9991template <typename Deserializer>
9998
9999namespace Acir {
10000
10002{
10003 if (!(lhs.width == rhs.width)) {
10004 return false;
10005 }
10006 return true;
10007}
10008
10009inline std::vector<uint8_t> ExpressionWidth::Bounded::bincodeSerialize() const
10010{
10011 auto serializer = serde::BincodeSerializer();
10013 return std::move(serializer).bytes();
10014}
10015
10017{
10018 auto deserializer = serde::BincodeDeserializer(input);
10020 if (deserializer.get_buffer_offset() < input.size()) {
10021 throw_or_abort("Some input bytes were not read");
10022 }
10023 return value;
10024}
10025
10026} // end of namespace Acir
10027
10028template <>
10029template <typename Serializer>
10031 Serializer& serializer)
10032{
10033 serde::Serializable<decltype(obj.width)>::serialize(obj.width, serializer);
10034}
10035
10036template <>
10037template <typename Deserializer>
10039 Deserializer& deserializer)
10040{
10042 obj.width = serde::Deserializable<decltype(obj.width)>::deserialize(deserializer);
10043 return obj;
10044}
10045
10046namespace Acir {
10047
10048inline bool operator==(const FunctionInput& lhs, const FunctionInput& rhs)
10049{
10050 if (!(lhs.value == rhs.value)) {
10051 return false;
10052 }
10053 return true;
10054}
10055
10056inline std::vector<uint8_t> FunctionInput::bincodeSerialize() const
10057{
10058 auto serializer = serde::BincodeSerializer();
10060 return std::move(serializer).bytes();
10061}
10062
10063inline FunctionInput FunctionInput::bincodeDeserialize(std::vector<uint8_t> input)
10064{
10065 auto deserializer = serde::BincodeDeserializer(input);
10067 if (deserializer.get_buffer_offset() < input.size()) {
10068 throw_or_abort("Some input bytes were not read");
10069 }
10070 return value;
10071}
10072
10073} // end of namespace Acir
10074
10075template <>
10076template <typename Serializer>
10078{
10079 serializer.increase_container_depth();
10080 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10081 serializer.decrease_container_depth();
10082}
10083
10084template <>
10085template <typename Deserializer>
10087{
10088 deserializer.increase_container_depth();
10090 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10091 deserializer.decrease_container_depth();
10092 return obj;
10093}
10094
10095namespace Acir {
10096
10098{
10099 if (!(lhs.value == rhs.value)) {
10100 return false;
10101 }
10102 return true;
10103}
10104
10105inline std::vector<uint8_t> FunctionInput::Constant::bincodeSerialize() const
10106{
10107 auto serializer = serde::BincodeSerializer();
10109 return std::move(serializer).bytes();
10110}
10111
10113{
10114 auto deserializer = serde::BincodeDeserializer(input);
10116 if (deserializer.get_buffer_offset() < input.size()) {
10117 throw_or_abort("Some input bytes were not read");
10118 }
10119 return value;
10120}
10121
10122} // end of namespace Acir
10123
10124template <>
10125template <typename Serializer>
10127 Serializer& serializer)
10128{
10129 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10130}
10131
10132template <>
10133template <typename Deserializer>
10135 Deserializer& deserializer)
10136{
10138 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10139 return obj;
10140}
10141
10142namespace Acir {
10143
10145{
10146 if (!(lhs.value == rhs.value)) {
10147 return false;
10148 }
10149 return true;
10150}
10151
10152inline std::vector<uint8_t> FunctionInput::Witness::bincodeSerialize() const
10153{
10154 auto serializer = serde::BincodeSerializer();
10156 return std::move(serializer).bytes();
10157}
10158
10160{
10161 auto deserializer = serde::BincodeDeserializer(input);
10163 if (deserializer.get_buffer_offset() < input.size()) {
10164 throw_or_abort("Some input bytes were not read");
10165 }
10166 return value;
10167}
10168
10169} // end of namespace Acir
10170
10171template <>
10172template <typename Serializer>
10174 Serializer& serializer)
10175{
10176 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10177}
10178
10179template <>
10180template <typename Deserializer>
10182 Deserializer& deserializer)
10183{
10185 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10186 return obj;
10187}
10188
10189namespace Acir {
10190
10191inline bool operator==(const HeapArray& lhs, const HeapArray& rhs)
10192{
10193 if (!(lhs.pointer == rhs.pointer)) {
10194 return false;
10195 }
10196 if (!(lhs.size == rhs.size)) {
10197 return false;
10198 }
10199 return true;
10200}
10201
10202inline std::vector<uint8_t> HeapArray::bincodeSerialize() const
10203{
10204 auto serializer = serde::BincodeSerializer();
10206 return std::move(serializer).bytes();
10207}
10208
10209inline HeapArray HeapArray::bincodeDeserialize(std::vector<uint8_t> input)
10210{
10211 auto deserializer = serde::BincodeDeserializer(input);
10213 if (deserializer.get_buffer_offset() < input.size()) {
10214 throw_or_abort("Some input bytes were not read");
10215 }
10216 return value;
10217}
10218
10219} // end of namespace Acir
10220
10221template <>
10222template <typename Serializer>
10224{
10225 serializer.increase_container_depth();
10226 serde::Serializable<decltype(obj.pointer)>::serialize(obj.pointer, serializer);
10227 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10228 serializer.decrease_container_depth();
10229}
10230
10231template <>
10232template <typename Deserializer>
10234{
10235 deserializer.increase_container_depth();
10236 Acir::HeapArray obj;
10237 obj.pointer = serde::Deserializable<decltype(obj.pointer)>::deserialize(deserializer);
10238 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10239 deserializer.decrease_container_depth();
10240 return obj;
10241}
10242
10243namespace Acir {
10244
10245inline bool operator==(const HeapValueType& lhs, const HeapValueType& rhs)
10246{
10247 if (!(lhs.value == rhs.value)) {
10248 return false;
10249 }
10250 return true;
10251}
10252
10253inline std::vector<uint8_t> HeapValueType::bincodeSerialize() const
10254{
10255 auto serializer = serde::BincodeSerializer();
10257 return std::move(serializer).bytes();
10258}
10259
10260inline HeapValueType HeapValueType::bincodeDeserialize(std::vector<uint8_t> input)
10261{
10262 auto deserializer = serde::BincodeDeserializer(input);
10264 if (deserializer.get_buffer_offset() < input.size()) {
10265 throw_or_abort("Some input bytes were not read");
10266 }
10267 return value;
10268}
10269
10270} // end of namespace Acir
10271
10272template <>
10273template <typename Serializer>
10275{
10276 serializer.increase_container_depth();
10277 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10278 serializer.decrease_container_depth();
10279}
10280
10281template <>
10282template <typename Deserializer>
10284{
10285 deserializer.increase_container_depth();
10287 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10288 deserializer.decrease_container_depth();
10289 return obj;
10290}
10291
10292namespace Acir {
10293
10294inline bool operator==(const HeapValueType::Simple& lhs, const HeapValueType::Simple& rhs)
10295{
10296 if (!(lhs.value == rhs.value)) {
10297 return false;
10298 }
10299 return true;
10300}
10301
10302inline std::vector<uint8_t> HeapValueType::Simple::bincodeSerialize() const
10303{
10304 auto serializer = serde::BincodeSerializer();
10306 return std::move(serializer).bytes();
10307}
10308
10310{
10311 auto deserializer = serde::BincodeDeserializer(input);
10313 if (deserializer.get_buffer_offset() < input.size()) {
10314 throw_or_abort("Some input bytes were not read");
10315 }
10316 return value;
10317}
10318
10319} // end of namespace Acir
10320
10321template <>
10322template <typename Serializer>
10324 Serializer& serializer)
10325{
10326 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10327}
10328
10329template <>
10330template <typename Deserializer>
10332{
10334 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10335 return obj;
10336}
10337
10338namespace Acir {
10339
10340inline bool operator==(const HeapValueType::Array& lhs, const HeapValueType::Array& rhs)
10341{
10342 if (!(lhs.value_types == rhs.value_types)) {
10343 return false;
10344 }
10345 if (!(lhs.size == rhs.size)) {
10346 return false;
10347 }
10348 return true;
10349}
10350
10351inline std::vector<uint8_t> HeapValueType::Array::bincodeSerialize() const
10352{
10353 auto serializer = serde::BincodeSerializer();
10355 return std::move(serializer).bytes();
10356}
10357
10359{
10360 auto deserializer = serde::BincodeDeserializer(input);
10362 if (deserializer.get_buffer_offset() < input.size()) {
10363 throw_or_abort("Some input bytes were not read");
10364 }
10365 return value;
10366}
10367
10368} // end of namespace Acir
10369
10370template <>
10371template <typename Serializer>
10373 Serializer& serializer)
10374{
10375 serde::Serializable<decltype(obj.value_types)>::serialize(obj.value_types, serializer);
10376 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10377}
10378
10379template <>
10380template <typename Deserializer>
10382{
10384 obj.value_types = serde::Deserializable<decltype(obj.value_types)>::deserialize(deserializer);
10385 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10386 return obj;
10387}
10388
10389namespace Acir {
10390
10391inline bool operator==(const HeapValueType::Vector& lhs, const HeapValueType::Vector& rhs)
10392{
10393 if (!(lhs.value_types == rhs.value_types)) {
10394 return false;
10395 }
10396 return true;
10397}
10398
10399inline std::vector<uint8_t> HeapValueType::Vector::bincodeSerialize() const
10400{
10401 auto serializer = serde::BincodeSerializer();
10403 return std::move(serializer).bytes();
10404}
10405
10407{
10408 auto deserializer = serde::BincodeDeserializer(input);
10410 if (deserializer.get_buffer_offset() < input.size()) {
10411 throw_or_abort("Some input bytes were not read");
10412 }
10413 return value;
10414}
10415
10416} // end of namespace Acir
10417
10418template <>
10419template <typename Serializer>
10421 Serializer& serializer)
10422{
10423 serde::Serializable<decltype(obj.value_types)>::serialize(obj.value_types, serializer);
10424}
10425
10426template <>
10427template <typename Deserializer>
10429{
10431 obj.value_types = serde::Deserializable<decltype(obj.value_types)>::deserialize(deserializer);
10432 return obj;
10433}
10434
10435namespace Acir {
10436
10437inline bool operator==(const HeapVector& lhs, const HeapVector& rhs)
10438{
10439 if (!(lhs.pointer == rhs.pointer)) {
10440 return false;
10441 }
10442 if (!(lhs.size == rhs.size)) {
10443 return false;
10444 }
10445 return true;
10446}
10447
10448inline std::vector<uint8_t> HeapVector::bincodeSerialize() const
10449{
10450 auto serializer = serde::BincodeSerializer();
10452 return std::move(serializer).bytes();
10453}
10454
10455inline HeapVector HeapVector::bincodeDeserialize(std::vector<uint8_t> input)
10456{
10457 auto deserializer = serde::BincodeDeserializer(input);
10459 if (deserializer.get_buffer_offset() < input.size()) {
10460 throw_or_abort("Some input bytes were not read");
10461 }
10462 return value;
10463}
10464
10465} // end of namespace Acir
10466
10467template <>
10468template <typename Serializer>
10470{
10471 serializer.increase_container_depth();
10472 serde::Serializable<decltype(obj.pointer)>::serialize(obj.pointer, serializer);
10473 serde::Serializable<decltype(obj.size)>::serialize(obj.size, serializer);
10474 serializer.decrease_container_depth();
10475}
10476
10477template <>
10478template <typename Deserializer>
10480{
10481 deserializer.increase_container_depth();
10482 Acir::HeapVector obj;
10483 obj.pointer = serde::Deserializable<decltype(obj.pointer)>::deserialize(deserializer);
10484 obj.size = serde::Deserializable<decltype(obj.size)>::deserialize(deserializer);
10485 deserializer.decrease_container_depth();
10486 return obj;
10487}
10488
10489namespace Acir {
10490
10491inline bool operator==(const IntegerBitSize& lhs, const IntegerBitSize& rhs)
10492{
10493 if (!(lhs.value == rhs.value)) {
10494 return false;
10495 }
10496 return true;
10497}
10498
10499inline std::vector<uint8_t> IntegerBitSize::bincodeSerialize() const
10500{
10501 auto serializer = serde::BincodeSerializer();
10503 return std::move(serializer).bytes();
10504}
10505
10506inline IntegerBitSize IntegerBitSize::bincodeDeserialize(std::vector<uint8_t> input)
10507{
10508 auto deserializer = serde::BincodeDeserializer(input);
10510 if (deserializer.get_buffer_offset() < input.size()) {
10511 throw_or_abort("Some input bytes were not read");
10512 }
10513 return value;
10514}
10515
10516} // end of namespace Acir
10517
10518template <>
10519template <typename Serializer>
10521{
10522 serializer.increase_container_depth();
10523 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10524 serializer.decrease_container_depth();
10525}
10526
10527template <>
10528template <typename Deserializer>
10530{
10531 deserializer.increase_container_depth();
10533 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10534 deserializer.decrease_container_depth();
10535 return obj;
10536}
10537
10538namespace Acir {
10539
10540inline bool operator==(const IntegerBitSize::U1& lhs, const IntegerBitSize::U1& rhs)
10541{
10542 return true;
10543}
10544
10545inline std::vector<uint8_t> IntegerBitSize::U1::bincodeSerialize() const
10546{
10547 auto serializer = serde::BincodeSerializer();
10549 return std::move(serializer).bytes();
10550}
10551
10553{
10554 auto deserializer = serde::BincodeDeserializer(input);
10556 if (deserializer.get_buffer_offset() < input.size()) {
10557 throw_or_abort("Some input bytes were not read");
10558 }
10559 return value;
10560}
10561
10562} // end of namespace Acir
10563
10564template <>
10565template <typename Serializer>
10567 Serializer& serializer)
10568{}
10569
10570template <>
10571template <typename Deserializer>
10577
10578namespace Acir {
10579
10580inline bool operator==(const IntegerBitSize::U8& lhs, const IntegerBitSize::U8& rhs)
10581{
10582 return true;
10583}
10584
10585inline std::vector<uint8_t> IntegerBitSize::U8::bincodeSerialize() const
10586{
10587 auto serializer = serde::BincodeSerializer();
10589 return std::move(serializer).bytes();
10590}
10591
10593{
10594 auto deserializer = serde::BincodeDeserializer(input);
10596 if (deserializer.get_buffer_offset() < input.size()) {
10597 throw_or_abort("Some input bytes were not read");
10598 }
10599 return value;
10600}
10601
10602} // end of namespace Acir
10603
10604template <>
10605template <typename Serializer>
10607 Serializer& serializer)
10608{}
10609
10610template <>
10611template <typename Deserializer>
10617
10618namespace Acir {
10619
10620inline bool operator==(const IntegerBitSize::U16& lhs, const IntegerBitSize::U16& rhs)
10621{
10622 return true;
10623}
10624
10625inline std::vector<uint8_t> IntegerBitSize::U16::bincodeSerialize() const
10626{
10627 auto serializer = serde::BincodeSerializer();
10629 return std::move(serializer).bytes();
10630}
10631
10633{
10634 auto deserializer = serde::BincodeDeserializer(input);
10636 if (deserializer.get_buffer_offset() < input.size()) {
10637 throw_or_abort("Some input bytes were not read");
10638 }
10639 return value;
10640}
10641
10642} // end of namespace Acir
10643
10644template <>
10645template <typename Serializer>
10647 Serializer& serializer)
10648{}
10649
10650template <>
10651template <typename Deserializer>
10657
10658namespace Acir {
10659
10660inline bool operator==(const IntegerBitSize::U32& lhs, const IntegerBitSize::U32& rhs)
10661{
10662 return true;
10663}
10664
10665inline std::vector<uint8_t> IntegerBitSize::U32::bincodeSerialize() const
10666{
10667 auto serializer = serde::BincodeSerializer();
10669 return std::move(serializer).bytes();
10670}
10671
10673{
10674 auto deserializer = serde::BincodeDeserializer(input);
10676 if (deserializer.get_buffer_offset() < input.size()) {
10677 throw_or_abort("Some input bytes were not read");
10678 }
10679 return value;
10680}
10681
10682} // end of namespace Acir
10683
10684template <>
10685template <typename Serializer>
10687 Serializer& serializer)
10688{}
10689
10690template <>
10691template <typename Deserializer>
10697
10698namespace Acir {
10699
10700inline bool operator==(const IntegerBitSize::U64& lhs, const IntegerBitSize::U64& rhs)
10701{
10702 return true;
10703}
10704
10705inline std::vector<uint8_t> IntegerBitSize::U64::bincodeSerialize() const
10706{
10707 auto serializer = serde::BincodeSerializer();
10709 return std::move(serializer).bytes();
10710}
10711
10713{
10714 auto deserializer = serde::BincodeDeserializer(input);
10716 if (deserializer.get_buffer_offset() < input.size()) {
10717 throw_or_abort("Some input bytes were not read");
10718 }
10719 return value;
10720}
10721
10722} // end of namespace Acir
10723
10724template <>
10725template <typename Serializer>
10727 Serializer& serializer)
10728{}
10729
10730template <>
10731template <typename Deserializer>
10737
10738namespace Acir {
10739
10740inline bool operator==(const IntegerBitSize::U128& lhs, const IntegerBitSize::U128& rhs)
10741{
10742 return true;
10743}
10744
10745inline std::vector<uint8_t> IntegerBitSize::U128::bincodeSerialize() const
10746{
10747 auto serializer = serde::BincodeSerializer();
10749 return std::move(serializer).bytes();
10750}
10751
10753{
10754 auto deserializer = serde::BincodeDeserializer(input);
10756 if (deserializer.get_buffer_offset() < input.size()) {
10757 throw_or_abort("Some input bytes were not read");
10758 }
10759 return value;
10760}
10761
10762} // end of namespace Acir
10763
10764template <>
10765template <typename Serializer>
10769
10770template <>
10771template <typename Deserializer>
10777
10778namespace Acir {
10779
10780inline bool operator==(const MemOp& lhs, const MemOp& rhs)
10781{
10782 if (!(lhs.operation == rhs.operation)) {
10783 return false;
10784 }
10785 if (!(lhs.index == rhs.index)) {
10786 return false;
10787 }
10788 if (!(lhs.value == rhs.value)) {
10789 return false;
10790 }
10791 return true;
10792}
10793
10794inline std::vector<uint8_t> MemOp::bincodeSerialize() const
10795{
10796 auto serializer = serde::BincodeSerializer();
10797 serde::Serializable<MemOp>::serialize(*this, serializer);
10798 return std::move(serializer).bytes();
10799}
10800
10801inline MemOp MemOp::bincodeDeserialize(std::vector<uint8_t> input)
10802{
10803 auto deserializer = serde::BincodeDeserializer(input);
10805 if (deserializer.get_buffer_offset() < input.size()) {
10806 throw_or_abort("Some input bytes were not read");
10807 }
10808 return value;
10809}
10810
10811} // end of namespace Acir
10812
10813template <>
10814template <typename Serializer>
10815void serde::Serializable<Acir::MemOp>::serialize(const Acir::MemOp& obj, Serializer& serializer)
10816{
10817 serializer.increase_container_depth();
10818 serde::Serializable<decltype(obj.operation)>::serialize(obj.operation, serializer);
10819 serde::Serializable<decltype(obj.index)>::serialize(obj.index, serializer);
10820 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10821 serializer.decrease_container_depth();
10822}
10823
10824template <>
10825template <typename Deserializer>
10827{
10828 deserializer.increase_container_depth();
10829 Acir::MemOp obj;
10830 obj.operation = serde::Deserializable<decltype(obj.operation)>::deserialize(deserializer);
10831 obj.index = serde::Deserializable<decltype(obj.index)>::deserialize(deserializer);
10832 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10833 deserializer.decrease_container_depth();
10834 return obj;
10835}
10836
10837namespace Acir {
10838
10839inline bool operator==(const MemoryAddress& lhs, const MemoryAddress& rhs)
10840{
10841 if (!(lhs.value == rhs.value)) {
10842 return false;
10843 }
10844 return true;
10845}
10846
10847inline std::vector<uint8_t> MemoryAddress::bincodeSerialize() const
10848{
10849 auto serializer = serde::BincodeSerializer();
10851 return std::move(serializer).bytes();
10852}
10853
10854inline MemoryAddress MemoryAddress::bincodeDeserialize(std::vector<uint8_t> input)
10855{
10856 auto deserializer = serde::BincodeDeserializer(input);
10858 if (deserializer.get_buffer_offset() < input.size()) {
10859 throw_or_abort("Some input bytes were not read");
10860 }
10861 return value;
10862}
10863
10864} // end of namespace Acir
10865
10866template <>
10867template <typename Serializer>
10869{
10870 serializer.increase_container_depth();
10871 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10872 serializer.decrease_container_depth();
10873}
10874
10875template <>
10876template <typename Deserializer>
10878{
10879 deserializer.increase_container_depth();
10881 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10882 deserializer.decrease_container_depth();
10883 return obj;
10884}
10885
10886namespace Acir {
10887
10888inline bool operator==(const MemoryAddress::Direct& lhs, const MemoryAddress::Direct& rhs)
10889{
10890 if (!(lhs.value == rhs.value)) {
10891 return false;
10892 }
10893 return true;
10894}
10895
10896inline std::vector<uint8_t> MemoryAddress::Direct::bincodeSerialize() const
10897{
10898 auto serializer = serde::BincodeSerializer();
10900 return std::move(serializer).bytes();
10901}
10902
10904{
10905 auto deserializer = serde::BincodeDeserializer(input);
10907 if (deserializer.get_buffer_offset() < input.size()) {
10908 throw_or_abort("Some input bytes were not read");
10909 }
10910 return value;
10911}
10912
10913} // end of namespace Acir
10914
10915template <>
10916template <typename Serializer>
10918 Serializer& serializer)
10919{
10920 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10921}
10922
10923template <>
10924template <typename Deserializer>
10926{
10928 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10929 return obj;
10930}
10931
10932namespace Acir {
10933
10935{
10936 if (!(lhs.value == rhs.value)) {
10937 return false;
10938 }
10939 return true;
10940}
10941
10942inline std::vector<uint8_t> MemoryAddress::Relative::bincodeSerialize() const
10943{
10944 auto serializer = serde::BincodeSerializer();
10946 return std::move(serializer).bytes();
10947}
10948
10950{
10951 auto deserializer = serde::BincodeDeserializer(input);
10953 if (deserializer.get_buffer_offset() < input.size()) {
10954 throw_or_abort("Some input bytes were not read");
10955 }
10956 return value;
10957}
10958
10959} // end of namespace Acir
10960
10961template <>
10962template <typename Serializer>
10964 Serializer& serializer)
10965{
10966 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
10967}
10968
10969template <>
10970template <typename Deserializer>
10972 Deserializer& deserializer)
10973{
10975 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
10976 return obj;
10977}
10978
10979namespace Acir {
10980
10981inline bool operator==(const Opcode& lhs, const Opcode& rhs)
10982{
10983 if (!(lhs.value == rhs.value)) {
10984 return false;
10985 }
10986 return true;
10987}
10988
10989inline std::vector<uint8_t> Opcode::bincodeSerialize() const
10990{
10991 auto serializer = serde::BincodeSerializer();
10992 serde::Serializable<Opcode>::serialize(*this, serializer);
10993 return std::move(serializer).bytes();
10994}
10995
10996inline Opcode Opcode::bincodeDeserialize(std::vector<uint8_t> input)
10997{
10998 auto deserializer = serde::BincodeDeserializer(input);
11000 if (deserializer.get_buffer_offset() < input.size()) {
11001 throw_or_abort("Some input bytes were not read");
11002 }
11003 return value;
11004}
11005
11006} // end of namespace Acir
11007
11008template <>
11009template <typename Serializer>
11010void serde::Serializable<Acir::Opcode>::serialize(const Acir::Opcode& obj, Serializer& serializer)
11011{
11012 serializer.increase_container_depth();
11013 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11014 serializer.decrease_container_depth();
11015}
11016
11017template <>
11018template <typename Deserializer>
11020{
11021 deserializer.increase_container_depth();
11022 Acir::Opcode obj;
11023 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11024 deserializer.decrease_container_depth();
11025 return obj;
11026}
11027
11028namespace Acir {
11029
11030inline bool operator==(const Opcode::AssertZero& lhs, const Opcode::AssertZero& rhs)
11031{
11032 if (!(lhs.value == rhs.value)) {
11033 return false;
11034 }
11035 return true;
11036}
11037
11038inline std::vector<uint8_t> Opcode::AssertZero::bincodeSerialize() const
11039{
11040 auto serializer = serde::BincodeSerializer();
11042 return std::move(serializer).bytes();
11043}
11044
11046{
11047 auto deserializer = serde::BincodeDeserializer(input);
11049 if (deserializer.get_buffer_offset() < input.size()) {
11050 throw_or_abort("Some input bytes were not read");
11051 }
11052 return value;
11053}
11054
11055} // end of namespace Acir
11056
11057template <>
11058template <typename Serializer>
11060 Serializer& serializer)
11061{
11062 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11063}
11064
11065template <>
11066template <typename Deserializer>
11068{
11070 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11071 return obj;
11072}
11073
11074namespace Acir {
11075
11077{
11078 if (!(lhs.value == rhs.value)) {
11079 return false;
11080 }
11081 return true;
11082}
11083
11084inline std::vector<uint8_t> Opcode::BlackBoxFuncCall::bincodeSerialize() const
11085{
11086 auto serializer = serde::BincodeSerializer();
11088 return std::move(serializer).bytes();
11089}
11090
11092{
11093 auto deserializer = serde::BincodeDeserializer(input);
11095 if (deserializer.get_buffer_offset() < input.size()) {
11096 throw_or_abort("Some input bytes were not read");
11097 }
11098 return value;
11099}
11100
11101} // end of namespace Acir
11102
11103template <>
11104template <typename Serializer>
11106 Serializer& serializer)
11107{
11108 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11109}
11110
11111template <>
11112template <typename Deserializer>
11114 Deserializer& deserializer)
11115{
11117 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11118 return obj;
11119}
11120
11121namespace Acir {
11122
11123inline bool operator==(const Opcode::MemoryOp& lhs, const Opcode::MemoryOp& rhs)
11124{
11125 if (!(lhs.block_id == rhs.block_id)) {
11126 return false;
11127 }
11128 if (!(lhs.op == rhs.op)) {
11129 return false;
11130 }
11131 return true;
11132}
11133
11134inline std::vector<uint8_t> Opcode::MemoryOp::bincodeSerialize() const
11135{
11136 auto serializer = serde::BincodeSerializer();
11138 return std::move(serializer).bytes();
11139}
11140
11142{
11143 auto deserializer = serde::BincodeDeserializer(input);
11145 if (deserializer.get_buffer_offset() < input.size()) {
11146 throw_or_abort("Some input bytes were not read");
11147 }
11148 return value;
11149}
11150
11151} // end of namespace Acir
11152
11153template <>
11154template <typename Serializer>
11156{
11157 serde::Serializable<decltype(obj.block_id)>::serialize(obj.block_id, serializer);
11158 serde::Serializable<decltype(obj.op)>::serialize(obj.op, serializer);
11159}
11160
11161template <>
11162template <typename Deserializer>
11164{
11166 obj.block_id = serde::Deserializable<decltype(obj.block_id)>::deserialize(deserializer);
11167 obj.op = serde::Deserializable<decltype(obj.op)>::deserialize(deserializer);
11168 return obj;
11169}
11170
11171namespace Acir {
11172
11173inline bool operator==(const Opcode::MemoryInit& lhs, const Opcode::MemoryInit& rhs)
11174{
11175 if (!(lhs.block_id == rhs.block_id)) {
11176 return false;
11177 }
11178 if (!(lhs.init == rhs.init)) {
11179 return false;
11180 }
11181 if (!(lhs.block_type == rhs.block_type)) {
11182 return false;
11183 }
11184 return true;
11185}
11186
11187inline std::vector<uint8_t> Opcode::MemoryInit::bincodeSerialize() const
11188{
11189 auto serializer = serde::BincodeSerializer();
11191 return std::move(serializer).bytes();
11192}
11193
11195{
11196 auto deserializer = serde::BincodeDeserializer(input);
11198 if (deserializer.get_buffer_offset() < input.size()) {
11199 throw_or_abort("Some input bytes were not read");
11200 }
11201 return value;
11202}
11203
11204} // end of namespace Acir
11205
11206template <>
11207template <typename Serializer>
11209 Serializer& serializer)
11210{
11211 serde::Serializable<decltype(obj.block_id)>::serialize(obj.block_id, serializer);
11212 serde::Serializable<decltype(obj.init)>::serialize(obj.init, serializer);
11213 serde::Serializable<decltype(obj.block_type)>::serialize(obj.block_type, serializer);
11214}
11215
11216template <>
11217template <typename Deserializer>
11219{
11221 obj.block_id = serde::Deserializable<decltype(obj.block_id)>::deserialize(deserializer);
11222 obj.init = serde::Deserializable<decltype(obj.init)>::deserialize(deserializer);
11223 obj.block_type = serde::Deserializable<decltype(obj.block_type)>::deserialize(deserializer);
11224 return obj;
11225}
11226
11227namespace Acir {
11228
11229inline bool operator==(const Opcode::BrilligCall& lhs, const Opcode::BrilligCall& rhs)
11230{
11231 if (!(lhs.id == rhs.id)) {
11232 return false;
11233 }
11234 if (!(lhs.inputs == rhs.inputs)) {
11235 return false;
11236 }
11237 if (!(lhs.outputs == rhs.outputs)) {
11238 return false;
11239 }
11240 if (!(lhs.predicate == rhs.predicate)) {
11241 return false;
11242 }
11243 return true;
11244}
11245
11246inline std::vector<uint8_t> Opcode::BrilligCall::bincodeSerialize() const
11247{
11248 auto serializer = serde::BincodeSerializer();
11250 return std::move(serializer).bytes();
11251}
11252
11254{
11255 auto deserializer = serde::BincodeDeserializer(input);
11257 if (deserializer.get_buffer_offset() < input.size()) {
11258 throw_or_abort("Some input bytes were not read");
11259 }
11260 return value;
11261}
11262
11263} // end of namespace Acir
11264
11265template <>
11266template <typename Serializer>
11268 Serializer& serializer)
11269{
11270 serde::Serializable<decltype(obj.id)>::serialize(obj.id, serializer);
11271 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
11272 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
11273 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
11274}
11275
11276template <>
11277template <typename Deserializer>
11279{
11281 obj.id = serde::Deserializable<decltype(obj.id)>::deserialize(deserializer);
11282 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
11283 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
11284 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
11285 return obj;
11286}
11287
11288namespace Acir {
11289
11290inline bool operator==(const Opcode::Call& lhs, const Opcode::Call& rhs)
11291{
11292 if (!(lhs.id == rhs.id)) {
11293 return false;
11294 }
11295 if (!(lhs.inputs == rhs.inputs)) {
11296 return false;
11297 }
11298 if (!(lhs.outputs == rhs.outputs)) {
11299 return false;
11300 }
11301 if (!(lhs.predicate == rhs.predicate)) {
11302 return false;
11303 }
11304 return true;
11305}
11306
11307inline std::vector<uint8_t> Opcode::Call::bincodeSerialize() const
11308{
11309 auto serializer = serde::BincodeSerializer();
11311 return std::move(serializer).bytes();
11312}
11313
11314inline Opcode::Call Opcode::Call::bincodeDeserialize(std::vector<uint8_t> input)
11315{
11316 auto deserializer = serde::BincodeDeserializer(input);
11318 if (deserializer.get_buffer_offset() < input.size()) {
11319 throw_or_abort("Some input bytes were not read");
11320 }
11321 return value;
11322}
11323
11324} // end of namespace Acir
11325
11326template <>
11327template <typename Serializer>
11329{
11330 serde::Serializable<decltype(obj.id)>::serialize(obj.id, serializer);
11331 serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
11332 serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
11333 serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
11334}
11335
11336template <>
11337template <typename Deserializer>
11339{
11341 obj.id = serde::Deserializable<decltype(obj.id)>::deserialize(deserializer);
11342 obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
11343 obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
11344 obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
11345 return obj;
11346}
11347
11348namespace Acir {
11349
11350inline bool operator==(const OpcodeLocation& lhs, const OpcodeLocation& rhs)
11351{
11352 if (!(lhs.value == rhs.value)) {
11353 return false;
11354 }
11355 return true;
11356}
11357
11358inline std::vector<uint8_t> OpcodeLocation::bincodeSerialize() const
11359{
11360 auto serializer = serde::BincodeSerializer();
11362 return std::move(serializer).bytes();
11363}
11364
11365inline OpcodeLocation OpcodeLocation::bincodeDeserialize(std::vector<uint8_t> input)
11366{
11367 auto deserializer = serde::BincodeDeserializer(input);
11369 if (deserializer.get_buffer_offset() < input.size()) {
11370 throw_or_abort("Some input bytes were not read");
11371 }
11372 return value;
11373}
11374
11375} // end of namespace Acir
11376
11377template <>
11378template <typename Serializer>
11380{
11381 serializer.increase_container_depth();
11382 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11383 serializer.decrease_container_depth();
11384}
11385
11386template <>
11387template <typename Deserializer>
11389{
11390 deserializer.increase_container_depth();
11392 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11393 deserializer.decrease_container_depth();
11394 return obj;
11395}
11396
11397namespace Acir {
11398
11399inline bool operator==(const OpcodeLocation::Acir& lhs, const OpcodeLocation::Acir& rhs)
11400{
11401 if (!(lhs.value == rhs.value)) {
11402 return false;
11403 }
11404 return true;
11405}
11406
11407inline std::vector<uint8_t> OpcodeLocation::Acir::bincodeSerialize() const
11408{
11409 auto serializer = serde::BincodeSerializer();
11411 return std::move(serializer).bytes();
11412}
11413
11415{
11416 auto deserializer = serde::BincodeDeserializer(input);
11418 if (deserializer.get_buffer_offset() < input.size()) {
11419 throw_or_abort("Some input bytes were not read");
11420 }
11421 return value;
11422}
11423
11424} // end of namespace Acir
11425
11426template <>
11427template <typename Serializer>
11429 Serializer& serializer)
11430{
11431 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11432}
11433
11434template <>
11435template <typename Deserializer>
11437{
11439 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11440 return obj;
11441}
11442
11443namespace Acir {
11444
11446{
11447 if (!(lhs.acir_index == rhs.acir_index)) {
11448 return false;
11449 }
11450 if (!(lhs.brillig_index == rhs.brillig_index)) {
11451 return false;
11452 }
11453 return true;
11454}
11455
11456inline std::vector<uint8_t> OpcodeLocation::Brillig::bincodeSerialize() const
11457{
11458 auto serializer = serde::BincodeSerializer();
11460 return std::move(serializer).bytes();
11461}
11462
11464{
11465 auto deserializer = serde::BincodeDeserializer(input);
11467 if (deserializer.get_buffer_offset() < input.size()) {
11468 throw_or_abort("Some input bytes were not read");
11469 }
11470 return value;
11471}
11472
11473} // end of namespace Acir
11474
11475template <>
11476template <typename Serializer>
11478 Serializer& serializer)
11479{
11480 serde::Serializable<decltype(obj.acir_index)>::serialize(obj.acir_index, serializer);
11481 serde::Serializable<decltype(obj.brillig_index)>::serialize(obj.brillig_index, serializer);
11482}
11483
11484template <>
11485template <typename Deserializer>
11487 Deserializer& deserializer)
11488{
11490 obj.acir_index = serde::Deserializable<decltype(obj.acir_index)>::deserialize(deserializer);
11491 obj.brillig_index = serde::Deserializable<decltype(obj.brillig_index)>::deserialize(deserializer);
11492 return obj;
11493}
11494
11495namespace Acir {
11496
11497inline bool operator==(const Program& lhs, const Program& rhs)
11498{
11499 if (!(lhs.functions == rhs.functions)) {
11500 return false;
11501 }
11503 return false;
11504 }
11505 return true;
11506}
11507
11508inline std::vector<uint8_t> Program::bincodeSerialize() const
11509{
11510 auto serializer = serde::BincodeSerializer();
11511 serde::Serializable<Program>::serialize(*this, serializer);
11512 return std::move(serializer).bytes();
11513}
11514
11515inline Program Program::bincodeDeserialize(std::vector<uint8_t> input)
11516{
11517 auto deserializer = serde::BincodeDeserializer(input);
11519 if (deserializer.get_buffer_offset() < input.size()) {
11520 throw_or_abort("Some input bytes were not read");
11521 }
11522 return value;
11523}
11524
11525} // end of namespace Acir
11526
11527template <>
11528template <typename Serializer>
11529void serde::Serializable<Acir::Program>::serialize(const Acir::Program& obj, Serializer& serializer)
11530{
11531 serializer.increase_container_depth();
11532 serde::Serializable<decltype(obj.functions)>::serialize(obj.functions, serializer);
11533 serde::Serializable<decltype(obj.unconstrained_functions)>::serialize(obj.unconstrained_functions, serializer);
11534 serializer.decrease_container_depth();
11535}
11536
11537template <>
11538template <typename Deserializer>
11540{
11541 deserializer.increase_container_depth();
11542 Acir::Program obj;
11543 obj.functions = serde::Deserializable<decltype(obj.functions)>::deserialize(deserializer);
11545 serde::Deserializable<decltype(obj.unconstrained_functions)>::deserialize(deserializer);
11546 deserializer.decrease_container_depth();
11547 return obj;
11548}
11549
11550namespace Acir {
11551
11552inline bool operator==(const ProgramWithoutBrillig& lhs, const ProgramWithoutBrillig& rhs)
11553{
11554 if (!(lhs.functions == rhs.functions)) {
11555 return false;
11556 }
11558 return false;
11559 }
11560 return true;
11561}
11562
11563inline std::vector<uint8_t> ProgramWithoutBrillig::bincodeSerialize() const
11564{
11565 auto serializer = serde::BincodeSerializer();
11567 return std::move(serializer).bytes();
11568}
11569
11571{
11572 auto deserializer = serde::BincodeDeserializer(input);
11574 if (deserializer.get_buffer_offset() < input.size()) {
11575 throw_or_abort("Some input bytes were not read");
11576 }
11577 return value;
11578}
11579
11580} // end of namespace Acir
11581
11582template <>
11583template <typename Serializer>
11585 Serializer& serializer)
11586{
11587 serializer.increase_container_depth();
11588 serde::Serializable<decltype(obj.functions)>::serialize(obj.functions, serializer);
11589 serde::Serializable<decltype(obj.unconstrained_functions)>::serialize(obj.unconstrained_functions, serializer);
11590 serializer.decrease_container_depth();
11591}
11592
11593template <>
11594template <typename Deserializer>
11596{
11597 deserializer.increase_container_depth();
11599 obj.functions = serde::Deserializable<decltype(obj.functions)>::deserialize(deserializer);
11601 serde::Deserializable<decltype(obj.unconstrained_functions)>::deserialize(deserializer);
11602 deserializer.decrease_container_depth();
11603 return obj;
11604}
11605
11606namespace Acir {
11607
11608inline bool operator==(const PublicInputs& lhs, const PublicInputs& rhs)
11609{
11610 if (!(lhs.value == rhs.value)) {
11611 return false;
11612 }
11613 return true;
11614}
11615
11616inline std::vector<uint8_t> PublicInputs::bincodeSerialize() const
11617{
11618 auto serializer = serde::BincodeSerializer();
11620 return std::move(serializer).bytes();
11621}
11622
11623inline PublicInputs PublicInputs::bincodeDeserialize(std::vector<uint8_t> input)
11624{
11625 auto deserializer = serde::BincodeDeserializer(input);
11627 if (deserializer.get_buffer_offset() < input.size()) {
11628 throw_or_abort("Some input bytes were not read");
11629 }
11630 return value;
11631}
11632
11633} // end of namespace Acir
11634
11635template <>
11636template <typename Serializer>
11638{
11639 serializer.increase_container_depth();
11640 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11641 serializer.decrease_container_depth();
11642}
11643
11644template <>
11645template <typename Deserializer>
11647{
11648 deserializer.increase_container_depth();
11650 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11651 deserializer.decrease_container_depth();
11652 return obj;
11653}
11654
11655namespace Acir {
11656
11657inline bool operator==(const ValueOrArray& lhs, const ValueOrArray& rhs)
11658{
11659 if (!(lhs.value == rhs.value)) {
11660 return false;
11661 }
11662 return true;
11663}
11664
11665inline std::vector<uint8_t> ValueOrArray::bincodeSerialize() const
11666{
11667 auto serializer = serde::BincodeSerializer();
11669 return std::move(serializer).bytes();
11670}
11671
11672inline ValueOrArray ValueOrArray::bincodeDeserialize(std::vector<uint8_t> input)
11673{
11674 auto deserializer = serde::BincodeDeserializer(input);
11676 if (deserializer.get_buffer_offset() < input.size()) {
11677 throw_or_abort("Some input bytes were not read");
11678 }
11679 return value;
11680}
11681
11682} // end of namespace Acir
11683
11684template <>
11685template <typename Serializer>
11687{
11688 serializer.increase_container_depth();
11689 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11690 serializer.decrease_container_depth();
11691}
11692
11693template <>
11694template <typename Deserializer>
11696{
11697 deserializer.increase_container_depth();
11699 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11700 deserializer.decrease_container_depth();
11701 return obj;
11702}
11703
11704namespace Acir {
11705
11707{
11708 if (!(lhs.value == rhs.value)) {
11709 return false;
11710 }
11711 return true;
11712}
11713
11714inline std::vector<uint8_t> ValueOrArray::MemoryAddress::bincodeSerialize() const
11715{
11716 auto serializer = serde::BincodeSerializer();
11718 return std::move(serializer).bytes();
11719}
11720
11722{
11723 auto deserializer = serde::BincodeDeserializer(input);
11725 if (deserializer.get_buffer_offset() < input.size()) {
11726 throw_or_abort("Some input bytes were not read");
11727 }
11728 return value;
11729}
11730
11731} // end of namespace Acir
11732
11733template <>
11734template <typename Serializer>
11736 Serializer& serializer)
11737{
11738 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11739}
11740
11741template <>
11742template <typename Deserializer>
11744 Deserializer& deserializer)
11745{
11747 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11748 return obj;
11749}
11750
11751namespace Acir {
11752
11754{
11755 if (!(lhs.value == rhs.value)) {
11756 return false;
11757 }
11758 return true;
11759}
11760
11761inline std::vector<uint8_t> ValueOrArray::HeapArray::bincodeSerialize() const
11762{
11763 auto serializer = serde::BincodeSerializer();
11765 return std::move(serializer).bytes();
11766}
11767
11769{
11770 auto deserializer = serde::BincodeDeserializer(input);
11772 if (deserializer.get_buffer_offset() < input.size()) {
11773 throw_or_abort("Some input bytes were not read");
11774 }
11775 return value;
11776}
11777
11778} // end of namespace Acir
11779
11780template <>
11781template <typename Serializer>
11783 Serializer& serializer)
11784{
11785 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11786}
11787
11788template <>
11789template <typename Deserializer>
11791 Deserializer& deserializer)
11792{
11794 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11795 return obj;
11796}
11797
11798namespace Acir {
11799
11801{
11802 if (!(lhs.value == rhs.value)) {
11803 return false;
11804 }
11805 return true;
11806}
11807
11808inline std::vector<uint8_t> ValueOrArray::HeapVector::bincodeSerialize() const
11809{
11810 auto serializer = serde::BincodeSerializer();
11812 return std::move(serializer).bytes();
11813}
11814
11816{
11817 auto deserializer = serde::BincodeDeserializer(input);
11819 if (deserializer.get_buffer_offset() < input.size()) {
11820 throw_or_abort("Some input bytes were not read");
11821 }
11822 return value;
11823}
11824
11825} // end of namespace Acir
11826
11827template <>
11828template <typename Serializer>
11830 Serializer& serializer)
11831{
11832 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11833}
11834
11835template <>
11836template <typename Deserializer>
11838 Deserializer& deserializer)
11839{
11841 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11842 return obj;
11843}
11844
11845namespace Acir {
11846
11847inline bool operator==(const Witness& lhs, const Witness& rhs)
11848{
11849 if (!(lhs.value == rhs.value)) {
11850 return false;
11851 }
11852 return true;
11853}
11854
11855inline std::vector<uint8_t> Witness::bincodeSerialize() const
11856{
11857 auto serializer = serde::BincodeSerializer();
11858 serde::Serializable<Witness>::serialize(*this, serializer);
11859 return std::move(serializer).bytes();
11860}
11861
11862inline Witness Witness::bincodeDeserialize(std::vector<uint8_t> input)
11863{
11864 auto deserializer = serde::BincodeDeserializer(input);
11866 if (deserializer.get_buffer_offset() < input.size()) {
11867 throw_or_abort("Some input bytes were not read");
11868 }
11869 return value;
11870}
11871
11872} // end of namespace Acir
11873
11874template <>
11875template <typename Serializer>
11876void serde::Serializable<Acir::Witness>::serialize(const Acir::Witness& obj, Serializer& serializer)
11877{
11878 serializer.increase_container_depth();
11879 serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
11880 serializer.decrease_container_depth();
11881}
11882
11883template <>
11884template <typename Deserializer>
11886{
11887 deserializer.increase_container_depth();
11888 Acir::Witness obj;
11889 obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
11890 deserializer.decrease_container_depth();
11891 return obj;
11892}
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:13
bool operator==(const AssertionPayload &lhs, const AssertionPayload &rhs)
Definition acir.hpp:5273
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:5291
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5284
uint64_t error_selector
Definition acir.hpp:4819
std::vector< Acir::ExpressionOrMemory > payload
Definition acir.hpp:4820
friend bool operator==(const AssertionPayload &, const AssertionPayload &)
Definition acir.hpp:5273
void msgpack_pack(auto &packer) const
Definition acir.hpp:4826
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4833
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:84
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5381
void msgpack_pack(auto &packer) const
Definition acir.hpp:83
static Add bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5388
friend bool operator==(const Add &, const Add &)
Definition acir.hpp:5376
void msgpack_pack(auto &packer) const
Definition acir.hpp:110
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:111
friend bool operator==(const Div &, const Div &)
Definition acir.hpp:5496
static Div bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5508
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5501
void msgpack_pack(auto &packer) const
Definition acir.hpp:128
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5582
static Equals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5589
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:129
friend bool operator==(const Equals &, const Equals &)
Definition acir.hpp:5577
static IntegerDiv bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5548
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5541
friend bool operator==(const IntegerDiv &, const IntegerDiv &)
Definition acir.hpp:5536
void msgpack_pack(auto &packer) const
Definition acir.hpp:119
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:120
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5663
friend bool operator==(const LessThanEquals &, const LessThanEquals &)
Definition acir.hpp:5658
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:147
void msgpack_pack(auto &packer) const
Definition acir.hpp:146
static LessThanEquals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5670
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:138
static LessThan bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5629
void msgpack_pack(auto &packer) const
Definition acir.hpp:137
friend bool operator==(const LessThan &, const LessThan &)
Definition acir.hpp:5617
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5622
void msgpack_pack(auto &packer) const
Definition acir.hpp:101
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:102
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5461
friend bool operator==(const Mul &, const Mul &)
Definition acir.hpp:5456
static Mul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5468
void msgpack_pack(auto &packer) const
Definition acir.hpp:92
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:93
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5421
friend bool operator==(const Sub &, const Sub &)
Definition acir.hpp:5416
static Sub bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5428
std::variant< Add, Sub, Mul, Div, IntegerDiv, Equals, LessThan, LessThanEquals > value
Definition acir.hpp:150
void msgpack_pack(auto &packer) const
Definition acir.hpp:156
static BinaryFieldOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5342
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:210
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5335
friend bool operator==(const BinaryFieldOp &, const BinaryFieldOp &)
Definition acir.hpp:5327
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5753
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:270
static Add bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5760
friend bool operator==(const Add &, const Add &)
Definition acir.hpp:5748
void msgpack_pack(auto &packer) const
Definition acir.hpp:269
void msgpack_pack(auto &packer) const
Definition acir.hpp:332
static And bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6037
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6030
friend bool operator==(const And &, const And &)
Definition acir.hpp:6025
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:333
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:297
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5870
static Div bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5877
friend bool operator==(const Div &, const Div &)
Definition acir.hpp:5865
void msgpack_pack(auto &packer) const
Definition acir.hpp:296
void msgpack_pack(auto &packer) const
Definition acir.hpp:305
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:306
static Equals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5916
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5909
friend bool operator==(const Equals &, const Equals &)
Definition acir.hpp:5904
friend bool operator==(const LessThanEquals &, const LessThanEquals &)
Definition acir.hpp:5984
static LessThanEquals bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5996
void msgpack_pack(auto &packer) const
Definition acir.hpp:323
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5989
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:324
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5949
static LessThan bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5956
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:315
friend bool operator==(const LessThan &, const LessThan &)
Definition acir.hpp:5944
void msgpack_pack(auto &packer) const
Definition acir.hpp:314
void msgpack_pack(auto &packer) const
Definition acir.hpp:287
friend bool operator==(const Mul &, const Mul &)
Definition acir.hpp:5826
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5831
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:288
static Mul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5838
static Or bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6076
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6069
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:342
void msgpack_pack(auto &packer) const
Definition acir.hpp:341
friend bool operator==(const Or &, const Or &)
Definition acir.hpp:6064
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6147
friend bool operator==(const Shl &, const Shl &)
Definition acir.hpp:6142
static Shl bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6154
void msgpack_pack(auto &packer) const
Definition acir.hpp:359
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:360
void msgpack_pack(auto &packer) const
Definition acir.hpp:368
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:369
friend bool operator==(const Shr &, const Shr &)
Definition acir.hpp:6181
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6186
static Shr bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6193
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:279
void msgpack_pack(auto &packer) const
Definition acir.hpp:278
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5792
static Sub bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5799
friend bool operator==(const Sub &, const Sub &)
Definition acir.hpp:5787
friend bool operator==(const Xor &, const Xor &)
Definition acir.hpp:6103
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:351
void msgpack_pack(auto &packer) const
Definition acir.hpp:350
static Xor bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6115
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6108
void msgpack_pack(auto &packer) const
Definition acir.hpp:378
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:5707
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:448
static BinaryIntOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:5714
std::variant< Add, Sub, Mul, Div, Equals, LessThan, LessThanEquals, And, Or, Xor, Shl, Shr > value
Definition acir.hpp:372
friend bool operator==(const BinaryIntOp &, const BinaryIntOp &)
Definition acir.hpp:5699
static Field bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6281
friend bool operator==(const Field &, const Field &)
Definition acir.hpp:6269
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:674
void msgpack_pack(auto &packer) const
Definition acir.hpp:673
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6274
Acir::IntegerBitSize value
Definition acir.hpp:678
static Integer bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6323
friend bool operator==(const Integer &, const Integer &)
Definition acir.hpp:6308
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6316
void msgpack_pack(auto &packer) const
Definition acir.hpp:684
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:686
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6228
std::variant< Field, Integer > value
Definition acir.hpp:697
static BitSize bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6235
friend bool operator==(const BitSize &, const BitSize &)
Definition acir.hpp:6220
void msgpack_pack(auto &packer) const
Definition acir.hpp:703
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:733
void msgpack_pack(auto &packer) const
Definition acir.hpp:3064
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > key
Definition acir.hpp:3057
std::vector< Acir::Witness > outputs
Definition acir.hpp:3058
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6419
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3055
friend bool operator==(const AES128Encrypt &, const AES128Encrypt &)
Definition acir.hpp:6402
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3073
static AES128Encrypt bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6426
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > iv
Definition acir.hpp:3056
friend bool operator==(const AND &, const AND &)
Definition acir.hpp:6464
static AND bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6488
Acir::FunctionInput lhs
Definition acir.hpp:3095
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3113
Acir::FunctionInput rhs
Definition acir.hpp:3096
void msgpack_pack(auto &packer) const
Definition acir.hpp:3104
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6481
std::shared_ptr< std::array< Acir::Witness, 32 > > outputs
Definition acir.hpp:3208
static Blake2s bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6656
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6649
void msgpack_pack(auto &packer) const
Definition acir.hpp:3214
friend bool operator==(const Blake2s &, const Blake2s &)
Definition acir.hpp:6638
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3207
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3221
void msgpack_pack(auto &packer) const
Definition acir.hpp:3246
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3253
static Blake3 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6708
std::shared_ptr< std::array< Acir::Witness, 32 > > outputs
Definition acir.hpp:3240
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6701
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3239
friend bool operator==(const Blake3 &, const Blake3 &)
Definition acir.hpp:6690
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6765
static EcdsaSecp256k1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6772
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_x
Definition acir.hpp:3271
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > hashed_message
Definition acir.hpp:3274
void msgpack_pack(auto &packer) const
Definition acir.hpp:3282
friend bool operator==(const EcdsaSecp256k1 &, const EcdsaSecp256k1 &)
Definition acir.hpp:6742
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_y
Definition acir.hpp:3272
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3293
std::shared_ptr< std::array< Acir::FunctionInput, 64 > > signature
Definition acir.hpp:3273
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_x
Definition acir.hpp:3319
static EcdsaSecp256r1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6844
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6837
friend bool operator==(const EcdsaSecp256r1 &, const EcdsaSecp256r1 &)
Definition acir.hpp:6814
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3341
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > hashed_message
Definition acir.hpp:3322
void msgpack_pack(auto &packer) const
Definition acir.hpp:3330
std::shared_ptr< std::array< Acir::FunctionInput, 32 > > public_key_y
Definition acir.hpp:3320
std::shared_ptr< std::array< Acir::FunctionInput, 64 > > signature
Definition acir.hpp:3321
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6965
std::shared_ptr< std::array< Acir::Witness, 3 > > outputs
Definition acir.hpp:3410
friend bool operator==(const EmbeddedCurveAdd &, const EmbeddedCurveAdd &)
Definition acir.hpp:6948
void msgpack_pack(auto &packer) const
Definition acir.hpp:3416
std::shared_ptr< std::array< Acir::FunctionInput, 3 > > input2
Definition acir.hpp:3408
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3425
std::shared_ptr< std::array< Acir::FunctionInput, 3 > > input1
Definition acir.hpp:3407
static EmbeddedCurveAdd bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6972
std::shared_ptr< std::array< Acir::FunctionInput, 25 > > inputs
Definition acir.hpp:3447
friend bool operator==(const Keccakf1600 &, const Keccakf1600 &)
Definition acir.hpp:7011
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3461
static Keccakf1600 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7029
void msgpack_pack(auto &packer) const
Definition acir.hpp:3454
std::shared_ptr< std::array< Acir::Witness, 25 > > outputs
Definition acir.hpp:3448
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7022
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6903
std::vector< Acir::FunctionInput > scalars
Definition acir.hpp:3368
std::vector< Acir::FunctionInput > points
Definition acir.hpp:3367
std::shared_ptr< std::array< Acir::Witness, 3 > > outputs
Definition acir.hpp:3370
static MultiScalarMul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6910
friend bool operator==(const MultiScalarMul &, const MultiScalarMul &)
Definition acir.hpp:6886
void msgpack_pack(auto &packer) const
Definition acir.hpp:3376
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3385
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7149
std::vector< Acir::Witness > outputs
Definition acir.hpp:3528
std::vector< Acir::FunctionInput > inputs
Definition acir.hpp:3527
static Poseidon2Permutation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7156
void msgpack_pack(auto &packer) const
Definition acir.hpp:3534
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3541
friend bool operator==(const Poseidon2Permutation &, const Poseidon2Permutation &)
Definition acir.hpp:7137
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3189
friend bool operator==(const RANGE &, const RANGE &)
Definition acir.hpp:6586
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6597
void msgpack_pack(auto &packer) const
Definition acir.hpp:3182
static RANGE bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6604
Acir::FunctionInput input
Definition acir.hpp:3175
std::vector< Acir::FunctionInput > verification_key
Definition acir.hpp:3479
std::vector< Acir::FunctionInput > proof
Definition acir.hpp:3480
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7087
void msgpack_pack(auto &packer) const
Definition acir.hpp:3490
std::vector< Acir::FunctionInput > public_inputs
Definition acir.hpp:3481
static RecursiveAggregation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7094
friend bool operator==(const RecursiveAggregation &, const RecursiveAggregation &)
Definition acir.hpp:7063
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3501
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3575
static Sha256Compression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7212
std::shared_ptr< std::array< Acir::FunctionInput, 8 > > hash_values
Definition acir.hpp:3560
friend bool operator==(const Sha256Compression &, const Sha256Compression &)
Definition acir.hpp:7191
std::shared_ptr< std::array< Acir::FunctionInput, 16 > > inputs
Definition acir.hpp:3559
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7205
std::shared_ptr< std::array< Acir::Witness, 8 > > outputs
Definition acir.hpp:3561
void msgpack_pack(auto &packer) const
Definition acir.hpp:3567
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3153
Acir::FunctionInput rhs
Definition acir.hpp:3136
Acir::FunctionInput lhs
Definition acir.hpp:3135
static XOR bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6549
void msgpack_pack(auto &packer) const
Definition acir.hpp:3144
friend bool operator==(const XOR &, const XOR &)
Definition acir.hpp:6525
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6542
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:6361
void msgpack_pack(auto &packer) const
Definition acir.hpp:3614
friend bool operator==(const BlackBoxFuncCall &, const BlackBoxFuncCall &)
Definition acir.hpp:6353
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3692
std::variant< AES128Encrypt, AND, XOR, RANGE, Blake2s, Blake3, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Keccakf1600, RecursiveAggregation, Poseidon2Permutation, Sha256Compression > value
Definition acir.hpp:3608
static BlackBoxFuncCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:6368
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:985
void msgpack_pack(auto &packer) const
Definition acir.hpp:976
Acir::HeapVector outputs
Definition acir.hpp:970
friend bool operator==(const AES128Encrypt &, const AES128Encrypt &)
Definition acir.hpp:7298
Acir::HeapVector inputs
Definition acir.hpp:967
static AES128Encrypt bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7322
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7315
Acir::HeapVector message
Definition acir.hpp:1007
static Blake2s bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7378
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7371
Acir::HeapArray output
Definition acir.hpp:1008
friend bool operator==(const Blake2s &, const Blake2s &)
Definition acir.hpp:7360
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1021
void msgpack_pack(auto &packer) const
Definition acir.hpp:1014
Acir::HeapArray output
Definition acir.hpp:1040
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7422
void msgpack_pack(auto &packer) const
Definition acir.hpp:1046
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1053
Acir::HeapVector message
Definition acir.hpp:1039
static Blake3 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7429
friend bool operator==(const Blake3 &, const Blake3 &)
Definition acir.hpp:7411
Acir::MemoryAddress result
Definition acir.hpp:1107
static EcdsaSecp256k1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7541
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7534
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1123
Acir::HeapVector hashed_msg
Definition acir.hpp:1103
friend bool operator==(const EcdsaSecp256k1 &, const EcdsaSecp256k1 &)
Definition acir.hpp:7514
void msgpack_pack(auto &packer) const
Definition acir.hpp:1113
Acir::MemoryAddress result
Definition acir.hpp:1151
Acir::HeapVector hashed_msg
Definition acir.hpp:1147
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1167
friend bool operator==(const EcdsaSecp256r1 &, const EcdsaSecp256r1 &)
Definition acir.hpp:7581
void msgpack_pack(auto &packer) const
Definition acir.hpp:1157
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7601
static EcdsaSecp256r1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7608
static EmbeddedCurveAdd bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7738
Acir::MemoryAddress input1_x
Definition acir.hpp:1227
friend bool operator==(const EmbeddedCurveAdd &, const EmbeddedCurveAdd &)
Definition acir.hpp:7705
Acir::MemoryAddress input2_infinite
Definition acir.hpp:1232
Acir::MemoryAddress input1_y
Definition acir.hpp:1228
Acir::MemoryAddress input1_infinite
Definition acir.hpp:1229
Acir::MemoryAddress input2_x
Definition acir.hpp:1230
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7731
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1251
void msgpack_pack(auto &packer) const
Definition acir.hpp:1239
Acir::MemoryAddress input2_y
Definition acir.hpp:1231
static Keccakf1600 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7480
friend bool operator==(const Keccakf1600 &, const Keccakf1600 &)
Definition acir.hpp:7462
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7473
void msgpack_pack(auto &packer) const
Definition acir.hpp:1078
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1085
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7662
friend bool operator==(const MultiScalarMul &, const MultiScalarMul &)
Definition acir.hpp:7648
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1207
void msgpack_pack(auto &packer) const
Definition acir.hpp:1199
static MultiScalarMul bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7669
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7793
static Poseidon2Permutation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7800
void msgpack_pack(auto &packer) const
Definition acir.hpp:1286
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1293
friend bool operator==(const Poseidon2Permutation &, const Poseidon2Permutation &)
Definition acir.hpp:7782
friend bool operator==(const Sha256Compression &, const Sha256Compression &)
Definition acir.hpp:7834
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7848
void msgpack_pack(auto &packer) const
Definition acir.hpp:1319
static Sha256Compression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7855
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1327
friend bool operator==(const ToRadix &, const ToRadix &)
Definition acir.hpp:7891
Acir::MemoryAddress output_pointer
Definition acir.hpp:1349
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7911
static ToRadix bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7918
Acir::MemoryAddress radix
Definition acir.hpp:1348
Acir::MemoryAddress output_bits
Definition acir.hpp:1351
Acir::MemoryAddress input
Definition acir.hpp:1347
Acir::MemoryAddress num_limbs
Definition acir.hpp:1350
void msgpack_pack(auto &packer) const
Definition acir.hpp:1357
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1367
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1473
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7257
void msgpack_pack(auto &packer) const
Definition acir.hpp:1407
friend bool operator==(const BlackBoxOp &, const BlackBoxOp &)
Definition acir.hpp:7249
std::variant< AES128Encrypt, Blake2s, Blake3, Keccakf1600, EcdsaSecp256k1, EcdsaSecp256r1, MultiScalarMul, EmbeddedCurveAdd, Poseidon2Permutation, Sha256Compression, ToRadix > value
Definition acir.hpp:1401
static BlackBoxOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7264
void msgpack_pack(auto &packer) const
Definition acir.hpp:3867
friend bool operator==(const BlockId &, const BlockId &)
Definition acir.hpp:7957
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3869
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:7965
static BlockId bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:7972
uint32_t value
Definition acir.hpp:3861
static CallData bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8109
friend bool operator==(const CallData &, const CallData &)
Definition acir.hpp:8094
void msgpack_pack(auto &packer) const
Definition acir.hpp:3898
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8102
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3900
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3888
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8060
friend bool operator==(const Memory &, const Memory &)
Definition acir.hpp:8055
void msgpack_pack(auto &packer) const
Definition acir.hpp:3887
static Memory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8067
static ReturnData bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8152
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3917
friend bool operator==(const ReturnData &, const ReturnData &)
Definition acir.hpp:8140
void msgpack_pack(auto &packer) const
Definition acir.hpp:3916
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8145
void msgpack_pack(auto &packer) const
Definition acir.hpp:3926
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8014
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3960
static BlockType bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8021
std::variant< Memory, CallData, ReturnData > value
Definition acir.hpp:3920
friend bool operator==(const BlockType &, const BlockType &)
Definition acir.hpp:8006
void msgpack_pack(auto &packer) const
Definition acir.hpp:5068
static BrilligBytecode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8198
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8191
friend bool operator==(const BrilligBytecode &, const BrilligBytecode &)
Definition acir.hpp:8180
std::vector< Acir::BrilligOpcode > bytecode
Definition acir.hpp:5062
std::string function_name
Definition acir.hpp:5061
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5075
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4071
void msgpack_pack(auto &packer) const
Definition acir.hpp:4069
std::vector< Acir::Expression > value
Definition acir.hpp:4063
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8344
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8337
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:8329
static MemoryArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8390
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8383
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4091
void msgpack_pack(auto &packer) const
Definition acir.hpp:4089
friend bool operator==(const MemoryArray &, const MemoryArray &)
Definition acir.hpp:8375
Acir::Expression value
Definition acir.hpp:4043
static Single bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8298
friend bool operator==(const Single &, const Single &)
Definition acir.hpp:8283
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4051
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8291
void msgpack_pack(auto &packer) const
Definition acir.hpp:4049
static BrilligInputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8249
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4142
std::variant< Single, Array, MemoryArray > value
Definition acir.hpp:4102
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8242
void msgpack_pack(auto &packer) const
Definition acir.hpp:4108
friend bool operator==(const BrilligInputs &, const BrilligInputs &)
Definition acir.hpp:8234
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8488
static BinaryFieldOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8495
void msgpack_pack(auto &packer) const
Definition acir.hpp:1965
friend bool operator==(const BinaryFieldOp &, const BinaryFieldOp &)
Definition acir.hpp:8471
Acir::MemoryAddress destination
Definition acir.hpp:1956
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1974
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2016
Acir::MemoryAddress destination
Definition acir.hpp:1996
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8553
Acir::MemoryAddress rhs
Definition acir.hpp:2000
static BinaryIntOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8560
void msgpack_pack(auto &packer) const
Definition acir.hpp:2006
friend bool operator==(const BinaryIntOp &, const BinaryIntOp &)
Definition acir.hpp:8533
Acir::IntegerBitSize bit_size
Definition acir.hpp:1998
Acir::MemoryAddress lhs
Definition acir.hpp:1999
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2505
static BlackBox bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9363
Acir::BlackBoxOp value
Definition acir.hpp:2497
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9356
friend bool operator==(const BlackBox &, const BlackBox &)
Definition acir.hpp:9348
void msgpack_pack(auto &packer) const
Definition acir.hpp:2503
void msgpack_pack(auto &packer) const
Definition acir.hpp:2214
static Call bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8881
friend bool operator==(const Call &, const Call &)
Definition acir.hpp:8866
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8874
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2220
Acir::MemoryAddress offset_address
Definition acir.hpp:2174
static CalldataCopy bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8830
friend bool operator==(const CalldataCopy &, const CalldataCopy &)
Definition acir.hpp:8809
Acir::MemoryAddress destination_address
Definition acir.hpp:2172
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8823
void msgpack_pack(auto &packer) const
Definition acir.hpp:2180
Acir::MemoryAddress size_address
Definition acir.hpp:2173
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2188
Acir::MemoryAddress source
Definition acir.hpp:2077
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2092
void msgpack_pack(auto &packer) const
Definition acir.hpp:2084
Acir::MemoryAddress destination
Definition acir.hpp:2076
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8670
static Cast bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8677
Acir::BitSize bit_size
Definition acir.hpp:2078
friend bool operator==(const Cast &, const Cast &)
Definition acir.hpp:8656
Acir::MemoryAddress source_b
Definition acir.hpp:2395
static ConditionalMov bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9208
friend bool operator==(const ConditionalMov &, const ConditionalMov &)
Definition acir.hpp:9184
Acir::MemoryAddress source_a
Definition acir.hpp:2394
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2411
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9201
void msgpack_pack(auto &packer) const
Definition acir.hpp:2402
Acir::MemoryAddress destination
Definition acir.hpp:2393
Acir::MemoryAddress condition
Definition acir.hpp:2396
static Const bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8933
Acir::BitSize bit_size
Definition acir.hpp:2237
friend bool operator==(const Const &, const Const &)
Definition acir.hpp:8912
std::vector< uint8_t > value
Definition acir.hpp:2238
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2252
void msgpack_pack(auto &packer) const
Definition acir.hpp:2244
Acir::MemoryAddress destination
Definition acir.hpp:2236
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8926
std::vector< Acir::HeapValueType > input_value_types
Definition acir.hpp:2321
std::vector< Acir::HeapValueType > destination_value_types
Definition acir.hpp:2319
static ForeignCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9092
std::vector< Acir::ValueOrArray > destinations
Definition acir.hpp:2318
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9085
friend bool operator==(const ForeignCall &, const ForeignCall &)
Definition acir.hpp:9065
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2337
void msgpack_pack(auto &packer) const
Definition acir.hpp:2327
std::vector< Acir::ValueOrArray > inputs
Definition acir.hpp:2320
std::vector< uint8_t > value
Definition acir.hpp:2274
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8982
void msgpack_pack(auto &packer) const
Definition acir.hpp:2280
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2288
static IndirectConst bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8989
friend bool operator==(const IndirectConst &, const IndirectConst &)
Definition acir.hpp:8968
Acir::MemoryAddress destination_pointer
Definition acir.hpp:2272
void msgpack_pack(auto &packer) const
Definition acir.hpp:2150
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8771
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2156
friend bool operator==(const Jump &, const Jump &)
Definition acir.hpp:8763
static Jump bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8778
void msgpack_pack(auto &packer) const
Definition acir.hpp:2119
Acir::MemoryAddress condition
Definition acir.hpp:2112
static JumpIf bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8730
friend bool operator==(const JumpIf &, const JumpIf &)
Definition acir.hpp:8712
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8723
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2126
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2447
static Load bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9264
Acir::MemoryAddress destination
Definition acir.hpp:2433
Acir::MemoryAddress source_pointer
Definition acir.hpp:2434
friend bool operator==(const Load &, const Load &)
Definition acir.hpp:9246
void msgpack_pack(auto &packer) const
Definition acir.hpp:2440
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9257
Acir::MemoryAddress destination
Definition acir.hpp:2361
friend bool operator==(const Mov &, const Mov &)
Definition acir.hpp:9133
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2375
static Mov bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9151
Acir::MemoryAddress source
Definition acir.hpp:2362
void msgpack_pack(auto &packer) const
Definition acir.hpp:2368
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9144
friend bool operator==(const Not &, const Not &)
Definition acir.hpp:8600
Acir::MemoryAddress source
Definition acir.hpp:2041
void msgpack_pack(auto &packer) const
Definition acir.hpp:2048
static Not bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8621
Acir::IntegerBitSize bit_size
Definition acir.hpp:2042
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8614
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2056
Acir::MemoryAddress destination
Definition acir.hpp:2040
friend bool operator==(const Return &, const Return &)
Definition acir.hpp:9025
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2313
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9030
void msgpack_pack(auto &packer) const
Definition acir.hpp:2312
static Return bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9037
friend bool operator==(const Stop &, const Stop &)
Definition acir.hpp:9441
static Stop bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9456
void msgpack_pack(auto &packer) const
Definition acir.hpp:2551
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9449
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2557
Acir::HeapVector return_data
Definition acir.hpp:2545
static Store bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9315
friend bool operator==(const Store &, const Store &)
Definition acir.hpp:9297
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2479
Acir::MemoryAddress source
Definition acir.hpp:2466
Acir::MemoryAddress destination_pointer
Definition acir.hpp:2465
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9308
void msgpack_pack(auto &packer) const
Definition acir.hpp:2472
friend bool operator==(const Trap &, const Trap &)
Definition acir.hpp:9395
void msgpack_pack(auto &packer) const
Definition acir.hpp:2523
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2529
Acir::HeapVector revert_data
Definition acir.hpp:2517
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9403
static Trap bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9410
static BrilligOpcode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:8437
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:2591
friend bool operator==(const BrilligOpcode &, const BrilligOpcode &)
Definition acir.hpp:8422
void msgpack_pack(auto &packer) const
Definition acir.hpp:2597
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:8430
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2695
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9598
void msgpack_pack(auto &packer) const
Definition acir.hpp:4229
std::vector< Acir::Witness > value
Definition acir.hpp:4223
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9591
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:9583
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4231
void msgpack_pack(auto &packer) const
Definition acir.hpp:4209
friend bool operator==(const Simple &, const Simple &)
Definition acir.hpp:9536
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4211
static Simple bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9551
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9544
friend bool operator==(const BrilligOutputs &, const BrilligOutputs &)
Definition acir.hpp:9487
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9495
void msgpack_pack(auto &packer) const
Definition acir.hpp:4248
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4278
static BrilligOutputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9502
std::variant< Simple, Array > value
Definition acir.hpp:4242
Acir::PublicInputs return_values
Definition acir.hpp:5014
static Circuit bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9662
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9655
void msgpack_pack(auto &packer) const
Definition acir.hpp:5021
std::vector< Acir::Opcode > opcodes
Definition acir.hpp:5011
friend bool operator==(const Circuit &, const Circuit &)
Definition acir.hpp:9629
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5033
uint32_t current_witness_index
Definition acir.hpp:5010
std::vector< Acir::Witness > private_parameters
Definition acir.hpp:5012
Acir::PublicInputs public_parameters
Definition acir.hpp:5013
std::string function_name
Definition acir.hpp:5009
std::vector< std::tuple< Acir::OpcodeLocation, Acir::AssertionPayload > > assert_messages
Definition acir.hpp:5015
static Expression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9729
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness > > linear_combinations
Definition acir.hpp:4006
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9722
std::vector< uint8_t > q_c
Definition acir.hpp:4007
std::vector< std::tuple< std::vector< uint8_t >, Acir::Witness, Acir::Witness > > mul_terms
Definition acir.hpp:4005
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4021
void msgpack_pack(auto &packer) const
Definition acir.hpp:4013
friend bool operator==(const Expression &, const Expression &)
Definition acir.hpp:9708
void msgpack_pack(auto &packer) const
Definition acir.hpp:4701
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4703
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9825
static Expression bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9832
friend bool operator==(const Expression &, const Expression &)
Definition acir.hpp:9817
void msgpack_pack(auto &packer) const
Definition acir.hpp:4721
friend bool operator==(const Memory &, const Memory &)
Definition acir.hpp:9864
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9872
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4723
static Memory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9879
std::variant< Expression, Memory > value
Definition acir.hpp:4734
void msgpack_pack(auto &packer) const
Definition acir.hpp:4740
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9775
static ExpressionOrMemory bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9782
friend bool operator==(const ExpressionOrMemory &, const ExpressionOrMemory &)
Definition acir.hpp:9767
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4770
void msgpack_pack(auto &packer) const
Definition acir.hpp:5171
friend bool operator==(const Bounded &, const Bounded &)
Definition acir.hpp:10001
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5177
static Bounded bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10016
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10009
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9965
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5161
static Unbounded bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9972
friend bool operator==(const Unbounded &, const Unbounded &)
Definition acir.hpp:9960
void msgpack_pack(auto &packer) const
Definition acir.hpp:5160
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:9919
std::variant< Unbounded, Bounded > value
Definition acir.hpp:5192
void msgpack_pack(auto &packer) const
Definition acir.hpp:5198
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5228
friend bool operator==(const ExpressionWidth &, const ExpressionWidth &)
Definition acir.hpp:9911
static ExpressionWidth bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:9926
std::vector< uint8_t > value
Definition acir.hpp:2929
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2937
static Constant bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10112
friend bool operator==(const Constant &, const Constant &)
Definition acir.hpp:10097
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10105
void msgpack_pack(auto &packer) const
Definition acir.hpp:2935
static Witness bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10159
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10152
void msgpack_pack(auto &packer) const
Definition acir.hpp:2955
friend bool operator==(const Witness &, const Witness &)
Definition acir.hpp:10144
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2957
static FunctionInput bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10063
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:3004
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10056
void msgpack_pack(auto &packer) const
Definition acir.hpp:2974
std::variant< Constant, Witness > value
Definition acir.hpp:2968
friend bool operator==(const FunctionInput &, const FunctionInput &)
Definition acir.hpp:10048
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10202
void msgpack_pack(auto &packer) const
Definition acir.hpp:908
uint64_t size
Definition acir.hpp:902
static HeapArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10209
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:915
friend bool operator==(const HeapArray &, const HeapArray &)
Definition acir.hpp:10191
Acir::MemoryAddress pointer
Definition acir.hpp:901
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10351
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1650
static Array bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10358
void msgpack_pack(auto &packer) const
Definition acir.hpp:1643
friend bool operator==(const Array &, const Array &)
Definition acir.hpp:10340
std::vector< Acir::HeapValueType > value_types
Definition acir.hpp:1636
void msgpack_pack(auto &packer) const
Definition acir.hpp:1622
friend bool operator==(const Simple &, const Simple &)
Definition acir.hpp:10294
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10302
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1624
static Simple bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10309
static Vector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10406
friend bool operator==(const Vector &, const Vector &)
Definition acir.hpp:10391
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1680
void msgpack_pack(auto &packer) const
Definition acir.hpp:1674
std::vector< Acir::HeapValueType > value_types
Definition acir.hpp:1668
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10399
static HeapValueType bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10260
void msgpack_pack(auto &packer) const
Definition acir.hpp:1701
friend bool operator==(const HeapValueType &, const HeapValueType &)
Definition acir.hpp:10245
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10253
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1735
std::variant< Simple, Array, Vector > value
Definition acir.hpp:1695
void msgpack_pack(auto &packer) const
Definition acir.hpp:940
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:947
static HeapVector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10455
friend bool operator==(const HeapVector &, const HeapVector &)
Definition acir.hpp:10437
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10448
Acir::MemoryAddress size
Definition acir.hpp:934
Acir::MemoryAddress pointer
Definition acir.hpp:933
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:34
static std::map< std::string, msgpack::object const * > make_kvmap(msgpack::object const &o, std::string const &name)
Definition acir.hpp:15
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:54
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10745
friend bool operator==(const U128 &, const U128 &)
Definition acir.hpp:10740
static U128 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10752
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:565
void msgpack_pack(auto &packer) const
Definition acir.hpp:564
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:538
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10625
friend bool operator==(const U16 &, const U16 &)
Definition acir.hpp:10620
static U16 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10632
void msgpack_pack(auto &packer) const
Definition acir.hpp:537
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10545
static U1 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10552
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:520
void msgpack_pack(auto &packer) const
Definition acir.hpp:519
friend bool operator==(const U1 &, const U1 &)
Definition acir.hpp:10540
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10665
void msgpack_pack(auto &packer) const
Definition acir.hpp:546
friend bool operator==(const U32 &, const U32 &)
Definition acir.hpp:10660
static U32 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10672
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:547
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10705
static U64 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10712
void msgpack_pack(auto &packer) const
Definition acir.hpp:555
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:556
friend bool operator==(const U64 &, const U64 &)
Definition acir.hpp:10700
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10585
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:529
void msgpack_pack(auto &packer) const
Definition acir.hpp:528
static U8 bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10592
friend bool operator==(const U8 &, const U8 &)
Definition acir.hpp:10580
static IntegerBitSize bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10506
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:620
friend bool operator==(const IntegerBitSize &, const IntegerBitSize &)
Definition acir.hpp:10491
std::variant< U1, U8, U16, U32, U64, U128 > value
Definition acir.hpp:568
void msgpack_pack(auto &packer) const
Definition acir.hpp:574
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10499
Acir::Expression value
Definition acir.hpp:4329
friend bool operator==(const MemOp &, const MemOp &)
Definition acir.hpp:10780
void msgpack_pack(auto &packer) const
Definition acir.hpp:4335
static MemOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10801
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4343
Acir::Expression operation
Definition acir.hpp:4327
Acir::Expression index
Definition acir.hpp:4328
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10794
static Direct bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10903
void msgpack_pack(auto &packer) const
Definition acir.hpp:783
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10896
friend bool operator==(const Direct &, const Direct &)
Definition acir.hpp:10888
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:785
void msgpack_pack(auto &packer) const
Definition acir.hpp:803
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10942
static Relative bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10949
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:805
friend bool operator==(const Relative &, const Relative &)
Definition acir.hpp:10934
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10847
static MemoryAddress bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10854
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:852
friend bool operator==(const MemoryAddress &, const MemoryAddress &)
Definition acir.hpp:10839
void msgpack_pack(auto &packer) const
Definition acir.hpp:822
std::variant< Direct, Relative > value
Definition acir.hpp:816
void msgpack_pack(auto &packer) const
Definition acir.hpp:4371
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4373
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11038
Acir::Expression value
Definition acir.hpp:4365
static AssertZero bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11045
friend bool operator==(const AssertZero &, const AssertZero &)
Definition acir.hpp:11030
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11084
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4393
Acir::BlackBoxFuncCall value
Definition acir.hpp:4385
static BlackBoxFuncCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11091
friend bool operator==(const BlackBoxFuncCall &, const BlackBoxFuncCall &)
Definition acir.hpp:11076
void msgpack_pack(auto &packer) const
Definition acir.hpp:4391
std::optional< Acir::Expression > predicate
Definition acir.hpp:4476
friend bool operator==(const BrilligCall &, const BrilligCall &)
Definition acir.hpp:11229
static BrilligCall bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11253
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11246
std::vector< Acir::BrilligInputs > inputs
Definition acir.hpp:4474
void msgpack_pack(auto &packer) const
Definition acir.hpp:4482
std::vector< Acir::BrilligOutputs > outputs
Definition acir.hpp:4475
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4491
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4531
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11307
friend bool operator==(const Call &, const Call &)
Definition acir.hpp:11290
void msgpack_pack(auto &packer) const
Definition acir.hpp:4522
std::vector< Acir::Witness > outputs
Definition acir.hpp:4515
std::optional< Acir::Expression > predicate
Definition acir.hpp:4516
std::vector< Acir::Witness > inputs
Definition acir.hpp:4514
static Call bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11314
Acir::BlockId block_id
Definition acir.hpp:4437
static MemoryInit bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11194
std::vector< Acir::Witness > init
Definition acir.hpp:4438
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11187
Acir::BlockType block_type
Definition acir.hpp:4439
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4453
void msgpack_pack(auto &packer) const
Definition acir.hpp:4445
friend bool operator==(const MemoryInit &, const MemoryInit &)
Definition acir.hpp:11173
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11134
friend bool operator==(const MemoryOp &, const MemoryOp &)
Definition acir.hpp:11123
static MemoryOp bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11141
void msgpack_pack(auto &packer) const
Definition acir.hpp:4412
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4419
Acir::BlockId block_id
Definition acir.hpp:4405
static Opcode bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:10996
std::variant< AssertZero, BlackBoxFuncCall, MemoryOp, MemoryInit, BrilligCall, Call > value
Definition acir.hpp:4552
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4604
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:10989
friend bool operator==(const Opcode &, const Opcode &)
Definition acir.hpp:10981
void msgpack_pack(auto &packer) const
Definition acir.hpp:4558
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4861
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11407
static Acir bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11414
friend bool operator==(const Acir &, const Acir &)
Definition acir.hpp:11399
void msgpack_pack(auto &packer) const
Definition acir.hpp:4859
friend bool operator==(const Brillig &, const Brillig &)
Definition acir.hpp:11445
void msgpack_pack(auto &packer) const
Definition acir.hpp:4880
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11456
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4887
static Brillig bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11463
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11358
friend bool operator==(const OpcodeLocation &, const OpcodeLocation &)
Definition acir.hpp:11350
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4940
static OpcodeLocation bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11365
std::variant< Acir, Brillig > value
Definition acir.hpp:4904
void msgpack_pack(auto &packer) const
Definition acir.hpp:4910
void msgpack_pack(auto &packer) const
Definition acir.hpp:5100
std::vector< Acir::Circuit > functions
Definition acir.hpp:5093
friend bool operator==(const Program &, const Program &)
Definition acir.hpp:11497
static Program bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11515
std::vector< Acir::BrilligBytecode > unconstrained_functions
Definition acir.hpp:5094
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11508
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5107
void msgpack_pack(auto &packer) const
Definition acir.hpp:5132
std::vector< Acir::Circuit > functions
Definition acir.hpp:5125
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:5138
std::monostate unconstrained_functions
Definition acir.hpp:5126
static ProgramWithoutBrillig bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11570
friend bool operator==(const ProgramWithoutBrillig &, const ProgramWithoutBrillig &)
Definition acir.hpp:11552
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11563
friend bool operator==(const PublicInputs &, const PublicInputs &)
Definition acir.hpp:11608
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11616
static PublicInputs bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11623
std::vector< Acir::Witness > value
Definition acir.hpp:4989
void msgpack_pack(auto &packer) const
Definition acir.hpp:4995
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:4997
static HeapArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11768
void msgpack_pack(auto &packer) const
Definition acir.hpp:1822
friend bool operator==(const HeapArray &, const HeapArray &)
Definition acir.hpp:11753
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1824
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11761
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1844
void msgpack_pack(auto &packer) const
Definition acir.hpp:1842
friend bool operator==(const HeapVector &, const HeapVector &)
Definition acir.hpp:11800
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11808
static HeapVector bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11815
void msgpack_pack(auto &packer) const
Definition acir.hpp:1802
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11714
static MemoryAddress bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11721
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1804
friend bool operator==(const MemoryAddress &, const MemoryAddress &)
Definition acir.hpp:11706
Acir::MemoryAddress value
Definition acir.hpp:1796
void msgpack_pack(auto &packer) const
Definition acir.hpp:1861
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:1895
std::variant< MemoryAddress, HeapArray, HeapVector > value
Definition acir.hpp:1855
static ValueOrArray bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11672
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11665
friend bool operator==(const ValueOrArray &, const ValueOrArray &)
Definition acir.hpp:11657
uint32_t value
Definition acir.hpp:2907
void msgpack_pack(auto &packer) const
Definition acir.hpp:2913
void msgpack_unpack(msgpack::object const &o)
Definition acir.hpp:2915
static Witness bincodeDeserialize(std::vector< uint8_t >)
Definition acir.hpp:11862
friend bool operator==(const Witness &, const Witness &)
Definition acir.hpp:11847
std::vector< uint8_t > bincodeSerialize() const
Definition acir.hpp:11855
static T deserialize(Deserializer &deserializer)
static void serialize(const T &value, Serializer &serializer)
void throw_or_abort(std::string const &err)