From cdd46b4e3ca679d6c818d35a60653571ef0b2d69 Mon Sep 17 00:00:00 2001 From: aakoshh Date: Tue, 25 Mar 2025 22:40:35 +0000 Subject: [PATCH 01/30] Turn on msgpack by default. Add Format::BincodeLegacy --- acvm-repo/acir/src/circuit/mod.rs | 4 ++-- acvm-repo/acir/src/native_types/witness_map.rs | 7 +++++-- .../acir/src/native_types/witness_stack.rs | 7 +++++-- acvm-repo/acir/src/serialization.rs | 18 +++++++++++++++--- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/acvm-repo/acir/src/circuit/mod.rs b/acvm-repo/acir/src/circuit/mod.rs index 47515cb8bf3..5117b5cb0af 100644 --- a/acvm-repo/acir/src/circuit/mod.rs +++ b/acvm-repo/acir/src/circuit/mod.rs @@ -6,7 +6,7 @@ pub mod opcodes; use crate::{ native_types::{Expression, Witness}, - serialization::{deserialize_any_format, serialize_with_format_from_env}, + serialization::{self, deserialize_any_format, serialize_with_format_from_env}, }; use acir_field::AcirField; pub use opcodes::Opcode; @@ -268,7 +268,7 @@ impl Circuit { impl Program { /// Serialize and compress the [Program] into bytes. fn write(&self, writer: W) -> std::io::Result<()> { - let buf = serialize_with_format_from_env(self)?; + let buf = serialize_with_format_from_env(self, Some(serialization::Format::default()))?; // Compress the data, which should help with formats that uses field names. let mut encoder = flate2::write::GzEncoder::new(writer, Compression::default()); diff --git a/acvm-repo/acir/src/native_types/witness_map.rs b/acvm-repo/acir/src/native_types/witness_map.rs index 847ba04453d..e292e26fe51 100644 --- a/acvm-repo/acir/src/native_types/witness_map.rs +++ b/acvm-repo/acir/src/native_types/witness_map.rs @@ -91,8 +91,11 @@ impl From> for WitnessMap { impl WitnessMap { /// Serialize and compress. pub fn serialize(&self) -> Result, WitnessMapError> { - let buf = serialization::serialize_with_format_from_env(self) - .map_err(|e| WitnessMapError(SerializationError::Serialize(e)))?; + let buf = serialization::serialize_with_format_from_env( + self, + Some(serialization::Format::default()), + ) + .map_err(|e| WitnessMapError(SerializationError::Serialize(e)))?; let mut deflater = GzEncoder::new(buf.as_slice(), Compression::best()); let mut buf = Vec::new(); diff --git a/acvm-repo/acir/src/native_types/witness_stack.rs b/acvm-repo/acir/src/native_types/witness_stack.rs index cf34c06e7a5..400c622630a 100644 --- a/acvm-repo/acir/src/native_types/witness_stack.rs +++ b/acvm-repo/acir/src/native_types/witness_stack.rs @@ -72,8 +72,11 @@ impl WitnessStack { impl WitnessStack { /// Serialize and compress. pub fn serialize(&self) -> Result, WitnessStackError> { - let buf = serialization::serialize_with_format_from_env(self) - .map_err(|e| WitnessStackError(SerializationError::Serialize(e)))?; + let buf = serialization::serialize_with_format_from_env( + self, + Some(serialization::Format::default()), + ) + .map_err(|e| WitnessStackError(SerializationError::Serialize(e)))?; let mut deflater = GzEncoder::new(buf.as_slice(), Compression::best()); let mut buf = Vec::new(); diff --git a/acvm-repo/acir/src/serialization.rs b/acvm-repo/acir/src/serialization.rs index 12323524508..b8cf1d73787 100644 --- a/acvm-repo/acir/src/serialization.rs +++ b/acvm-repo/acir/src/serialization.rs @@ -27,6 +27,12 @@ pub(crate) enum Format { Protobuf = 4, } +impl Default for Format { + fn default() -> Self { + Self::Msgpack + } +} + impl Format { /// Look for a `NOIR_SERIALIZATION_FORMAT` env var to turn on formatted serialization. /// @@ -132,7 +138,7 @@ where match format { Format::BincodeLegacy => { // This is just a coincidence, as this format does not appear in the data, - // but we know it's none of the other formats. + // but we know it's none of the other formats, so we can just return bincode. } Format::Bincode => { if let Ok(value) = bincode_deserialize(&buf[1..]) { @@ -176,14 +182,20 @@ where Ok(res) } -pub(crate) fn serialize_with_format_from_env(value: &T) -> std::io::Result> +/// Serialize the format with whatever the env indicates. +/// If the env is empty, but a `default` value is passed, use that. +/// Otherwise if both are empty, use `bincode`. +pub(crate) fn serialize_with_format_from_env( + value: &T, + default: Option, +) -> std::io::Result> where F: AcirField, T: Serialize, R: prost::Message, ProtoSchema: ProtoCodec, { - match Format::from_env() { + match Format::from_env().map(|fopt| fopt.or(default)) { Ok(Some(format)) => { // This will need a new `bb` even if it's the bincode format, because of the format byte. serialize_with_format(value, format) From 2ed34413a695d6af61303b2d05b66d3d7b5db8fd Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 20 May 2025 14:53:02 +0100 Subject: [PATCH 02/30] Update expected serialized bytes in tests to msgpack --- .../acir/tests/test_program_serialization.rs | 106 ++++++++++++++++-- acvm-repo/acvm_js/test/shared/addition.ts | 16 ++- .../test/shared/complex_foreign_call.ts | 30 +++-- acvm-repo/acvm_js/test/shared/foreign_call.ts | 22 +++- acvm-repo/acvm_js/test/shared/memory_op.ts | 16 ++- .../acvm_js/test/shared/multi_scalar_mul.ts | 13 ++- .../acvm_js/test/shared/nested_acir_call.ts | 21 ++-- 7 files changed, 185 insertions(+), 39 deletions(-) diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 2863bc011d8..7c0fd30945d 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -47,7 +47,22 @@ fn addition_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 144, 65, 14, 128, 32, 12, 4, 65, 124, 80, 75, 91, 104, 111, 126, 69, 34, 252, 255, 9, 106, 228, 64, 194, 81, 38, 105, 182, 167, 201, 102, 189, 251, 216, 159, 243, 110, 38, 244, 60, 122, 194, 63, 208, 47, 116, 109, 131, 139, 32, 49, 215, 28, 43, 18, 158, 16, 173, 168, 0, 75, 73, 138, 138, 162, 114, 69, 37, 170, 202, 154, 173, 88, 6, 67, 166, 138, 77, 140, 90, 151, 133, 117, 189, 224, 117, 108, 221, 229, 135, 223, 13, 27, 135, 121, 106, 119, 3, 58, 173, 124, 163, 140, 1, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[ + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, + 227, 164, 113, 54, 120, 8, 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, + 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, 21, 66, 236, 237, 29, 239, 112, 244, + 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, 197, 149, + 141, 14, 66, 16, 214, 25, 88, 31, 61, 250, 65, 123, 3, 97, 115, 253, 116, 18, 2, 96, 60, 3, + 244, 183, 83, 159, 58, 17, 1, 251, 48, 126, 116, 214, 129, 68, 161, 125, 175, 172, 147, 59, + 218, 253, 246, 251, 152, 236, 119, 116, 118, 0, 198, 60, 51, 24, 89, 150, 37, 212, 5, 80, + 70, 37, 41, 26, 197, 43, 82, 86, 106, 201, 41, 167, 21, 175, 76, 193, 25, 3, 94, 242, 186, + 81, 77, 77, 26, 90, 50, 160, 109, 213, 176, 246, 23, 178, 120, 184, 20, 122, 239, 41, 228, + 21, 214, 3, 102, 173, 89, 79, 54, 108, 226, 197, 116, 234, 148, 79, 217, 177, 121, 31, 208, + 174, 100, 4, 49, 72, 148, 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, + 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, 119, 69, 68, 159, 185, 242, 28, 194, + 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, 235, 1, 0, + 0, + ]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -86,7 +101,21 @@ fn multi_scalar_mul_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 77, 9, 10, 0, 48, 8, 114, 107, 231, 255, 255, 59, 86, 204, 64, 22, 136, 102, 89, 5, 175, 182, 163, 80, 7, 47, 135, 73, 31, 56, 228, 42, 218, 196, 203, 221, 38, 243, 78, 61, 28, 147, 119, 65, 31, 146, 53, 230, 210, 135, 252, 255, 179, 90, 23, 212, 196, 199, 187, 192, 0, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[ + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, + 181, 34, 184, 115, 37, 226, 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, + 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, 194, 51, 137, 77, 2, 33, 100, 145, 93, + 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, 8, 80, 212, + 157, 19, 4, 102, 229, 208, 66, 115, 220, 135, 104, 130, 5, 158, 181, 203, 177, 215, 230, + 118, 28, 154, 211, 44, 58, 209, 222, 183, 239, 103, 201, 139, 59, 55, 218, 107, 202, 227, + 253, 75, 12, 14, 133, 231, 211, 103, 135, 49, 73, 219, 95, 174, 173, 138, 87, 76, 181, 170, + 156, 240, 239, 223, 46, 43, 247, 176, 193, 134, 21, 61, 175, 190, 240, 227, 238, 205, 112, + 143, 126, 180, 197, 250, 144, 36, 51, 158, 31, 28, 30, 45, 161, 137, 148, 121, 14, 158, + 211, 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, + 128, 248, 169, 40, 7, 195, 209, 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, + 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, 224, 238, 39, 87, 149, 219, 21, + 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0, + ]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -154,7 +183,7 @@ fn simple_brillig_foreign_call() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 81, 203, 10, 128, 48, 12, 179, 243, 57, 240, 230, 143, 108, 127, 224, 207, 120, 240, 226, 65, 196, 239, 119, 98, 11, 101, 100, 94, 214, 64, 73, 26, 88, 73, 24, 53, 31, 166, 52, 196, 186, 99, 150, 93, 67, 188, 149, 57, 212, 33, 146, 221, 173, 160, 243, 186, 92, 144, 54, 127, 138, 245, 204, 62, 243, 95, 110, 13, 195, 122, 144, 207, 240, 126, 28, 65, 71, 7, 250, 206, 105, 6, 214, 251, 113, 111, 231, 133, 190, 93, 191, 40, 237, 37, 127, 1, 190, 36, 121, 0, 128, 254, 118, 42, 127, 2, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 147, 207, 78, 27, 49, 16, 198, 201, 158, 250, 56, 208, 190, 64, 219, 84, 72, 61, 244, 132, 56, 91, 222, 245, 100, 59, 146, 215, 118, 237, 113, 74, 122, 51, 105, 213, 107, 64, 226, 5, 128, 252, 83, 194, 127, 33, 174, 188, 6, 111, 195, 108, 32, 33, 138, 4, 151, 136, 189, 237, 216, 154, 239, 155, 223, 55, 206, 246, 199, 173, 104, 10, 66, 107, 194, 193, 255, 219, 34, 122, 15, 134, 196, 111, 36, 3, 33, 8, 52, 10, 246, 62, 12, 173, 43, 172, 130, 112, 144, 38, 95, 61, 106, 141, 101, 83, 106, 253, 247, 24, 213, 198, 0, 141, 139, 196, 39, 131, 29, 52, 165, 134, 238, 184, 138, 90, 16, 248, 42, 244, 110, 52, 26, 144, 94, 20, 182, 202, 209, 200, 39, 141, 195, 135, 207, 155, 235, 125, 91, 141, 147, 95, 162, 88, 187, 205, 230, 208, 70, 90, 120, 175, 156, 134, 108, 236, 60, 40, 44, 36, 193, 253, 37, 236, 241, 79, 8, 236, 153, 97, 40, 250, 57, 222, 53, 185, 141, 140, 67, 93, 59, 143, 109, 190, 35, 156, 244, 178, 2, 158, 53, 28, 54, 178, 43, 23, 115, 141, 197, 82, 177, 119, 230, 129, 162, 55, 162, 45, 117, 132, 208, 187, 144, 33, 128, 39, 81, 113, 91, 89, 114, 225, 142, 193, 51, 18, 242, 146, 57, 41, 241, 146, 67, 26, 229, 29, 130, 26, 249, 81, 234, 55, 235, 43, 221, 9, 227, 167, 103, 136, 105, 240, 13, 61, 20, 212, 24, 229, 72, 34, 224, 31, 72, 195, 239, 134, 160, 4, 127, 178, 251, 233, 99, 127, 166, 183, 62, 159, 183, 164, 179, 119, 149, 222, 74, 211, 122, 193, 148, 36, 217, 180, 174, 211, 189, 89, 114, 32, 164, 82, 117, 48, 115, 39, 27, 211, 218, 197, 106, 53, 59, 183, 173, 86, 0, 90, 173, 55, 210, 100, 219, 122, 192, 210, 212, 2, 255, 70, 115, 230, 188, 198, 109, 206, 102, 186, 36, 196, 49, 156, 253, 128, 202, 250, 206, 151, 21, 197, 187, 101, 59, 179, 137, 5, 117, 28, 188, 44, 82, 127, 27, 65, 171, 197, 211, 120, 165, 205, 213, 236, 252, 141, 6, 233, 116, 135, 172, 75, 147, 231, 53, 170, 113, 236, 15, 157, 69, 230, 237, 23, 3, 157, 206, 66, 152, 143, 253, 8, 241, 88, 190, 153, 207, 3, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -293,8 +322,36 @@ fn complex_brillig_foreign_call() { Program { functions: vec![circuit], unconstrained_functions: vec![brillig_bytecode] }; let bytes = Program::serialize_program(&program); - - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 14, 130, 48, 12, 238, 54, 20, 136, 222, 124, 1, 19, 125, 128, 161, 241, 238, 187, 24, 111, 26, 61, 250, 248, 178, 216, 198, 89, 26, 56, 216, 18, 248, 146, 165, 12, 218, 175, 255, 193, 193, 7, 85, 123, 28, 62, 23, 40, 61, 202, 244, 62, 192, 47, 72, 247, 140, 50, 254, 135, 198, 233, 113, 69, 171, 24, 253, 12, 98, 12, 6, 49, 66, 214, 255, 9, 246, 91, 179, 47, 170, 245, 11, 194, 254, 164, 221, 90, 180, 103, 137, 247, 18, 101, 197, 11, 157, 140, 60, 116, 23, 47, 7, 13, 207, 10, 101, 45, 124, 87, 76, 232, 88, 51, 191, 202, 252, 145, 138, 177, 133, 254, 124, 109, 243, 60, 68, 226, 15, 38, 252, 177, 33, 254, 194, 168, 79, 37, 171, 87, 158, 75, 238, 119, 13, 223, 1, 188, 60, 238, 207, 219, 245, 21, 4, 83, 110, 158, 176, 99, 247, 189, 80, 178, 33, 14, 66, 254, 159, 233, 211, 119, 130, 254, 144, 205, 88, 163, 98, 180, 18, 167, 13, 116, 65, 190, 222, 250, 76, 4, 233, 188, 7, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[ + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, + 240, 0, 105, 43, 238, 148, 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, + 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, 230, 103, 181, 41, 80, 42, 212, 43, + 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, 227, 25, + 207, 108, 190, 25, 85, 67, 238, 27, 42, 184, 238, 188, 255, 230, 135, 74, 1, 55, 232, 53, + 53, 28, 180, 70, 148, 19, 168, 111, 13, 133, 244, 5, 1, 221, 177, 241, 19, 69, 25, 163, + 181, 50, 102, 236, 237, 71, 74, 114, 3, 202, 101, 104, 116, 215, 246, 247, 148, 194, 141, + 94, 43, 10, 66, 134, 12, 168, 64, 183, 207, 25, 229, 128, 21, 242, 69, 80, 161, 28, 255, + 194, 232, 254, 120, 92, 90, 237, 217, 246, 142, 95, 33, 127, 229, 109, 74, 255, 131, 106, + 254, 246, 80, 45, 172, 135, 170, 29, 28, 80, 94, 99, 240, 55, 202, 189, 117, 92, 132, 117, + 56, 116, 115, 164, 27, 138, 208, 36, 97, 234, 165, 97, 42, 222, 185, 155, 200, 25, 72, 6, + 247, 210, 151, 173, 72, 42, 32, 212, 199, 6, 190, 127, 129, 186, 251, 208, 218, 233, 233, + 18, 75, 204, 203, 232, 144, 87, 68, 232, 50, 75, 190, 74, 69, 143, 220, 26, 36, 177, 194, + 1, 56, 31, 116, 207, 203, 23, 206, 100, 88, 97, 212, 207, 76, 219, 167, 10, 76, 168, 56, + 58, 194, 44, 4, 221, 254, 140, 181, 6, 101, 80, 224, 246, 197, 53, 55, 184, 112, 245, 224, + 252, 50, 10, 59, 19, 9, 250, 221, 22, 118, 84, 105, 24, 72, 138, 225, 131, 237, 151, 147, + 37, 173, 216, 149, 132, 153, 58, 108, 7, 79, 169, 2, 223, 228, 70, 21, 106, 144, 166, 111, + 192, 14, 159, 115, 3, 53, 80, 199, 135, 187, 59, 253, 9, 222, 202, 162, 237, 46, 131, 246, + 54, 10, 93, 178, 227, 164, 6, 9, 54, 184, 44, 100, 163, 117, 158, 97, 128, 48, 33, 137, 51, + 41, 147, 251, 227, 132, 197, 229, 105, 238, 147, 168, 86, 53, 152, 203, 115, 239, 218, 244, + 220, 41, 45, 131, 46, 108, 84, 207, 237, 101, 208, 197, 13, 223, 162, 127, 183, 210, 251, + 163, 149, 133, 5, 86, 22, 109, 188, 47, 20, 208, 26, 79, 0, 222, 141, 210, 248, 12, 93, 23, + 186, 52, 215, 199, 25, 36, 23, 252, 232, 25, 96, 57, 9, 127, 115, 40, 5, 117, 7, 85, 51, + 223, 79, 18, 220, 130, 61, 125, 1, 129, 80, 141, 189, 121, 156, 7, 11, 230, 15, 47, 178, + 71, 153, 168, 133, 76, 67, 194, 172, 100, 154, 113, 102, 216, 73, 91, 166, 191, 79, 129, + 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, + 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, + 240, 2, 11, 102, 132, 126, 2, 214, 167, 16, 147, 245, 9, 0, 0, + ]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -331,7 +388,23 @@ fn memory_op_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 144, 75, 10, 0, 32, 8, 68, 253, 117, 31, 187, 65, 247, 63, 85, 65, 10, 82, 203, 116, 209, 128, 60, 221, 12, 227, 32, 108, 181, 53, 108, 187, 147, 140, 24, 118, 231, 169, 97, 212, 55, 245, 106, 95, 76, 246, 229, 60, 47, 173, 46, 87, 127, 43, 87, 178, 127, 231, 16, 148, 194, 29, 195, 11, 220, 154, 119, 139, 115, 25, 38, 3, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[ + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, + 180, 20, 136, 138, 218, 242, 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, + 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, 187, 18, 74, 71, 145, 8, 161, 184, + 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, 46, 223, + 68, 64, 4, 227, 217, 185, 242, 6, 136, 152, 50, 18, 70, 219, 247, 214, 9, 43, 129, 102, + 147, 197, 62, 104, 139, 227, 61, 163, 124, 53, 47, 74, 43, 78, 153, 146, 91, 55, 42, 197, + 211, 94, 182, 232, 50, 126, 236, 224, 174, 3, 78, 230, 221, 125, 224, 150, 224, 87, 214, + 85, 209, 58, 64, 254, 77, 91, 69, 29, 74, 230, 1, 53, 213, 175, 165, 50, 192, 145, 9, 171, + 11, 101, 218, 103, 170, 175, 207, 152, 248, 220, 205, 87, 59, 59, 183, 109, 43, 127, 69, + 54, 228, 101, 128, 223, 200, 154, 233, 234, 76, 253, 181, 20, 156, 71, 135, 32, 149, 224, + 30, 62, 254, 141, 101, 249, 134, 90, 54, 88, 187, 101, 79, 48, 74, 1, 81, 170, 48, 77, 174, + 244, 39, 241, 208, 20, 54, 36, 245, 228, 139, 67, 53, 76, 24, 230, 56, 114, 13, 169, 51, + 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, + 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, + 46, 146, 253, 172, 141, 250, 11, 130, 86, 177, 6, 68, 4, 0, 0, + ]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -429,7 +502,26 @@ fn nested_acir_call_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 146, 81, 10, 195, 48, 8, 134, 77, 164, 247, 209, 152, 52, 230, 109, 87, 89, 88, 122, 255, 35, 172, 99, 41, 11, 89, 161, 15, 77, 31, 250, 193, 143, 34, 34, 250, 35, 194, 23, 172, 250, 48, 173, 50, 171, 44, 252, 48, 85, 176, 213, 143, 154, 16, 58, 182, 198, 71, 141, 116, 14, 182, 205, 44, 161, 217, 251, 18, 93, 97, 225, 39, 185, 148, 53, 144, 15, 121, 86, 86, 14, 26, 94, 78, 69, 138, 122, 141, 41, 167, 72, 137, 189, 20, 94, 66, 146, 165, 14, 195, 113, 123, 17, 52, 38, 180, 185, 129, 127, 176, 51, 240, 42, 175, 96, 160, 87, 118, 220, 94, 110, 170, 183, 218, 230, 238, 221, 39, 234, 191, 172, 207, 177, 171, 153, 155, 153, 106, 96, 236, 3, 30, 249, 181, 199, 27, 99, 149, 130, 253, 11, 4, 0, 0]"); + insta::assert_compact_debug_snapshot!(bytes, @"[ + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, + 109, 178, 3, 113, 6, 54, 108, 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, + 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, 220, 6, 83, 81, 40, 42, 130, 162, + 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, 196, 232, + 248, 62, 85, 156, 3, 147, 104, 143, 74, 6, 66, 32, 202, 8, 12, 237, 113, 89, 165, 37, 1, + 49, 218, 63, 219, 192, 121, 126, 116, 66, 137, 121, 78, 89, 165, 164, 104, 13, 115, 92, 42, + 249, 114, 109, 172, 174, 226, 64, 104, 138, 37, 60, 126, 157, 105, 207, 102, 94, 172, 11, + 1, 92, 110, 1, 47, 15, 187, 66, 229, 72, 2, 47, 68, 125, 151, 83, 6, 152, 163, 180, 44, 18, + 202, 240, 164, 195, 182, 125, 90, 115, 150, 59, 174, 165, 107, 248, 78, 47, 8, 160, 239, + 129, 235, 187, 216, 241, 226, 36, 10, 157, 32, 76, 122, 145, 27, 185, 97, 20, 18, 47, 242, + 125, 136, 130, 168, 31, 39, 113, 223, 137, 221, 192, 7, 55, 11, 99, 63, 123, 45, 98, 159, + 238, 162, 116, 233, 86, 156, 107, 24, 106, 14, 66, 232, 167, 105, 226, 68, 238, 116, 155, + 44, 41, 149, 102, 78, 110, 43, 78, 7, 26, 15, 170, 48, 199, 5, 104, 36, 162, 49, 110, 42, + 149, 228, 52, 157, 141, 153, 151, 28, 164, 226, 12, 13, 112, 174, 64, 212, 87, 120, 2, 19, + 21, 186, 44, 222, 214, 129, 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, + 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, 71, 125, 94, 85, 253, 209, 84, 99, + 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, 15, 122, + 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0, + ]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); diff --git a/acvm-repo/acvm_js/test/shared/addition.ts b/acvm-repo/acvm_js/test/shared/addition.ts index 2b8124e77d7..b6b1f3fc81d 100644 --- a/acvm-repo/acvm_js/test/shared/addition.ts +++ b/acvm-repo/acvm_js/test/shared/addition.ts @@ -2,11 +2,17 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `addition_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 144, 65, 14, 128, 32, 12, 4, 65, 124, 80, 75, 91, 104, 111, 126, 69, 34, 252, - 255, 9, 106, 228, 64, 194, 81, 38, 105, 182, 167, 201, 102, 189, 251, 216, 159, 243, 110, 38, 244, 60, 122, 194, 63, - 208, 47, 116, 109, 131, 139, 32, 49, 215, 28, 43, 18, 158, 16, 173, 168, 0, 75, 73, 138, 138, 162, 114, 69, 37, 170, - 202, 154, 173, 88, 6, 67, 166, 138, 77, 140, 90, 151, 133, 117, 189, 224, 117, 108, 221, 229, 135, 223, 13, 27, 135, - 121, 106, 119, 3, 58, 173, 124, 163, 140, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, 227, 164, 113, 54, 120, 8, + 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, + 21, 66, 236, 237, 29, 239, 112, 244, 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, + 197, 149, 141, 14, 66, 16, 214, 25, 88, 31, 61, 250, 65, 123, 3, 97, 115, 253, 116, 18, 2, 96, 60, 3, 244, 183, 83, + 159, 58, 17, 1, 251, 48, 126, 116, 214, 129, 68, 161, 125, 175, 172, 147, 59, 218, 253, 246, 251, 152, 236, 119, 116, + 118, 0, 198, 60, 51, 24, 89, 150, 37, 212, 5, 80, 70, 37, 41, 26, 197, 43, 82, 86, 106, 201, 41, 167, 21, 175, 76, + 193, 25, 3, 94, 242, 186, 81, 77, 77, 26, 90, 50, 160, 109, 213, 176, 246, 23, 178, 120, 184, 20, 122, 239, 41, 228, + 21, 214, 3, 102, 173, 89, 79, 54, 108, 226, 197, 116, 234, 148, 79, 217, 177, 121, 31, 208, 174, 100, 4, 49, 72, 148, + 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, + 119, 69, 68, 159, 185, 242, 28, 194, 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, + 235, 1, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts index 24fbc1a921a..e4412dd4bb8 100644 --- a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts @@ -2,14 +2,28 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `complex_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 14, 130, 48, 12, 238, 54, 20, 136, 222, 124, 1, 19, 125, 128, 161, - 241, 238, 187, 24, 111, 26, 61, 250, 248, 178, 216, 198, 89, 26, 56, 216, 18, 248, 146, 165, 12, 218, 175, 255, 193, - 193, 7, 85, 123, 28, 62, 23, 40, 61, 202, 244, 62, 192, 47, 72, 247, 140, 50, 254, 135, 198, 233, 113, 69, 171, 24, - 253, 12, 98, 12, 6, 49, 66, 214, 255, 9, 246, 91, 179, 47, 170, 245, 11, 194, 254, 164, 221, 90, 180, 103, 137, 247, - 18, 101, 197, 11, 157, 140, 60, 116, 23, 47, 7, 13, 207, 10, 101, 45, 124, 87, 76, 232, 88, 51, 191, 202, 252, 145, - 138, 177, 133, 254, 124, 109, 243, 60, 68, 226, 15, 38, 252, 177, 33, 254, 194, 168, 79, 37, 171, 87, 158, 75, 238, - 119, 13, 223, 1, 188, 60, 238, 207, 219, 245, 21, 4, 83, 110, 158, 176, 99, 247, 189, 80, 178, 33, 14, 66, 254, 159, - 233, 211, 119, 130, 254, 144, 205, 88, 163, 98, 180, 18, 167, 13, 116, 65, 190, 222, 250, 76, 4, 233, 188, 7, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, 240, 0, 105, 43, 238, 148, + 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, + 230, 103, 181, 41, 80, 42, 212, 43, 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, + 227, 25, 207, 108, 190, 25, 85, 67, 238, 27, 42, 184, 238, 188, 255, 230, 135, 74, 1, 55, 232, 53, 53, 28, 180, 70, + 148, 19, 168, 111, 13, 133, 244, 5, 1, 221, 177, 241, 19, 69, 25, 163, 181, 50, 102, 236, 237, 71, 74, 114, 3, 202, + 101, 104, 116, 215, 246, 247, 148, 194, 141, 94, 43, 10, 66, 134, 12, 168, 64, 183, 207, 25, 229, 128, 21, 242, 69, + 80, 161, 28, 255, 194, 232, 254, 120, 92, 90, 237, 217, 246, 142, 95, 33, 127, 229, 109, 74, 255, 131, 106, 254, 246, + 80, 45, 172, 135, 170, 29, 28, 80, 94, 99, 240, 55, 202, 189, 117, 92, 132, 117, 56, 116, 115, 164, 27, 138, 208, 36, + 97, 234, 165, 97, 42, 222, 185, 155, 200, 25, 72, 6, 247, 210, 151, 173, 72, 42, 32, 212, 199, 6, 190, 127, 129, 186, + 251, 208, 218, 233, 233, 18, 75, 204, 203, 232, 144, 87, 68, 232, 50, 75, 190, 74, 69, 143, 220, 26, 36, 177, 194, 1, + 56, 31, 116, 207, 203, 23, 206, 100, 88, 97, 212, 207, 76, 219, 167, 10, 76, 168, 56, 58, 194, 44, 4, 221, 254, 140, + 181, 6, 101, 80, 224, 246, 197, 53, 55, 184, 112, 245, 224, 252, 50, 10, 59, 19, 9, 250, 221, 22, 118, 84, 105, 24, + 72, 138, 225, 131, 237, 151, 147, 37, 173, 216, 149, 132, 153, 58, 108, 7, 79, 169, 2, 223, 228, 70, 21, 106, 144, + 166, 111, 192, 14, 159, 115, 3, 53, 80, 199, 135, 187, 59, 253, 9, 222, 202, 162, 237, 46, 131, 246, 54, 10, 93, 178, + 227, 164, 6, 9, 54, 184, 44, 100, 163, 117, 158, 97, 128, 48, 33, 137, 51, 41, 147, 251, 227, 132, 197, 229, 105, 238, + 147, 168, 86, 53, 152, 203, 115, 239, 218, 244, 220, 41, 45, 131, 46, 108, 84, 207, 237, 101, 208, 197, 13, 223, 162, + 127, 183, 210, 251, 163, 149, 133, 5, 86, 22, 109, 188, 47, 20, 208, 26, 79, 0, 222, 141, 210, 248, 12, 93, 23, 186, + 52, 215, 199, 25, 36, 23, 252, 232, 25, 96, 57, 9, 127, 115, 40, 5, 117, 7, 85, 51, 223, 79, 18, 220, 130, 61, 125, 1, + 129, 80, 141, 189, 121, 156, 7, 11, 230, 15, 47, 178, 71, 153, 168, 133, 76, 67, 194, 172, 100, 154, 113, 102, 216, + 73, 91, 166, 191, 79, 129, 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, + 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, 240, 2, 11, 102, 132, 126, + 2, 214, 167, 16, 147, 245, 9, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/foreign_call.ts b/acvm-repo/acvm_js/test/shared/foreign_call.ts index da0b9974c61..f804df8c742 100644 --- a/acvm-repo/acvm_js/test/shared/foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/foreign_call.ts @@ -2,11 +2,23 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `simple_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 81, 203, 10, 128, 48, 12, 179, 243, 57, 240, 230, 143, 108, 127, 224, 207, - 120, 240, 226, 65, 196, 239, 119, 98, 11, 101, 100, 94, 214, 64, 73, 26, 88, 73, 24, 53, 31, 166, 52, 196, 186, 99, - 150, 93, 67, 188, 149, 57, 212, 33, 146, 221, 173, 160, 243, 186, 92, 144, 54, 127, 138, 245, 204, 62, 243, 95, 110, - 13, 195, 122, 144, 207, 240, 126, 28, 65, 71, 7, 250, 206, 105, 6, 214, 251, 113, 111, 231, 133, 190, 93, 191, 40, - 237, 37, 127, 1, 190, 36, 121, 0, 128, 254, 118, 42, 127, 2, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 147, 207, 78, 27, 49, 16, 198, 201, 158, 250, 56, 208, 190, 64, 219, 84, 72, + 61, 244, 132, 56, 91, 222, 245, 100, 59, 146, 215, 118, 237, 113, 74, 122, 51, 105, 213, 107, 64, 226, 5, 128, 252, + 83, 194, 127, 33, 174, 188, 6, 111, 195, 108, 32, 33, 138, 4, 151, 136, 189, 237, 216, 154, 239, 155, 223, 55, 206, + 246, 199, 173, 104, 10, 66, 107, 194, 193, 255, 219, 34, 122, 15, 134, 196, 111, 36, 3, 33, 8, 52, 10, 246, 62, 12, + 173, 43, 172, 130, 112, 144, 38, 95, 61, 106, 141, 101, 83, 106, 253, 247, 24, 213, 198, 0, 141, 139, 196, 39, 131, + 29, 52, 165, 134, 238, 184, 138, 90, 16, 248, 42, 244, 110, 52, 26, 144, 94, 20, 182, 202, 209, 200, 39, 141, 195, + 135, 207, 155, 235, 125, 91, 141, 147, 95, 162, 88, 187, 205, 230, 208, 70, 90, 120, 175, 156, 134, 108, 236, 60, 40, + 44, 36, 193, 253, 37, 236, 241, 79, 8, 236, 153, 97, 40, 250, 57, 222, 53, 185, 141, 140, 67, 93, 59, 143, 109, 190, + 35, 156, 244, 178, 2, 158, 53, 28, 54, 178, 43, 23, 115, 141, 197, 82, 177, 119, 230, 129, 162, 55, 162, 45, 117, 132, + 208, 187, 144, 33, 128, 39, 81, 113, 91, 89, 114, 225, 142, 193, 51, 18, 242, 146, 57, 41, 241, 146, 67, 26, 229, 29, + 130, 26, 249, 81, 234, 55, 235, 43, 221, 9, 227, 167, 103, 136, 105, 240, 13, 61, 20, 212, 24, 229, 72, 34, 224, 31, + 72, 195, 239, 134, 160, 4, 127, 178, 251, 233, 99, 127, 166, 183, 62, 159, 183, 164, 179, 119, 149, 222, 74, 211, 122, + 193, 148, 36, 217, 180, 174, 211, 189, 89, 114, 32, 164, 82, 117, 48, 115, 39, 27, 211, 218, 197, 106, 53, 59, 183, + 173, 86, 0, 90, 173, 55, 210, 100, 219, 122, 192, 210, 212, 2, 255, 70, 115, 230, 188, 198, 109, 206, 102, 186, 36, + 196, 49, 156, 253, 128, 202, 250, 206, 151, 21, 197, 187, 101, 59, 179, 137, 5, 117, 28, 188, 44, 82, 127, 27, 65, + 171, 197, 211, 120, 165, 205, 213, 236, 252, 141, 6, 233, 116, 135, 172, 75, 147, 231, 53, 170, 113, 236, 15, 157, 69, + 230, 237, 23, 3, 157, 206, 66, 152, 143, 253, 8, 241, 88, 190, 153, 207, 3, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000005'], diff --git a/acvm-repo/acvm_js/test/shared/memory_op.ts b/acvm-repo/acvm_js/test/shared/memory_op.ts index 2f0fbfb85f1..0fd302fea81 100644 --- a/acvm-repo/acvm_js/test/shared/memory_op.ts +++ b/acvm-repo/acvm_js/test/shared/memory_op.ts @@ -1,9 +1,17 @@ // See `memory_op_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 144, 75, 10, 0, 32, 8, 68, 253, 117, 31, 187, 65, 247, 63, 85, 65, 10, 82, - 203, 116, 209, 128, 60, 221, 12, 227, 32, 108, 181, 53, 108, 187, 147, 140, 24, 118, 231, 169, 97, 212, 55, 245, 106, - 95, 76, 246, 229, 60, 47, 173, 46, 87, 127, 43, 87, 178, 127, 231, 16, 148, 194, 29, 195, 11, 220, 154, 119, 139, 115, - 25, 38, 3, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, 180, 20, 136, 138, 218, 242, + 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, + 187, 18, 74, 71, 145, 8, 161, 184, 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, + 46, 223, 68, 64, 4, 227, 217, 185, 242, 6, 136, 152, 50, 18, 70, 219, 247, 214, 9, 43, 129, 102, 147, 197, 62, 104, + 139, 227, 61, 163, 124, 53, 47, 74, 43, 78, 153, 146, 91, 55, 42, 197, 211, 94, 182, 232, 50, 126, 236, 224, 174, 3, + 78, 230, 221, 125, 224, 150, 224, 87, 214, 85, 209, 58, 64, 254, 77, 91, 69, 29, 74, 230, 1, 53, 213, 175, 165, 50, + 192, 145, 9, 171, 11, 101, 218, 103, 170, 175, 207, 152, 248, 220, 205, 87, 59, 59, 183, 109, 43, 127, 69, 54, 228, + 101, 128, 223, 200, 154, 233, 234, 76, 253, 181, 20, 156, 71, 135, 32, 149, 224, 30, 62, 254, 141, 101, 249, 134, 90, + 54, 88, 187, 101, 79, 48, 74, 1, 81, 170, 48, 77, 174, 244, 39, 241, 208, 20, 54, 36, 245, 228, 139, 67, 53, 76, 24, + 230, 56, 114, 13, 169, 51, 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, + 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, 46, 146, 253, 172, 141, + 250, 11, 130, 86, 177, 6, 68, 4, 0, 0, ]); export const initialWitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts index fac77e4ee27..43d9c2b8274 100644 --- a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts +++ b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts @@ -1,8 +1,15 @@ // See `multi_scalar_mul_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 77, 9, 10, 0, 48, 8, 114, 107, 231, 255, 255, 59, 86, 204, 64, 22, 136, 102, - 89, 5, 175, 182, 163, 80, 7, 47, 135, 73, 31, 56, 228, 42, 218, 196, 203, 221, 38, 243, 78, 61, 28, 147, 119, 65, 31, - 146, 53, 230, 210, 135, 252, 255, 179, 90, 23, 212, 196, 199, 187, 192, 0, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, 181, 34, 184, 115, 37, 226, + 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, + 194, 51, 137, 77, 2, 33, 100, 145, 93, 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, + 8, 80, 212, 157, 19, 4, 102, 229, 208, 66, 115, 220, 135, 104, 130, 5, 158, 181, 203, 177, 215, 230, 118, 28, 154, + 211, 44, 58, 209, 222, 183, 239, 103, 201, 139, 59, 55, 218, 107, 202, 227, 253, 75, 12, 14, 133, 231, 211, 103, 135, + 49, 73, 219, 95, 174, 173, 138, 87, 76, 181, 170, 156, 240, 239, 223, 46, 43, 247, 176, 193, 134, 21, 61, 175, 190, + 240, 227, 238, 205, 112, 143, 126, 180, 197, 250, 144, 36, 51, 158, 31, 28, 30, 45, 161, 137, 148, 121, 14, 158, 211, + 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, 128, 248, 169, 40, 7, 195, 209, + 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, + 224, 238, 39, 87, 149, 219, 21, 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0, ]); export const initialWitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index 3464809dfc4..d734c3bc420 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -2,13 +2,20 @@ import { WitnessMap, StackItem, WitnessStack } from '@noir-lang/acvm_js'; // See `nested_acir_call_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 146, 81, 10, 195, 48, 8, 134, 77, 164, 247, 209, 152, 52, 230, 109, 87, 89, - 88, 122, 255, 35, 172, 99, 41, 11, 89, 161, 15, 77, 31, 250, 193, 143, 34, 34, 250, 35, 194, 23, 172, 250, 48, 173, - 50, 171, 44, 252, 48, 85, 176, 213, 143, 154, 16, 58, 182, 198, 71, 141, 116, 14, 182, 205, 44, 161, 217, 251, 18, 93, - 97, 225, 39, 185, 148, 53, 144, 15, 121, 86, 86, 14, 26, 94, 78, 69, 138, 122, 141, 41, 167, 72, 137, 189, 20, 94, 66, - 146, 165, 14, 195, 113, 123, 17, 52, 38, 180, 185, 129, 127, 176, 51, 240, 42, 175, 96, 160, 87, 118, 220, 94, 110, - 170, 183, 218, 230, 238, 221, 39, 234, 191, 172, 207, 177, 171, 153, 155, 153, 106, 96, 236, 3, 30, 249, 181, 199, 27, - 99, 149, 130, 253, 11, 4, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, 109, 178, 3, 113, 6, 54, 108, + 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, + 220, 6, 83, 81, 40, 42, 130, 162, 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, + 196, 232, 248, 62, 85, 156, 3, 147, 104, 143, 74, 6, 66, 32, 202, 8, 12, 237, 113, 89, 165, 37, 1, 49, 218, 63, 219, + 192, 121, 126, 116, 66, 137, 121, 78, 89, 165, 164, 104, 13, 115, 92, 42, 249, 114, 109, 172, 174, 226, 64, 104, 138, + 37, 60, 126, 157, 105, 207, 102, 94, 172, 11, 1, 92, 110, 1, 47, 15, 187, 66, 229, 72, 2, 47, 68, 125, 151, 83, 6, + 152, 163, 180, 44, 18, 202, 240, 164, 195, 182, 125, 90, 115, 150, 59, 174, 165, 107, 248, 78, 47, 8, 160, 239, 129, + 235, 187, 216, 241, 226, 36, 10, 157, 32, 76, 122, 145, 27, 185, 97, 20, 18, 47, 242, 125, 136, 130, 168, 31, 39, 113, + 223, 137, 221, 192, 7, 55, 11, 99, 63, 123, 45, 98, 159, 238, 162, 116, 233, 86, 156, 107, 24, 106, 14, 66, 232, 167, + 105, 226, 68, 238, 116, 155, 44, 41, 149, 102, 78, 110, 43, 78, 7, 26, 15, 170, 48, 199, 5, 104, 36, 162, 49, 110, 42, + 149, 228, 52, 157, 141, 153, 151, 28, 164, 226, 12, 13, 112, 174, 64, 212, 87, 120, 2, 19, 21, 186, 44, 222, 214, 129, + 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, + 71, 125, 94, 85, 253, 209, 84, 99, 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, + 15, 122, 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ From 9a1db2150892779867b1d1719be31107d9fa7113 Mon Sep 17 00:00:00 2001 From: aakoshh Date: Wed, 26 Mar 2025 09:41:24 +0000 Subject: [PATCH 03/30] Update expected serialized witness data --- acvm-repo/acvm_js/test/shared/nested_acir_call.ts | 7 ++++--- acvm-repo/acvm_js/test/shared/witness_compression.ts | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index d734c3bc420..a4cdb66d5fe 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -60,7 +60,8 @@ export const expectedWitnessStack: WitnessStack = [ ]; export const expectedCompressedWitnessStack = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 13, 0, 32, 8, 4, 17, 117, 31, 75, 75, 87, 113, 255, 37, 44, 196, 5, - 228, 42, 194, 39, 132, 238, 114, 249, 239, 114, 163, 118, 47, 203, 254, 240, 101, 23, 152, 213, 120, 199, 73, 58, 42, - 200, 170, 176, 87, 238, 27, 119, 95, 201, 238, 190, 89, 7, 37, 195, 196, 176, 4, 5, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, 148, 89, 69, 18, 11, 9, 216, + 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, + 244, 73, 233, 87, 90, 200, 191, 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, + 180, 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, 142, 4, 0, 0, ]); diff --git a/acvm-repo/acvm_js/test/shared/witness_compression.ts b/acvm-repo/acvm_js/test/shared/witness_compression.ts index d2326c1b11b..0643624682f 100644 --- a/acvm-repo/acvm_js/test/shared/witness_compression.ts +++ b/acvm-repo/acvm_js/test/shared/witness_compression.ts @@ -9,9 +9,10 @@ // after recompiling Noir to print the witness byte array to be written to file after execution export const expectedCompressedWitnessMap = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 173, 206, 185, 13, 0, 48, 8, 67, 209, 144, 107, 30, 146, 44, 144, 253, 167, 162, - 65, 130, 158, 239, 198, 174, 158, 44, 45, 178, 211, 254, 222, 90, 203, 17, 206, 186, 29, 252, 53, 64, 107, 114, 150, - 46, 206, 122, 6, 24, 73, 44, 193, 220, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, 173, 5, 172, 34, 56, 136, + 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, + 43, 108, 101, 159, 162, 35, 234, 108, 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, + 91, 126, 196, 195, 172, 1, 0, 0, ]); export const expectedWitnessMap = new Map([ From 6e246f534c06de3f75ddd7defd54eca49dab60b1 Mon Sep 17 00:00:00 2001 From: aakoshh Date: Wed, 26 Mar 2025 10:44:47 +0000 Subject: [PATCH 04/30] Try bincode first, the others might falsely pass --- acvm-repo/acir/src/serialization.rs | 4 +- .../acir/tests/test_program_serialization.rs | 74 ++++++++++++++++++- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/acvm-repo/acir/src/serialization.rs b/acvm-repo/acir/src/serialization.rs index b8cf1d73787..b27f9d67922 100644 --- a/acvm-repo/acir/src/serialization.rs +++ b/acvm-repo/acir/src/serialization.rs @@ -123,7 +123,7 @@ where /// but fall back to the legacy `bincode` format if anything fails. pub(crate) fn deserialize_any_format(buf: &[u8]) -> std::io::Result where - T: for<'a> Deserialize<'a>, + T: for<'a> Deserialize<'a> + std::fmt::Debug, F: AcirField, R: prost::Message + Default, ProtoSchema: ProtoCodec, @@ -138,7 +138,7 @@ where match format { Format::BincodeLegacy => { // This is just a coincidence, as this format does not appear in the data, - // but we know it's none of the other formats, so we can just return bincode. + // but we know it's none of the other formats. } Format::Bincode => { if let Ok(value) = bincode_deserialize(&buf[1..]) { diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 7c0fd30945d..67d7c6a8c69 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -17,7 +17,7 @@ use acir::{ brillig::{BrilligBytecode, BrilligFunctionId, BrilligInputs, BrilligOutputs}, opcodes::{AcirFunctionId, BlackBoxFuncCall, BlockId, FunctionInput, MemOp}, }, - native_types::{Expression, Witness}, + native_types::{Expression, Witness, WitnessMap, WitnessStack}, }; use acir_field::{AcirField, FieldElement}; use brillig::{ @@ -526,3 +526,75 @@ fn nested_acir_call_circuit() { let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); } + +#[test] +fn legacy_witness_map() { + // This is from `witness_compression.ts`, and is actually a compressed `WitnessStack`. + // The `decompress_witness` function in `acvm_js` knows to decompress into a stack first. + let legacy_data: Vec = vec![ + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 173, 206, 185, 13, 0, 48, 8, 67, 209, 144, 107, 30, 146, + 44, 144, 253, 167, 162, 65, 130, 158, 239, 198, 174, 158, 44, 45, 178, 211, 254, 222, 90, + 203, 17, 206, 186, 29, 252, 53, 64, 107, 114, 150, 46, 206, 122, 6, 24, 73, 44, 193, 220, + 1, 0, 0, + ]; + + let witness = WitnessStack::::deserialize(&legacy_data) + .expect("should figure out it's unmarked bincode") + .pop() + .expect("non-empty stack") + .witness; + + let expected_witness = { + let mut w = WitnessMap::new(); + for (i, f) in [1, 2, 1, 1, 0, 3].iter().enumerate() { + w.insert(Witness::new(i as u32), FieldElement::from(*f as u64)); + } + w + }; + + assert_eq!(witness, expected_witness); + + let expected_serialization: Vec = vec![ + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, + 173, 5, 172, 34, 56, 136, 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, + 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, 43, 108, 101, 159, 162, 35, 234, 108, + 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, 91, 126, + 196, 195, 172, 1, 0, 0, + ]; + + let mut stack = WitnessStack::default(); + stack.push(0, witness); + + let bytes = stack.serialize().unwrap(); + assert_eq!(bytes, expected_serialization); +} + +#[test] +fn legacy_witness_stack() { + let legacy_data: Vec = vec![ + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 13, 0, 32, 8, 4, 17, 117, 31, 75, 75, 87, + 113, 255, 37, 44, 196, 5, 228, 42, 194, 39, 132, 238, 114, 249, 239, 114, 163, 118, 47, + 203, 254, 240, 101, 23, 152, 213, 120, 199, 73, 58, 42, 200, 170, 176, 87, 238, 27, 119, + 95, 201, 238, 190, 89, 7, 37, 195, 196, 176, 4, 5, 0, 0, + ]; + + let stack = WitnessStack::::deserialize(&legacy_data) + .expect("should figure out it's unmarked bincode"); + + assert_eq!(stack.length(), 5); + + let expected_serialization: Vec = vec![ + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, + 148, 89, 69, 18, 11, 9, 216, 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, + 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, 244, 73, 233, 87, 90, 200, 191, + 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, 180, + 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, + 142, 4, 0, 0, + ]; + + let bytes = stack.serialize().unwrap(); + assert_eq!(bytes, expected_serialization); + + let stack_de = WitnessStack::deserialize(&bytes).unwrap(); + assert_eq!(stack_de, stack); +} From 3625ab7a69e66961f7e351bf9075245a4ee0ee26 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 20 May 2025 14:59:15 +0100 Subject: [PATCH 05/30] Update insta formats to use msgpack --- .../acir/tests/test_program_serialization.rs | 126 ++---------------- 1 file changed, 9 insertions(+), 117 deletions(-) diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 67d7c6a8c69..ab937224efe 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -47,22 +47,7 @@ fn addition_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, - 227, 164, 113, 54, 120, 8, 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, - 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, 21, 66, 236, 237, 29, 239, 112, 244, - 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, 197, 149, - 141, 14, 66, 16, 214, 25, 88, 31, 61, 250, 65, 123, 3, 97, 115, 253, 116, 18, 2, 96, 60, 3, - 244, 183, 83, 159, 58, 17, 1, 251, 48, 126, 116, 214, 129, 68, 161, 125, 175, 172, 147, 59, - 218, 253, 246, 251, 152, 236, 119, 116, 118, 0, 198, 60, 51, 24, 89, 150, 37, 212, 5, 80, - 70, 37, 41, 26, 197, 43, 82, 86, 106, 201, 41, 167, 21, 175, 76, 193, 25, 3, 94, 242, 186, - 81, 77, 77, 26, 90, 50, 160, 109, 213, 176, 246, 23, 178, 120, 184, 20, 122, 239, 41, 228, - 21, 214, 3, 102, 173, 89, 79, 54, 108, 226, 197, 116, 234, 148, 79, 217, 177, 121, 31, 208, - 174, 100, 4, 49, 72, 148, 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, - 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, 119, 69, 68, 159, 185, 242, 28, 194, - 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, 235, 1, 0, - 0, - ]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, 227, 164, 113, 54, 120, 8, 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, 21, 66, 236, 237, 29, 239, 112, 244, 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, 197, 149, 141, 14, 66, 16, 214, 25, 88, 31, 61, 250, 65, 123, 3, 97, 115, 253, 116, 18, 2, 96, 60, 3, 244, 183, 83, 159, 58, 17, 1, 251, 48, 126, 116, 214, 129, 68, 161, 125, 175, 172, 147, 59, 218, 253, 246, 251, 152, 236, 119, 116, 118, 0, 198, 60, 51, 24, 89, 150, 37, 212, 5, 80, 70, 37, 41, 26, 197, 43, 82, 86, 106, 201, 41, 167, 21, 175, 76, 193, 25, 3, 94, 242, 186, 81, 77, 77, 26, 90, 50, 160, 109, 213, 176, 246, 23, 178, 120, 184, 20, 122, 239, 41, 228, 21, 214, 3, 102, 173, 89, 79, 54, 108, 226, 197, 116, 234, 148, 79, 217, 177, 121, 31, 208, 174, 100, 4, 49, 72, 148, 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, 119, 69, 68, 159, 185, 242, 28, 194, 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, 235, 1, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -101,21 +86,7 @@ fn multi_scalar_mul_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, - 181, 34, 184, 115, 37, 226, 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, - 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, 194, 51, 137, 77, 2, 33, 100, 145, 93, - 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, 8, 80, 212, - 157, 19, 4, 102, 229, 208, 66, 115, 220, 135, 104, 130, 5, 158, 181, 203, 177, 215, 230, - 118, 28, 154, 211, 44, 58, 209, 222, 183, 239, 103, 201, 139, 59, 55, 218, 107, 202, 227, - 253, 75, 12, 14, 133, 231, 211, 103, 135, 49, 73, 219, 95, 174, 173, 138, 87, 76, 181, 170, - 156, 240, 239, 223, 46, 43, 247, 176, 193, 134, 21, 61, 175, 190, 240, 227, 238, 205, 112, - 143, 126, 180, 197, 250, 144, 36, 51, 158, 31, 28, 30, 45, 161, 137, 148, 121, 14, 158, - 211, 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, - 128, 248, 169, 40, 7, 195, 209, 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, - 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, 224, 238, 39, 87, 149, 219, 21, - 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0, - ]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, 181, 34, 184, 115, 37, 226, 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, 194, 51, 137, 77, 2, 33, 100, 145, 93, 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, 8, 80, 212, 157, 19, 4, 102, 229, 208, 66, 115, 220, 135, 104, 130, 5, 158, 181, 203, 177, 215, 230, 118, 28, 154, 211, 44, 58, 209, 222, 183, 239, 103, 201, 139, 59, 55, 218, 107, 202, 227, 253, 75, 12, 14, 133, 231, 211, 103, 135, 49, 73, 219, 95, 174, 173, 138, 87, 76, 181, 170, 156, 240, 239, 223, 46, 43, 247, 176, 193, 134, 21, 61, 175, 190, 240, 227, 238, 205, 112, 143, 126, 180, 197, 250, 144, 36, 51, 158, 31, 28, 30, 45, 161, 137, 148, 121, 14, 158, 211, 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, 128, 248, 169, 40, 7, 195, 209, 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, 224, 238, 39, 87, 149, 219, 21, 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -322,36 +293,7 @@ fn complex_brillig_foreign_call() { Program { functions: vec![circuit], unconstrained_functions: vec![brillig_bytecode] }; let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, - 240, 0, 105, 43, 238, 148, 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, - 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, 230, 103, 181, 41, 80, 42, 212, 43, - 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, 227, 25, - 207, 108, 190, 25, 85, 67, 238, 27, 42, 184, 238, 188, 255, 230, 135, 74, 1, 55, 232, 53, - 53, 28, 180, 70, 148, 19, 168, 111, 13, 133, 244, 5, 1, 221, 177, 241, 19, 69, 25, 163, - 181, 50, 102, 236, 237, 71, 74, 114, 3, 202, 101, 104, 116, 215, 246, 247, 148, 194, 141, - 94, 43, 10, 66, 134, 12, 168, 64, 183, 207, 25, 229, 128, 21, 242, 69, 80, 161, 28, 255, - 194, 232, 254, 120, 92, 90, 237, 217, 246, 142, 95, 33, 127, 229, 109, 74, 255, 131, 106, - 254, 246, 80, 45, 172, 135, 170, 29, 28, 80, 94, 99, 240, 55, 202, 189, 117, 92, 132, 117, - 56, 116, 115, 164, 27, 138, 208, 36, 97, 234, 165, 97, 42, 222, 185, 155, 200, 25, 72, 6, - 247, 210, 151, 173, 72, 42, 32, 212, 199, 6, 190, 127, 129, 186, 251, 208, 218, 233, 233, - 18, 75, 204, 203, 232, 144, 87, 68, 232, 50, 75, 190, 74, 69, 143, 220, 26, 36, 177, 194, - 1, 56, 31, 116, 207, 203, 23, 206, 100, 88, 97, 212, 207, 76, 219, 167, 10, 76, 168, 56, - 58, 194, 44, 4, 221, 254, 140, 181, 6, 101, 80, 224, 246, 197, 53, 55, 184, 112, 245, 224, - 252, 50, 10, 59, 19, 9, 250, 221, 22, 118, 84, 105, 24, 72, 138, 225, 131, 237, 151, 147, - 37, 173, 216, 149, 132, 153, 58, 108, 7, 79, 169, 2, 223, 228, 70, 21, 106, 144, 166, 111, - 192, 14, 159, 115, 3, 53, 80, 199, 135, 187, 59, 253, 9, 222, 202, 162, 237, 46, 131, 246, - 54, 10, 93, 178, 227, 164, 6, 9, 54, 184, 44, 100, 163, 117, 158, 97, 128, 48, 33, 137, 51, - 41, 147, 251, 227, 132, 197, 229, 105, 238, 147, 168, 86, 53, 152, 203, 115, 239, 218, 244, - 220, 41, 45, 131, 46, 108, 84, 207, 237, 101, 208, 197, 13, 223, 162, 127, 183, 210, 251, - 163, 149, 133, 5, 86, 22, 109, 188, 47, 20, 208, 26, 79, 0, 222, 141, 210, 248, 12, 93, 23, - 186, 52, 215, 199, 25, 36, 23, 252, 232, 25, 96, 57, 9, 127, 115, 40, 5, 117, 7, 85, 51, - 223, 79, 18, 220, 130, 61, 125, 1, 129, 80, 141, 189, 121, 156, 7, 11, 230, 15, 47, 178, - 71, 153, 168, 133, 76, 67, 194, 172, 100, 154, 113, 102, 216, 73, 91, 166, 191, 79, 129, - 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, - 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, - 240, 2, 11, 102, 132, 126, 2, 214, 167, 16, 147, 245, 9, 0, 0, - ]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, 240, 0, 105, 43, 238, 148, 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, 230, 103, 181, 41, 80, 42, 212, 43, 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, 227, 25, 207, 108, 190, 25, 85, 67, 238, 27, 42, 184, 238, 188, 255, 230, 135, 74, 1, 55, 232, 53, 53, 28, 180, 70, 148, 19, 168, 111, 13, 133, 244, 5, 1, 221, 177, 241, 19, 69, 25, 163, 181, 50, 102, 236, 237, 71, 74, 114, 3, 202, 101, 104, 116, 215, 246, 247, 148, 194, 141, 94, 43, 10, 66, 134, 12, 168, 64, 183, 207, 25, 229, 128, 21, 242, 69, 80, 161, 28, 255, 194, 232, 254, 120, 92, 90, 237, 217, 246, 142, 95, 33, 127, 229, 109, 74, 255, 131, 106, 254, 246, 80, 45, 172, 135, 170, 29, 28, 80, 94, 99, 240, 55, 202, 189, 117, 92, 132, 117, 56, 116, 115, 164, 27, 138, 208, 36, 97, 234, 165, 97, 42, 222, 185, 155, 200, 25, 72, 6, 247, 210, 151, 173, 72, 42, 32, 212, 199, 6, 190, 127, 129, 186, 251, 208, 218, 233, 233, 18, 75, 204, 203, 232, 144, 87, 68, 232, 50, 75, 190, 74, 69, 143, 220, 26, 36, 177, 194, 1, 56, 31, 116, 207, 203, 23, 206, 100, 88, 97, 212, 207, 76, 219, 167, 10, 76, 168, 56, 58, 194, 44, 4, 221, 254, 140, 181, 6, 101, 80, 224, 246, 197, 53, 55, 184, 112, 245, 224, 252, 50, 10, 59, 19, 9, 250, 221, 22, 118, 84, 105, 24, 72, 138, 225, 131, 237, 151, 147, 37, 173, 216, 149, 132, 153, 58, 108, 7, 79, 169, 2, 223, 228, 70, 21, 106, 144, 166, 111, 192, 14, 159, 115, 3, 53, 80, 199, 135, 187, 59, 253, 9, 222, 202, 162, 237, 46, 131, 246, 54, 10, 93, 178, 227, 164, 6, 9, 54, 184, 44, 100, 163, 117, 158, 97, 128, 48, 33, 137, 51, 41, 147, 251, 227, 132, 197, 229, 105, 238, 147, 168, 86, 53, 152, 203, 115, 239, 218, 244, 220, 41, 45, 131, 46, 108, 84, 207, 237, 101, 208, 197, 13, 223, 162, 127, 183, 210, 251, 163, 149, 133, 5, 86, 22, 109, 188, 47, 20, 208, 26, 79, 0, 222, 141, 210, 248, 12, 93, 23, 186, 52, 215, 199, 25, 36, 23, 252, 232, 25, 96, 57, 9, 127, 115, 40, 5, 117, 7, 85, 51, 223, 79, 18, 220, 130, 61, 125, 1, 129, 80, 141, 189, 121, 156, 7, 11, 230, 15, 47, 178, 71, 153, 168, 133, 76, 67, 194, 172, 100, 154, 113, 102, 216, 73, 91, 166, 191, 79, 129, 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, 240, 2, 11, 102, 132, 126, 2, 214, 167, 16, 147, 245, 9, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -388,23 +330,7 @@ fn memory_op_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, - 180, 20, 136, 138, 218, 242, 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, - 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, 187, 18, 74, 71, 145, 8, 161, 184, - 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, 46, 223, - 68, 64, 4, 227, 217, 185, 242, 6, 136, 152, 50, 18, 70, 219, 247, 214, 9, 43, 129, 102, - 147, 197, 62, 104, 139, 227, 61, 163, 124, 53, 47, 74, 43, 78, 153, 146, 91, 55, 42, 197, - 211, 94, 182, 232, 50, 126, 236, 224, 174, 3, 78, 230, 221, 125, 224, 150, 224, 87, 214, - 85, 209, 58, 64, 254, 77, 91, 69, 29, 74, 230, 1, 53, 213, 175, 165, 50, 192, 145, 9, 171, - 11, 101, 218, 103, 170, 175, 207, 152, 248, 220, 205, 87, 59, 59, 183, 109, 43, 127, 69, - 54, 228, 101, 128, 223, 200, 154, 233, 234, 76, 253, 181, 20, 156, 71, 135, 32, 149, 224, - 30, 62, 254, 141, 101, 249, 134, 90, 54, 88, 187, 101, 79, 48, 74, 1, 81, 170, 48, 77, 174, - 244, 39, 241, 208, 20, 54, 36, 245, 228, 139, 67, 53, 76, 24, 230, 56, 114, 13, 169, 51, - 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, - 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, - 46, 146, 253, 172, 141, 250, 11, 130, 86, 177, 6, 68, 4, 0, 0, - ]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, 180, 20, 136, 138, 218, 242, 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, 187, 18, 74, 71, 145, 8, 161, 184, 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, 46, 223, 68, 64, 4, 227, 217, 185, 242, 6, 136, 152, 50, 18, 70, 219, 247, 214, 9, 43, 129, 102, 147, 197, 62, 104, 139, 227, 61, 163, 124, 53, 47, 74, 43, 78, 153, 146, 91, 55, 42, 197, 211, 94, 182, 232, 50, 126, 236, 224, 174, 3, 78, 230, 221, 125, 224, 150, 224, 87, 214, 85, 209, 58, 64, 254, 77, 91, 69, 29, 74, 230, 1, 53, 213, 175, 165, 50, 192, 145, 9, 171, 11, 101, 218, 103, 170, 175, 207, 152, 248, 220, 205, 87, 59, 59, 183, 109, 43, 127, 69, 54, 228, 101, 128, 223, 200, 154, 233, 234, 76, 253, 181, 20, 156, 71, 135, 32, 149, 224, 30, 62, 254, 141, 101, 249, 134, 90, 54, 88, 187, 101, 79, 48, 74, 1, 81, 170, 48, 77, 174, 244, 39, 241, 208, 20, 54, 36, 245, 228, 139, 67, 53, 76, 24, 230, 56, 114, 13, 169, 51, 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, 46, 146, 253, 172, 141, 250, 11, 130, 86, 177, 6, 68, 4, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -502,26 +428,7 @@ fn nested_acir_call_circuit() { let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, - 109, 178, 3, 113, 6, 54, 108, 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, - 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, 220, 6, 83, 81, 40, 42, 130, 162, - 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, 196, 232, - 248, 62, 85, 156, 3, 147, 104, 143, 74, 6, 66, 32, 202, 8, 12, 237, 113, 89, 165, 37, 1, - 49, 218, 63, 219, 192, 121, 126, 116, 66, 137, 121, 78, 89, 165, 164, 104, 13, 115, 92, 42, - 249, 114, 109, 172, 174, 226, 64, 104, 138, 37, 60, 126, 157, 105, 207, 102, 94, 172, 11, - 1, 92, 110, 1, 47, 15, 187, 66, 229, 72, 2, 47, 68, 125, 151, 83, 6, 152, 163, 180, 44, 18, - 202, 240, 164, 195, 182, 125, 90, 115, 150, 59, 174, 165, 107, 248, 78, 47, 8, 160, 239, - 129, 235, 187, 216, 241, 226, 36, 10, 157, 32, 76, 122, 145, 27, 185, 97, 20, 18, 47, 242, - 125, 136, 130, 168, 31, 39, 113, 223, 137, 221, 192, 7, 55, 11, 99, 63, 123, 45, 98, 159, - 238, 162, 116, 233, 86, 156, 107, 24, 106, 14, 66, 232, 167, 105, 226, 68, 238, 116, 155, - 44, 41, 149, 102, 78, 110, 43, 78, 7, 26, 15, 170, 48, 199, 5, 104, 36, 162, 49, 110, 42, - 149, 228, 52, 157, 141, 153, 151, 28, 164, 226, 12, 13, 112, 174, 64, 212, 87, 120, 2, 19, - 21, 186, 44, 222, 214, 129, 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, - 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, 71, 125, 94, 85, 253, 209, 84, 99, - 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, 15, 122, - 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0, - ]"); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, 109, 178, 3, 113, 6, 54, 108, 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, 220, 6, 83, 81, 40, 42, 130, 162, 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, 196, 232, 248, 62, 85, 156, 3, 147, 104, 143, 74, 6, 66, 32, 202, 8, 12, 237, 113, 89, 165, 37, 1, 49, 218, 63, 219, 192, 121, 126, 116, 66, 137, 121, 78, 89, 165, 164, 104, 13, 115, 92, 42, 249, 114, 109, 172, 174, 226, 64, 104, 138, 37, 60, 126, 157, 105, 207, 102, 94, 172, 11, 1, 92, 110, 1, 47, 15, 187, 66, 229, 72, 2, 47, 68, 125, 151, 83, 6, 152, 163, 180, 44, 18, 202, 240, 164, 195, 182, 125, 90, 115, 150, 59, 174, 165, 107, 248, 78, 47, 8, 160, 239, 129, 235, 187, 216, 241, 226, 36, 10, 157, 32, 76, 122, 145, 27, 185, 97, 20, 18, 47, 242, 125, 136, 130, 168, 31, 39, 113, 223, 137, 221, 192, 7, 55, 11, 99, 63, 123, 45, 98, 159, 238, 162, 116, 233, 86, 156, 107, 24, 106, 14, 66, 232, 167, 105, 226, 68, 238, 116, 155, 44, 41, 149, 102, 78, 110, 43, 78, 7, 26, 15, 170, 48, 199, 5, 104, 36, 162, 49, 110, 42, 149, 228, 52, 157, 141, 153, 151, 28, 164, 226, 12, 13, 112, 174, 64, 212, 87, 120, 2, 19, 21, 186, 44, 222, 214, 129, 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, 71, 125, 94, 85, 253, 209, 84, 99, 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, 15, 122, 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); @@ -554,19 +461,12 @@ fn legacy_witness_map() { assert_eq!(witness, expected_witness); - let expected_serialization: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, - 173, 5, 172, 34, 56, 136, 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, - 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, 43, 108, 101, 159, 162, 35, 234, 108, - 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, 91, 126, - 196, 195, 172, 1, 0, 0, - ]; - let mut stack = WitnessStack::default(); stack.push(0, witness); let bytes = stack.serialize().unwrap(); - assert_eq!(bytes, expected_serialization); + + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, 173, 5, 172, 34, 56, 136, 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, 43, 108, 101, 159, 162, 35, 234, 108, 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, 91, 126, 196, 195, 172, 1, 0, 0]"); } #[test] @@ -583,17 +483,9 @@ fn legacy_witness_stack() { assert_eq!(stack.length(), 5); - let expected_serialization: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, - 148, 89, 69, 18, 11, 9, 216, 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, - 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, 244, 73, 233, 87, 90, 200, 191, - 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, 180, - 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, - 142, 4, 0, 0, - ]; - let bytes = stack.serialize().unwrap(); - assert_eq!(bytes, expected_serialization); + + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, 148, 89, 69, 18, 11, 9, 216, 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, 244, 73, 233, 87, 90, 200, 191, 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, 180, 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, 142, 4, 0, 0]"); let stack_de = WitnessStack::deserialize(&bytes).unwrap(); assert_eq!(stack_de, stack); From e6679ecbd53cef569d8c75f594452ecbb4da9c7b Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 20 May 2025 16:15:39 +0100 Subject: [PATCH 06/30] Update insta snapshots to use msgpack --- .../execute__tests__force_brillig_false_inliner_0.snap | 4 ++-- .../execute__tests__force_brillig_false_inliner_0.snap | 6 +++--- .../execute__tests__force_brillig_false_inliner_0.snap | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap index 2ebaf85258f..571aa6ef916 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap @@ -18,7 +18,7 @@ expression: artifact "return_type": null, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/5XDsQkAAADCMAv+f7PuTgaCFm19Arunwj5IAAAA", + "bytecode": "H4sIAAAAAAAA/02OSwrCQBAFRTyZFxnamVYHkp6hPzHbuHEbDyHBhfgB8Xo2LiTLVxSPWh6vW6OouZCcT+9ozEgaDlkJRUKmhP1iKjWWhDI+sK/s3G1Xku6HaV3MnTRcfnv1qpw7UAwVGFpUZBmf1TZNjnN0Y1RjCh005r93EEHW0Po37Bx8vMmLlCETpvBPHL8wJ2nVsAAAAA==", "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", "names": [ "fn1" @@ -38,7 +38,7 @@ expression: artifact "return_type": null, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/5XDsQkAAADCMAv+f7PuTgaCFm19Arunwj5IAAAA", + "bytecode": "H4sIAAAAAAAA/02OSwrCQBAFRTyZFxnamVYHkp6hPzHbuHEbDyHBhfgB8Xo2LiTLVxSPWh6vW6OouZCcT+9ozEgaDlkJRUKmhP1iKjWWhDI+sK/s3G1Xku6HaV3MnTRcfnv1qpw7UAwVGFpUZBmf1TZNjnN0Y1RjCh005r93EEHW0Po37Bx8vMmLlCETpvBPHL8wJ2nVsAAAAA==", "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", "names": [ "fn2" diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap index f058d2f6091..f85b53ac917 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap @@ -29,7 +29,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/62QsQ2AMAwEMWIgO7aJ3bEKEc7+IyCUFFEKGjjp9cVLVzwsDeiZWXsfvRl3kcgpiOnE5MUURctuZKSmVzLmMLHsxTM6CQdVdY7aGF34DYL/XPi4tuGLGXjZbl/bHHBEAQAA", + "bytecode": "H4sIAAAAAAAA/6XRTU7DMBAF4BZxIDtOGmcHHION5dgTsJTYYWyXbgMLtkmvgFBVJMSfEGfhNlhBQt13djOLJ833Tu72TbQqGGf99PClIiLYIG5NsOC9MFbDZrlzvXIa/DQ8n3sPGC4B3f2+i60IgJ0fP1tjQaJQrquNlXPadvtzxsgqz6HMgDIqSVbVvCB5Ua845bTghc44Y8BzXlZ1VZKK5gxoU1QMmr9ZpAxy3NDl441QR8eQN9j0mEjSa0lHh+thd+Fi4tHD07yffvRo1jKA6CXKDpKMnxbvfaxbow5u4wtCiGjFWrYxmS5f5WwqupQur8CP36mQBBhQJlUt/vsZfwEqkzXdrQEAAA==", "debug_symbols": "dY/RCoMwDEX/Jc99GIyB81fGkFijFEJaYisM8d8XRTcZ7Cm9OT2XdoaO2jI0Qfo4Qv2YodXAHIaGo8ccoth2XhwcsclKZCs4cbMSKkmGWgqzgwm5bJfGhLLNjGr04oCks2mFfWBaT4v72pf/alXt7v36kW9mPy2hD/r73gk1YMu0x76IP9H8Sgc5/ps0euqK0tq0Met+Aw==", "names": [ "double" @@ -59,7 +59,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/7WR0QrDIAxFq2z/k5ikJm/7lUnT//+ErZ0FkT7N9sBFkHCJxzj9iDUbz29CzUFo5tr7nVc9YQxsO+PF3aHpIpiZPSdHwjckKyrAUmZFRVFZkhK5smYrlsGQyXEVI193lnjdXrDt9egkTyfi+884m+2dDb4z3+UfBvnH2cEHq8+0wPECAAA=", + "bytecode": "H4sIAAAAAAAA/9WTS07DMBBAm4gDxU3SODs+t2BjOfYULCV28Kd0G0Bim+YI/KogIX5CnIXbYEUCsUEIpZvOyp7FjOa9mfCsnzvJrFDSdJdvzGkN0pJTYSUYQ4TksAzXqmaKg+mamwNalhdXggd3QtbOmtVkrZwdXmFfa+CCUQvnfeVKYkFXpn0thQSqCVNVISQdOrXXJ4R97EbjAjX3e8aAtoeg1V8tu258v8DXiKNZkkA2BRQjGk3zAqdRkhYzjDBKccqnOI4BJzjLizyLcpTEgOZpHsN8CB5uZPToCZaetjF+NC+L2+Nmva+ct8Wb2+G/81JrsfAuSE01rcCT8bKea1eUgv3ItQ8arNOSLGjpwKyCRzowJZWvTo/AtL9sRfC1Fav/ahiJMJtsQuXWaXj3Z+oBWk09VU6+r7b9BC/bX3TDAwAA", "debug_symbols": "zZDBCoMwDIbfJWcPnduY81WGSK1RCqUtsR0M6buvFXV6GIOxw05p8vcL7TdCi43va6k7M0B5G6EhqZTsa2UEd9LoOB1DBktbO0KMI9jkkbKcUDsotVcqgztXfro0WK6n6jjFlGWAuo01LuykwnQK2Ytm79GcFTOcH64rfv6Gz487voodF5J2PwYG5SGkdSR5o3C20HktNlLcwy7Jos2SEdh6wrRuytID/1XqZZVSnD5L+ZGPKjwB", "names": [ "times_40", @@ -90,7 +90,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/62QsQ2AMAwEMWIgO7aJ3bEKEc7+IyAgRZSCBk56ffHSFQ/TA7SMzK231oyrSOQUxLRj8mKKomU1MlLTIxlzmFj24hmdhIOqOke9id6F3yD4z4WXa+m+GIGX7QSI948TRAEAAA==", + "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXQZWKYMcNzR7vBHq6BjyBtsBE0l6LenocD3uL1xMPHp8WvbTjwHNRgYQg0TZQ5Lx8+p9iE1n1L/b9IIQIlqxkV1MptmrXExFn9LlFfjpOxWSAAPKpKrFXz/TL9esnu+tAQAA", "debug_symbols": "dY/RCoMwDEX/Jc990DEZ+CtjSKxRCqEtsRWG+O+LopsMfEpvTs+lnaGjNg+N830YoX7O0IpjdkPDwWJywet2XgwcsUlCpCs4cbUiCvkEtc/MBibkvF0aI/ptJhSlhQHynU4t7B3TelrMzy6u1fL+2OWyun31Sv2XJrRO/l88oThsmfbYZ29PNL3jQY4fRwmWuiy0Nm1Muz8=", "names": [ "triple" diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap index 2c998935cb2..cd95ea8254d 100644 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap +++ b/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap @@ -29,7 +29,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/62QsQ2AMAwEMWIgO7aJ3bEKEc7+IyCUFFEKGjjp9cVLVzwsDeiZWXsfvRl3kcgpiOnE5MUURctuZKSmVzLmMLHsxTM6CQdVdY7aGF34DYL/XPi4tuGLGXjZbl/bHHBEAQAA", + "bytecode": "H4sIAAAAAAAA/6XRTU7DMBAF4BZxIDtOGmcHHION5dgTsJTYYWyXbgMLtkmvgFBVJMSfEGfhNlhBQt13djOLJ833Tu72TbQqGGf99PClIiLYIG5NsOC9MFbDZrlzvXIa/DQ8n3sPGC4B3f2+i60IgJ0fP1tjQaJQrquNlXPadvtzxsgqz6HMgDIqSVbVvCB5Ua845bTghc44Y8BzXlZ1VZKK5gxoU1QMmr9ZpAxy3NDl441QR8eQN9j0mEjSa0lHh+thd+Fi4tHD07yffvRo1jKA6CXKDpKMnxbvfaxbow5u4wtCiGjFWrYxmS5f5WwqupQur8CP36mQBBhQJlUt/vsZfwEqkzXdrQEAAA==", "debug_symbols": "dY/RCoMwDEX/Jc99GIM58FfGkFijFEJaYisM8d8XRTcZ7Cm9OT2XdoaO2jI0Qfo4Qv2YodXAHIaGo8ccoth2XhwcsclKZCs4cbMSKkmGWgqzgwm5bJfGhLLNjGr04oCks2mFfWBaT4v72pf/anXd3er+kW9mPy2hD/r73gk1YMu0x76IP9H8Sgc5/ps0euqK0tq0Met+Aw==", "names": [ "double" @@ -59,7 +59,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/62QsQ2AMAwECWIgO7YTu2MVojj7j4CAFFEKGjjp9cVLV3xYHkLPzNp7702QmD1HR8IDohUVYClJUVFUalQiV9ZsxTIYMjk2MfJ2U0cXfAPDfy64XNvwxUx42U76ES6ERAEAAA==", + "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXUavUgY5bmj2eCPU0THkDbYDJpL0WtLR4XrcX7iYePT4tOynHwOajQwgBomyhyTj59X7EJvOqH+36QUhRLRiI7uYTLNXuZiKPqXLK/DTdyokAQaUSVWLv36mX0NE10itAQAA", "debug_symbols": "dY/RCoMwDEX/Jc99UMZA/JUxJNYohdCW2ApD/PdFsZsM9pTenJ5Lu8JAfZ4658cwQ/tYoRfH7KaOg8XkgtftuhkosUtCpCu4cLUiCvkErc/MBhbkfFyaI/pjJhSllQHyg04tHB3TftrM167+q3VzO+W6aT76Xf2nJrROfl+8oDjsmc44Zm8vNL1iIeXHUYKlIQvtTQfT7jc=", "names": [ "quadruple" @@ -89,7 +89,7 @@ expression: artifact }, "error_types": {} }, - "bytecode": "H4sIAAAAAAAA/62QsQ2AMAwEMWIgO7aJ3bEKEc7+IyAgRZSCBk56ffHSFQ/TA7SMzK231oyrSOQUxLRj8mKKomU1MlLTIxlzmFj24hmdhIOqOke9id6F3yD4z4WXa+m+GIGX7QSI948TRAEAAA==", + "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXQZWKYMcNzR7vBHq6BjyBtsBE0l6LenocD3uL1xMPHp8WvbTjwHNRgYQg0TZQ5Lx8+p9iE1n1L/b9IIQIlqxkV1MptmrXExFn9LlFfjpOxWSAAPKpKrFXz/TL9esnu+tAQAA", "debug_symbols": "dY/RCoMwDEX/Jc99UGF78FfGkFijFEJbYisM8d8XxW4y2FN6c3ou7QoD9XnqnB/DDO1jhV4cs5s6DhaTC16362agxC4Jka7gwtWKKOQTtD4zG1iQ83FpjuiPmVCUVgbIDzq1cHRM+2kzX7v6r9ZNfcp1c//oN/WfmtA6+X3xguKwZzrjmL290PSKhZQfRwmWhiy0Nx1Mu98=", "names": [ "triple" From 732620550cd3c5b535b1305518e35ccaf9500ac2 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 13:07:16 +0000 Subject: [PATCH 07/30] Test both legacy and default formats --- .../acir/tests/test_program_serialization.rs | 97 +++++++------------ 1 file changed, 35 insertions(+), 62 deletions(-) diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index f33d04f1a15..ace6b404213 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -11,7 +11,7 @@ use acir::{ circuit::{Circuit, Program, brillig::BrilligBytecode}, - native_types::{Witness, WitnessMap, WitnessStack}, + native_types::Witness, }; use acir_field::FieldElement; use brillig::{ @@ -33,11 +33,16 @@ fn addition_circuit() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 10, 128, 48, 12, 69, 127, 170, 7, 113, 212, 77, 241, 8, 34, 56, 137, 163, 139, 155, 7, 16, 55, 199, 30, 65, 188, 128, 167, 16, 61, 78, 55, 71, 23, 119, 29, 90, 140, 116, 105, 31, 132, 36, 240, 73, 254, 39, 252, 9, 223, 34, 216, 4, 186, 71, 112, 130, 200, 67, 43, 152, 54, 237, 235, 81, 101, 107, 178, 55, 229, 38, 101, 219, 197, 249, 89, 77, 199, 48, 23, 234, 94, 46, 237, 195, 241, 46, 132, 121, 192, 102, 179, 3, 95, 38, 206, 3, 2, 103, 244, 195, 16, 1, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); + + let bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, 1, 0, 0]"); + + let program_de = Program::deserialize_program(&bytes).unwrap(); + assert_eq!(program_de, program); } #[test] @@ -55,11 +60,16 @@ fn multi_scalar_mul_circuit() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 12, 66, 87, 235, 127, 255, 3, 183, 224, 5, 214, 64, 84, 68, 151, 236, 189, 21, 72, 232, 195, 35, 224, 226, 47, 50, 236, 232, 155, 23, 184, 194, 45, 208, 217, 153, 120, 147, 13, 167, 83, 37, 51, 249, 169, 221, 255, 54, 129, 45, 40, 232, 188, 0, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); + + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 144, 75, 75, 3, 65, 16, 132, 201, 230, 225, 227, 103, 69, 240, 230, 201, 131, 199, 161, 157, 109, 165, 113, 210, 51, 116, 247, 196, 92, 87, 4, 175, 27, 5, 207, 158, 92, 114, 136, 47, 16, 255, 158, 67, 196, 33, 183, 143, 42, 170, 232, 174, 230, 110, 115, 149, 217, 27, 69, 214, 245, 195, 246, 159, 29, 195, 2, 95, 190, 125, 22, 65, 54, 119, 75, 198, 168, 234, 136, 91, 92, 29, 15, 49, 249, 216, 162, 174, 187, 143, 121, 0, 127, 51, 143, 171, 211, 146, 59, 129, 16, 186, 183, 179, 28, 140, 206, 61, 4, 144, 130, 247, 175, 41, 18, 155, 62, 117, 195, 197, 95, 199, 168, 82, 83, 105, 60, 232, 46, 160, 143, 85, 154, 84, 154, 110, 146, 96, 75, 30, 12, 171, 54, 27, 98, 182, 148, 75, 239, 193, 225, 209, 87, 18, 90, 22, 215, 37, 144, 114, 181, 161, 232, 243, 168, 25, 79, 166, 179, 207, 148, 47, 3, 249, 61, 163, 223, 10, 90, 22, 118, 75, 8, 25, 119, 241, 119, 80, 69, 49, 183, 40, 189, 112, 141, 218, 255, 148, 95, 202, 26, 38, 64, 140, 173, 171, 243, 244, 191, 238, 86, 173, 160, 44, 1, 0, 0]"); + + let program_de = Program::deserialize_program(&default_bytes).unwrap(); + assert_eq!(program_de, program); } #[test] @@ -118,11 +128,16 @@ fn simple_brillig_foreign_call() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 81, 237, 10, 128, 32, 12, 116, 246, 193, 160, 127, 61, 65, 111, 22, 17, 253, 8, 164, 31, 17, 61, 127, 69, 91, 204, 156, 48, 7, 58, 61, 239, 240, 142, 129, 139, 11, 239, 5, 116, 174, 169, 131, 75, 139, 177, 193, 153, 10, 192, 206, 141, 254, 243, 223, 70, 15, 222, 32, 236, 168, 175, 219, 185, 236, 199, 56, 79, 33, 52, 4, 225, 143, 250, 244, 170, 192, 27, 74, 95, 229, 122, 104, 21, 80, 70, 146, 17, 152, 251, 198, 208, 166, 32, 21, 185, 123, 14, 239, 21, 156, 157, 92, 163, 94, 232, 115, 22, 2, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); + + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 119, 247, 212, 199, 232, 51, 180, 79, 208, 166, 66, 234, 161, 39, 212, 179, 229, 216, 147, 213, 72, 94, 219, 29, 207, 166, 77, 111, 155, 180, 234, 53, 32, 245, 94, 21, 242, 79, 155, 128, 0, 33, 174, 60, 8, 15, 131, 55, 144, 16, 34, 17, 144, 240, 201, 26, 123, 230, 155, 239, 55, 147, 245, 103, 157, 210, 42, 70, 103, 195, 193, 159, 197, 234, 46, 172, 44, 224, 223, 165, 42, 137, 192, 178, 248, 142, 108, 33, 4, 129, 86, 195, 143, 55, 19, 231, 149, 211, 16, 14, 170, 250, 35, 161, 49, 152, 183, 164, 49, 191, 254, 163, 78, 198, 104, 125, 201, 241, 101, 188, 143, 54, 55, 48, 152, 21, 165, 17, 12, 84, 132, 225, 133, 65, 11, 146, 132, 114, 69, 27, 173, 188, 147, 60, 188, 73, 222, 38, 187, 79, 154, 30, 125, 19, 234, 249, 127, 201, 196, 149, 188, 86, 47, 188, 129, 108, 230, 9, 52, 42, 201, 112, 125, 238, 9, 187, 241, 34, 188, 164, 232, 45, 182, 20, 14, 211, 236, 204, 151, 109, 131, 106, 35, 56, 92, 16, 112, 73, 86, 116, 165, 41, 33, 12, 79, 101, 8, 64, 44, 138, 232, 95, 230, 49, 112, 21, 17, 197, 206, 153, 100, 180, 163, 197, 3, 189, 254, 99, 122, 53, 218, 110, 147, 168, 34, 155, 105, 187, 199, 208, 48, 251, 91, 141, 90, 77, 242, 160, 142, 252, 248, 158, 66, 53, 254, 132, 4, 138, 211, 105, 27, 89, 4, 252, 9, 213, 228, 179, 101, 200, 129, 142, 190, 190, 127, 55, 90, 118, 242, 2, 255, 187, 106, 103, 175, 171, 157, 86, 243, 102, 198, 90, 178, 108, 57, 223, 27, 92, 108, 72, 8, 169, 53, 69, 58, 43, 169, 100, 222, 200, 108, 71, 179, 19, 215, 233, 4, 224, 237, 120, 90, 213, 123, 142, 0, 115, 219, 8, 252, 158, 174, 24, 142, 239, 240, 205, 55, 132, 226, 96, 23, 95, 160, 112, 212, 251, 176, 165, 120, 181, 217, 206, 210, 146, 224, 158, 135, 135, 77, 24, 237, 33, 24, 189, 222, 206, 39, 202, 156, 45, 223, 119, 20, 168, 142, 247, 217, 249, 170, 190, 95, 145, 6, 71, 127, 226, 29, 70, 160, 180, 54, 116, 188, 164, 188, 178, 125, 11, 131, 35, 244, 228, 97, 3, 0, 0]"); + + let program_de = Program::deserialize_program(&default_bytes).unwrap(); + assert_eq!(program_de, program); } #[test] @@ -234,11 +249,16 @@ fn complex_brillig_foreign_call() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 84, 219, 10, 194, 48, 12, 109, 154, 109, 22, 244, 201, 47, 24, 232, 127, 137, 12, 223, 42, 250, 232, 231, 187, 66, 50, 178, 88, 181, 233, 182, 64, 73, 27, 206, 201, 101, 39, 12, 220, 220, 194, 120, 128, 238, 13, 121, 79, 62, 197, 81, 225, 25, 219, 187, 34, 3, 40, 199, 86, 215, 240, 110, 251, 26, 232, 236, 53, 146, 161, 177, 142, 225, 123, 89, 230, 54, 245, 207, 61, 75, 253, 211, 110, 180, 227, 233, 232, 189, 35, 31, 52, 193, 187, 207, 165, 153, 117, 66, 254, 64, 126, 120, 220, 159, 241, 246, 186, 12, 215, 24, 247, 50, 169, 226, 24, 6, 192, 160, 106, 25, 249, 211, 144, 223, 240, 156, 119, 97, 159, 61, 243, 177, 142, 15, 204, 111, 234, 248, 216, 9, 222, 20, 20, 119, 206, 155, 116, 97, 193, 73, 47, 204, 80, 53, 61, 217, 73, 189, 207, 10, 7, 5, 57, 216, 228, 127, 233, 23, 30, 50, 248, 127, 156, 181, 164, 172, 92, 185, 246, 152, 9, 114, 174, 55, 111, 172, 240, 81, 180, 5, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); + + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, 47, 57, 1, 149, 10, 117, 203, 135, 240, 49, 140, 67, 28, 156, 138, 60, 212, 20, 240, 234, 250, 200, 190, 231, 220, 51, 231, 218, 165, 214, 164, 158, 136, 208, 48, 41, 116, 247, 253, 44, 175, 137, 160, 49, 124, 252, 22, 38, 136, 32, 12, 121, 205, 140, 0, 173, 9, 19, 17, 156, 29, 142, 164, 10, 101, 4, 186, 107, 211, 39, 200, 56, 103, 141, 42, 229, 252, 237, 39, 22, 121, 67, 38, 84, 98, 116, 207, 14, 142, 16, 105, 179, 223, 158, 196, 9, 39, 6, 48, 214, 157, 43, 206, 4, 80, 36, 161, 140, 107, 76, 208, 95, 148, 189, 31, 94, 197, 219, 124, 249, 254, 249, 43, 18, 110, 127, 206, 187, 19, 178, 210, 191, 36, 11, 118, 36, 179, 195, 19, 38, 26, 28, 182, 145, 246, 119, 178, 115, 39, 27, 238, 82, 254, 72, 38, 38, 139, 69, 63, 143, 69, 249, 224, 94, 54, 82, 172, 56, 220, 207, 139, 195, 137, 66, 136, 88, 72, 13, 124, 255, 170, 144, 157, 186, 130, 40, 138, 46, 136, 110, 96, 221, 247, 75, 193, 165, 74, 106, 156, 133, 5, 180, 51, 67, 48, 9, 10, 114, 74, 121, 2, 186, 243, 133, 106, 13, 104, 72, 236, 210, 74, 27, 14, 184, 118, 129, 118, 198, 24, 164, 206, 173, 136, 252, 206, 122, 107, 53, 235, 83, 103, 163, 19, 113, 70, 66, 23, 229, 113, 173, 105, 32, 139, 248, 7, 59, 168, 102, 111, 183, 83, 23, 119, 179, 112, 217, 14, 159, 50, 132, 208, 120, 227, 26, 51, 68, 179, 55, 96, 71, 207, 133, 129, 6, 224, 249, 203, 199, 143, 6, 115, 41, 219, 93, 9, 54, 245, 246, 247, 235, 237, 217, 105, 182, 146, 17, 53, 180, 42, 85, 179, 125, 85, 160, 32, 52, 138, 208, 217, 147, 83, 85, 166, 25, 205, 77, 212, 251, 44, 235, 117, 13, 230, 38, 238, 255, 69, 71, 42, 155, 122, 7, 251, 245, 222, 168, 187, 188, 239, 73, 238, 238, 182, 255, 71, 183, 131, 53, 110, 151, 109, 122, 44, 17, 88, 67, 100, 4, 239, 198, 121, 100, 71, 139, 180, 78, 11, 76, 110, 187, 38, 207, 128, 170, 249, 134, 181, 70, 74, 50, 55, 9, 46, 143, 230, 34, 227, 13, 236, 236, 5, 196, 18, 155, 71, 171, 60, 15, 214, 224, 15, 175, 139, 163, 204, 237, 32, 166, 169, 96, 185, 201, 173, 180, 0, 118, 243, 85, 30, 28, 51, 224, 209, 130, 113, 5, 91, 189, 91, 254, 45, 110, 45, 220, 191, 156, 183, 40, 74, 235, 221, 86, 218, 127, 10, 246, 158, 171, 126, 96, 47, 78, 140, 84, 54, 93, 124, 8, 179, 20, 174, 49, 113, 201, 248, 19, 97, 10, 106, 42, 245, 7, 0, 0]"); + + let program_de = Program::deserialize_program(&default_bytes).unwrap(); + assert_eq!(program_de, program); } #[test] @@ -258,11 +278,16 @@ fn memory_op_circuit() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 81, 65, 10, 0, 32, 8, 115, 106, 255, 232, 255, 175, 172, 131, 70, 129, 7, 211, 129, 108, 135, 13, 28, 3, 189, 24, 251, 196, 180, 51, 27, 227, 210, 76, 49, 38, 165, 128, 110, 14, 159, 57, 201, 123, 187, 221, 170, 185, 114, 55, 205, 123, 207, 166, 190, 165, 4, 15, 104, 144, 91, 71, 10, 197, 194, 40, 2, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); + + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 83, 75, 78, 195, 48, 16, 77, 210, 114, 15, 174, 195, 2, 113, 132, 145, 227, 12, 200, 34, 254, 48, 99, 23, 186, 108, 179, 96, 155, 180, 23, 64, 124, 155, 74, 21, 2, 132, 184, 12, 135, 193, 36, 226, 179, 130, 44, 16, 170, 55, 158, 159, 222, 123, 51, 154, 201, 230, 237, 97, 48, 210, 43, 107, 184, 57, 223, 124, 216, 96, 132, 198, 139, 103, 25, 136, 208, 120, 56, 85, 222, 32, 51, 40, 83, 224, 217, 206, 157, 117, 210, 22, 200, 203, 217, 122, 31, 181, 165, 233, 158, 81, 190, 90, 229, 165, 149, 199, 160, 138, 228, 90, 69, 127, 145, 102, 235, 62, 226, 167, 14, 111, 251, 194, 217, 170, 255, 15, 220, 252, 171, 252, 210, 186, 170, 181, 14, 73, 188, 51, 87, 173, 14, 37, 120, 36, 205, 245, 83, 169, 12, 10, 2, 105, 117, 174, 76, 151, 230, 250, 234, 4, 228, 107, 178, 155, 252, 252, 210, 155, 78, 235, 159, 161, 77, 68, 25, 240, 55, 180, 102, 49, 0, 106, 52, 140, 50, 249, 191, 89, 37, 91, 59, 171, 241, 192, 6, 30, 29, 169, 137, 240, 8, 78, 80, 92, 220, 200, 202, 203, 52, 27, 61, 184, 144, 151, 74, 126, 139, 214, 27, 66, 31, 200, 64, 167, 145, 155, 241, 189, 96, 70, 242, 160, 227, 122, 139, 35, 228, 250, 37, 94, 64, 148, 231, 73, 68, 205, 5, 124, 30, 71, 253, 6, 10, 180, 163, 42, 42, 3, 0, 0]"); + + let program_de = Program::deserialize_program(&default_bytes).unwrap(); + assert_eq!(program_de, program); } #[test] @@ -314,66 +339,14 @@ fn nested_acir_call_circuit() { let bytes = Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 81, 59, 10, 131, 64, 16, 157, 15, 222, 35, 101, 210, 37, 228, 8, 33, 144, 42, 88, 218, 216, 121, 0, 177, 179, 244, 8, 226, 5, 60, 133, 232, 113, 236, 44, 109, 236, 85, 88, 101, 92, 23, 119, 45, 124, 240, 96, 216, 125, 204, 188, 55, 195, 176, 5, 43, 206, 240, 38, 226, 68, 18, 255, 168, 8, 203, 187, 77, 196, 218, 128, 85, 120, 3, 39, 32, 9, 237, 51, 250, 39, 237, 171, 124, 212, 254, 183, 202, 178, 32, 188, 191, 187, 95, 218, 196, 249, 167, 29, 138, 94, 13, 115, 236, 187, 26, 148, 53, 30, 232, 25, 182, 33, 23, 156, 205, 35, 181, 182, 60, 228, 222, 151, 60, 165, 39, 225, 107, 119, 8, 253, 74, 122, 205, 96, 118, 108, 90, 204, 149, 193, 209, 189, 175, 53, 147, 9, 35, 191, 119, 205, 214, 247, 2, 0, 0]"); let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); -} - -#[test] -fn legacy_witness_map() { - // This is from `witness_compression.ts`, and is actually a compressed `WitnessStack`. - // The `decompress_witness` function in `acvm_js` knows to decompress into a stack first. - let legacy_data: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 173, 206, 185, 13, 0, 48, 8, 67, 209, 144, 107, 30, 146, - 44, 144, 253, 167, 162, 65, 130, 158, 239, 198, 174, 158, 44, 45, 178, 211, 254, 222, 90, - 203, 17, 206, 186, 29, 252, 53, 64, 107, 114, 150, 46, 206, 122, 6, 24, 73, 44, 193, 220, - 1, 0, 0, - ]; - - let witness = WitnessStack::::deserialize(&legacy_data) - .expect("should figure out it's unmarked bincode") - .pop() - .expect("non-empty stack") - .witness; - - let expected_witness = { - let mut w = WitnessMap::new(); - for (i, f) in [1, 2, 1, 1, 0, 3].iter().enumerate() { - w.insert(Witness::new(i as u32), FieldElement::from(*f as u64)); - } - w - }; - - assert_eq!(witness, expected_witness); - - let mut stack = WitnessStack::default(); - stack.push(0, witness); - let bytes = stack.serialize_with_format(acir::SerializationFormat::BincodeLegacy).unwrap(); + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 212, 205, 74, 3, 49, 16, 0, 224, 108, 246, 69, 60, 234, 77, 241, 9, 164, 8, 158, 196, 163, 8, 18, 210, 108, 148, 192, 110, 54, 230, 167, 234, 177, 42, 120, 221, 221, 190, 64, 81, 177, 84, 40, 162, 226, 223, 205, 7, 152, 71, 240, 210, 155, 71, 47, 222, 77, 11, 171, 149, 150, 218, 22, 15, 230, 20, 194, 36, 204, 124, 51, 4, 31, 181, 119, 156, 100, 86, 164, 210, 52, 78, 59, 229, 158, 72, 154, 240, 230, 61, 115, 90, 115, 105, 201, 190, 176, 146, 27, 67, 132, 140, 248, 65, 216, 74, 21, 75, 35, 110, 26, 245, 139, 10, 141, 227, 147, 51, 17, 5, 151, 66, 42, 103, 77, 129, 130, 86, 234, 108, 111, 155, 227, 182, 210, 60, 18, 140, 90, 254, 50, 62, 50, 28, 140, 188, 90, 49, 134, 107, 187, 197, 117, 122, 220, 78, 92, 76, 44, 215, 137, 201, 238, 98, 33, 57, 213, 132, 165, 73, 85, 72, 218, 79, 184, 40, 94, 209, 28, 26, 191, 2, 220, 11, 90, 140, 214, 53, 116, 151, 160, 185, 0, 79, 27, 171, 240, 0, 117, 168, 111, 110, 207, 47, 195, 219, 218, 33, 60, 43, 200, 43, 208, 133, 15, 104, 192, 187, 191, 18, 158, 239, 17, 246, 251, 203, 232, 86, 105, 81, 243, 57, 19, 69, 181, 231, 242, 121, 154, 28, 221, 40, 87, 141, 5, 27, 60, 11, 58, 154, 91, 167, 37, 169, 209, 216, 113, 147, 93, 211, 126, 133, 36, 241, 164, 116, 215, 31, 76, 233, 94, 252, 185, 17, 154, 218, 8, 79, 102, 132, 191, 27, 143, 203, 198, 227, 209, 141, 31, 161, 233, 103, 100, 152, 51, 251, 169, 153, 135, 51, 114, 6, 37, 103, 254, 15, 56, 131, 217, 71, 110, 34, 36, 52, 132, 244, 232, 137, 124, 61, 86, 83, 95, 100, 68, 190, 62, 129, 236, 19, 155, 126, 197, 103, 18, 4, 0, 0]"); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, 173, 5, 172, 34, 56, 136, 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, 43, 108, 101, 159, 162, 35, 234, 108, 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, 91, 126, 196, 195, 172, 1, 0, 0]"); -} - -#[test] -fn legacy_witness_stack() { - let legacy_data: Vec = vec![ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 13, 0, 32, 8, 4, 17, 117, 31, 75, 75, 87, - 113, 255, 37, 44, 196, 5, 228, 42, 194, 39, 132, 238, 114, 249, 239, 114, 163, 118, 47, - 203, 254, 240, 101, 23, 152, 213, 120, 199, 73, 58, 42, 200, 170, 176, 87, 238, 27, 119, - 95, 201, 238, 190, 89, 7, 37, 195, 196, 176, 4, 5, 0, 0, - ]; - - let stack = WitnessStack::::deserialize(&legacy_data) - .expect("should figure out it's unmarked bincode"); - - assert_eq!(stack.length(), 5); - - let bytes = stack.serialize_with_format(acir::SerializationFormat::BincodeLegacy).unwrap(); - - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, 148, 89, 69, 18, 11, 9, 216, 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, 244, 73, 233, 87, 90, 200, 191, 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, 180, 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, 142, 4, 0, 0]"); - - let stack_de = WitnessStack::deserialize(&bytes).unwrap(); - assert_eq!(stack_de, stack); + let program_de = Program::deserialize_program(&default_bytes).unwrap(); + assert_eq!(program_de, program); } From c2c1fc7c5e16cb36140a08c35e9c970b2e00d45e Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 13:48:19 +0000 Subject: [PATCH 08/30] Fix merge --- acvm-repo/acvm_js/test/shared/addition.ts | 8 -------- .../acvm_js/test/shared/complex_foreign_call.ts | 11 ----------- acvm-repo/acvm_js/test/shared/foreign_call.ts | 8 -------- acvm-repo/acvm_js/test/shared/memory_op.ts | 6 ------ .../acvm_js/test/shared/multi_scalar_mul.ts | 6 ------ .../acvm_js/test/shared/nested_acir_call.ts | 16 ---------------- .../acvm_js/test/shared/witness_compression.ts | 5 ----- 7 files changed, 60 deletions(-) diff --git a/acvm-repo/acvm_js/test/shared/addition.ts b/acvm-repo/acvm_js/test/shared/addition.ts index afa39a93961..b6b1f3fc81d 100644 --- a/acvm-repo/acvm_js/test/shared/addition.ts +++ b/acvm-repo/acvm_js/test/shared/addition.ts @@ -2,7 +2,6 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `addition_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, 227, 164, 113, 54, 120, 8, 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, 21, 66, 236, 237, 29, 239, 112, 244, 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, @@ -14,13 +13,6 @@ export const bytecode = Uint8Array.from([ 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, 119, 69, 68, 159, 185, 242, 28, 194, 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, 235, 1, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 10, 128, 48, 12, 69, 127, 170, 7, 113, 212, 77, 241, 8, 34, 56, 137, - 163, 139, 155, 7, 16, 55, 199, 30, 65, 188, 128, 167, 16, 61, 78, 55, 71, 23, 119, 29, 90, 140, 116, 105, 31, 132, 36, - 240, 73, 254, 39, 252, 9, 223, 34, 216, 4, 186, 71, 112, 130, 200, 67, 43, 152, 54, 237, 235, 81, 101, 107, 178, 55, - 229, 38, 101, 219, 197, 249, 89, 77, 199, 48, 23, 234, 94, 46, 237, 195, 241, 46, 132, 121, 192, 102, 179, 3, 95, 38, - 206, 3, 2, 103, 244, 195, 16, 1, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap: WitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts index 178517e5b7e..e4412dd4bb8 100644 --- a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts @@ -2,7 +2,6 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `complex_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, 240, 0, 105, 43, 238, 148, 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, 230, 103, 181, 41, 80, 42, 212, 43, 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, @@ -25,16 +24,6 @@ export const bytecode = Uint8Array.from([ 73, 91, 166, 191, 79, 129, 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, 240, 2, 11, 102, 132, 126, 2, 214, 167, 16, 147, 245, 9, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 84, 219, 10, 194, 48, 12, 109, 154, 109, 22, 244, 201, 47, 24, 232, 127, 137, - 12, 223, 42, 250, 232, 231, 187, 66, 50, 178, 88, 181, 233, 182, 64, 73, 27, 206, 201, 101, 39, 12, 220, 220, 194, - 120, 128, 238, 13, 121, 79, 62, 197, 81, 225, 25, 219, 187, 34, 3, 40, 199, 86, 215, 240, 110, 251, 26, 232, 236, 53, - 146, 161, 177, 142, 225, 123, 89, 230, 54, 245, 207, 61, 75, 253, 211, 110, 180, 227, 233, 232, 189, 35, 31, 52, 193, - 187, 207, 165, 153, 117, 66, 254, 64, 126, 120, 220, 159, 241, 246, 186, 12, 215, 24, 247, 50, 169, 226, 24, 6, 192, - 160, 106, 25, 249, 211, 144, 223, 240, 156, 119, 97, 159, 61, 243, 177, 142, 15, 204, 111, 234, 248, 216, 9, 222, 20, - 20, 119, 206, 155, 116, 97, 193, 73, 47, 204, 80, 53, 61, 217, 73, 189, 207, 10, 7, 5, 57, 216, 228, 127, 233, 23, 30, - 50, 248, 127, 156, 181, 164, 172, 92, 185, 246, 152, 9, 114, 174, 55, 111, 172, 240, 81, 180, 5, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/foreign_call.ts b/acvm-repo/acvm_js/test/shared/foreign_call.ts index 1be3c81392a..f804df8c742 100644 --- a/acvm-repo/acvm_js/test/shared/foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/foreign_call.ts @@ -2,7 +2,6 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `simple_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 147, 207, 78, 27, 49, 16, 198, 201, 158, 250, 56, 208, 190, 64, 219, 84, 72, 61, 244, 132, 56, 91, 222, 245, 100, 59, 146, 215, 118, 237, 113, 74, 122, 51, 105, 213, 107, 64, 226, 5, 128, 252, 83, 194, 127, 33, 174, 188, 6, 111, 195, 108, 32, 33, 138, 4, 151, 136, 189, 237, 216, 154, 239, 155, 223, 55, 206, @@ -20,13 +19,6 @@ export const bytecode = Uint8Array.from([ 196, 49, 156, 253, 128, 202, 250, 206, 151, 21, 197, 187, 101, 59, 179, 137, 5, 117, 28, 188, 44, 82, 127, 27, 65, 171, 197, 211, 120, 165, 205, 213, 236, 252, 141, 6, 233, 116, 135, 172, 75, 147, 231, 53, 170, 113, 236, 15, 157, 69, 230, 237, 23, 3, 157, 206, 66, 152, 143, 253, 8, 241, 88, 190, 153, 207, 3, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 81, 237, 10, 128, 32, 12, 116, 246, 193, 160, 127, 61, 65, 111, 22, 17, 253, - 8, 164, 31, 17, 61, 127, 69, 91, 204, 156, 48, 7, 58, 61, 239, 240, 142, 129, 139, 11, 239, 5, 116, 174, 169, 131, 75, - 139, 177, 193, 153, 10, 192, 206, 141, 254, 243, 223, 70, 15, 222, 32, 236, 168, 175, 219, 185, 236, 199, 56, 79, 33, - 52, 4, 225, 143, 250, 244, 170, 192, 27, 74, 95, 229, 122, 104, 21, 80, 70, 146, 17, 152, 251, 198, 208, 166, 32, 21, - 185, 123, 14, 239, 21, 156, 157, 92, 163, 94, 232, 115, 22, 2, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000005'], diff --git a/acvm-repo/acvm_js/test/shared/memory_op.ts b/acvm-repo/acvm_js/test/shared/memory_op.ts index 523cedfde84..0fd302fea81 100644 --- a/acvm-repo/acvm_js/test/shared/memory_op.ts +++ b/acvm-repo/acvm_js/test/shared/memory_op.ts @@ -1,6 +1,5 @@ // See `memory_op_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, 180, 20, 136, 138, 218, 242, 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, 187, 18, 74, 71, 145, 8, 161, 184, 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, @@ -13,11 +12,6 @@ export const bytecode = Uint8Array.from([ 230, 56, 114, 13, 169, 51, 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, 46, 146, 253, 172, 141, 250, 11, 130, 86, 177, 6, 68, 4, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 81, 65, 10, 0, 32, 8, 115, 106, 255, 232, 255, 175, 172, 131, 70, 129, 7, 211, - 129, 108, 135, 13, 28, 3, 189, 24, 251, 196, 180, 51, 27, 227, 210, 76, 49, 38, 165, 128, 110, 14, 159, 57, 201, 123, - 187, 221, 170, 185, 114, 55, 205, 123, 207, 166, 190, 165, 4, 15, 104, 144, 91, 71, 10, 197, 194, 40, 2, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts index ed73400882d..917afad2e32 100644 --- a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts +++ b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts @@ -1,6 +1,5 @@ // See `multi_scalar_mul_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, 181, 34, 184, 115, 37, 226, 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, 194, 51, 137, 77, 2, 33, 100, 145, 93, 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, @@ -11,11 +10,6 @@ export const bytecode = Uint8Array.from([ 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, 128, 248, 169, 40, 7, 195, 209, 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, 224, 238, 39, 87, 149, 219, 21, 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 12, 66, 87, 235, 127, 255, 3, 183, 224, 5, 214, 64, 84, 68, - 151, 236, 189, 21, 72, 232, 195, 35, 224, 226, 47, 50, 236, 232, 155, 23, 184, 194, 45, 208, 217, 153, 120, 147, 13, - 167, 83, 37, 51, 249, 169, 221, 255, 54, 129, 45, 40, 232, 188, 0, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index 6222951f46d..a4cdb66d5fe 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -2,7 +2,6 @@ import { WitnessMap, StackItem, WitnessStack } from '@noir-lang/acvm_js'; // See `nested_acir_call_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, 109, 178, 3, 113, 6, 54, 108, 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, 220, 6, 83, 81, 40, 42, 130, 162, 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, @@ -17,15 +16,6 @@ export const bytecode = Uint8Array.from([ 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, 71, 125, 94, 85, 253, 209, 84, 99, 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, 15, 122, 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 81, 59, 10, 131, 64, 16, 157, 15, 222, 35, 101, 210, 37, 228, 8, 33, 144, 42, - 88, 218, 216, 121, 0, 177, 179, 244, 8, 226, 5, 60, 133, 232, 113, 236, 44, 109, 236, 85, 88, 101, 92, 23, 119, 45, - 124, 240, 96, 216, 125, 204, 188, 55, 195, 176, 5, 43, 206, 240, 38, 226, 68, 18, 255, 168, 8, 203, 187, 77, 196, 218, - 128, 85, 120, 3, 39, 32, 9, 237, 51, 250, 39, 237, 171, 124, 212, 254, 183, 202, 178, 32, 188, 191, 187, 95, 218, 196, - 249, 167, 29, 138, 94, 13, 115, 236, 187, 26, 148, 53, 30, 232, 25, 182, 33, 23, 156, 205, 35, 181, 182, 60, 228, 222, - 151, 60, 165, 39, 225, 107, 119, 8, 253, 74, 122, 205, 96, 118, 108, 90, 204, 149, 193, 209, 189, 175, 53, 147, 9, 35, - 191, 119, 205, 214, 247, 2, 0, 0, ->>>>>>> origin/master ]); export const initialWitnessMap: WitnessMap = new Map([ @@ -70,14 +60,8 @@ export const expectedWitnessStack: WitnessStack = [ ]; export const expectedCompressedWitnessStack = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, 148, 89, 69, 18, 11, 9, 216, 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, 244, 73, 233, 87, 90, 200, 191, 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, 180, 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, 142, 4, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 144, 49, 10, 0, 32, 12, 3, 99, 85, 16, 95, 225, 255, 95, 233, 160, 142, 66, - 111, 44, 244, 160, 219, 209, 132, 116, 29, 236, 222, 99, 201, 197, 44, 208, 109, 60, 99, 144, 12, 3, 110, 133, 127, - 115, 159, 191, 171, 192, 221, 55, 110, 127, 96, 15, 4, 3, 0, 0, ->>>>>>> origin/master ]); diff --git a/acvm-repo/acvm_js/test/shared/witness_compression.ts b/acvm-repo/acvm_js/test/shared/witness_compression.ts index 2f56824c136..0643624682f 100644 --- a/acvm-repo/acvm_js/test/shared/witness_compression.ts +++ b/acvm-repo/acvm_js/test/shared/witness_compression.ts @@ -9,15 +9,10 @@ // after recompiling Noir to print the witness byte array to be written to file after execution export const expectedCompressedWitnessMap = Uint8Array.from([ -<<<<<<< HEAD 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, 173, 5, 172, 34, 56, 136, 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, 43, 108, 101, 159, 162, 35, 234, 108, 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, 91, 126, 196, 195, 172, 1, 0, 0, -======= - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 149, 204, 185, 17, 0, 0, 8, 2, 65, 240, 171, 195, 254, 171, 52, 212, 16, 47, 34, - 216, 129, 216, 234, 236, 134, 20, 169, 91, 179, 199, 175, 63, 108, 232, 22, 169, 91, 31, 143, 90, 63, 92, 28, 1, 0, 0, ->>>>>>> origin/master ]); export const expectedWitnessMap = new Map([ From f188383b5a447f04711fb41e3139410ffed79464 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 14:16:01 +0000 Subject: [PATCH 09/30] Update the TS test to contain compressed msgpack --- .../acir/tests/test_program_serialization.rs | 6 +-- acvm-repo/acvm_js/test/shared/addition.ts | 22 +++++----- .../test/shared/complex_foreign_call.ts | 43 +++++++++---------- acvm-repo/acvm_js/test/shared/foreign_call.ts | 34 +++++++-------- acvm-repo/acvm_js/test/shared/memory_op.ts | 23 +++++----- .../acvm_js/test/shared/multi_scalar_mul.ts | 19 ++++---- .../acvm_js/test/shared/nested_acir_call.ts | 28 ++++++------ 7 files changed, 86 insertions(+), 89 deletions(-) diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index ace6b404213..43244cfac92 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -38,10 +38,10 @@ fn addition_circuit() { let program_de = Program::deserialize_program(&bytes).unwrap(); assert_eq!(program_de, program); - let bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, 1, 0, 0]"); + let default_bytes = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, 1, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); + let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); } diff --git a/acvm-repo/acvm_js/test/shared/addition.ts b/acvm-repo/acvm_js/test/shared/addition.ts index b6b1f3fc81d..7df23931408 100644 --- a/acvm-repo/acvm_js/test/shared/addition.ts +++ b/acvm-repo/acvm_js/test/shared/addition.ts @@ -2,17 +2,17 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `addition_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 145, 189, 78, 195, 48, 20, 70, 213, 150, 7, 178, 227, 164, 113, 54, 120, 8, - 22, 22, 203, 63, 55, 96, 41, 177, 195, 181, 93, 186, 2, 3, 107, 90, 30, 129, 1, 5, 9, 241, 39, 196, 179, 240, 54, 88, - 21, 66, 236, 237, 29, 239, 112, 244, 233, 156, 249, 205, 212, 38, 167, 163, 245, 46, 108, 238, 62, 117, 66, 4, 23, - 197, 149, 141, 14, 66, 16, 214, 25, 88, 31, 61, 250, 65, 123, 3, 97, 115, 253, 116, 18, 2, 96, 60, 3, 244, 183, 83, - 159, 58, 17, 1, 251, 48, 126, 116, 214, 129, 68, 161, 125, 175, 172, 147, 59, 218, 253, 246, 251, 152, 236, 119, 116, - 118, 0, 198, 60, 51, 24, 89, 150, 37, 212, 5, 80, 70, 37, 41, 26, 197, 43, 82, 86, 106, 201, 41, 167, 21, 175, 76, - 193, 25, 3, 94, 242, 186, 81, 77, 77, 26, 90, 50, 160, 109, 213, 176, 246, 23, 178, 120, 184, 20, 122, 239, 41, 228, - 21, 214, 3, 102, 173, 89, 79, 54, 108, 226, 197, 116, 234, 148, 79, 217, 177, 121, 31, 208, 174, 100, 4, 49, 72, 148, - 61, 100, 173, 97, 59, 155, 191, 13, 73, 117, 86, 255, 123, 142, 207, 8, 49, 161, 19, 43, 217, 165, 92, 100, 241, 34, - 119, 69, 68, 159, 185, 242, 28, 194, 248, 149, 115, 102, 253, 17, 101, 110, 98, 196, 95, 221, 241, 7, 105, 165, 0, 5, - 235, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, + 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, + 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, + 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, + 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, + 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, + 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, + 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, + 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, + 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, + 1, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts index e4412dd4bb8..b2a9184370d 100644 --- a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts @@ -2,28 +2,27 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `complex_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 85, 205, 110, 19, 49, 24, 204, 38, 1, 250, 24, 72, 240, 0, 105, 43, 238, 148, - 160, 10, 14, 156, 170, 158, 45, 103, 253, 37, 88, 242, 218, 198, 246, 150, 132, 155, 19, 16, 215, 252, 28, 185, 209, - 230, 103, 181, 41, 80, 42, 212, 43, 175, 193, 219, 224, 13, 217, 176, 169, 72, 64, 77, 66, 219, 61, 237, 126, 178, 60, - 227, 25, 207, 108, 190, 25, 85, 67, 238, 27, 42, 184, 238, 188, 255, 230, 135, 74, 1, 55, 232, 53, 53, 28, 180, 70, - 148, 19, 168, 111, 13, 133, 244, 5, 1, 221, 177, 241, 19, 69, 25, 163, 181, 50, 102, 236, 237, 71, 74, 114, 3, 202, - 101, 104, 116, 215, 246, 247, 148, 194, 141, 94, 43, 10, 66, 134, 12, 168, 64, 183, 207, 25, 229, 128, 21, 242, 69, - 80, 161, 28, 255, 194, 232, 254, 120, 92, 90, 237, 217, 246, 142, 95, 33, 127, 229, 109, 74, 255, 131, 106, 254, 246, - 80, 45, 172, 135, 170, 29, 28, 80, 94, 99, 240, 55, 202, 189, 117, 92, 132, 117, 56, 116, 115, 164, 27, 138, 208, 36, - 97, 234, 165, 97, 42, 222, 185, 155, 200, 25, 72, 6, 247, 210, 151, 173, 72, 42, 32, 212, 199, 6, 190, 127, 129, 186, - 251, 208, 218, 233, 233, 18, 75, 204, 203, 232, 144, 87, 68, 232, 50, 75, 190, 74, 69, 143, 220, 26, 36, 177, 194, 1, - 56, 31, 116, 207, 203, 23, 206, 100, 88, 97, 212, 207, 76, 219, 167, 10, 76, 168, 56, 58, 194, 44, 4, 221, 254, 140, - 181, 6, 101, 80, 224, 246, 197, 53, 55, 184, 112, 245, 224, 252, 50, 10, 59, 19, 9, 250, 221, 22, 118, 84, 105, 24, - 72, 138, 225, 131, 237, 151, 147, 37, 173, 216, 149, 132, 153, 58, 108, 7, 79, 169, 2, 223, 228, 70, 21, 106, 144, - 166, 111, 192, 14, 159, 115, 3, 53, 80, 199, 135, 187, 59, 253, 9, 222, 202, 162, 237, 46, 131, 246, 54, 10, 93, 178, - 227, 164, 6, 9, 54, 184, 44, 100, 163, 117, 158, 97, 128, 48, 33, 137, 51, 41, 147, 251, 227, 132, 197, 229, 105, 238, - 147, 168, 86, 53, 152, 203, 115, 239, 218, 244, 220, 41, 45, 131, 46, 108, 84, 207, 237, 101, 208, 197, 13, 223, 162, - 127, 183, 210, 251, 163, 149, 133, 5, 86, 22, 109, 188, 47, 20, 208, 26, 79, 0, 222, 141, 210, 248, 12, 93, 23, 186, - 52, 215, 199, 25, 36, 23, 252, 232, 25, 96, 57, 9, 127, 115, 40, 5, 117, 7, 85, 51, 223, 79, 18, 220, 130, 61, 125, 1, - 129, 80, 141, 189, 121, 156, 7, 11, 230, 15, 47, 178, 71, 153, 168, 133, 76, 67, 194, 172, 100, 154, 113, 102, 216, - 73, 91, 166, 191, 79, 129, 145, 41, 226, 220, 108, 254, 107, 246, 251, 191, 50, 113, 239, 108, 178, 69, 150, 90, 247, - 170, 212, 110, 102, 106, 54, 219, 66, 143, 236, 201, 129, 17, 210, 198, 211, 26, 79, 238, 240, 2, 11, 102, 132, 126, - 2, 214, 167, 16, 147, 245, 9, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, + 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, + 47, 57, 1, 149, 10, 117, 203, 135, 240, 49, 140, 67, 28, 156, 138, 60, 212, 20, 240, 234, 250, 200, 190, 231, 220, 51, + 231, 218, 165, 214, 164, 158, 136, 208, 48, 41, 116, 247, 253, 44, 175, 137, 160, 49, 124, 252, 22, 38, 136, 32, 12, + 121, 205, 140, 0, 173, 9, 19, 17, 156, 29, 142, 164, 10, 101, 4, 186, 107, 211, 39, 200, 56, 103, 141, 42, 229, 252, + 237, 39, 22, 121, 67, 38, 84, 98, 116, 207, 14, 142, 16, 105, 179, 223, 158, 196, 9, 39, 6, 48, 214, 157, 43, 206, 4, + 80, 36, 161, 140, 107, 76, 208, 95, 148, 189, 31, 94, 197, 219, 124, 249, 254, 249, 43, 18, 110, 127, 206, 187, 19, + 178, 210, 191, 36, 11, 118, 36, 179, 195, 19, 38, 26, 28, 182, 145, 246, 119, 178, 115, 39, 27, 238, 82, 254, 72, 38, + 38, 139, 69, 63, 143, 69, 249, 224, 94, 54, 82, 172, 56, 220, 207, 139, 195, 137, 66, 136, 88, 72, 13, 124, 255, 170, + 144, 157, 186, 130, 40, 138, 46, 136, 110, 96, 221, 247, 75, 193, 165, 74, 106, 156, 133, 5, 180, 51, 67, 48, 9, 10, + 114, 74, 121, 2, 186, 243, 133, 106, 13, 104, 72, 236, 210, 74, 27, 14, 184, 118, 129, 118, 198, 24, 164, 206, 173, + 136, 252, 206, 122, 107, 53, 235, 83, 103, 163, 19, 113, 70, 66, 23, 229, 113, 173, 105, 32, 139, 248, 7, 59, 168, + 102, 111, 183, 83, 23, 119, 179, 112, 217, 14, 159, 50, 132, 208, 120, 227, 26, 51, 68, 179, 55, 96, 71, 207, 133, + 129, 6, 224, 249, 203, 199, 143, 6, 115, 41, 219, 93, 9, 54, 245, 246, 247, 235, 237, 217, 105, 182, 146, 17, 53, 180, + 42, 85, 179, 125, 85, 160, 32, 52, 138, 208, 217, 147, 83, 85, 166, 25, 205, 77, 212, 251, 44, 235, 117, 13, 230, 38, + 238, 255, 69, 71, 42, 155, 122, 7, 251, 245, 222, 168, 187, 188, 239, 73, 238, 238, 182, 255, 71, 183, 131, 53, 110, + 151, 109, 122, 44, 17, 88, 67, 100, 4, 239, 198, 121, 100, 71, 139, 180, 78, 11, 76, 110, 187, 38, 207, 128, 170, 249, + 134, 181, 70, 74, 50, 55, 9, 46, 143, 230, 34, 227, 13, 236, 236, 5, 196, 18, 155, 71, 171, 60, 15, 214, 224, 15, 175, + 139, 163, 204, 237, 32, 166, 169, 96, 185, 201, 173, 180, 0, 118, 243, 85, 30, 28, 51, 224, 209, 130, 113, 5, 91, 189, + 91, 254, 45, 110, 45, 220, 191, 156, 183, 40, 74, 235, 221, 86, 218, 127, 10, 246, 158, 171, 126, 96, 47, 78, 140, 84, + 54, 93, 124, 8, 179, 20, 174, 49, 113, 201, 248, 19, 97, 10, 106, 42, 245, 7, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/foreign_call.ts b/acvm-repo/acvm_js/test/shared/foreign_call.ts index f804df8c742..eaf72b7a76c 100644 --- a/acvm-repo/acvm_js/test/shared/foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/foreign_call.ts @@ -2,23 +2,23 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `simple_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 147, 207, 78, 27, 49, 16, 198, 201, 158, 250, 56, 208, 190, 64, 219, 84, 72, - 61, 244, 132, 56, 91, 222, 245, 100, 59, 146, 215, 118, 237, 113, 74, 122, 51, 105, 213, 107, 64, 226, 5, 128, 252, - 83, 194, 127, 33, 174, 188, 6, 111, 195, 108, 32, 33, 138, 4, 151, 136, 189, 237, 216, 154, 239, 155, 223, 55, 206, - 246, 199, 173, 104, 10, 66, 107, 194, 193, 255, 219, 34, 122, 15, 134, 196, 111, 36, 3, 33, 8, 52, 10, 246, 62, 12, - 173, 43, 172, 130, 112, 144, 38, 95, 61, 106, 141, 101, 83, 106, 253, 247, 24, 213, 198, 0, 141, 139, 196, 39, 131, - 29, 52, 165, 134, 238, 184, 138, 90, 16, 248, 42, 244, 110, 52, 26, 144, 94, 20, 182, 202, 209, 200, 39, 141, 195, - 135, 207, 155, 235, 125, 91, 141, 147, 95, 162, 88, 187, 205, 230, 208, 70, 90, 120, 175, 156, 134, 108, 236, 60, 40, - 44, 36, 193, 253, 37, 236, 241, 79, 8, 236, 153, 97, 40, 250, 57, 222, 53, 185, 141, 140, 67, 93, 59, 143, 109, 190, - 35, 156, 244, 178, 2, 158, 53, 28, 54, 178, 43, 23, 115, 141, 197, 82, 177, 119, 230, 129, 162, 55, 162, 45, 117, 132, - 208, 187, 144, 33, 128, 39, 81, 113, 91, 89, 114, 225, 142, 193, 51, 18, 242, 146, 57, 41, 241, 146, 67, 26, 229, 29, - 130, 26, 249, 81, 234, 55, 235, 43, 221, 9, 227, 167, 103, 136, 105, 240, 13, 61, 20, 212, 24, 229, 72, 34, 224, 31, - 72, 195, 239, 134, 160, 4, 127, 178, 251, 233, 99, 127, 166, 183, 62, 159, 183, 164, 179, 119, 149, 222, 74, 211, 122, - 193, 148, 36, 217, 180, 174, 211, 189, 89, 114, 32, 164, 82, 117, 48, 115, 39, 27, 211, 218, 197, 106, 53, 59, 183, - 173, 86, 0, 90, 173, 55, 210, 100, 219, 122, 192, 210, 212, 2, 255, 70, 115, 230, 188, 198, 109, 206, 102, 186, 36, - 196, 49, 156, 253, 128, 202, 250, 206, 151, 21, 197, 187, 101, 59, 179, 137, 5, 117, 28, 188, 44, 82, 127, 27, 65, - 171, 197, 211, 120, 165, 205, 213, 236, 252, 141, 6, 233, 116, 135, 172, 75, 147, 231, 53, 170, 113, 236, 15, 157, 69, - 230, 237, 23, 3, 157, 206, 66, 152, 143, 253, 8, 241, 88, 190, 153, 207, 3, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 119, 247, 212, 199, 232, 51, 180, 79, 208, 166, + 66, 234, 161, 39, 212, 179, 229, 216, 147, 213, 72, 94, 219, 29, 207, 166, 77, 111, 155, 180, 234, 53, 32, 245, 94, + 21, 242, 79, 155, 128, 0, 33, 174, 60, 8, 15, 131, 55, 144, 16, 34, 17, 144, 240, 201, 26, 123, 230, 155, 239, 55, + 147, 245, 103, 157, 210, 42, 70, 103, 195, 193, 159, 197, 234, 46, 172, 44, 224, 223, 165, 42, 137, 192, 178, 248, + 142, 108, 33, 4, 129, 86, 195, 143, 55, 19, 231, 149, 211, 16, 14, 170, 250, 35, 161, 49, 152, 183, 164, 49, 191, 254, + 163, 78, 198, 104, 125, 201, 241, 101, 188, 143, 54, 55, 48, 152, 21, 165, 17, 12, 84, 132, 225, 133, 65, 11, 146, + 132, 114, 69, 27, 173, 188, 147, 60, 188, 73, 222, 38, 187, 79, 154, 30, 125, 19, 234, 249, 127, 201, 196, 149, 188, + 86, 47, 188, 129, 108, 230, 9, 52, 42, 201, 112, 125, 238, 9, 187, 241, 34, 188, 164, 232, 45, 182, 20, 14, 211, 236, + 204, 151, 109, 131, 106, 35, 56, 92, 16, 112, 73, 86, 116, 165, 41, 33, 12, 79, 101, 8, 64, 44, 138, 232, 95, 230, 49, + 112, 21, 17, 197, 206, 153, 100, 180, 163, 197, 3, 189, 254, 99, 122, 53, 218, 110, 147, 168, 34, 155, 105, 187, 199, + 208, 48, 251, 91, 141, 90, 77, 242, 160, 142, 252, 248, 158, 66, 53, 254, 132, 4, 138, 211, 105, 27, 89, 4, 252, 9, + 213, 228, 179, 101, 200, 129, 142, 190, 190, 127, 55, 90, 118, 242, 2, 255, 187, 106, 103, 175, 171, 157, 86, 243, + 102, 198, 90, 178, 108, 57, 223, 27, 92, 108, 72, 8, 169, 53, 69, 58, 43, 169, 100, 222, 200, 108, 71, 179, 19, 215, + 233, 4, 224, 237, 120, 90, 213, 123, 142, 0, 115, 219, 8, 252, 158, 174, 24, 142, 239, 240, 205, 55, 132, 226, 96, 23, + 95, 160, 112, 212, 251, 176, 165, 120, 181, 217, 206, 210, 146, 224, 158, 135, 135, 77, 24, 237, 33, 24, 189, 222, + 206, 39, 202, 156, 45, 223, 119, 20, 168, 142, 247, 217, 249, 170, 190, 95, 145, 6, 71, 127, 226, 29, 70, 160, 180, + 54, 116, 188, 164, 188, 178, 125, 11, 131, 35, 244, 228, 97, 3, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000005'], diff --git a/acvm-repo/acvm_js/test/shared/memory_op.ts b/acvm-repo/acvm_js/test/shared/memory_op.ts index 0fd302fea81..767d834978b 100644 --- a/acvm-repo/acvm_js/test/shared/memory_op.ts +++ b/acvm-repo/acvm_js/test/shared/memory_op.ts @@ -1,17 +1,16 @@ // See `memory_op_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 221, 84, 59, 78, 3, 49, 16, 37, 155, 112, 159, 229, 6, 180, 20, 136, 138, 218, 242, - 218, 3, 88, 172, 63, 204, 216, 33, 41, 195, 22, 180, 187, 201, 13, 248, 198, 145, 16, 63, 33, 90, 174, 193, 109, 48, - 187, 18, 74, 71, 145, 8, 161, 184, 177, 102, 252, 228, 55, 243, 158, 102, 178, 139, 120, 20, 140, 240, 202, 26, 106, - 46, 223, 68, 64, 4, 227, 217, 185, 242, 6, 136, 152, 50, 18, 70, 219, 247, 214, 9, 43, 129, 102, 147, 197, 62, 104, - 139, 227, 61, 163, 124, 53, 47, 74, 43, 78, 153, 146, 91, 55, 42, 197, 211, 94, 182, 232, 50, 126, 236, 224, 174, 3, - 78, 230, 221, 125, 224, 150, 224, 87, 214, 85, 209, 58, 64, 254, 77, 91, 69, 29, 74, 230, 1, 53, 213, 175, 165, 50, - 192, 145, 9, 171, 11, 101, 218, 103, 170, 175, 207, 152, 248, 220, 205, 87, 59, 59, 183, 109, 43, 127, 69, 54, 228, - 101, 128, 223, 200, 154, 233, 234, 76, 253, 181, 20, 156, 71, 135, 32, 149, 224, 30, 62, 254, 141, 101, 249, 134, 90, - 54, 88, 187, 101, 79, 48, 74, 1, 81, 170, 48, 77, 174, 244, 39, 241, 208, 20, 54, 36, 245, 228, 139, 67, 53, 76, 24, - 230, 56, 114, 13, 169, 51, 154, 245, 178, 254, 179, 11, 69, 169, 196, 82, 182, 126, 64, 240, 1, 13, 107, 117, 160, - 102, 240, 200, 137, 0, 61, 211, 233, 99, 126, 12, 84, 191, 167, 61, 145, 36, 240, 200, 147, 46, 146, 253, 172, 141, - 250, 11, 130, 86, 177, 6, 68, 4, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 83, 75, 78, 195, 48, 16, 77, 210, 114, 15, 174, 195, 2, 113, 132, 145, 227, + 12, 200, 34, 254, 48, 99, 23, 186, 108, 179, 96, 155, 180, 23, 64, 124, 155, 74, 21, 2, 132, 184, 12, 135, 193, 36, + 226, 179, 130, 44, 16, 170, 55, 158, 159, 222, 123, 51, 154, 201, 230, 237, 97, 48, 210, 43, 107, 184, 57, 223, 124, + 216, 96, 132, 198, 139, 103, 25, 136, 208, 120, 56, 85, 222, 32, 51, 40, 83, 224, 217, 206, 157, 117, 210, 22, 200, + 203, 217, 122, 31, 181, 165, 233, 158, 81, 190, 90, 229, 165, 149, 199, 160, 138, 228, 90, 69, 127, 145, 102, 235, 62, + 226, 167, 14, 111, 251, 194, 217, 170, 255, 15, 220, 252, 171, 252, 210, 186, 170, 181, 14, 73, 188, 51, 87, 173, 14, + 37, 120, 36, 205, 245, 83, 169, 12, 10, 2, 105, 117, 174, 76, 151, 230, 250, 234, 4, 228, 107, 178, 155, 252, 252, + 210, 155, 78, 235, 159, 161, 77, 68, 25, 240, 55, 180, 102, 49, 0, 106, 52, 140, 50, 249, 191, 89, 37, 91, 59, 171, + 241, 192, 6, 30, 29, 169, 137, 240, 8, 78, 80, 92, 220, 200, 202, 203, 52, 27, 61, 184, 144, 151, 74, 126, 139, 214, + 27, 66, 31, 200, 64, 167, 145, 155, 241, 189, 96, 70, 242, 160, 227, 122, 139, 35, 228, 250, 37, 94, 64, 148, 231, 73, + 68, 205, 5, 124, 30, 71, 253, 6, 10, 180, 163, 42, 42, 3, 0, 0, ]); export const initialWitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts index 917afad2e32..23344eaff66 100644 --- a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts +++ b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts @@ -1,15 +1,14 @@ // See `multi_scalar_mul_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 125, 144, 77, 74, 3, 65, 16, 133, 153, 73, 226, 207, 181, 34, 184, 115, 37, 226, - 178, 233, 233, 46, 181, 177, 167, 186, 169, 170, 142, 179, 157, 184, 112, 59, 49, 120, 4, 29, 179, 80, 163, 32, 94, - 194, 51, 137, 77, 2, 33, 100, 145, 93, 81, 95, 189, 87, 188, 87, 78, 23, 87, 9, 141, 184, 128, 60, 123, 248, 54, 137, - 8, 80, 212, 157, 19, 4, 102, 229, 208, 66, 115, 220, 135, 104, 130, 5, 158, 181, 203, 177, 215, 230, 118, 28, 154, - 211, 44, 58, 209, 222, 183, 239, 103, 201, 139, 59, 55, 218, 107, 202, 227, 253, 75, 12, 14, 133, 231, 211, 103, 135, - 49, 73, 219, 95, 174, 173, 138, 87, 76, 181, 170, 156, 240, 239, 223, 46, 43, 247, 176, 193, 134, 21, 61, 175, 190, - 240, 227, 238, 205, 112, 143, 126, 180, 197, 250, 144, 36, 51, 158, 31, 28, 30, 45, 161, 137, 148, 121, 14, 158, 211, - 90, 185, 89, 92, 96, 21, 82, 206, 107, 191, 34, 185, 137, 22, 80, 81, 147, 174, 65, 128, 248, 169, 40, 7, 195, 209, - 103, 76, 149, 119, 102, 107, 223, 189, 17, 72, 34, 84, 19, 237, 19, 172, 140, 63, 52, 51, 144, 168, 58, 155, 235, 107, - 224, 238, 39, 87, 149, 219, 21, 210, 14, 193, 170, 77, 221, 221, 63, 3, 121, 88, 245, 124, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 144, 75, 75, 3, 65, 16, 132, 201, 230, 225, 227, 103, 69, 240, 230, 201, 131, + 199, 161, 157, 109, 165, 113, 210, 51, 116, 247, 196, 92, 87, 4, 175, 27, 5, 207, 158, 92, 114, 136, 47, 16, 255, 158, + 67, 196, 33, 183, 143, 42, 170, 232, 174, 230, 110, 115, 149, 217, 27, 69, 214, 245, 195, 246, 159, 29, 195, 2, 95, + 190, 125, 22, 65, 54, 119, 75, 198, 168, 234, 136, 91, 92, 29, 15, 49, 249, 216, 162, 174, 187, 143, 121, 0, 127, 51, + 143, 171, 211, 146, 59, 129, 16, 186, 183, 179, 28, 140, 206, 61, 4, 144, 130, 247, 175, 41, 18, 155, 62, 117, 195, + 197, 95, 199, 168, 82, 83, 105, 60, 232, 46, 160, 143, 85, 154, 84, 154, 110, 146, 96, 75, 30, 12, 171, 54, 27, 98, + 182, 148, 75, 239, 193, 225, 209, 87, 18, 90, 22, 215, 37, 144, 114, 181, 161, 232, 243, 168, 25, 79, 166, 179, 207, + 148, 47, 3, 249, 61, 163, 223, 10, 90, 22, 118, 75, 8, 25, 119, 241, 119, 80, 69, 49, 183, 40, 189, 112, 141, 218, + 255, 148, 95, 202, 26, 38, 64, 140, 173, 171, 243, 244, 191, 238, 86, 173, 160, 44, 1, 0, 0, ]); export const initialWitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index a4cdb66d5fe..39e3ecd43b1 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -2,20 +2,20 @@ import { WitnessMap, StackItem, WitnessStack } from '@noir-lang/acvm_js'; // See `nested_acir_call_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 148, 75, 78, 195, 48, 16, 64, 243, 185, 80, 190, 109, 178, 3, 113, 6, 54, 108, - 44, 39, 158, 128, 165, 196, 9, 254, 148, 110, 249, 72, 108, 147, 244, 6, 128, 168, 130, 132, 248, 9, 177, 229, 26, - 220, 6, 83, 81, 40, 42, 130, 162, 86, 32, 188, 178, 70, 163, 209, 248, 189, 241, 88, 7, 93, 166, 88, 42, 105, 201, - 196, 232, 248, 62, 85, 156, 3, 147, 104, 143, 74, 6, 66, 32, 202, 8, 12, 237, 113, 89, 165, 37, 1, 49, 218, 63, 219, - 192, 121, 126, 116, 66, 137, 121, 78, 89, 165, 164, 104, 13, 115, 92, 42, 249, 114, 109, 172, 174, 226, 64, 104, 138, - 37, 60, 126, 157, 105, 207, 102, 94, 172, 11, 1, 92, 110, 1, 47, 15, 187, 66, 229, 72, 2, 47, 68, 125, 151, 83, 6, - 152, 163, 180, 44, 18, 202, 240, 164, 195, 182, 125, 90, 115, 150, 59, 174, 165, 107, 248, 78, 47, 8, 160, 239, 129, - 235, 187, 216, 241, 226, 36, 10, 157, 32, 76, 122, 145, 27, 185, 97, 20, 18, 47, 242, 125, 136, 130, 168, 31, 39, 113, - 223, 137, 221, 192, 7, 55, 11, 99, 63, 123, 45, 98, 159, 238, 162, 116, 233, 86, 156, 107, 24, 106, 14, 66, 232, 167, - 105, 226, 68, 238, 116, 155, 44, 41, 149, 102, 78, 110, 43, 78, 7, 26, 15, 170, 48, 199, 5, 104, 36, 162, 49, 110, 42, - 149, 228, 52, 157, 141, 153, 151, 28, 164, 226, 12, 13, 112, 174, 64, 212, 87, 120, 2, 19, 21, 186, 44, 222, 214, 129, - 239, 156, 182, 191, 205, 223, 88, 1, 127, 107, 37, 252, 189, 247, 33, 181, 166, 67, 106, 125, 62, 164, 63, 51, 165, - 71, 125, 94, 85, 253, 209, 84, 99, 47, 170, 202, 156, 170, 106, 254, 163, 42, 243, 47, 190, 202, 66, 2, 140, 57, 1, - 15, 122, 19, 106, 116, 146, 99, 205, 147, 160, 183, 197, 88, 63, 3, 120, 190, 183, 13, 38, 5, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 212, 205, 74, 3, 49, 16, 0, 224, 108, 246, 69, 60, 234, 77, 241, 9, 164, 8, + 158, 196, 163, 8, 18, 210, 108, 148, 192, 110, 54, 230, 167, 234, 177, 42, 120, 221, 221, 190, 64, 81, 177, 84, 40, + 162, 226, 223, 205, 7, 152, 71, 240, 210, 155, 71, 47, 222, 77, 11, 171, 149, 150, 218, 22, 15, 230, 20, 194, 36, 204, + 124, 51, 4, 31, 181, 119, 156, 100, 86, 164, 210, 52, 78, 59, 229, 158, 72, 154, 240, 230, 61, 115, 90, 115, 105, 201, + 190, 176, 146, 27, 67, 132, 140, 248, 65, 216, 74, 21, 75, 35, 110, 26, 245, 139, 10, 141, 227, 147, 51, 17, 5, 151, + 66, 42, 103, 77, 129, 130, 86, 234, 108, 111, 155, 227, 182, 210, 60, 18, 140, 90, 254, 50, 62, 50, 28, 140, 188, 90, + 49, 134, 107, 187, 197, 117, 122, 220, 78, 92, 76, 44, 215, 137, 201, 238, 98, 33, 57, 213, 132, 165, 73, 85, 72, 218, + 79, 184, 40, 94, 209, 28, 26, 191, 2, 220, 11, 90, 140, 214, 53, 116, 151, 160, 185, 0, 79, 27, 171, 240, 0, 117, 168, + 111, 110, 207, 47, 195, 219, 218, 33, 60, 43, 200, 43, 208, 133, 15, 104, 192, 187, 191, 18, 158, 239, 17, 246, 251, + 203, 232, 86, 105, 81, 243, 57, 19, 69, 181, 231, 242, 121, 154, 28, 221, 40, 87, 141, 5, 27, 60, 11, 58, 154, 91, + 167, 37, 169, 209, 216, 113, 147, 93, 211, 126, 133, 36, 241, 164, 116, 215, 31, 76, 233, 94, 252, 185, 17, 154, 218, + 8, 79, 102, 132, 191, 27, 143, 203, 198, 227, 209, 141, 31, 161, 233, 103, 100, 152, 51, 251, 169, 153, 135, 51, 114, + 6, 37, 103, 254, 15, 56, 131, 217, 71, 110, 34, 36, 52, 132, 244, 232, 137, 124, 61, 86, 83, 95, 100, 68, 190, 62, + 129, 236, 19, 155, 126, 197, 103, 18, 4, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ From 01bd2cc7a9c8b5fb80df1b74ff5e7927b437a2ab Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 14:22:55 +0000 Subject: [PATCH 10/30] Update the expected compressed witness data --- acvm-repo/acvm_js/test/shared/nested_acir_call.ts | 8 ++++---- acvm-repo/acvm_js/test/shared/witness_compression.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index 39e3ecd43b1..26398d9a55f 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -60,8 +60,8 @@ export const expectedWitnessStack: WitnessStack = [ ]; export const expectedCompressedWitnessStack = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 237, 145, 177, 9, 192, 32, 16, 69, 245, 178, 80, 202, 148, 89, 69, 18, 11, 9, 216, - 156, 16, 91, 197, 21, 28, 65, 156, 201, 109, 108, 180, 179, 59, 27, 193, 63, 192, 227, 241, 31, 184, 132, 70, 60, 95, - 244, 73, 233, 87, 90, 200, 191, 50, 90, 34, 122, 86, 238, 147, 54, 193, 233, 136, 166, 197, 187, 86, 160, 107, 93, 19, - 180, 128, 142, 56, 166, 157, 179, 155, 173, 215, 140, 237, 115, 6, 136, 10, 194, 76, 233, 151, 142, 4, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 229, 143, 49, 10, 192, 32, 16, 4, 207, 75, 19, 242, 138, 124, 45, 36, 22, 18, 176, + 57, 33, 105, 35, 249, 130, 79, 16, 63, 229, 99, 108, 180, 149, 45, 5, 183, 30, 134, 89, 254, 162, 184, 227, 188, 131, + 143, 198, 94, 250, 229, 244, 24, 103, 181, 136, 167, 76, 59, 245, 183, 41, 128, 169, 98, 213, 196, 63, 32, 94, 17, 49, + 3, 204, 130, 7, 206, 251, 156, 134, 13, 44, 76, 29, 48, 255, 158, 2, 0, 0, ]); diff --git a/acvm-repo/acvm_js/test/shared/witness_compression.ts b/acvm-repo/acvm_js/test/shared/witness_compression.ts index 0643624682f..608af2c96aa 100644 --- a/acvm-repo/acvm_js/test/shared/witness_compression.ts +++ b/acvm-repo/acvm_js/test/shared/witness_compression.ts @@ -9,10 +9,10 @@ // after recompiling Noir to print the witness byte array to be written to file after execution export const expectedCompressedWitnessMap = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 206, 193, 13, 192, 16, 24, 134, 97, 213, 118, 31, 173, 5, 172, 34, 56, 136, - 196, 229, 151, 112, 229, 224, 110, 8, 49, 147, 109, 12, 241, 189, 3, 60, 121, 121, 157, 148, 180, 9, 163, 77, 31, 173, - 43, 108, 101, 159, 162, 35, 234, 108, 43, 129, 245, 93, 48, 241, 115, 252, 226, 198, 137, 7, 38, 196, 11, 19, 242, 0, - 91, 126, 196, 195, 172, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 141, 204, 177, 9, 192, 32, 16, 70, 225, 223, 51, 217, 35, 171, 133, 196, 66, 4, + 155, 19, 180, 213, 194, 222, 33, 196, 165, 28, 198, 13, 60, 95, 253, 241, 40, 119, 14, 239, 231, 90, 233, 214, 255, + 38, 97, 68, 27, 188, 97, 174, 152, 120, 176, 79, 41, 217, 16, 29, 124, 244, 129, 185, 100, 131, 91, 54, 122, 1, 182, + 39, 151, 52, 242, 0, 0, 0, ]); export const expectedWitnessMap = new Map([ From 763ff88455a8deca0e06ed4db26df62b099b065e Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 20:30:57 +0000 Subject: [PATCH 11/30] Use ByteMode::ForceIterables --- acvm-repo/acir/src/serialization.rs | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/acvm-repo/acir/src/serialization.rs b/acvm-repo/acir/src/serialization.rs index 378eef7d957..01bc350a268 100644 --- a/acvm-repo/acir/src/serialization.rs +++ b/acvm-repo/acir/src/serialization.rs @@ -76,25 +76,33 @@ pub(crate) fn bincode_deserialize Deserialize<'a>>(buf: &[u8]) -> std /// /// Set `compact` to `true` if we want old readers to fail when a new field is added to a struct, /// that is, if we think that ignoring a new field could lead to incorrect behavior. -#[allow(dead_code)] pub(crate) fn msgpack_serialize( value: &T, compact: bool, ) -> std::io::Result> { - if compact { - // The default behavior encodes struct fields as - rmp_serde::to_vec(value).map_err(std::io::Error::other) + // There are convenience methods to serialize structs as tuples or maps: + // * `rmp_serde::to_vec` uses tuples + // * `rmp_serde::to_vec_named` uses maps + // However it looks like the default `BytesMode` is not compatible with the C++ deserializer, + // so we have to use `rmp_serde::Serializer` directly. + let mut buf = Vec::new(); + + let serializer = rmp_serde::Serializer::new(&mut buf) + .with_bytes(rmp_serde::config::BytesMode::ForceIterables); + + let result = if compact { + value.serialize(&mut serializer.with_struct_tuple()) } else { - // Or this to be able to configure the serialization: - // * `Serializer::with_struct_map` encodes structs with field names instead of positions, which is backwards compatible when new fields are added, or optional fields removed. - // * consider using `Serializer::with_bytes` to force buffers to be compact, or use `serde_bytes` on the field. - // * enums have their name encoded in `Serializer::serialize_newtype_variant`, but originally it was done by index instead - rmp_serde::to_vec_named(value).map_err(std::io::Error::other) + value.serialize(&mut serializer.with_struct_map()) + }; + + match result { + Ok(()) => Ok(buf), + Err(e) => Err(std::io::Error::other(e)), } } /// Deserialize a value using MessagePack, based on `serde`. -#[allow(dead_code)] pub(crate) fn msgpack_deserialize Deserialize<'a>>(buf: &[u8]) -> std::io::Result { rmp_serde::from_slice(buf).map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e)) } @@ -102,7 +110,6 @@ pub(crate) fn msgpack_deserialize Deserialize<'a>>(buf: &[u8]) -> std /// Serialize a value using `protobuf`. /// /// This format is forwards and backwards compatible, but requires code generation based on `.proto` schemas. -#[allow(dead_code)] pub(crate) fn proto_serialize(value: &T) -> Vec where F: AcirField, @@ -113,7 +120,6 @@ where } /// Deserialize a value using `protobuf`. -#[allow(dead_code)] pub(crate) fn proto_deserialize(buf: &[u8]) -> std::io::Result where F: AcirField, From 3e3fac07f0250f88abb0ca3b68ccd95d2b33193c Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 20:31:12 +0000 Subject: [PATCH 12/30] First write the VK, then prove --- examples/prove_and_verify/prove_and_verify.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/prove_and_verify/prove_and_verify.sh b/examples/prove_and_verify/prove_and_verify.sh index 0a59606e28b..91da30b471e 100755 --- a/examples/prove_and_verify/prove_and_verify.sh +++ b/examples/prove_and_verify/prove_and_verify.sh @@ -3,12 +3,8 @@ set -eu BACKEND=${BACKEND:-bb} -nargo execute --pedantic-solving witness +nargo execute --force --pedantic-solving witness -# TODO: `bb` should create `proofs` directory if it doesn't exist. -mkdir -p proofs -$BACKEND prove -b ./target/hello_world.json -w ./target/witness.gz -o ./proofs - -# TODO: backend should automatically generate vk if necessary. $BACKEND write_vk -b ./target/hello_world.json -o ./target -$BACKEND verify -k ./target/vk -p ./proofs/proof -i ./proofs/public_inputs +$BACKEND prove -b ./target/hello_world.json -w ./target/witness.gz -o ./proofs +$BACKEND verify -k ./target/vk -p ./proofs/proof -i ./proofs/public_inputs \ No newline at end of file From d5126b932d0eb90c5daaf512247dd1081ea73ab8 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 9 Dec 2025 20:40:50 +0000 Subject: [PATCH 13/30] Update test vectors with ByteMode::ForceIterables --- acvm-repo/acir/tests/test_program_serialization.rs | 10 +++++----- acvm-repo/acvm_js/test/shared/nested_acir_call.ts | 8 ++++---- acvm-repo/acvm_js/test/shared/witness_compression.ts | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 43244cfac92..6914e75b221 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -39,7 +39,7 @@ fn addition_circuit() { assert_eq!(program_de, program); let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, 1, 0, 0]"); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 187, 74, 3, 81, 16, 134, 179, 27, 31, 196, 82, 59, 197, 39, 16, 17, 172, 196, 82, 4, 25, 78, 206, 142, 114, 96, 207, 197, 153, 115, 162, 150, 171, 133, 237, 110, 242, 2, 1, 11, 137, 16, 68, 197, 91, 239, 139, 164, 179, 180, 177, 119, 8, 36, 164, 74, 50, 213, 48, 252, 252, 204, 247, 229, 55, 195, 179, 228, 116, 52, 222, 113, 115, 55, 154, 238, 224, 148, 197, 193, 155, 78, 68, 232, 34, 92, 154, 232, 144, 25, 140, 43, 240, 106, 237, 193, 7, 237, 11, 228, 166, 122, 220, 101, 70, 138, 39, 72, 254, 118, 104, 83, 9, 17, 201, 114, 253, 90, 26, 135, 138, 64, 123, 219, 49, 78, 77, 202, 251, 189, 239, 245, 214, 226, 201, 178, 21, 50, 185, 100, 182, 138, 67, 26, 111, 15, 54, 63, 143, 246, 223, 171, 234, 248, 116, 99, 231, 231, 224, 250, 43, 52, 123, 227, 191, 254, 175, 132, 218, 247, 23, 160, 151, 86, 181, 94, 2, 153, 174, 138, 8, 65, 145, 224, 202, 239, 220, 203, 242, 231, 144, 58, 165, 209, 115, 199, 122, 68, 24, 19, 57, 232, 170, 50, 9, 118, 251, 73, 77, 176, 193, 138, 19, 117, 142, 92, 127, 136, 54, 97, 140, 164, 4, 188, 128, 153, 209, 250, 31, 140, 53, 217, 21, 95, 1, 0, 0]"); let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); @@ -134,7 +134,7 @@ fn simple_brillig_foreign_call() { assert_eq!(program_de, program); let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 119, 247, 212, 199, 232, 51, 180, 79, 208, 166, 66, 234, 161, 39, 212, 179, 229, 216, 147, 213, 72, 94, 219, 29, 207, 166, 77, 111, 155, 180, 234, 53, 32, 245, 94, 21, 242, 79, 155, 128, 0, 33, 174, 60, 8, 15, 131, 55, 144, 16, 34, 17, 144, 240, 201, 26, 123, 230, 155, 239, 55, 147, 245, 103, 157, 210, 42, 70, 103, 195, 193, 159, 197, 234, 46, 172, 44, 224, 223, 165, 42, 137, 192, 178, 248, 142, 108, 33, 4, 129, 86, 195, 143, 55, 19, 231, 149, 211, 16, 14, 170, 250, 35, 161, 49, 152, 183, 164, 49, 191, 254, 163, 78, 198, 104, 125, 201, 241, 101, 188, 143, 54, 55, 48, 152, 21, 165, 17, 12, 84, 132, 225, 133, 65, 11, 146, 132, 114, 69, 27, 173, 188, 147, 60, 188, 73, 222, 38, 187, 79, 154, 30, 125, 19, 234, 249, 127, 201, 196, 149, 188, 86, 47, 188, 129, 108, 230, 9, 52, 42, 201, 112, 125, 238, 9, 187, 241, 34, 188, 164, 232, 45, 182, 20, 14, 211, 236, 204, 151, 109, 131, 106, 35, 56, 92, 16, 112, 73, 86, 116, 165, 41, 33, 12, 79, 101, 8, 64, 44, 138, 232, 95, 230, 49, 112, 21, 17, 197, 206, 153, 100, 180, 163, 197, 3, 189, 254, 99, 122, 53, 218, 110, 147, 168, 34, 155, 105, 187, 199, 208, 48, 251, 91, 141, 90, 77, 242, 160, 142, 252, 248, 158, 66, 53, 254, 132, 4, 138, 211, 105, 27, 89, 4, 252, 9, 213, 228, 179, 101, 200, 129, 142, 190, 190, 127, 55, 90, 118, 242, 2, 255, 187, 106, 103, 175, 171, 157, 86, 243, 102, 198, 90, 178, 108, 57, 223, 27, 92, 108, 72, 8, 169, 53, 69, 58, 43, 169, 100, 222, 200, 108, 71, 179, 19, 215, 233, 4, 224, 237, 120, 90, 213, 123, 142, 0, 115, 219, 8, 252, 158, 174, 24, 142, 239, 240, 205, 55, 132, 226, 96, 23, 95, 160, 112, 212, 251, 176, 165, 120, 181, 217, 206, 210, 146, 224, 158, 135, 135, 77, 24, 237, 33, 24, 189, 222, 206, 39, 202, 156, 45, 223, 119, 20, 168, 142, 247, 217, 249, 170, 190, 95, 145, 6, 71, 127, 226, 29, 70, 160, 180, 54, 116, 188, 164, 188, 178, 125, 11, 131, 35, 244, 228, 97, 3, 0, 0]"); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 179, 123, 234, 99, 244, 25, 218, 39, 104, 83, 33, 245, 208, 19, 234, 217, 114, 236, 201, 106, 36, 175, 237, 142, 103, 211, 166, 183, 77, 64, 92, 3, 18, 119, 4, 228, 159, 54, 1, 1, 66, 92, 57, 240, 96, 120, 3, 9, 33, 18, 225, 128, 79, 214, 216, 51, 223, 124, 191, 153, 180, 55, 109, 23, 86, 49, 58, 27, 14, 15, 230, 203, 187, 176, 50, 135, 147, 91, 85, 16, 129, 101, 241, 23, 217, 66, 8, 2, 173, 134, 127, 159, 198, 206, 43, 167, 33, 28, 150, 213, 119, 66, 99, 48, 107, 74, 99, 246, 78, 81, 55, 70, 104, 125, 193, 241, 101, 180, 139, 54, 51, 208, 159, 230, 133, 17, 12, 148, 135, 193, 141, 65, 11, 146, 132, 114, 121, 11, 173, 124, 146, 60, 122, 248, 220, 216, 126, 146, 228, 236, 143, 80, 239, 126, 107, 140, 93, 193, 43, 237, 220, 27, 72, 167, 158, 64, 163, 146, 12, 247, 215, 158, 176, 19, 47, 194, 75, 138, 206, 98, 67, 225, 40, 73, 175, 124, 209, 50, 168, 214, 130, 131, 57, 1, 23, 100, 69, 71, 154, 2, 194, 224, 82, 134, 0, 196, 34, 143, 238, 101, 22, 3, 119, 17, 80, 236, 155, 73, 70, 51, 90, 188, 176, 235, 189, 102, 87, 161, 237, 212, 137, 42, 146, 153, 180, 186, 12, 53, 177, 227, 114, 216, 172, 147, 251, 85, 164, 199, 207, 12, 202, 209, 15, 36, 80, 156, 76, 90, 200, 34, 224, 127, 40, 199, 63, 45, 67, 6, 116, 246, 251, 235, 151, 225, 162, 147, 247, 237, 111, 43, 157, 126, 168, 116, 82, 206, 234, 249, 106, 201, 178, 233, 124, 183, 127, 179, 166, 32, 164, 214, 20, 217, 44, 149, 26, 179, 90, 101, 51, 154, 94, 184, 118, 59, 0, 111, 198, 147, 178, 218, 113, 4, 152, 217, 90, 96, 127, 178, 36, 56, 122, 130, 55, 91, 19, 138, 99, 157, 255, 130, 220, 81, 247, 219, 134, 226, 221, 122, 59, 11, 71, 130, 187, 30, 94, 246, 96, 184, 131, 96, 244, 106, 51, 223, 40, 115, 181, 120, 223, 82, 160, 60, 223, 101, 231, 203, 234, 121, 65, 106, 28, 189, 177, 119, 24, 121, 210, 202, 208, 249, 2, 242, 210, 246, 35, 236, 162, 101, 87, 93, 3, 0, 0]"); let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); @@ -255,7 +255,7 @@ fn complex_brillig_foreign_call() { assert_eq!(program_de, program); let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, 47, 57, 1, 149, 10, 117, 203, 135, 240, 49, 140, 67, 28, 156, 138, 60, 212, 20, 240, 234, 250, 200, 190, 231, 220, 51, 231, 218, 165, 214, 164, 158, 136, 208, 48, 41, 116, 247, 253, 44, 175, 137, 160, 49, 124, 252, 22, 38, 136, 32, 12, 121, 205, 140, 0, 173, 9, 19, 17, 156, 29, 142, 164, 10, 101, 4, 186, 107, 211, 39, 200, 56, 103, 141, 42, 229, 252, 237, 39, 22, 121, 67, 38, 84, 98, 116, 207, 14, 142, 16, 105, 179, 223, 158, 196, 9, 39, 6, 48, 214, 157, 43, 206, 4, 80, 36, 161, 140, 107, 76, 208, 95, 148, 189, 31, 94, 197, 219, 124, 249, 254, 249, 43, 18, 110, 127, 206, 187, 19, 178, 210, 191, 36, 11, 118, 36, 179, 195, 19, 38, 26, 28, 182, 145, 246, 119, 178, 115, 39, 27, 238, 82, 254, 72, 38, 38, 139, 69, 63, 143, 69, 249, 224, 94, 54, 82, 172, 56, 220, 207, 139, 195, 137, 66, 136, 88, 72, 13, 124, 255, 170, 144, 157, 186, 130, 40, 138, 46, 136, 110, 96, 221, 247, 75, 193, 165, 74, 106, 156, 133, 5, 180, 51, 67, 48, 9, 10, 114, 74, 121, 2, 186, 243, 133, 106, 13, 104, 72, 236, 210, 74, 27, 14, 184, 118, 129, 118, 198, 24, 164, 206, 173, 136, 252, 206, 122, 107, 53, 235, 83, 103, 163, 19, 113, 70, 66, 23, 229, 113, 173, 105, 32, 139, 248, 7, 59, 168, 102, 111, 183, 83, 23, 119, 179, 112, 217, 14, 159, 50, 132, 208, 120, 227, 26, 51, 68, 179, 55, 96, 71, 207, 133, 129, 6, 224, 249, 203, 199, 143, 6, 115, 41, 219, 93, 9, 54, 245, 246, 247, 235, 237, 217, 105, 182, 146, 17, 53, 180, 42, 85, 179, 125, 85, 160, 32, 52, 138, 208, 217, 147, 83, 85, 166, 25, 205, 77, 212, 251, 44, 235, 117, 13, 230, 38, 238, 255, 69, 71, 42, 155, 122, 7, 251, 245, 222, 168, 187, 188, 239, 73, 238, 238, 182, 255, 71, 183, 131, 53, 110, 151, 109, 122, 44, 17, 88, 67, 100, 4, 239, 198, 121, 100, 71, 139, 180, 78, 11, 76, 110, 187, 38, 207, 128, 170, 249, 134, 181, 70, 74, 50, 55, 9, 46, 143, 230, 34, 227, 13, 236, 236, 5, 196, 18, 155, 71, 171, 60, 15, 214, 224, 15, 175, 139, 163, 204, 237, 32, 166, 169, 96, 185, 201, 173, 180, 0, 118, 243, 85, 30, 28, 51, 224, 209, 130, 113, 5, 91, 189, 91, 254, 45, 110, 45, 220, 191, 156, 183, 40, 74, 235, 221, 86, 218, 127, 10, 246, 158, 171, 126, 96, 47, 78, 140, 84, 54, 93, 124, 8, 179, 20, 174, 49, 113, 201, 248, 19, 97, 10, 106, 42, 245, 7, 0, 0]"); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, 47, 57, 1, 149, 10, 117, 203, 130, 15, 99, 28, 226, 224, 84, 228, 161, 166, 128, 87, 215, 71, 246, 61, 231, 158, 57, 215, 46, 181, 38, 245, 68, 132, 134, 73, 161, 187, 239, 103, 121, 77, 4, 141, 225, 227, 183, 48, 65, 4, 97, 200, 107, 102, 4, 104, 77, 152, 136, 224, 236, 112, 36, 85, 40, 35, 208, 93, 155, 62, 65, 198, 57, 107, 84, 41, 231, 111, 63, 177, 200, 27, 50, 161, 18, 163, 123, 118, 112, 132, 72, 155, 253, 246, 36, 78, 56, 49, 128, 177, 238, 92, 113, 38, 128, 34, 9, 101, 92, 99, 130, 254, 162, 236, 253, 168, 120, 155, 47, 223, 63, 127, 69, 194, 173, 143, 121, 119, 65, 85, 250, 119, 84, 193, 110, 84, 118, 120, 194, 68, 131, 195, 54, 202, 254, 46, 70, 238, 226, 192, 221, 73, 31, 201, 196, 100, 97, 232, 231, 97, 40, 31, 220, 203, 198, 137, 21, 135, 251, 121, 113, 56, 81, 8, 17, 11, 169, 129, 239, 95, 21, 178, 83, 87, 16, 69, 209, 197, 207, 13, 171, 251, 126, 41, 184, 84, 73, 141, 179, 176, 128, 118, 102, 8, 38, 65, 65, 78, 41, 79, 64, 119, 190, 80, 173, 1, 13, 137, 93, 70, 105, 195, 1, 215, 46, 198, 206, 20, 131, 212, 57, 21, 145, 223, 9, 111, 173, 38, 124, 234, 44, 116, 34, 206, 72, 232, 2, 60, 174, 53, 13, 100, 193, 254, 96, 7, 213, 236, 237, 118, 234, 66, 110, 22, 14, 219, 225, 83, 134, 16, 26, 111, 92, 99, 134, 104, 246, 6, 236, 232, 185, 48, 208, 0, 60, 127, 249, 248, 209, 96, 46, 101, 171, 41, 193, 166, 214, 254, 94, 173, 61, 59, 205, 214, 48, 162, 134, 86, 165, 106, 182, 175, 10, 12, 132, 70, 17, 58, 115, 114, 166, 202, 52, 99, 185, 137, 122, 159, 101, 189, 174, 193, 220, 196, 253, 191, 231, 71, 101, 83, 235, 96, 175, 214, 27, 85, 151, 247, 60, 197, 221, 173, 246, 255, 104, 117, 176, 198, 234, 178, 77, 143, 37, 2, 107, 136, 140, 224, 221, 56, 79, 235, 104, 17, 212, 105, 129, 201, 45, 214, 228, 25, 80, 53, 95, 174, 214, 72, 73, 230, 6, 193, 229, 185, 92, 100, 188, 129, 157, 189, 128, 88, 98, 243, 104, 149, 231, 193, 26, 252, 225, 117, 113, 148, 185, 27, 196, 52, 21, 44, 151, 184, 149, 22, 192, 110, 190, 197, 131, 99, 6, 60, 90, 48, 174, 96, 171, 119, 203, 223, 195, 173, 133, 251, 151, 243, 22, 69, 105, 189, 219, 74, 251, 63, 169, 222, 111, 203, 15, 236, 197, 137, 145, 202, 166, 139, 47, 96, 150, 193, 53, 22, 46, 9, 127, 2, 175, 169, 227, 172, 228, 7, 0, 0]"); let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); @@ -284,7 +284,7 @@ fn memory_op_circuit() { assert_eq!(program_de, program); let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 83, 75, 78, 195, 48, 16, 77, 210, 114, 15, 174, 195, 2, 113, 132, 145, 227, 12, 200, 34, 254, 48, 99, 23, 186, 108, 179, 96, 155, 180, 23, 64, 124, 155, 74, 21, 2, 132, 184, 12, 135, 193, 36, 226, 179, 130, 44, 16, 170, 55, 158, 159, 222, 123, 51, 154, 201, 230, 237, 97, 48, 210, 43, 107, 184, 57, 223, 124, 216, 96, 132, 198, 139, 103, 25, 136, 208, 120, 56, 85, 222, 32, 51, 40, 83, 224, 217, 206, 157, 117, 210, 22, 200, 203, 217, 122, 31, 181, 165, 233, 158, 81, 190, 90, 229, 165, 149, 199, 160, 138, 228, 90, 69, 127, 145, 102, 235, 62, 226, 167, 14, 111, 251, 194, 217, 170, 255, 15, 220, 252, 171, 252, 210, 186, 170, 181, 14, 73, 188, 51, 87, 173, 14, 37, 120, 36, 205, 245, 83, 169, 12, 10, 2, 105, 117, 174, 76, 151, 230, 250, 234, 4, 228, 107, 178, 155, 252, 252, 210, 155, 78, 235, 159, 161, 77, 68, 25, 240, 55, 180, 102, 49, 0, 106, 52, 140, 50, 249, 191, 89, 37, 91, 59, 171, 241, 192, 6, 30, 29, 169, 137, 240, 8, 78, 80, 92, 220, 200, 202, 203, 52, 27, 61, 184, 144, 151, 74, 126, 139, 214, 27, 66, 31, 200, 64, 167, 145, 155, 241, 189, 96, 70, 242, 160, 227, 122, 139, 35, 228, 250, 37, 94, 64, 148, 231, 73, 68, 205, 5, 124, 30, 71, 253, 6, 10, 180, 163, 42, 42, 3, 0, 0]"); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 147, 75, 78, 195, 48, 16, 134, 147, 180, 220, 131, 235, 176, 64, 28, 97, 228, 56, 3, 178, 136, 31, 204, 216, 133, 46, 219, 44, 216, 38, 237, 5, 16, 207, 166, 82, 133, 0, 33, 46, 192, 193, 48, 137, 120, 172, 104, 23, 168, 170, 55, 182, 199, 163, 255, 255, 52, 250, 157, 77, 219, 227, 96, 164, 87, 214, 112, 115, 185, 250, 58, 131, 17, 26, 175, 94, 101, 32, 66, 227, 225, 92, 121, 131, 204, 160, 76, 129, 23, 123, 15, 214, 73, 91, 32, 207, 39, 203, 67, 212, 150, 198, 7, 70, 249, 106, 145, 151, 86, 158, 130, 42, 146, 91, 21, 239, 179, 52, 91, 246, 21, 63, 118, 120, 223, 55, 78, 22, 253, 126, 228, 166, 63, 237, 215, 214, 85, 173, 117, 72, 226, 211, 185, 106, 117, 40, 193, 35, 105, 174, 95, 74, 101, 80, 16, 72, 171, 115, 101, 186, 103, 174, 111, 206, 64, 190, 239, 39, 127, 175, 244, 174, 67, 253, 47, 177, 145, 40, 3, 174, 19, 107, 102, 235, 149, 6, 27, 25, 38, 91, 155, 83, 178, 163, 115, 26, 110, 70, 255, 236, 72, 141, 132, 71, 112, 130, 98, 96, 163, 39, 207, 211, 108, 240, 228, 66, 94, 42, 249, 171, 90, 175, 8, 125, 32, 3, 29, 33, 55, 195, 71, 193, 140, 228, 65, 199, 88, 139, 19, 228, 250, 45, 38, 63, 194, 121, 18, 145, 184, 128, 239, 79, 81, 127, 0, 205, 96, 137, 59, 34, 3, 0, 0]"); let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); @@ -345,7 +345,7 @@ fn nested_acir_call_circuit() { assert_eq!(program_de, program); let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 212, 205, 74, 3, 49, 16, 0, 224, 108, 246, 69, 60, 234, 77, 241, 9, 164, 8, 158, 196, 163, 8, 18, 210, 108, 148, 192, 110, 54, 230, 167, 234, 177, 42, 120, 221, 221, 190, 64, 81, 177, 84, 40, 162, 226, 223, 205, 7, 152, 71, 240, 210, 155, 71, 47, 222, 77, 11, 171, 149, 150, 218, 22, 15, 230, 20, 194, 36, 204, 124, 51, 4, 31, 181, 119, 156, 100, 86, 164, 210, 52, 78, 59, 229, 158, 72, 154, 240, 230, 61, 115, 90, 115, 105, 201, 190, 176, 146, 27, 67, 132, 140, 248, 65, 216, 74, 21, 75, 35, 110, 26, 245, 139, 10, 141, 227, 147, 51, 17, 5, 151, 66, 42, 103, 77, 129, 130, 86, 234, 108, 111, 155, 227, 182, 210, 60, 18, 140, 90, 254, 50, 62, 50, 28, 140, 188, 90, 49, 134, 107, 187, 197, 117, 122, 220, 78, 92, 76, 44, 215, 137, 201, 238, 98, 33, 57, 213, 132, 165, 73, 85, 72, 218, 79, 184, 40, 94, 209, 28, 26, 191, 2, 220, 11, 90, 140, 214, 53, 116, 151, 160, 185, 0, 79, 27, 171, 240, 0, 117, 168, 111, 110, 207, 47, 195, 219, 218, 33, 60, 43, 200, 43, 208, 133, 15, 104, 192, 187, 191, 18, 158, 239, 17, 246, 251, 203, 232, 86, 105, 81, 243, 57, 19, 69, 181, 231, 242, 121, 154, 28, 221, 40, 87, 141, 5, 27, 60, 11, 58, 154, 91, 167, 37, 169, 209, 216, 113, 147, 93, 211, 126, 133, 36, 241, 164, 116, 215, 31, 76, 233, 94, 252, 185, 17, 154, 218, 8, 79, 102, 132, 191, 27, 143, 203, 198, 227, 209, 141, 31, 161, 233, 103, 100, 152, 51, 251, 169, 153, 135, 51, 114, 6, 37, 103, 254, 15, 56, 131, 217, 71, 110, 34, 36, 52, 132, 244, 232, 137, 124, 61, 86, 83, 95, 100, 68, 190, 62, 129, 236, 19, 155, 126, 197, 103, 18, 4, 0, 0]"); + insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 211, 205, 74, 3, 49, 16, 0, 224, 221, 236, 139, 120, 212, 155, 226, 19, 72, 17, 60, 137, 71, 17, 36, 164, 217, 81, 2, 187, 217, 56, 73, 170, 30, 171, 130, 215, 253, 121, 129, 162, 98, 89, 161, 136, 138, 127, 55, 15, 190, 72, 111, 30, 189, 120, 55, 22, 86, 43, 45, 117, 45, 130, 57, 133, 97, 8, 51, 223, 76, 200, 65, 185, 101, 37, 55, 34, 145, 186, 56, 238, 85, 119, 42, 89, 12, 157, 91, 110, 17, 65, 26, 186, 43, 140, 4, 173, 169, 144, 33, 236, 5, 221, 68, 241, 36, 4, 93, 180, 207, 26, 44, 138, 142, 78, 68, 232, 159, 11, 169, 172, 209, 185, 231, 119, 19, 107, 62, 174, 25, 41, 21, 66, 40, 56, 51, 240, 52, 57, 51, 24, 206, 188, 88, 210, 26, 208, 108, 0, 38, 135, 101, 108, 35, 106, 0, 99, 157, 222, 68, 66, 2, 67, 202, 147, 184, 41, 36, 27, 20, 156, 231, 207, 51, 222, 228, 227, 19, 151, 51, 31, 174, 98, 127, 161, 51, 247, 176, 182, 124, 215, 110, 175, 111, 206, 46, 190, 172, 236, 63, 170, 172, 209, 127, 43, 94, 93, 82, 112, 186, 67, 249, 143, 79, 121, 215, 10, 69, 203, 213, 72, 21, 67, 199, 227, 234, 210, 153, 119, 165, 108, 51, 18, 124, 56, 230, 247, 16, 140, 69, 73, 91, 44, 178, 160, 211, 75, 54, 232, 136, 198, 142, 144, 109, 187, 192, 47, 157, 243, 191, 54, 241, 106, 152, 144, 90, 38, 228, 107, 176, 164, 26, 44, 25, 63, 216, 49, 122, 110, 7, 70, 249, 210, 239, 122, 89, 48, 37, 159, 95, 241, 101, 255, 193, 231, 79, 189, 82, 181, 80, 188, 17, 148, 123, 71, 226, 234, 55, 200, 92, 83, 33, 253, 252, 212, 233, 59, 226, 130, 57, 211, 226, 3, 0, 0]"); let program_de = Program::deserialize_program(&default_bytes).unwrap(); assert_eq!(program_de, program); diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index 26398d9a55f..6c4dce8e8e7 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -60,8 +60,8 @@ export const expectedWitnessStack: WitnessStack = [ ]; export const expectedCompressedWitnessStack = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 229, 143, 49, 10, 192, 32, 16, 4, 207, 75, 19, 242, 138, 124, 45, 36, 22, 18, 176, - 57, 33, 105, 35, 249, 130, 79, 16, 63, 229, 99, 108, 180, 149, 45, 5, 183, 30, 134, 89, 254, 162, 184, 227, 188, 131, - 143, 198, 94, 250, 229, 244, 24, 103, 181, 136, 167, 76, 59, 245, 183, 41, 128, 169, 98, 213, 196, 63, 32, 94, 17, 49, - 3, 204, 130, 7, 206, 251, 156, 134, 13, 44, 76, 29, 48, 255, 158, 2, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 229, 143, 177, 9, 192, 32, 16, 69, 207, 75, 19, 50, 69, 86, 11, 137, 133, 4, 108, + 78, 72, 90, 197, 21, 28, 65, 92, 196, 193, 108, 180, 245, 44, 5, 127, 253, 120, 188, 143, 54, 146, 185, 238, 55, 184, + 168, 244, 35, 127, 76, 159, 50, 90, 18, 57, 200, 39, 244, 119, 8, 30, 169, 90, 209, 180, 158, 215, 238, 3, 90, 228, + 145, 109, 56, 110, 197, 207, 48, 101, 92, 1, 173, 227, 137, 55, 142, 2, 0, 0, ]); diff --git a/acvm-repo/acvm_js/test/shared/witness_compression.ts b/acvm-repo/acvm_js/test/shared/witness_compression.ts index 608af2c96aa..ba12688d2de 100644 --- a/acvm-repo/acvm_js/test/shared/witness_compression.ts +++ b/acvm-repo/acvm_js/test/shared/witness_compression.ts @@ -9,10 +9,10 @@ // after recompiling Noir to print the witness byte array to be written to file after execution export const expectedCompressedWitnessMap = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 141, 204, 177, 9, 192, 32, 16, 70, 225, 223, 51, 217, 35, 171, 133, 196, 66, 4, - 155, 19, 180, 213, 194, 222, 33, 196, 165, 28, 198, 13, 60, 95, 253, 241, 40, 119, 14, 239, 231, 90, 233, 214, 255, - 38, 97, 68, 27, 188, 97, 174, 152, 120, 176, 79, 41, 217, 16, 29, 124, 244, 129, 185, 100, 131, 91, 54, 122, 1, 182, - 39, 151, 52, 242, 0, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 133, 204, 193, 13, 0, 17, 16, 70, 225, 49, 118, 251, 216, 214, 54, 56, 136, 196, + 101, 36, 92, 57, 184, 43, 66, 52, 162, 48, 29, 248, 223, 249, 203, 227, 58, 37, 253, 38, 140, 54, 125, 180, 174, 208, + 202, 62, 69, 39, 210, 105, 127, 116, 79, 41, 72, 152, 241, 69, 99, 242, 64, 66, 47, 36, 250, 0, 73, 112, 132, 122, + 236, 0, 0, 0, ]); export const expectedWitnessMap = new Map([ From f45aacad8e7deb7864ced2f1aa8f2a06452b6fb4 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 09:14:37 +0000 Subject: [PATCH 14/30] Update to bb version Adam pointed at, which still supports all kinds of msgpack --- scripts/install_bb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_bb.sh b/scripts/install_bb.sh index 04c7f7a9a68..f4e9e00b01b 100755 --- a/scripts/install_bb.sh +++ b/scripts/install_bb.sh @@ -1,10 +1,10 @@ #!/bin/bash -VERSION="3.0.0-nightly.20251104" +VERSION="v3.0.0-nightly.20251216" BBUP_PATH=~/.bb/bbup -if ! [ -f $BBUP_PATH ]; then +if ! [ -f $BBUP_PATH ]; then curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/next/barretenberg/bbup/install | bash fi From 08f5e41f04674e048dd25f47f520399039601178 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 10:03:29 +0000 Subject: [PATCH 15/30] Remove the v prefix from the release tag --- scripts/install_bb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_bb.sh b/scripts/install_bb.sh index f4e9e00b01b..a4b13efe1ca 100755 --- a/scripts/install_bb.sh +++ b/scripts/install_bb.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="v3.0.0-nightly.20251216" +VERSION="3.0.0-nightly.20251216" BBUP_PATH=~/.bb/bbup From 7e9f48a3b002100f01a2baebdfc2a9bb26af916b Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 10:34:35 +0000 Subject: [PATCH 16/30] Print the circuit name in gates_report.sh --- test_programs/gates_report.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index 8d0646ac689..ec26bfc2182 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -12,30 +12,31 @@ test_dirs=$(ls $artifacts_path) echo "{\"programs\": [" > gates_report.json -# Bound for checking where to place last parentheses +# Bound for checking where to place last parentheses NUM_ARTIFACTS=$(ls -1q "$artifacts_path" | wc -l) ITER="1" -for pathname in $test_dirs; do +for pathname in $test_dirs; do ARTIFACT_NAME=$(basename "$pathname") if [[ " ${excluded_dirs[@]} " =~ "$ARTIFACT_NAME" ]]; then ITER=$(( $ITER + 1 )) continue fi + # Print the name of the circuit to make it easier to find out which one is problematic. + echo $ARTIFACT_NAME + GATES_INFO=$($BACKEND gates -b "$artifacts_path/$ARTIFACT_NAME/target/program.json") MAIN_FUNCTION_INFO=$(echo $GATES_INFO | jq -r ".functions[0] | {package_name: "\"$ARTIFACT_NAME\"", functions: [{name: \"main\", acir_opcodes, opcodes: .acir_opcodes, circuit_size}], unconstrained_functions: []}") echo -n $MAIN_FUNCTION_INFO >> gates_report.json if (($ITER == $NUM_ARTIFACTS)); then echo "" >> gates_report.json - else + else echo "," >> gates_report.json fi ITER=$(( $ITER + 1 )) done -echo "]}" >> gates_report.json - - +echo "]}" >> gates_report.json From 7401bfe5c71d1ebc2116a14665ea62f4135f0d81 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 10:41:20 +0000 Subject: [PATCH 17/30] Skip databus_composite_calldata in gates_report --- test_programs/gates_report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index ec26bfc2182..a5b2adc5f88 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -4,7 +4,7 @@ set -e BACKEND=${BACKEND:-bb} # These tests are incompatible with gas reporting -excluded_dirs=("workspace" "workspace_default_member" "databus" "double_verify_honk_proof" "verify_honk_proof" "verify_rollup_honk_proof") +excluded_dirs=("workspace" "workspace_default_member" "databus" "databus_composite_calldata" "double_verify_honk_proof" "verify_honk_proof" "verify_rollup_honk_proof") current_dir=$(pwd) artifacts_path="$current_dir/acir_artifacts" From 38b5faef4ffa2b7a142ccefba5946cf89426dd59 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 11:00:23 +0000 Subject: [PATCH 18/30] Skip a bunch more circuits with #[fold] --- test_programs/gates_report.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index a5b2adc5f88..4fc8133def8 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -4,7 +4,30 @@ set -e BACKEND=${BACKEND:-bb} # These tests are incompatible with gas reporting -excluded_dirs=("workspace" "workspace_default_member" "databus" "databus_composite_calldata" "double_verify_honk_proof" "verify_honk_proof" "verify_rollup_honk_proof") +excluded_dirs=( \ + "workspace" \ + "workspace_default_member" \ + "databus" \ + "double_verify_honk_proof" \ + "verify_honk_proof" \ + "verify_rollup_honk_proof" \ + # UltraCircuitBuilder (standalone Noir application) does not support CallData/ReturnData block constraints. Use MegaCircuitBuilder (Aztec app) or fall back to RAM and ROM operations. + "databus_composite_calldata" \ + "databus_two_calldata" \ + "databus_two_calldata_simple" \ + "regression_7143" \ + "regression_7612" \ + # For circuits which use #[fold]: circuit_buf_to_acir_format: expected single function in ACIR program + "fold_2_to_17" \ + "fold_after_inlined_calls" \ + "fold_basic" \ + "fold_basic_nested_call" \ + "fold_call_witness_condition" \ + "fold_complex_outputs" \ + "fold_distinct_return" \ + "fold_fibonacci" \ + "fold_numeric_generic_poseidon" \ + ) current_dir=$(pwd) artifacts_path="$current_dir/acir_artifacts" From eb0b035554dd979f32e7f77c11af5b812901aeba Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 11:12:01 +0000 Subject: [PATCH 19/30] Update bb version in integration tests --- compiler/integration-tests/circuits/recursion/Nargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/integration-tests/circuits/recursion/Nargo.toml b/compiler/integration-tests/circuits/recursion/Nargo.toml index 7b7b92eb73f..3e1a393c66e 100644 --- a/compiler/integration-tests/circuits/recursion/Nargo.toml +++ b/compiler/integration-tests/circuits/recursion/Nargo.toml @@ -4,4 +4,4 @@ type = "bin" authors = [""] [dependencies] -bb_proof_verification = { git = "https://github.com/AztecProtocol/aztec-packages", tag ="v3.0.0-nightly.20251104", directory = "./barretenberg/noir/bb_proof_verification" } +bb_proof_verification = { git = "https://github.com/AztecProtocol/aztec-packages", tag = "v3.0.0-nightly.20251216", directory = "./barretenberg/noir/bb_proof_verification" } From d6f1945338a6a9da4a4aa41d6cb76847c4962ec5 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 12:27:17 +0000 Subject: [PATCH 20/30] Update name to verify_honk_proof --- compiler/integration-tests/circuits/recursion/src/main.nr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/integration-tests/circuits/recursion/src/main.nr b/compiler/integration-tests/circuits/recursion/src/main.nr index 51d7bbffc9d..703d022fb2e 100644 --- a/compiler/integration-tests/circuits/recursion/src/main.nr +++ b/compiler/integration-tests/circuits/recursion/src/main.nr @@ -1,4 +1,4 @@ -use bb_proof_verification::{UltraHonkVerificationKey, UltraHonkZKProof, verify_ultrahonkzk_proof}; +use bb_proof_verification::{UltraHonkVerificationKey, UltraHonkZKProof, verify_honk_proof}; fn main( verification_key: UltraHonkVerificationKey, @@ -6,5 +6,5 @@ fn main( public_inputs: [Field; 2], key_hash: Field, ) { - verify_ultrahonkzk_proof(verification_key, proof, public_inputs, key_hash); + verify_honk_proof(verification_key, proof, public_inputs, key_hash); } From 35629591f41f423ef0189bed5c91b6587ac84342 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 12:29:44 +0000 Subject: [PATCH 21/30] feat: C++ codegen to support the `msgpack-compact` serialisation format (#10878) --- acvm-repo/acir/codegen/acir.cpp | 1156 +++++++++++++++++++++------- acvm-repo/acir/codegen/witness.cpp | 54 +- acvm-repo/acir/src/lib.rs | 82 +- 3 files changed, 977 insertions(+), 315 deletions(-) diff --git a/acvm-repo/acir/codegen/acir.cpp b/acvm-repo/acir/codegen/acir.cpp index 973963029f3..aed11f9178b 100644 --- a/acvm-repo/acir/codegen/acir.cpp +++ b/acvm-repo/acir/codegen/acir.cpp @@ -1,7 +1,7 @@ #pragma once #include "serde.hpp" -#include "msgpack.hpp" +#include "barretenberg/serialize/msgpack_impl.hpp" #include "bincode.hpp" namespace Acir { @@ -10,7 +10,7 @@ namespace Acir { msgpack::object const& o, std::string const& name ) { - if(o.type != msgpack::type::MAP) { + if (o.type != msgpack::type::MAP) { std::cerr << o << std::endl; throw_or_abort("expected MAP for " + name); } @@ -28,6 +28,7 @@ namespace Acir { } return kvmap; } + template static void conv_fld_from_kvmap( std::map const& kvmap, @@ -48,6 +49,26 @@ namespace Acir { throw_or_abort("missing field: " + struct_name + "::" + field_name); } } + + template + 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 + ) { + if (index >= array.size) { + throw_or_abort("index out of bounds: " + struct_name + "::" + field_name + " at " + std::to_string(index)); + } + auto element = array.ptr[index]; + try { + element.convert(field); + } catch (const msgpack::type_error&) { + std::cerr << element << std::endl; + throw_or_abort("error converting into field " + struct_name + "::" + field_name); + } + } }; } @@ -899,10 +920,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "HeapArray"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + std::string name = "HeapArray"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0); + Helpers::conv_fld_from_array(array, name, "size", size, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -921,10 +950,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "HeapVector"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + std::string name = "HeapVector"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "pointer", pointer, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "pointer", pointer, 0); + Helpers::conv_fld_from_array(array, name, "size", size, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -949,12 +986,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "AES128Encrypt"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "AES128Encrypt"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "iv", iv, 1); + Helpers::conv_fld_from_array(array, name, "key", key, 2); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -973,10 +1020,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Blake2s"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "Blake2s"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "message", message, 0); + Helpers::conv_fld_from_array(array, name, "output", output, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -995,10 +1050,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Blake3"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "Blake3"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "message", message, 0); + Helpers::conv_fld_from_array(array, name, "output", output, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1017,10 +1080,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Keccakf1600"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "Keccakf1600"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input", input, 0); + Helpers::conv_fld_from_array(array, name, "output", output, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1045,13 +1116,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EcdsaSecp256k1"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + std::string name = "EcdsaSecp256k1"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0); + Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1); + Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2); + Helpers::conv_fld_from_array(array, name, "signature", signature, 3); + Helpers::conv_fld_from_array(array, name, "result", result, 4); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1076,13 +1158,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EcdsaSecp256r1"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + std::string name = "EcdsaSecp256r1"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_msg", hashed_msg, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "hashed_msg", hashed_msg, 0); + Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 1); + Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 2); + Helpers::conv_fld_from_array(array, name, "signature", signature, 3); + Helpers::conv_fld_from_array(array, name, "result", result, 4); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1103,11 +1196,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "MultiScalarMul"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "MultiScalarMul"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "points", points, 0); + Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1136,15 +1238,28 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EmbeddedCurveAdd"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input1_x", input1_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input1_y", input1_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input1_infinite", input1_infinite, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input2_x", input2_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input2_y", input2_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input2_infinite", input2_infinite, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + std::string name = "EmbeddedCurveAdd"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input1_x", input1_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input1_y", input1_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input1_infinite", input1_infinite, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input2_x", input2_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input2_y", input2_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input2_infinite", input2_infinite, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "result", result, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input1_x", input1_x, 0); + Helpers::conv_fld_from_array(array, name, "input1_y", input1_y, 1); + Helpers::conv_fld_from_array(array, name, "input1_infinite", input1_infinite, 2); + Helpers::conv_fld_from_array(array, name, "input2_x", input2_x, 3); + Helpers::conv_fld_from_array(array, name, "input2_y", input2_y, 4); + Helpers::conv_fld_from_array(array, name, "input2_infinite", input2_infinite, 5); + Helpers::conv_fld_from_array(array, name, "result", result, 6); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1163,10 +1278,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Poseidon2Permutation"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "Poseidon2Permutation"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "message", message, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "message", message, 0); + Helpers::conv_fld_from_array(array, name, "output", output, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1187,11 +1310,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Sha256Compression"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "Sha256Compression"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input", input, 0); + Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1); + Helpers::conv_fld_from_array(array, name, "output", output, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1216,13 +1348,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "ToRadix"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "radix", radix, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output_pointer", output_pointer, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "num_limbs", num_limbs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output_bits", output_bits, false); + std::string name = "ToRadix"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "radix", radix, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output_pointer", output_pointer, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "num_limbs", num_limbs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output_bits", output_bits, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input", input, 0); + Helpers::conv_fld_from_array(array, name, "radix", radix, 1); + Helpers::conv_fld_from_array(array, name, "output_pointer", output_pointer, 2); + Helpers::conv_fld_from_array(array, name, "num_limbs", num_limbs, 3); + Helpers::conv_fld_from_array(array, name, "output_bits", output_bits, 4); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1481,10 +1624,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Array"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + std::string name = "Array"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "size", size, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0); + Helpers::conv_fld_from_array(array, name, "size", size, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1501,9 +1652,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Vector"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false); + std::string name = "Vector"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "value_types", value_types, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "value_types", value_types, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1781,12 +1939,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "BinaryFieldOp"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + std::string name = "BinaryFieldOp"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "op", op, 1); + Helpers::conv_fld_from_array(array, name, "lhs", lhs, 2); + Helpers::conv_fld_from_array(array, name, "rhs", rhs, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1811,13 +1979,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "BinaryIntOp"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + std::string name = "BinaryIntOp"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "op", op, 1); + Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2); + Helpers::conv_fld_from_array(array, name, "lhs", lhs, 3); + Helpers::conv_fld_from_array(array, name, "rhs", rhs, 4); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1838,11 +2017,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Not"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + std::string name = "Not"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "source", source, 1); + Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1863,11 +2051,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Cast"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + std::string name = "Cast"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "source", source, 1); + Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1886,10 +2083,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "JumpIf"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + std::string name = "JumpIf"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "condition", condition, 0); + Helpers::conv_fld_from_array(array, name, "location", location, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1906,9 +2111,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Jump"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + std::string name = "Jump"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "location", location, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1929,11 +2141,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "CalldataCopy"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination_address", destination_address, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "size_address", size_address, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "offset_address", offset_address, false); + std::string name = "CalldataCopy"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination_address", destination_address, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "size_address", size_address, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "offset_address", offset_address, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination_address", destination_address, 0); + Helpers::conv_fld_from_array(array, name, "size_address", size_address, 1); + Helpers::conv_fld_from_array(array, name, "offset_address", offset_address, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1950,9 +2171,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Call"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + std::string name = "Call"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "location", location, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "location", location, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1973,11 +2201,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Const"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + std::string name = "Const"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1); + Helpers::conv_fld_from_array(array, name, "value", value, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -1998,11 +2235,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "IndirectConst"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + std::string name = "IndirectConst"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bit_size", bit_size, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0); + Helpers::conv_fld_from_array(array, name, "bit_size", bit_size, 1); + Helpers::conv_fld_from_array(array, name, "value", value, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2036,13 +2282,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "ForeignCall"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "function", function, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "destinations", destinations, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination_value_types", destination_value_types, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input_value_types", input_value_types, false); + std::string name = "ForeignCall"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "function", function, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "destinations", destinations, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination_value_types", destination_value_types, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input_value_types", input_value_types, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "function", function, 0); + Helpers::conv_fld_from_array(array, name, "destinations", destinations, 1); + Helpers::conv_fld_from_array(array, name, "destination_value_types", destination_value_types, 2); + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 3); + Helpers::conv_fld_from_array(array, name, "input_value_types", input_value_types, 4); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2061,10 +2318,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Mov"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + std::string name = "Mov"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "source", source, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2087,12 +2352,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "ConditionalMov"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source_a", source_a, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source_b", source_b, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false); + std::string name = "ConditionalMov"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source_a", source_a, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source_b", source_b, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "condition", condition, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "source_a", source_a, 1); + Helpers::conv_fld_from_array(array, name, "source_b", source_b, 2); + Helpers::conv_fld_from_array(array, name, "condition", condition, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2111,10 +2386,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Load"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source_pointer", source_pointer, false); + std::string name = "Load"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination", destination, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source_pointer", source_pointer, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination", destination, 0); + Helpers::conv_fld_from_array(array, name, "source_pointer", source_pointer, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2133,10 +2416,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Store"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + std::string name = "Store"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "destination_pointer", destination_pointer, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "source", source, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "destination_pointer", destination_pointer, 0); + Helpers::conv_fld_from_array(array, name, "source", source, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2172,9 +2463,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Trap"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "revert_data", revert_data, false); + std::string name = "Trap"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "revert_data", revert_data, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "revert_data", revert_data, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2191,9 +2489,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Stop"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "return_data", return_data, false); + std::string name = "Stop"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "return_data", return_data, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "return_data", return_data, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2689,12 +2994,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "AES128Encrypt"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "AES128Encrypt"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "iv", iv, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "key", key, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "iv", iv, 1); + Helpers::conv_fld_from_array(array, name, "key", key, 2); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2717,12 +3032,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "AND"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "AND"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0); + Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1); + Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2); + Helpers::conv_fld_from_array(array, name, "output", output, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2745,12 +3070,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "XOR"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "XOR"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "lhs", lhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "rhs", rhs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "lhs", lhs, 0); + Helpers::conv_fld_from_array(array, name, "rhs", rhs, 1); + Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 2); + Helpers::conv_fld_from_array(array, name, "output", output, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2769,10 +3104,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "RANGE"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); + std::string name = "RANGE"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input", input, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "num_bits", num_bits, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input", input, 0); + Helpers::conv_fld_from_array(array, name, "num_bits", num_bits, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2791,10 +3134,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Blake2s"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "Blake2s"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2813,10 +3164,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Blake3"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "Blake3"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2843,14 +3202,26 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EcdsaSecp256k1"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "EcdsaSecp256k1"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0); + Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1); + Helpers::conv_fld_from_array(array, name, "signature", signature, 2); + Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4); + Helpers::conv_fld_from_array(array, name, "output", output, 5); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2877,14 +3248,26 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EcdsaSecp256r1"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + std::string name = "EcdsaSecp256r1"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_x", public_key_x, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_key_y", public_key_y, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "signature", signature, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "hashed_message", hashed_message, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "output", output, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "public_key_x", public_key_x, 0); + Helpers::conv_fld_from_array(array, name, "public_key_y", public_key_y, 1); + Helpers::conv_fld_from_array(array, name, "signature", signature, 2); + Helpers::conv_fld_from_array(array, name, "hashed_message", hashed_message, 3); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 4); + Helpers::conv_fld_from_array(array, name, "output", output, 5); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2907,12 +3290,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "MultiScalarMul"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "MultiScalarMul"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "points", points, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "scalars", scalars, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "points", points, 0); + Helpers::conv_fld_from_array(array, name, "scalars", scalars, 1); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2935,12 +3328,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "EmbeddedCurveAdd"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "input1", input1, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "input2", input2, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "EmbeddedCurveAdd"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "input1", input1, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "input2", input2, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "input1", input1, 0); + Helpers::conv_fld_from_array(array, name, "input2", input2, 1); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 2); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2959,10 +3362,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Keccakf1600"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "Keccakf1600"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -2989,14 +3400,26 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "RecursiveAggregation"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "verification_key", verification_key, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "proof", proof, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_inputs", public_inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "key_hash", key_hash, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "proof_type", proof_type, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + std::string name = "RecursiveAggregation"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "verification_key", verification_key, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "proof", proof, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_inputs", public_inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "key_hash", key_hash, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "proof_type", proof_type, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "verification_key", verification_key, 0); + Helpers::conv_fld_from_array(array, name, "proof", proof, 1); + Helpers::conv_fld_from_array(array, name, "public_inputs", public_inputs, 2); + Helpers::conv_fld_from_array(array, name, "key_hash", key_hash, 3); + Helpers::conv_fld_from_array(array, name, "proof_type", proof_type, 4); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 5); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3015,10 +3438,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Poseidon2Permutation"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "Poseidon2Permutation"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3039,11 +3470,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Sha256Compression"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + std::string name = "Sha256Compression"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "hash_values", hash_values, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 0); + Helpers::conv_fld_from_array(array, name, "hash_values", hash_values, 1); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3467,11 +3907,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Expression"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "mul_terms", mul_terms, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "linear_combinations", linear_combinations, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "q_c", q_c, false); + std::string name = "Expression"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "mul_terms", mul_terms, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "linear_combinations", linear_combinations, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "q_c", q_c, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "mul_terms", mul_terms, 0); + Helpers::conv_fld_from_array(array, name, "linear_combinations", linear_combinations, 1); + Helpers::conv_fld_from_array(array, name, "q_c", q_c, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3770,11 +4219,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "MemOp"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "operation", operation, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + std::string name = "MemOp"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "operation", operation, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "value", value, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "operation", operation, 0); + Helpers::conv_fld_from_array(array, name, "index", index, 1); + Helpers::conv_fld_from_array(array, name, "value", value, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3833,10 +4291,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "MemoryOp"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); + std::string name = "MemoryOp"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "op", op, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0); + Helpers::conv_fld_from_array(array, name, "op", op, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3857,11 +4323,20 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "MemoryInit"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "init", init, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "block_type", block_type, false); + std::string name = "MemoryInit"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "block_id", block_id, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "init", init, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "block_type", block_type, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "block_id", block_id, 0); + Helpers::conv_fld_from_array(array, name, "init", init, 1); + Helpers::conv_fld_from_array(array, name, "block_type", block_type, 2); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3884,12 +4359,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "BrilligCall"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true); + std::string name = "BrilligCall"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "id", id, 0); + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -3912,12 +4397,22 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Call"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true); + std::string name = "Call"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "id", id, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "inputs", inputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "outputs", outputs, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "predicate", predicate, true); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "id", id, 0); + Helpers::conv_fld_from_array(array, name, "inputs", inputs, 1); + Helpers::conv_fld_from_array(array, name, "outputs", outputs, 2); + Helpers::conv_fld_from_array(array, name, "predicate", predicate, 3); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4200,10 +4695,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "AssertionPayload"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "error_selector", error_selector, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "payload", payload, false); + std::string name = "AssertionPayload"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "error_selector", error_selector, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "payload", payload, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "error_selector", error_selector, 0); + Helpers::conv_fld_from_array(array, name, "payload", payload, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4243,10 +4746,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Brillig"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "acir_index", acir_index, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "brillig_index", brillig_index, false); + std::string name = "Brillig"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "acir_index", acir_index, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "brillig_index", brillig_index, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "acir_index", acir_index, 0); + Helpers::conv_fld_from_array(array, name, "brillig_index", brillig_index, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4376,15 +4887,28 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Circuit"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "current_witness_index", current_witness_index, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "opcodes", opcodes, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "private_parameters", private_parameters, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "public_parameters", public_parameters, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "return_values", return_values, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "assert_messages", assert_messages, false); + std::string name = "Circuit"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "current_witness_index", current_witness_index, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "opcodes", opcodes, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "private_parameters", private_parameters, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "public_parameters", public_parameters, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "return_values", return_values, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "assert_messages", assert_messages, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0); + Helpers::conv_fld_from_array(array, name, "current_witness_index", current_witness_index, 1); + Helpers::conv_fld_from_array(array, name, "opcodes", opcodes, 2); + Helpers::conv_fld_from_array(array, name, "private_parameters", private_parameters, 3); + Helpers::conv_fld_from_array(array, name, "public_parameters", public_parameters, 4); + Helpers::conv_fld_from_array(array, name, "return_values", return_values, 5); + Helpers::conv_fld_from_array(array, name, "assert_messages", assert_messages, 6); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4403,10 +4927,18 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "BrilligBytecode"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "bytecode", bytecode, false); + std::string name = "BrilligBytecode"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "function_name", function_name, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "bytecode", bytecode, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "function_name", function_name, 0); + Helpers::conv_fld_from_array(array, name, "bytecode", bytecode, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4425,15 +4957,24 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Program"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "unconstrained_functions", unconstrained_functions, false); + std::string name = "Program"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "unconstrained_functions", unconstrained_functions, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "functions", functions, 0); + Helpers::conv_fld_from_array(array, name, "unconstrained_functions", unconstrained_functions, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; struct ProgramWithoutBrillig { std::vector functions; + std::monostate unconstrained_functions; friend bool operator==(const ProgramWithoutBrillig&, const ProgramWithoutBrillig&); std::vector bincodeSerialize() const; @@ -4445,9 +4986,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "ProgramWithoutBrillig"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false); + std::string name = "ProgramWithoutBrillig"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "functions", functions, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "functions", functions, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -4475,9 +5023,16 @@ namespace Acir { } void msgpack_unpack(msgpack::object const& o) { - auto name = "Bounded"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "width", width, false); + std::string name = "Bounded"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "width", width, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "width", width, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -9684,6 +10239,7 @@ namespace Acir { inline bool operator==(const ProgramWithoutBrillig &lhs, const ProgramWithoutBrillig &rhs) { if (!(lhs.functions == rhs.functions)) { return false; } + if (!(lhs.unconstrained_functions == rhs.unconstrained_functions)) { return false; } return true; } @@ -9709,6 +10265,7 @@ template void serde::Serializable::serialize(const Acir::ProgramWithoutBrillig &obj, Serializer &serializer) { serializer.increase_container_depth(); serde::Serializable::serialize(obj.functions, serializer); + serde::Serializable::serialize(obj.unconstrained_functions, serializer); serializer.decrease_container_depth(); } @@ -9718,6 +10275,7 @@ Acir::ProgramWithoutBrillig serde::Deserializable:: deserializer.increase_container_depth(); Acir::ProgramWithoutBrillig obj; obj.functions = serde::Deserializable::deserialize(deserializer); + obj.unconstrained_functions = serde::Deserializable::deserialize(deserializer); deserializer.decrease_container_depth(); return obj; } diff --git a/acvm-repo/acir/codegen/witness.cpp b/acvm-repo/acir/codegen/witness.cpp index 01825d0acb7..15ae319fdcb 100644 --- a/acvm-repo/acir/codegen/witness.cpp +++ b/acvm-repo/acir/codegen/witness.cpp @@ -1,7 +1,7 @@ #pragma once #include "serde.hpp" -#include "msgpack.hpp" +#include "barretenberg/serialize/msgpack_impl.hpp" #include "bincode.hpp" namespace Witnesses { @@ -10,7 +10,7 @@ namespace Witnesses { msgpack::object const& o, std::string const& name ) { - if(o.type != msgpack::type::MAP) { + if (o.type != msgpack::type::MAP) { std::cerr << o << std::endl; throw_or_abort("expected MAP for " + name); } @@ -28,6 +28,7 @@ namespace Witnesses { } return kvmap; } + template static void conv_fld_from_kvmap( std::map const& kvmap, @@ -48,6 +49,26 @@ namespace Witnesses { throw_or_abort("missing field: " + struct_name + "::" + field_name); } } + + template + 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 + ) { + if (index >= array.size) { + throw_or_abort("index out of bounds: " + struct_name + "::" + field_name + " at " + std::to_string(index)); + } + auto element = array.ptr[index]; + try { + element.convert(field); + } catch (const msgpack::type_error&) { + std::cerr << element << std::endl; + throw_or_abort("error converting into field " + struct_name + "::" + field_name); + } + } }; } @@ -106,10 +127,18 @@ namespace Witnesses { } void msgpack_unpack(msgpack::object const& o) { - auto name = "StackItem"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false); - Helpers::conv_fld_from_kvmap(kvmap, name, "witness", witness, false); + std::string name = "StackItem"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "index", index, false); + Helpers::conv_fld_from_kvmap(kvmap, name, "witness", witness, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "index", index, 0); + Helpers::conv_fld_from_array(array, name, "witness", witness, 1); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; @@ -126,9 +155,16 @@ namespace Witnesses { } void msgpack_unpack(msgpack::object const& o) { - auto name = "WitnessStack"; - auto kvmap = Helpers::make_kvmap(o, name); - Helpers::conv_fld_from_kvmap(kvmap, name, "stack", stack, false); + std::string name = "WitnessStack"; + if (o.type == msgpack::type::MAP) { + auto kvmap = Helpers::make_kvmap(o, name); + Helpers::conv_fld_from_kvmap(kvmap, name, "stack", stack, false); + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; + Helpers::conv_fld_from_array(array, name, "stack", stack, 0); + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + } } }; diff --git a/acvm-repo/acir/src/lib.rs b/acvm-repo/acir/src/lib.rs index 12fb22aaa9a..fda6f901a7a 100644 --- a/acvm-repo/acir/src/lib.rs +++ b/acvm-repo/acir/src/lib.rs @@ -76,6 +76,11 @@ mod reflection { #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default, Hash)] struct ProgramWithoutBrillig { pub functions: Vec>, + /// We want to ignore this field. By setting its type as `unit` + /// it will not be deserialized, but it will correctly maintain + /// the position of the others (although in this case it doesn't) + /// matter since it's the last field. + pub unconstrained_functions: (), } #[test] @@ -226,7 +231,10 @@ mod reflection { fn add_preamble(source: &mut String) { let inc = r#"#include "serde.hpp""#; let pos = source.find(inc).expect("serde.hpp missing"); - source.insert_str(pos + inc.len(), "\n#include \"msgpack.hpp\""); + source.insert_str( + pos + inc.len(), + "\n#include \"barretenberg/serialize/msgpack_impl.hpp\"", + ); } /// Add helper functions to cut down repetition in the generated code. @@ -240,7 +248,7 @@ mod reflection { msgpack::object const& o, std::string const& name ) { - if(o.type != msgpack::type::MAP) { + if (o.type != msgpack::type::MAP) { std::cerr << o << std::endl; throw_or_abort("expected MAP for " + name); } @@ -258,6 +266,7 @@ mod reflection { } return kvmap; } + template static void conv_fld_from_kvmap( std::map const& kvmap, @@ -278,6 +287,26 @@ mod reflection { throw_or_abort("missing field: " + struct_name + "::" + field_name); } } + + template + 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 + ) { + if (index >= array.size) { + throw_or_abort("index out of bounds: " + struct_name + "::" + field_name + " at " + std::to_string(index)); + } + auto element = array.ptr[index]; + try { + element.convert(field); + } catch (const msgpack::type_error&) { + std::cerr << element << std::endl; + throw_or_abort("error converting into field " + struct_name + "::" + field_name); + } + } }; "#; // cSpell:enable @@ -362,13 +391,24 @@ mod reflection { // or we could reject the data if there was a new field we could // not recognize, or we could even handle aliases. + // We treat unit fields as special, using them to ignore fields during deserialization: + // * in 'map' format we skip over them, never try to deserialize them from the map + // * in 'tuple' format we jump over their index, ignoring whatever is in that position + fn is_unit(field: &Named) -> bool { + matches!(field.value, Format::Unit) + } + + let non_unit_field_count = fields.iter().filter(|f| !is_unit(f)).count(); + self.msgpack_pack(name, &{ let mut body = format!( " - packer.pack_map({});", - fields.len() + packer.pack_map({non_unit_field_count});", ); for field in fields { + if is_unit(field) { + continue; + } let field_name = &field.name; body.push_str(&format!( r#" @@ -384,20 +424,48 @@ mod reflection { // cSpell:disable let mut body = format!( r#" - auto name = "{name}"; - auto kvmap = Helpers::make_kvmap(o, name);"# + std::string name = "{name}"; + if (o.type == msgpack::type::MAP) {{ + auto kvmap = Helpers::make_kvmap(o, name);"# ); // cSpell:enable for field in fields { + if is_unit(field) { + continue; + } let field_name = &field.name; let is_optional = matches!(field.value, Format::Option(_)); // cSpell:disable body.push_str(&format!( r#" - Helpers::conv_fld_from_kvmap(kvmap, name, "{field_name}", {field_name}, {is_optional});"# + Helpers::conv_fld_from_kvmap(kvmap, name, "{field_name}", {field_name}, {is_optional});"# )); // cSpell:enable } + body.push_str( + " + } else if (o.type == msgpack::type::ARRAY) { + auto array = o.via.array; ", + ); + for (index, field) in fields.iter().enumerate() { + if is_unit(field) { + continue; + } + let field_name = &field.name; + // cSpell:disable + body.push_str(&format!( + r#" + Helpers::conv_fld_from_array(array, name, "{field_name}", {field_name}, {index});"# + )); + // cSpell:enable + } + + body.push_str( + r#" + } else { + throw_or_abort("expected MAP or ARRAY for " + name); + }"#, + ); body }); } From 2580f0cb92bb067101941d3da1bcce3da6a33eb1 Mon Sep 17 00:00:00 2001 From: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:47:06 +0000 Subject: [PATCH 22/30] Update bb.js and remove fold_fibonacci --- .../circuits/fold_fibonacci/Nargo.toml | 7 ---- .../circuits/fold_fibonacci/src/main.nr | 12 ------ compiler/integration-tests/package.json | 2 +- .../scripts/compile-programs.sh | 3 -- .../onchain_recursive_verification.test.ts | 13 +++--- .../test/node/prove_and_verify.test.ts | 41 +++++++------------ .../test/node/smart_contract_verifier.test.ts | 14 ++++++- yarn.lock | 18 +++++++- 8 files changed, 52 insertions(+), 58 deletions(-) delete mode 100644 compiler/integration-tests/circuits/fold_fibonacci/Nargo.toml delete mode 100644 compiler/integration-tests/circuits/fold_fibonacci/src/main.nr diff --git a/compiler/integration-tests/circuits/fold_fibonacci/Nargo.toml b/compiler/integration-tests/circuits/fold_fibonacci/Nargo.toml deleted file mode 100644 index 6d8214689b0..00000000000 --- a/compiler/integration-tests/circuits/fold_fibonacci/Nargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "fold_fibonacci" -type = "bin" -authors = [""] -compiler_version = ">=0.28.0" - -[dependencies] \ No newline at end of file diff --git a/compiler/integration-tests/circuits/fold_fibonacci/src/main.nr b/compiler/integration-tests/circuits/fold_fibonacci/src/main.nr deleted file mode 100644 index e150a586086..00000000000 --- a/compiler/integration-tests/circuits/fold_fibonacci/src/main.nr +++ /dev/null @@ -1,12 +0,0 @@ -fn main(x: u32) { - assert(fibonacci(x) == 55); -} - -#[fold] -fn fibonacci(x: u32) -> u32 { - if x <= 1 { - x - } else { - fibonacci(x - 1) + fibonacci(x - 2) - } -} diff --git a/compiler/integration-tests/package.json b/compiler/integration-tests/package.json index 1ed81c486b3..7127df6d3e1 100644 --- a/compiler/integration-tests/package.json +++ b/compiler/integration-tests/package.json @@ -14,7 +14,7 @@ "lint": "NODE_NO_WARNINGS=1 eslint ./test --max-warnings 0" }, "dependencies": { - "@aztec/bb.js": "3.0.0-nightly.20251104", + "@aztec/bb.js": "3.0.0-nightly.20251216", "@noir-lang/noir_js": "workspace:*", "@noir-lang/noir_wasm": "workspace:*", "@nomicfoundation/hardhat-chai-matchers": "^2.0.8", diff --git a/compiler/integration-tests/scripts/compile-programs.sh b/compiler/integration-tests/scripts/compile-programs.sh index 2d07e4d95e1..5278f33e7cb 100755 --- a/compiler/integration-tests/scripts/compile-programs.sh +++ b/compiler/integration-tests/scripts/compile-programs.sh @@ -7,6 +7,3 @@ package_root=$self_path/../ assert_lt_dir=$package_root/circuits/assert_lt/ nargo --program-dir $assert_lt_dir compile --pedantic-solving - -fold_fibonacci_dir=$package_root/circuits/fold_fibonacci/ -nargo --program-dir $fold_fibonacci_dir compile --pedantic-solving diff --git a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts index 699a02a2201..41310b2782b 100644 --- a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts +++ b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts @@ -7,8 +7,10 @@ import assertLtCircuit from '../../circuits/assert_lt/target/assert_lt.json' ass import recursionCircuit from '../../circuits/recursion/target/recursion.json' assert { type: 'json' }; it(`smart contract can verify a recursive proof`, async () => { + const api = await Barretenberg.new({ threads: 1 }); + // Inner circuit - const innerBackend = new UltraHonkBackend(assertLtCircuit.bytecode, {}, { recursive: true }); + const innerBackend = new UltraHonkBackend(assertLtCircuit.bytecode, api); const inner = new Noir(assertLtCircuit as CompiledCircuit); const innerInputs = { x: '2', @@ -22,13 +24,12 @@ it(`smart contract can verify a recursive proof`, async () => { // Get verification key for inner circuit as fields const innerCircuitVerificationKey = await innerBackend.getVerificationKey(); - const barretenbergAPI = await Barretenberg.new({ threads: 1 }); - const vkAsFields = await barretenbergAPI.vkAsFields({ verificationKey: innerCircuitVerificationKey }); - const vkHash = await barretenbergAPI.poseidon2Hash({ inputs: vkAsFields.fields }); + const vkAsFields = await api.vkAsFields({ verificationKey: innerCircuitVerificationKey }); + const vkHash = await api.poseidon2Hash({ inputs: vkAsFields.fields }); // Generate proof of the recursive circuit const recursiveCircuitNoir = new Noir(recursionCircuit as CompiledCircuit); - const recursiveBackend = new UltraHonkBackend(recursionCircuit.bytecode, { threads: 1 }); + const recursiveBackend = new UltraHonkBackend(recursionCircuit.bytecode, api); const vkAsFieldsReal = vkAsFields.fields.map((field) => { let fieldBigint = 0n; @@ -79,4 +80,6 @@ it(`smart contract can verify a recursive proof`, async () => { const result = await contract.verify.staticCall(recursiveProof, recursivePublicInputs); expect(result).to.be.true; + + await api.destroy(); }); diff --git a/compiler/integration-tests/test/node/prove_and_verify.test.ts b/compiler/integration-tests/test/node/prove_and_verify.test.ts index 36b74dd92c1..9d6f8bb71e1 100644 --- a/compiler/integration-tests/test/node/prove_and_verify.test.ts +++ b/compiler/integration-tests/test/node/prove_and_verify.test.ts @@ -1,14 +1,22 @@ import { expect } from 'chai'; import assert_lt_json from '../../circuits/assert_lt/target/assert_lt.json' assert { type: 'json' }; -import fold_fibonacci_json from '../../circuits/fold_fibonacci/target/fold_fibonacci.json' assert { type: 'json' }; import { Noir } from '@noir-lang/noir_js'; -import { UltraHonkVerifierBackend, UltraHonkBackend } from '@aztec/bb.js'; +import { UltraHonkVerifierBackend, UltraHonkBackend, Barretenberg } from '@aztec/bb.js'; import { CompiledCircuit } from '@noir-lang/types'; const assert_lt_program = assert_lt_json as CompiledCircuit; -const fold_fibonacci_program = fold_fibonacci_json as CompiledCircuit; -const honkBackend = new UltraHonkBackend(assert_lt_program.bytecode); +let api: Barretenberg; +let honkBackend: UltraHonkBackend; + +before(async () => { + api = await Barretenberg.new({ threads: 1 }); + honkBackend = new UltraHonkBackend(assert_lt_program.bytecode, api); +}); + +after(async () => { + await api?.destroy(); +}); it('end-to-end proof creation and verification', async () => { // Noir.Js part @@ -48,7 +56,7 @@ it('end-to-end proof creation and verification -- Verifier API', async () => { const verificationKey = await honkBackend.getVerificationKey(); // Proof verification - const verifier = new UltraHonkVerifierBackend(); + const verifier = new UltraHonkVerifierBackend(api); const isValid = await verifier.verifyProof({ ...proof, verificationKey }); expect(isValid).to.be.true; }); @@ -67,28 +75,7 @@ it('end-to-end proving and verification with different instances', async () => { // bb.js part const proof = await honkBackend.generateProof(witness); - const verifier = new UltraHonkBackend(assert_lt_program.bytecode); + const verifier = new UltraHonkBackend(assert_lt_program.bytecode, api); const proof_is_valid = await verifier.verifyProof(proof); expect(proof_is_valid).to.be.true; }); - -it('end-to-end proof creation and verification for multiple ACIR circuits', async () => { - // Noir.Js part - const inputs = { - x: '10', - }; - - const program = new Noir(fold_fibonacci_program); - - const { witness } = await program.execute(inputs); - - // bb.js part - // - // Proof creation - const honkBackend = new UltraHonkBackend(fold_fibonacci_program.bytecode); - const proof = await honkBackend.generateProof(witness); - - // Proof verification - const isValid = await honkBackend.verifyProof(proof); - expect(isValid).to.be.true; -}); diff --git a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts index f9da7aef846..bc74a74b8a9 100644 --- a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts +++ b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts @@ -6,7 +6,7 @@ import { resolve } from 'path'; import toml from 'toml'; import { Noir } from '@noir-lang/noir_js'; -import { UltraHonkBackend } from '@aztec/bb.js'; +import { UltraHonkBackend, Barretenberg } from '@aztec/bb.js'; import { compile, createFileManager } from '@noir-lang/noir_wasm'; @@ -25,6 +25,16 @@ const test_cases = [ }, ]; +let api: Barretenberg; + +before(async () => { + api = await Barretenberg.new({ threads: 1 }); +}); + +after(async () => { + await api?.destroy(); +}); + test_cases.forEach((testInfo) => { const test_name = testInfo.case.split('/').pop(); @@ -46,7 +56,7 @@ test_cases.forEach((testInfo) => { const prover_toml = readFileSync(resolve(`${base_relative_path}/${test_case}/Prover.toml`)).toString(); const inputs = toml.parse(prover_toml); const { witness } = await program.execute(inputs); - const backend = new UltraHonkBackend(noir_program.bytecode); + const backend = new UltraHonkBackend(noir_program.bytecode, api); const proofData = await backend.generateProof(witness, { keccakZK: true }); // JS verification diff --git a/yarn.lock b/yarn.lock index 03efe7444b1..d1e49bc9b79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -308,6 +308,22 @@ __metadata: languageName: node linkType: hard +"@aztec/bb.js@npm:3.0.0-nightly.20251216": + version: 3.0.0-nightly.20251216 + resolution: "@aztec/bb.js@npm:3.0.0-nightly.20251216" + dependencies: + comlink: "npm:^4.4.1" + commander: "npm:^12.1.0" + idb-keyval: "npm:^6.2.1" + msgpackr: "npm:^1.11.2" + pako: "npm:^2.1.0" + tslib: "npm:^2.4.0" + bin: + bb: dest/node/bin/index.js + checksum: 10/7727305475e8ba00f162a0455f08342cf7a6201bb67285cff60ddc9699029c7e75ae20dc9ac5f410e9574816b4dac5e1742ec8452f76482dad8423581bfa2481 + languageName: node + linkType: hard + "@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.11": version: 7.23.5 resolution: "@babel/code-frame@npm:7.23.5" @@ -17498,7 +17514,7 @@ __metadata: version: 0.0.0-use.local resolution: "integration-tests@workspace:compiler/integration-tests" dependencies: - "@aztec/bb.js": "npm:3.0.0-nightly.20251104" + "@aztec/bb.js": "npm:3.0.0-nightly.20251216" "@noir-lang/noir_js": "workspace:*" "@noir-lang/noir_wasm": "workspace:*" "@nomicfoundation/hardhat-chai-matchers": "npm:^2.0.8" From 632479b81e6a24333c7b460f42d146449df8bac4 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 15:03:28 +0000 Subject: [PATCH 23/30] Update the BB version in other places --- compiler/integration-tests/package.json | 2 +- docs/docs/tutorials/noirjs_app.md | 4 ++-- examples/browser/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/integration-tests/package.json b/compiler/integration-tests/package.json index 1ed81c486b3..7127df6d3e1 100644 --- a/compiler/integration-tests/package.json +++ b/compiler/integration-tests/package.json @@ -14,7 +14,7 @@ "lint": "NODE_NO_WARNINGS=1 eslint ./test --max-warnings 0" }, "dependencies": { - "@aztec/bb.js": "3.0.0-nightly.20251104", + "@aztec/bb.js": "3.0.0-nightly.20251216", "@noir-lang/noir_js": "workspace:*", "@noir-lang/noir_wasm": "workspace:*", "@nomicfoundation/hardhat-chai-matchers": "^2.0.8", diff --git a/docs/docs/tutorials/noirjs_app.md b/docs/docs/tutorials/noirjs_app.md index e82e5e24821..b84b2b3dd62 100644 --- a/docs/docs/tutorials/noirjs_app.md +++ b/docs/docs/tutorials/noirjs_app.md @@ -23,7 +23,7 @@ Let's go barebones. Doing the bare minimum is not only simple, but also allows y Barebones means we can immediately start with the dependencies even on an empty folder 😈: ```bash -yarn add @noir-lang/noir_js@1.0.0-beta.15 @aztec/bb.js@3.0.0-nightly.20251104 buffer vite vite-plugin-node-polyfills@0.17.0 +yarn add @noir-lang/noir_js@1.0.0-beta.15 @aztec/bb.js@3.0.0-nightly.20251216 buffer vite vite-plugin-node-polyfills@0.17.0 ``` Wait, what are these dependencies? @@ -33,7 +33,7 @@ Wait, what are these dependencies? :::info -In this guide, we will install versions pinned to 1.0.0-beta.15. These work with Barretenberg version 3.0.0-nightly.20251104, so we are using that one version too. Feel free to try with older or later versions, though! +In this guide, we will install versions pinned to 1.0.0-beta.15. These work with Barretenberg version 3.0.0-nightly.20251216, so we are using that one version too. Feel free to try with older or later versions, though! ::: diff --git a/examples/browser/package.json b/examples/browser/package.json index 8ca9150e21e..f6969db3566 100644 --- a/examples/browser/package.json +++ b/examples/browser/package.json @@ -8,7 +8,7 @@ "test": "yarn build && playwright test browser.test.ts" }, "dependencies": { - "@aztec/bb.js": "3.0.0-nightly.20251104", + "@aztec/bb.js": "3.0.0-nightly.20251216", "@noir-lang/noir_js": "workspace:*" }, "devDependencies": { From 2a6e81ba99322ffa2913d8e4b59a63de0e811514 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 18 Dec 2025 15:30:49 +0000 Subject: [PATCH 24/30] Update yarn.lock --- yarn.lock | 130 +----------------------------------------------------- 1 file changed, 1 insertion(+), 129 deletions(-) diff --git a/yarn.lock b/yarn.lock index d1e49bc9b79..a56f723dc74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -291,23 +291,6 @@ __metadata: languageName: node linkType: hard -"@aztec/bb.js@npm:3.0.0-nightly.20251104": - version: 3.0.0-nightly.20251104 - resolution: "@aztec/bb.js@npm:3.0.0-nightly.20251104" - dependencies: - comlink: "npm:^4.4.1" - commander: "npm:^12.1.0" - idb-keyval: "npm:^6.2.1" - msgpackr: "npm:^1.11.2" - pako: "npm:^2.1.0" - pino: "npm:^9.5.0" - tslib: "npm:^2.4.0" - bin: - bb.js: dest/node/main.js - checksum: 10/3bbe7a7eebcb8ea457bd17418a89c14f622e19487a650a62e348e31e7c081153f26894c7ff01941674fad033910ae46786e4d7e305afe45760d65ae6df071761 - languageName: node - linkType: hard - "@aztec/bb.js@npm:3.0.0-nightly.20251216": version: 3.0.0-nightly.20251216 resolution: "@aztec/bb.js@npm:3.0.0-nightly.20251216" @@ -11340,13 +11323,6 @@ __metadata: languageName: node linkType: hard -"atomic-sleep@npm:^1.0.0": - version: 1.0.0 - resolution: "atomic-sleep@npm:1.0.0" - checksum: 10/3ab6d2cf46b31394b4607e935ec5c1c3c4f60f3e30f0913d35ea74b51b3585e84f590d09e58067f11762eec71c87d25314ce859030983dc0e4397eed21daa12e - languageName: node - linkType: hard - "autoprefixer@npm:^10.4.19": version: 10.4.20 resolution: "autoprefixer@npm:10.4.20" @@ -11805,7 +11781,7 @@ __metadata: version: 0.0.0-use.local resolution: "browser_example@workspace:examples/browser" dependencies: - "@aztec/bb.js": "npm:3.0.0-nightly.20251104" + "@aztec/bb.js": "npm:3.0.0-nightly.20251216" "@noir-lang/noir_js": "workspace:*" "@playwright/test": "npm:^1.49.0" "@types/node": "npm:^20.0.0" @@ -15510,13 +15486,6 @@ __metadata: languageName: node linkType: hard -"fast-redact@npm:^3.1.1": - version: 3.5.0 - resolution: "fast-redact@npm:3.5.0" - checksum: 10/24b27e2023bd5a62f908d97a753b1adb8d89206b260f97727728e00b693197dea2fc2aa3711147a385d0ec6e713569fd533df37a4ef947e08cb65af3019c7ad5 - languageName: node - linkType: hard - "fast-url-parser@npm:1.1.3": version: 1.1.3 resolution: "fast-url-parser@npm:1.1.3" @@ -20937,13 +20906,6 @@ __metadata: languageName: node linkType: hard -"on-exit-leak-free@npm:^2.1.0": - version: 2.1.2 - resolution: "on-exit-leak-free@npm:2.1.2" - checksum: 10/f7b4b7200026a08f6e4a17ba6d72e6c5cbb41789ed9cf7deaf9d9e322872c7dc5a7898549a894651ee0ee9ae635d34a678115bf8acdfba8ebd2ba2af688b563c - languageName: node - linkType: hard - "on-finished@npm:2.4.1, on-finished@npm:^2.3.0, on-finished@npm:^2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -21603,43 +21565,6 @@ __metadata: languageName: node linkType: hard -"pino-abstract-transport@npm:^2.0.0": - version: 2.0.0 - resolution: "pino-abstract-transport@npm:2.0.0" - dependencies: - split2: "npm:^4.0.0" - checksum: 10/e5699ecb06c7121055978e988e5cecea5b6892fc2589c64f1f86df5e7386bbbfd2ada268839e911b021c6b3123428aed7c6be3ac7940eee139556c75324c7e83 - languageName: node - linkType: hard - -"pino-std-serializers@npm:^7.0.0": - version: 7.0.0 - resolution: "pino-std-serializers@npm:7.0.0" - checksum: 10/884e08f65aa5463d820521ead3779d4472c78fc434d8582afb66f9dcb8d8c7119c69524b68106cb8caf92c0487be7794cf50e5b9c0383ae65b24bf2a03480951 - languageName: node - linkType: hard - -"pino@npm:^9.5.0": - version: 9.7.0 - resolution: "pino@npm:9.7.0" - dependencies: - atomic-sleep: "npm:^1.0.0" - fast-redact: "npm:^3.1.1" - on-exit-leak-free: "npm:^2.1.0" - pino-abstract-transport: "npm:^2.0.0" - pino-std-serializers: "npm:^7.0.0" - process-warning: "npm:^5.0.0" - quick-format-unescaped: "npm:^4.0.3" - real-require: "npm:^0.2.0" - safe-stable-stringify: "npm:^2.3.1" - sonic-boom: "npm:^4.0.1" - thread-stream: "npm:^3.0.0" - bin: - pino: bin.js - checksum: 10/01f489e01457ceeb46aa73189922381a6e6c7e0b8599a49d2d18e4d765e7898e36534b7bfd389aca9702c57d680f14dc87d66ab4e80792266f928b051ba8872a - languageName: node - linkType: hard - "pkg-dir@npm:^4.2.0": version: 4.2.0 resolution: "pkg-dir@npm:4.2.0" @@ -22689,13 +22614,6 @@ __metadata: languageName: node linkType: hard -"process-warning@npm:^5.0.0": - version: 5.0.0 - resolution: "process-warning@npm:5.0.0" - checksum: 10/10f3e00ac9fc1943ec4566ff41fff2b964e660f853c283e622257719839d340b4616e707d62a02d6aa0038761bb1fa7c56bc7308d602d51bd96f05f9cd305dcd - languageName: node - linkType: hard - "process@npm:^0.11.10": version: 0.11.10 resolution: "process@npm:0.11.10" @@ -22927,13 +22845,6 @@ __metadata: languageName: node linkType: hard -"quick-format-unescaped@npm:^4.0.3": - version: 4.0.4 - resolution: "quick-format-unescaped@npm:4.0.4" - checksum: 10/591eca457509a99368b623db05248c1193aa3cedafc9a077d7acab09495db1231017ba3ad1b5386e5633271edd0a03b312d8640a59ee585b8516a42e15438aa7 - languageName: node - linkType: hard - "quick-lru@npm:^5.1.1": version: 5.1.1 resolution: "quick-lru@npm:5.1.1" @@ -23366,13 +23277,6 @@ __metadata: languageName: node linkType: hard -"real-require@npm:^0.2.0": - version: 0.2.0 - resolution: "real-require@npm:0.2.0" - checksum: 10/ddf44ee76301c774e9c9f2826da8a3c5c9f8fc87310f4a364e803ef003aa1a43c378b4323051ced212097fff1af459070f4499338b36a7469df1d4f7e8c0ba4c - languageName: node - linkType: hard - "recharts-scale@npm:^0.4.4": version: 0.4.5 resolution: "recharts-scale@npm:0.4.5" @@ -24178,13 +24082,6 @@ __metadata: languageName: node linkType: hard -"safe-stable-stringify@npm:^2.3.1": - version: 2.5.0 - resolution: "safe-stable-stringify@npm:2.5.0" - checksum: 10/2697fa186c17c38c3ca5309637b4ac6de2f1c3d282da27cd5e1e3c88eca0fb1f9aea568a6aabdf284111592c8782b94ee07176f17126031be72ab1313ed46c5c - languageName: node - linkType: hard - "safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" @@ -24850,15 +24747,6 @@ __metadata: languageName: node linkType: hard -"sonic-boom@npm:^4.0.1": - version: 4.2.0 - resolution: "sonic-boom@npm:4.2.0" - dependencies: - atomic-sleep: "npm:^1.0.0" - checksum: 10/385ef7fb5ea5976c1d2a1fef0b6df8df6b7caba8696d2d67f689d60c05e3ea2d536752ce7e1c69b9fad844635f1036d07c446f8e8149f5c6a80e0040a455b310 - languageName: node - linkType: hard - "sort-css-media-queries@npm:2.2.0": version: 2.2.0 resolution: "sort-css-media-queries@npm:2.2.0" @@ -24945,13 +24833,6 @@ __metadata: languageName: node linkType: hard -"split2@npm:^4.0.0": - version: 4.2.0 - resolution: "split2@npm:4.2.0" - checksum: 10/09bbefc11bcf03f044584c9764cd31a252d8e52cea29130950b26161287c11f519807c5e54bd9e5804c713b79c02cefe6a98f4688630993386be353e03f534ab - languageName: node - linkType: hard - "sprintf-js@npm:^1.0.3, sprintf-js@npm:^1.1.3": version: 1.1.3 resolution: "sprintf-js@npm:1.1.3" @@ -25571,15 +25452,6 @@ __metadata: languageName: node linkType: hard -"thread-stream@npm:^3.0.0": - version: 3.1.0 - resolution: "thread-stream@npm:3.1.0" - dependencies: - real-require: "npm:^0.2.0" - checksum: 10/ea2d816c4f6077a7062fac5414a88e82977f807c82ee330938fb9691fe11883bb03f078551c0518bb649c239e47ba113d44014fcbb5db42c5abd5996f35e4213 - languageName: node - linkType: hard - "throttleit@npm:2.1.0": version: 2.1.0 resolution: "throttleit@npm:2.1.0" From 8080de61250bc0ea2ee96d5063f7816a8ce17929 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:44:06 +0000 Subject: [PATCH 25/30] cleanup --- .../onchain_recursive_verification.test.ts | 2 - .../test/node/smart_contract_verifier.test.ts | 10 -- ..._tests__force_brillig_false_inliner_0.snap | 54 --------- ..._tests__force_brillig_false_inliner_0.snap | 111 ------------------ ..._tests__force_brillig_false_inliner_0.snap | 105 ----------------- yarn.lock | 16 +-- 6 files changed, 8 insertions(+), 290 deletions(-) delete mode 100644 tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap delete mode 100644 tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap delete mode 100644 tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap diff --git a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts index 1504df8c7ff..c21c93709f0 100644 --- a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts +++ b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts @@ -80,6 +80,4 @@ it(`smart contract can verify a recursive proof`, async () => { const result = await contract.verify.staticCall(recursiveProof, recursivePublicInputs); expect(result).to.be.true; - - await api.destroy(); }); diff --git a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts index e8165f06762..46de46305de 100644 --- a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts +++ b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts @@ -25,16 +25,6 @@ const test_cases = [ }, ]; -let api: Barretenberg; - -before(async () => { - api = await Barretenberg.new({ threads: 1 }); -}); - -after(async () => { - await api?.destroy(); -}); - test_cases.forEach((testInfo) => { const test_name = testInfo.case.split('/').pop(); diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap deleted file mode 100644 index 571aa6ef916..00000000000 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/contract_with_comptime_attributes/execute__tests__force_brillig_false_inliner_0.snap +++ /dev/null @@ -1,54 +0,0 @@ ---- -source: tooling/nargo_cli/tests/execute.rs -expression: artifact ---- -{ - "noir_version": "[noir_version]", - "name": "SomeContract", - "functions": [ - { - "name": "fn1", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [ - "add_utility" - ], - "abi": { - "parameters": [], - "return_type": null, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/02OSwrCQBAFRTyZFxnamVYHkp6hPzHbuHEbDyHBhfgB8Xo2LiTLVxSPWh6vW6OouZCcT+9ozEgaDlkJRUKmhP1iKjWWhDI+sK/s3G1Xku6HaV3MnTRcfnv1qpw7UAwVGFpUZBmf1TZNjnN0Y1RjCh005r93EEHW0Po37Bx8vMmLlCETpvBPHL8wJ2nVsAAAAA==", - "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", - "names": [ - "fn1" - ], - "brillig_names": [] - }, - { - "name": "fn2", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [ - "utility", - "custom" - ], - "abi": { - "parameters": [], - "return_type": null, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/02OSwrCQBAFRTyZFxnamVYHkp6hPzHbuHEbDyHBhfgB8Xo2LiTLVxSPWh6vW6OouZCcT+9ozEgaDlkJRUKmhP1iKjWWhDI+sK/s3G1Xku6HaV3MnTRcfnv1qpw7UAwVGFpUZBmf1TZNjnN0Y1RjCh005r93EEHW0Po37Bx8vMmLlCETpvBPHL8wJ2nVsAAAAA==", - "debug_symbols": "XY5BCsQwCEXv4rqLWfcqw1BsaosgJtikMITefWyYQOlK/3/6tcJCc9km1jXuML4rzMYivE0SA2aO6m49B+hyykbkFty4byU00gyjFpEBDpTShvaE2mpGc/oagHTx6oErC13d+XGBge158UBjnIX+ci0abjR/Uyf942Qx0FKMrqTGPPsH", - "names": [ - "fn2" - ], - "brillig_names": [] - } - ], - "outputs": { - "structs": {}, - "globals": {} - }, - "file_map": {} -} diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap deleted file mode 100644 index f85b53ac917..00000000000 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/fold_non_contract_method/execute__tests__force_brillig_false_inliner_0.snap +++ /dev/null @@ -1,111 +0,0 @@ ---- -source: tooling/nargo_cli/tests/execute.rs -expression: artifact ---- -{ - "noir_version": "[noir_version]", - "name": "Foo", - "functions": [ - { - "name": "double", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/6XRTU7DMBAF4BZxIDtOGmcHHION5dgTsJTYYWyXbgMLtkmvgFBVJMSfEGfhNlhBQt13djOLJ833Tu72TbQqGGf99PClIiLYIG5NsOC9MFbDZrlzvXIa/DQ8n3sPGC4B3f2+i60IgJ0fP1tjQaJQrquNlXPadvtzxsgqz6HMgDIqSVbVvCB5Ua845bTghc44Y8BzXlZ1VZKK5gxoU1QMmr9ZpAxy3NDl441QR8eQN9j0mEjSa0lHh+thd+Fi4tHD07yffvRo1jKA6CXKDpKMnxbvfaxbow5u4wtCiGjFWrYxmS5f5WwqupQur8CP36mQBBhQJlUt/vsZfwEqkzXdrQEAAA==", - "debug_symbols": "dY/RCoMwDEX/Jc99GIyB81fGkFijFEJaYisM8d8XRTcZ7Cm9OT2XdoaO2jI0Qfo4Qv2YodXAHIaGo8ccoth2XhwcsclKZCs4cbMSKkmGWgqzgwm5bJfGhLLNjGr04oCks2mFfWBaT4v72pf/alXt7v36kW9mPy2hD/r73gk1YMu0x76IP9H8Sgc5/ps0euqK0tq0Met+Aw==", - "names": [ - "double" - ], - "brillig_names": [] - }, - { - "name": "times_40", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/9WTS07DMBBAm4gDxU3SODs+t2BjOfYULCV28Kd0G0Bim+YI/KogIX5CnIXbYEUCsUEIpZvOyp7FjOa9mfCsnzvJrFDSdJdvzGkN0pJTYSUYQ4TksAzXqmaKg+mamwNalhdXggd3QtbOmtVkrZwdXmFfa+CCUQvnfeVKYkFXpn0thQSqCVNVISQdOrXXJ4R97EbjAjX3e8aAtoeg1V8tu258v8DXiKNZkkA2BRQjGk3zAqdRkhYzjDBKccqnOI4BJzjLizyLcpTEgOZpHsN8CB5uZPToCZaetjF+NC+L2+Nmva+ct8Wb2+G/81JrsfAuSE01rcCT8bKea1eUgv3ItQ8arNOSLGjpwKyCRzowJZWvTo/AtL9sRfC1Fav/ahiJMJtsQuXWaXj3Z+oBWk09VU6+r7b9BC/bX3TDAwAA", - "debug_symbols": "zZDBCoMwDIbfJWcPnduY81WGSK1RCqUtsR0M6buvFXV6GIOxw05p8vcL7TdCi43va6k7M0B5G6EhqZTsa2UEd9LoOB1DBktbO0KMI9jkkbKcUDsotVcqgztXfro0WK6n6jjFlGWAuo01LuykwnQK2Ytm79GcFTOcH64rfv6Gz487voodF5J2PwYG5SGkdSR5o3C20HktNlLcwy7Jos2SEdh6wrRuytID/1XqZZVSnD5L+ZGPKjwB", - "names": [ - "times_40", - "times_10" - ], - "brillig_names": [] - }, - { - "name": "triple", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXQZWKYMcNzR7vBHq6BjyBtsBE0l6LenocD3uL1xMPHp8WvbTjwHNRgYQg0TZQ5Lx8+p9iE1n1L/b9IIQIlqxkV1MptmrXExFn9LlFfjpOxWSAAPKpKrFXz/TL9esnu+tAQAA", - "debug_symbols": "dY/RCoMwDEX/Jc990DEZ+CtjSKxRCqEtsRWG+O+LopsMfEpvTs+lnaGjNg+N830YoX7O0IpjdkPDwWJywet2XgwcsUlCpCs4cbUiCvkEtc/MBibkvF0aI/ptJhSlhQHynU4t7B3TelrMzy6u1fL+2OWyun31Sv2XJrRO/l88oThsmfbYZ29PNL3jQY4fRwmWuiy0Nm1Muz8=", - "names": [ - "triple" - ], - "brillig_names": [] - } - ], - "outputs": { - "structs": {}, - "globals": {} - }, - "file_map": { - "50": { - "source": "contract Foo {\n use crate::times_10;\n\n fn double(x: Field) -> pub Field {\n x * 2\n }\n fn triple(x: Field) -> pub Field {\n x * 3\n }\n fn times_40(x: Field) -> pub Field {\n times_10(x) * 4\n }\n}\n\n#[fold]\nfn times_10(x: Field) -> Field {\n x * 10\n}\n", - "path": "" - } - } -} diff --git a/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap b/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap deleted file mode 100644 index cd95ea8254d..00000000000 --- a/tooling/nargo_cli/tests/snapshots/compile_success_contract/simple_contract/execute__tests__force_brillig_false_inliner_0.snap +++ /dev/null @@ -1,105 +0,0 @@ ---- -source: tooling/nargo_cli/tests/execute.rs -expression: artifact ---- -{ - "noir_version": "[noir_version]", - "name": "Foo", - "functions": [ - { - "name": "double", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/6XRTU7DMBAF4BZxIDtOGmcHHION5dgTsJTYYWyXbgMLtkmvgFBVJMSfEGfhNlhBQt13djOLJ833Tu72TbQqGGf99PClIiLYIG5NsOC9MFbDZrlzvXIa/DQ8n3sPGC4B3f2+i60IgJ0fP1tjQaJQrquNlXPadvtzxsgqz6HMgDIqSVbVvCB5Ua845bTghc44Y8BzXlZ1VZKK5gxoU1QMmr9ZpAxy3NDl441QR8eQN9j0mEjSa0lHh+thd+Fi4tHD07yffvRo1jKA6CXKDpKMnxbvfaxbow5u4wtCiGjFWrYxmS5f5WwqupQur8CP36mQBBhQJlUt/vsZfwEqkzXdrQEAAA==", - "debug_symbols": "dY/RCoMwDEX/Jc99GIM58FfGkFijFEJaYisM8d8XRTcZ7Cm9OT2XdoaO2jI0Qfo4Qv2YodXAHIaGo8ccoth2XhwcsclKZCs4cbMSKkmGWgqzgwm5bJfGhLLNjGr04oCks2mFfWBaT4v72pf/anXd3er+kW9mPy2hD/r73gk1YMu0x76IP9H8Sgc5/ps0euqK0tq0Met+Aw==", - "names": [ - "double" - ], - "brillig_names": [] - }, - { - "name": "quadruple", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXUavUgY5bmj2eCPU0THkDbYDJpL0WtLR4XrcX7iYePT4tOynHwOajQwgBomyhyTj59X7EJvOqH+36QUhRLRiI7uYTLNXuZiKPqXLK/DTdyokAQaUSVWLv36mX0NE10itAQAA", - "debug_symbols": "dY/RCoMwDEX/Jc99UMZA/JUxJNYohdCW2ApD/PdFsZsM9pTenJ5Lu8JAfZ4658cwQ/tYoRfH7KaOg8XkgtftuhkosUtCpCu4cLUiCvkErc/MBhbkfFyaI/pjJhSllQHyg04tHB3TftrM167+q3VzO+W6aT76Xf2nJrROfl+8oDjsmc44Zm8vNL1iIeXHUYKlIQvtTQfT7jc=", - "names": [ - "quadruple" - ], - "brillig_names": [] - }, - { - "name": "triple", - "hash": "[hash]", - "is_unconstrained": false, - "custom_attributes": [], - "abi": { - "parameters": [ - { - "name": "x", - "type": { - "kind": "field" - }, - "visibility": "private" - } - ], - "return_type": { - "abi_type": { - "kind": "field" - }, - "visibility": "public" - }, - "error_types": {} - }, - "bytecode": "H4sIAAAAAAAA/6XRPU7EMBAF4A3iQHacbJwOOAaN5dgTsJTYYWwv2wYK2mSvgNBqkRB/QpyF22ClQPQ73UzxpPneyd2hjVYF46yfH75URAQbxK0JFrwXxmrYZns3KKfBz+PzufeA4RLQ3R/62IkA2PvpszMWJArl+sZYuaTtdj9njKyLAqocKKOS5HXDS1KUzZpTTkte6pwzBrzgVd3UFalpwYC2Zc2gXQZWKYMcNzR7vBHq6BjyBtsBE0l6LenocD3uL1xMPHp8WvbTjwHNRgYQg0TZQ5Lx8+p9iE1n1L/b9IIQIlqxkV1MptmrXExFn9LlFfjpOxWSAAPKpKrFXz/TL9esnu+tAQAA", - "debug_symbols": "dY/RCoMwDEX/Jc99UGF78FfGkFijFEJbYisM8d8XxW4y2FN6c3ou7QoD9XnqnB/DDO1jhV4cs5s6DhaTC16362agxC4Jka7gwtWKKOQTtD4zG1iQ83FpjuiPmVCUVgbIDzq1cHRM+2kzX7v6r9ZNfcp1c//oN/WfmtA6+X3xguKwZzrjmL290PSKhZQfRwmWhiy0Nx1Mu98=", - "names": [ - "triple" - ], - "brillig_names": [] - } - ], - "outputs": { - "structs": {}, - "globals": {} - }, - "file_map": {} -} diff --git a/yarn.lock b/yarn.lock index 19252c2173a..f2492a9c37d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9748,11 +9748,11 @@ __metadata: linkType: hard "@types/node@npm:^22.13.10": - version: 22.13.10 - resolution: "@types/node@npm:22.13.10" + version: 22.19.3 + resolution: "@types/node@npm:22.19.3" dependencies: - undici-types: "npm:~6.20.0" - checksum: 10/57dc6a5e0110ca9edea8d7047082e649fa7fa813f79e4a901653b9174141c622f4336435648baced5b38d9f39843f404fa2d8d7a10981610da26066bc8caab48 + undici-types: "npm:~6.21.0" + checksum: 10/ffee06ce6d741fde98a40bc65a57394ed2283c521f57f9143d2356513181162bd4108809be6902a861d098b35e35569f61f14c64d3032e48a0289b74f917669a languageName: node linkType: hard @@ -26118,10 +26118,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~6.20.0": - version: 6.20.0 - resolution: "undici-types@npm:6.20.0" - checksum: 10/583ac7bbf4ff69931d3985f4762cde2690bb607844c16a5e2fbb92ed312fe4fa1b365e953032d469fa28ba8b224e88a595f0b10a449332f83fa77c695e567dbe +"undici-types@npm:~6.21.0": + version: 6.21.0 + resolution: "undici-types@npm:6.21.0" + checksum: 10/ec8f41aa4359d50f9b59fa61fe3efce3477cc681908c8f84354d8567bb3701fafdddf36ef6bff307024d3feb42c837cf6f670314ba37fc8145e219560e473d14 languageName: node linkType: hard From 235e07e6030725bc86b734a66d3666ac35008dfb Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:46:29 +0000 Subject: [PATCH 26/30] Apply suggestions from code review --- docs/docs/tutorials/noirjs_app.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/tutorials/noirjs_app.md b/docs/docs/tutorials/noirjs_app.md index b84b2b3dd62..e82e5e24821 100644 --- a/docs/docs/tutorials/noirjs_app.md +++ b/docs/docs/tutorials/noirjs_app.md @@ -23,7 +23,7 @@ Let's go barebones. Doing the bare minimum is not only simple, but also allows y Barebones means we can immediately start with the dependencies even on an empty folder 😈: ```bash -yarn add @noir-lang/noir_js@1.0.0-beta.15 @aztec/bb.js@3.0.0-nightly.20251216 buffer vite vite-plugin-node-polyfills@0.17.0 +yarn add @noir-lang/noir_js@1.0.0-beta.15 @aztec/bb.js@3.0.0-nightly.20251104 buffer vite vite-plugin-node-polyfills@0.17.0 ``` Wait, what are these dependencies? @@ -33,7 +33,7 @@ Wait, what are these dependencies? :::info -In this guide, we will install versions pinned to 1.0.0-beta.15. These work with Barretenberg version 3.0.0-nightly.20251216, so we are using that one version too. Feel free to try with older or later versions, though! +In this guide, we will install versions pinned to 1.0.0-beta.15. These work with Barretenberg version 3.0.0-nightly.20251104, so we are using that one version too. Feel free to try with older or later versions, though! ::: From d36f17f8bf8e9b69d3a4deb65ada8748f29d31a6 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:48:22 +0000 Subject: [PATCH 27/30] Apply suggestion from @TomAFrench --- test_programs/gates_report.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index 68980e22214..f8aded8b941 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -47,9 +47,6 @@ for pathname in $test_dirs; do fi echo $ARTIFACT_NAME - # Print the name of the circuit to make it easier to find out which one is problematic. - echo $ARTIFACT_NAME - GATES_INFO=$($BACKEND gates -b "$artifacts_path/$ARTIFACT_NAME/target/program.json") MAIN_FUNCTION_INFO=$(echo $GATES_INFO | jq -r ".functions[0] | {package_name: "\"$ARTIFACT_NAME\"", functions: [{name: \"main\", acir_opcodes, opcodes: .acir_opcodes, circuit_size}], unconstrained_functions: []}") echo -n $MAIN_FUNCTION_INFO >> gates_report.json From 023e77e74c7b84cee89df0e041e51a1d3c44c58c Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Tue, 6 Jan 2026 15:24:08 +0000 Subject: [PATCH 28/30] chore(serialization): Use `msgpack-compact` by default (#11094) --- acvm-repo/acir/codegen/acir.cpp | 108 ++++++++-------- acvm-repo/acir/src/lib.rs | 6 +- acvm-repo/acir/src/serialization.rs | 2 +- .../acir/tests/test_program_serialization.rs | 118 ++++++++++-------- acvm-repo/acvm_js/test/shared/addition.ts | 16 +-- .../test/shared/complex_foreign_call.ts | 33 ++--- acvm-repo/acvm_js/test/shared/foreign_call.ts | 25 ++-- acvm-repo/acvm_js/test/shared/memory_op.ts | 16 +-- .../acvm_js/test/shared/multi_scalar_mul.ts | 14 +-- .../acvm_js/test/shared/nested_acir_call.ts | 28 ++--- .../test/shared/witness_compression.ts | 7 +- 11 files changed, 170 insertions(+), 203 deletions(-) diff --git a/acvm-repo/acir/codegen/acir.cpp b/acvm-repo/acir/codegen/acir.cpp index aed11f9178b..18d6ce3c48b 100644 --- a/acvm-repo/acir/codegen/acir.cpp +++ b/acvm-repo/acir/codegen/acir.cpp @@ -198,9 +198,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -440,9 +440,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -620,9 +620,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -734,9 +734,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -849,9 +849,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -1431,9 +1431,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -1695,9 +1695,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -1851,9 +1851,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -2596,9 +2596,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -2917,9 +2917,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -3561,9 +3561,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -3837,9 +3837,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -4013,9 +4013,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -4146,9 +4146,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -4458,9 +4458,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -4624,9 +4624,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -4787,9 +4787,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } @@ -5062,9 +5062,9 @@ namespace Acir { packer.pack(tag); } else { std::visit([&packer, tag](const auto& arg) { - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }, value); } } diff --git a/acvm-repo/acir/src/lib.rs b/acvm-repo/acir/src/lib.rs index fda6f901a7a..5ffc19d9b6e 100644 --- a/acvm-repo/acir/src/lib.rs +++ b/acvm-repo/acir/src/lib.rs @@ -535,9 +535,9 @@ mod reflection { packer.pack(tag); }} else {{ std::visit([&packer, tag](const auto& arg) {{ - std::map data; - data[tag] = msgpack::object(arg); - packer.pack(data); + packer.pack_map(1); + packer.pack(tag); + arg.msgpack_pack(packer); }}, value); }}"# ) diff --git a/acvm-repo/acir/src/serialization.rs b/acvm-repo/acir/src/serialization.rs index 0aeac255253..185aa9e5792 100644 --- a/acvm-repo/acir/src/serialization.rs +++ b/acvm-repo/acir/src/serialization.rs @@ -25,7 +25,7 @@ pub enum Format { impl Default for Format { fn default() -> Self { - Self::Msgpack + Self::MsgpackCompact } } diff --git a/acvm-repo/acir/tests/test_program_serialization.rs b/acvm-repo/acir/tests/test_program_serialization.rs index 6914e75b221..29b8355ded9 100644 --- a/acvm-repo/acir/tests/test_program_serialization.rs +++ b/acvm-repo/acir/tests/test_program_serialization.rs @@ -10,6 +10,7 @@ //! actual output, **HOWEVER** note that this results in a breaking change to the backend ACIR format. use acir::{ + SerializationFormat, circuit::{Circuit, Program, brillig::BrilligBytecode}, native_types::Witness, }; @@ -18,6 +19,15 @@ use brillig::{ BitSize, HeapArray, HeapValueType, HeapVector, IntegerBitSize, MemoryAddress, ValueOrArray, }; +fn assert_deserialization(expected: &Program, bytes: [Vec; 3]) { + for (i, bytes) in bytes.iter().enumerate() { + let program = Program::deserialize_program(bytes) + .map_err(|e| format!("failed to deserialize format {i}: {e:?}")) + .unwrap(); + assert_eq!(&program, expected, "incorrect deserialized program for format {i}"); + } +} + #[test] fn addition_circuit() { let src = " @@ -31,18 +41,18 @@ fn addition_circuit() { let program = Program { functions: vec![circuit], unconstrained_functions: vec![] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 10, 128, 48, 12, 69, 127, 170, 7, 113, 212, 77, 241, 8, 34, 56, 137, 163, 139, 155, 7, 16, 55, 199, 30, 65, 188, 128, 167, 16, 61, 78, 55, 71, 23, 119, 29, 90, 140, 116, 105, 31, 132, 36, 240, 73, 254, 39, 252, 9, 223, 34, 216, 4, 186, 71, 112, 130, 200, 67, 43, 152, 54, 237, 235, 81, 101, 107, 178, 55, 229, 38, 101, 219, 197, 249, 89, 77, 199, 48, 23, 234, 94, 46, 237, 195, 241, 46, 132, 121, 192, 102, 179, 3, 95, 38, 206, 3, 2, 103, 244, 195, 16, 1, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 10, 128, 48, 12, 69, 127, 170, 7, 113, 212, 77, 241, 8, 34, 56, 137, 163, 139, 155, 7, 16, 55, 199, 30, 65, 188, 128, 167, 16, 61, 78, 55, 71, 23, 119, 29, 90, 140, 116, 105, 31, 132, 36, 240, 73, 254, 39, 252, 9, 223, 34, 216, 4, 186, 71, 112, 130, 200, 67, 43, 152, 54, 237, 235, 81, 101, 107, 178, 55, 229, 38, 101, 219, 197, 249, 89, 77, 199, 48, 23, 234, 94, 46, 237, 195, 241, 46, 132, 121, 192, 102, 179, 3, 95, 38, 206, 3, 2, 103, 244, 195, 16, 1, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 187, 74, 3, 81, 16, 134, 179, 27, 31, 196, 82, 59, 197, 39, 16, 17, 172, 196, 82, 4, 25, 78, 206, 142, 114, 96, 207, 197, 153, 115, 162, 150, 171, 133, 237, 110, 242, 2, 1, 11, 137, 16, 68, 197, 91, 239, 139, 164, 179, 180, 177, 119, 8, 36, 164, 74, 50, 213, 48, 252, 252, 204, 247, 229, 55, 195, 179, 228, 116, 52, 222, 113, 115, 55, 154, 238, 224, 148, 197, 193, 155, 78, 68, 232, 34, 92, 154, 232, 144, 25, 140, 43, 240, 106, 237, 193, 7, 237, 11, 228, 166, 122, 220, 101, 70, 138, 39, 72, 254, 118, 104, 83, 9, 17, 201, 114, 253, 90, 26, 135, 138, 64, 123, 219, 49, 78, 77, 202, 251, 189, 239, 245, 214, 226, 201, 178, 21, 50, 185, 100, 182, 138, 67, 26, 111, 15, 54, 63, 143, 246, 223, 171, 234, 248, 116, 99, 231, 231, 224, 250, 43, 52, 123, 227, 191, 254, 175, 132, 218, 247, 23, 160, 151, 86, 181, 94, 2, 153, 174, 138, 8, 65, 145, 224, 202, 239, 220, 203, 242, 231, 144, 58, 165, 209, 115, 199, 122, 68, 24, 19, 57, 232, 170, 50, 9, 118, 251, 73, 77, 176, 193, 138, 19, 117, 142, 92, 127, 136, 54, 97, 140, 164, 4, 188, 128, 153, 209, 250, 31, 140, 53, 217, 21, 95, 1, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 187, 74, 3, 81, 16, 134, 179, 27, 31, 196, 82, 59, 197, 39, 16, 17, 172, 196, 82, 4, 25, 78, 206, 142, 114, 96, 207, 197, 153, 115, 162, 150, 171, 133, 237, 110, 242, 2, 1, 11, 137, 16, 68, 197, 91, 239, 139, 164, 179, 180, 177, 119, 8, 36, 164, 74, 50, 213, 48, 252, 252, 204, 247, 229, 55, 195, 179, 228, 116, 52, 222, 113, 115, 55, 154, 238, 224, 148, 197, 193, 155, 78, 68, 232, 34, 92, 154, 232, 144, 25, 140, 43, 240, 106, 237, 193, 7, 237, 11, 228, 166, 122, 220, 101, 70, 138, 39, 72, 254, 118, 104, 83, 9, 17, 201, 114, 253, 90, 26, 135, 138, 64, 123, 219, 49, 78, 77, 202, 251, 189, 239, 245, 214, 226, 201, 178, 21, 50, 185, 100, 182, 138, 67, 26, 111, 15, 54, 63, 143, 246, 223, 171, 234, 248, 116, 99, 231, 231, 224, 250, 43, 52, 123, 227, 191, 254, 175, 132, 218, 247, 23, 160, 151, 86, 181, 94, 2, 153, 174, 138, 8, 65, 145, 224, 202, 239, 220, 203, 242, 231, 144, 58, 165, 209, 115, 199, 122, 68, 24, 19, 57, 232, 170, 50, 9, 118, 251, 73, 77, 176, 193, 138, 19, 117, 142, 92, 127, 136, 54, 97, 140, 164, 4, 188, 128, 153, 209, 250, 31, 140, 53, 217, 21, 95, 1, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 204, 59, 14, 64, 48, 0, 128, 225, 62, 28, 196, 200, 70, 156, 64, 68, 98, 18, 163, 72, 108, 58, 147, 214, 98, 236, 13, 250, 24, 172, 157, 29, 64, 216, 93, 164, 155, 209, 98, 215, 19, 224, 159, 191, 252, 88, 201, 217, 120, 146, 47, 41, 99, 132, 142, 13, 161, 189, 22, 90, 29, 62, 120, 15, 194, 31, 6, 57, 19, 117, 37, 181, 177, 9, 183, 42, 95, 57, 175, 219, 32, 57, 139, 105, 31, 100, 102, 111, 125, 57, 132, 63, 55, 64, 65, 36, 36, 22, 226, 1, 27, 166, 206, 10, 172, 0, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } #[test] @@ -58,18 +68,18 @@ fn multi_scalar_mul_circuit() { let program = Program { functions: vec![circuit], unconstrained_functions: vec![] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 12, 66, 87, 235, 127, 255, 3, 183, 224, 5, 214, 64, 84, 68, 151, 236, 189, 21, 72, 232, 195, 35, 224, 226, 47, 50, 236, 232, 155, 23, 184, 194, 45, 208, 217, 153, 120, 147, 13, 167, 83, 37, 51, 249, 169, 221, 255, 54, 129, 45, 40, 232, 188, 0, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 141, 11, 10, 0, 32, 12, 66, 87, 235, 127, 255, 3, 183, 224, 5, 214, 64, 84, 68, 151, 236, 189, 21, 72, 232, 195, 35, 224, 226, 47, 50, 236, 232, 155, 23, 184, 194, 45, 208, 217, 153, 120, 147, 13, 167, 83, 37, 51, 249, 169, 221, 255, 54, 129, 45, 40, 232, 188, 0, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 144, 75, 75, 3, 65, 16, 132, 201, 230, 225, 227, 103, 69, 240, 230, 201, 131, 199, 161, 157, 109, 165, 113, 210, 51, 116, 247, 196, 92, 87, 4, 175, 27, 5, 207, 158, 92, 114, 136, 47, 16, 255, 158, 67, 196, 33, 183, 143, 42, 170, 232, 174, 230, 110, 115, 149, 217, 27, 69, 214, 245, 195, 246, 159, 29, 195, 2, 95, 190, 125, 22, 65, 54, 119, 75, 198, 168, 234, 136, 91, 92, 29, 15, 49, 249, 216, 162, 174, 187, 143, 121, 0, 127, 51, 143, 171, 211, 146, 59, 129, 16, 186, 183, 179, 28, 140, 206, 61, 4, 144, 130, 247, 175, 41, 18, 155, 62, 117, 195, 197, 95, 199, 168, 82, 83, 105, 60, 232, 46, 160, 143, 85, 154, 84, 154, 110, 146, 96, 75, 30, 12, 171, 54, 27, 98, 182, 148, 75, 239, 193, 225, 209, 87, 18, 90, 22, 215, 37, 144, 114, 181, 161, 232, 243, 168, 25, 79, 166, 179, 207, 148, 47, 3, 249, 61, 163, 223, 10, 90, 22, 118, 75, 8, 25, 119, 241, 119, 80, 69, 49, 183, 40, 189, 112, 141, 218, 255, 148, 95, 202, 26, 38, 64, 140, 173, 171, 243, 244, 191, 238, 86, 173, 160, 44, 1, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 144, 75, 75, 3, 65, 16, 132, 201, 230, 225, 227, 103, 69, 240, 230, 201, 131, 199, 161, 157, 109, 165, 113, 210, 51, 116, 247, 196, 92, 87, 4, 175, 27, 5, 207, 158, 92, 114, 136, 47, 16, 255, 158, 67, 196, 33, 183, 143, 42, 170, 232, 174, 230, 110, 115, 149, 217, 27, 69, 214, 245, 195, 246, 159, 29, 195, 2, 95, 190, 125, 22, 65, 54, 119, 75, 198, 168, 234, 136, 91, 92, 29, 15, 49, 249, 216, 162, 174, 187, 143, 121, 0, 127, 51, 143, 171, 211, 146, 59, 129, 16, 186, 183, 179, 28, 140, 206, 61, 4, 144, 130, 247, 175, 41, 18, 155, 62, 117, 195, 197, 95, 199, 168, 82, 83, 105, 60, 232, 46, 160, 143, 85, 154, 84, 154, 110, 146, 96, 75, 30, 12, 171, 54, 27, 98, 182, 148, 75, 239, 193, 225, 209, 87, 18, 90, 22, 215, 37, 144, 114, 181, 161, 232, 243, 168, 25, 79, 166, 179, 207, 148, 47, 3, 249, 61, 163, 223, 10, 90, 22, 118, 75, 8, 25, 119, 241, 119, 80, 69, 49, 183, 40, 189, 112, 141, 218, 255, 148, 95, 202, 26, 38, 64, 140, 173, 171, 243, 244, 191, 238, 86, 173, 160, 44, 1, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 61, 198, 171, 10, 128, 48, 20, 0, 80, 116, 190, 63, 75, 193, 102, 50, 152, 199, 48, 12, 47, 19, 220, 6, 214, 253, 193, 30, 162, 213, 102, 19, 63, 81, 45, 183, 29, 226, 221, 113, 86, 206, 60, 53, 80, 54, 213, 243, 218, 106, 193, 26, 10, 96, 238, 78, 131, 226, 61, 163, 64, 151, 143, 91, 48, 215, 192, 149, 24, 165, 140, 80, 49, 138, 120, 100, 130, 74, 81, 89, 200, 139, 114, 143, 98, 146, 164, 153, 253, 109, 237, 11, 181, 107, 246, 16, 122, 0, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } #[test] @@ -126,18 +136,18 @@ fn simple_brillig_foreign_call() { let program = Program { functions: vec![circuit], unconstrained_functions: vec![brillig_bytecode] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 81, 237, 10, 128, 32, 12, 116, 246, 193, 160, 127, 61, 65, 111, 22, 17, 253, 8, 164, 31, 17, 61, 127, 69, 91, 204, 156, 48, 7, 58, 61, 239, 240, 142, 129, 139, 11, 239, 5, 116, 174, 169, 131, 75, 139, 177, 193, 153, 10, 192, 206, 141, 254, 243, 223, 70, 15, 222, 32, 236, 168, 175, 219, 185, 236, 199, 56, 79, 33, 52, 4, 225, 143, 250, 244, 170, 192, 27, 74, 95, 229, 122, 104, 21, 80, 70, 146, 17, 152, 251, 198, 208, 166, 32, 21, 185, 123, 14, 239, 21, 156, 157, 92, 163, 94, 232, 115, 22, 2, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 81, 237, 10, 128, 32, 12, 116, 246, 193, 160, 127, 61, 65, 111, 22, 17, 253, 8, 164, 31, 17, 61, 127, 69, 91, 204, 156, 48, 7, 58, 61, 239, 240, 142, 129, 139, 11, 239, 5, 116, 174, 169, 131, 75, 139, 177, 193, 153, 10, 192, 206, 141, 254, 243, 223, 70, 15, 222, 32, 236, 168, 175, 219, 185, 236, 199, 56, 79, 33, 52, 4, 225, 143, 250, 244, 170, 192, 27, 74, 95, 229, 122, 104, 21, 80, 70, 146, 17, 152, 251, 198, 208, 166, 32, 21, 185, 123, 14, 239, 21, 156, 157, 92, 163, 94, 232, 115, 22, 2, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 179, 123, 234, 99, 244, 25, 218, 39, 104, 83, 33, 245, 208, 19, 234, 217, 114, 236, 201, 106, 36, 175, 237, 142, 103, 211, 166, 183, 77, 64, 92, 3, 18, 119, 4, 228, 159, 54, 1, 1, 66, 92, 57, 240, 96, 120, 3, 9, 33, 18, 225, 128, 79, 214, 216, 51, 223, 124, 191, 153, 180, 55, 109, 23, 86, 49, 58, 27, 14, 15, 230, 203, 187, 176, 50, 135, 147, 91, 85, 16, 129, 101, 241, 23, 217, 66, 8, 2, 173, 134, 127, 159, 198, 206, 43, 167, 33, 28, 150, 213, 119, 66, 99, 48, 107, 74, 99, 246, 78, 81, 55, 70, 104, 125, 193, 241, 101, 180, 139, 54, 51, 208, 159, 230, 133, 17, 12, 148, 135, 193, 141, 65, 11, 146, 132, 114, 121, 11, 173, 124, 146, 60, 122, 248, 220, 216, 126, 146, 228, 236, 143, 80, 239, 126, 107, 140, 93, 193, 43, 237, 220, 27, 72, 167, 158, 64, 163, 146, 12, 247, 215, 158, 176, 19, 47, 194, 75, 138, 206, 98, 67, 225, 40, 73, 175, 124, 209, 50, 168, 214, 130, 131, 57, 1, 23, 100, 69, 71, 154, 2, 194, 224, 82, 134, 0, 196, 34, 143, 238, 101, 22, 3, 119, 17, 80, 236, 155, 73, 70, 51, 90, 188, 176, 235, 189, 102, 87, 161, 237, 212, 137, 42, 146, 153, 180, 186, 12, 53, 177, 227, 114, 216, 172, 147, 251, 85, 164, 199, 207, 12, 202, 209, 15, 36, 80, 156, 76, 90, 200, 34, 224, 127, 40, 199, 63, 45, 67, 6, 116, 246, 251, 235, 151, 225, 162, 147, 247, 237, 111, 43, 157, 126, 168, 116, 82, 206, 234, 249, 106, 201, 178, 233, 124, 183, 127, 179, 166, 32, 164, 214, 20, 217, 44, 149, 26, 179, 90, 101, 51, 154, 94, 184, 118, 59, 0, 111, 198, 147, 178, 218, 113, 4, 152, 217, 90, 96, 127, 178, 36, 56, 122, 130, 55, 91, 19, 138, 99, 157, 255, 130, 220, 81, 247, 219, 134, 226, 221, 122, 59, 11, 71, 130, 187, 30, 94, 246, 96, 184, 131, 96, 244, 106, 51, 223, 40, 115, 181, 120, 223, 82, 160, 60, 223, 101, 231, 203, 234, 121, 65, 106, 28, 189, 177, 119, 24, 121, 210, 202, 208, 249, 2, 242, 210, 246, 35, 236, 162, 101, 87, 93, 3, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 179, 123, 234, 99, 244, 25, 218, 39, 104, 83, 33, 245, 208, 19, 234, 217, 114, 236, 201, 106, 36, 175, 237, 142, 103, 211, 166, 183, 77, 64, 92, 3, 18, 119, 4, 228, 159, 54, 1, 1, 66, 92, 57, 240, 96, 120, 3, 9, 33, 18, 225, 128, 79, 214, 216, 51, 223, 124, 191, 153, 180, 55, 109, 23, 86, 49, 58, 27, 14, 15, 230, 203, 187, 176, 50, 135, 147, 91, 85, 16, 129, 101, 241, 23, 217, 66, 8, 2, 173, 134, 127, 159, 198, 206, 43, 167, 33, 28, 150, 213, 119, 66, 99, 48, 107, 74, 99, 246, 78, 81, 55, 70, 104, 125, 193, 241, 101, 180, 139, 54, 51, 208, 159, 230, 133, 17, 12, 148, 135, 193, 141, 65, 11, 146, 132, 114, 121, 11, 173, 124, 146, 60, 122, 248, 220, 216, 126, 146, 228, 236, 143, 80, 239, 126, 107, 140, 93, 193, 43, 237, 220, 27, 72, 167, 158, 64, 163, 146, 12, 247, 215, 158, 176, 19, 47, 194, 75, 138, 206, 98, 67, 225, 40, 73, 175, 124, 209, 50, 168, 214, 130, 131, 57, 1, 23, 100, 69, 71, 154, 2, 194, 224, 82, 134, 0, 196, 34, 143, 238, 101, 22, 3, 119, 17, 80, 236, 155, 73, 70, 51, 90, 188, 176, 235, 189, 102, 87, 161, 237, 212, 137, 42, 146, 153, 180, 186, 12, 53, 177, 227, 114, 216, 172, 147, 251, 85, 164, 199, 207, 12, 202, 209, 15, 36, 80, 156, 76, 90, 200, 34, 224, 127, 40, 199, 63, 45, 67, 6, 116, 246, 251, 235, 151, 225, 162, 147, 247, 237, 111, 43, 157, 126, 168, 116, 82, 206, 234, 249, 106, 201, 178, 233, 124, 183, 127, 179, 166, 32, 164, 214, 20, 217, 44, 149, 26, 179, 90, 101, 51, 154, 94, 184, 118, 59, 0, 111, 198, 147, 178, 218, 113, 4, 152, 217, 90, 96, 127, 178, 36, 56, 122, 130, 55, 91, 19, 138, 99, 157, 255, 130, 220, 81, 247, 219, 134, 226, 221, 122, 59, 11, 71, 130, 187, 30, 94, 246, 96, 184, 131, 96, 244, 106, 51, 223, 40, 115, 181, 120, 223, 82, 160, 60, 223, 101, 231, 203, 234, 121, 65, 106, 28, 189, 177, 119, 24, 121, 210, 202, 208, 249, 2, 242, 210, 246, 35, 236, 162, 101, 87, 93, 3, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 14, 130, 48, 20, 134, 41, 46, 30, 195, 51, 232, 9, 20, 99, 226, 224, 68, 156, 13, 129, 23, 210, 164, 180, 164, 52, 38, 140, 189, 1, 45, 18, 87, 19, 5, 7, 244, 14, 14, 30, 76, 8, 177, 36, 14, 162, 111, 126, 223, 247, 255, 255, 72, 171, 227, 105, 172, 100, 189, 224, 152, 16, 28, 58, 30, 33, 7, 75, 201, 202, 197, 52, 36, 144, 103, 74, 63, 39, 214, 247, 67, 104, 240, 165, 51, 70, 49, 1, 251, 161, 145, 157, 101, 141, 183, 198, 116, 15, 92, 236, 252, 38, 178, 144, 165, 195, 104, 34, 114, 89, 45, 49, 7, 95, 32, 121, 93, 83, 1, 33, 240, 243, 118, 54, 29, 246, 127, 242, 246, 127, 60, 146, 183, 118, 121, 224, 9, 207, 97, 113, 106, 52, 86, 239, 51, 197, 234, 21, 227, 128, 67, 218, 2, 69, 213, 141, 80, 242, 190, 129, 136, 241, 116, 30, 4, 28, 146, 196, 240, 102, 119, 185, 194, 64, 130, 95, 255, 228, 197, 21, 44, 86, 186, 79, 125, 247, 120, 1, 82, 78, 27, 216, 177, 1, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } #[test] @@ -247,18 +257,18 @@ fn complex_brillig_foreign_call() { let program = Program { functions: vec![circuit], unconstrained_functions: vec![brillig_bytecode] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 84, 219, 10, 194, 48, 12, 109, 154, 109, 22, 244, 201, 47, 24, 232, 127, 137, 12, 223, 42, 250, 232, 231, 187, 66, 50, 178, 88, 181, 233, 182, 64, 73, 27, 206, 201, 101, 39, 12, 220, 220, 194, 120, 128, 238, 13, 121, 79, 62, 197, 81, 225, 25, 219, 187, 34, 3, 40, 199, 86, 215, 240, 110, 251, 26, 232, 236, 53, 146, 161, 177, 142, 225, 123, 89, 230, 54, 245, 207, 61, 75, 253, 211, 110, 180, 227, 233, 232, 189, 35, 31, 52, 193, 187, 207, 165, 153, 117, 66, 254, 64, 126, 120, 220, 159, 241, 246, 186, 12, 215, 24, 247, 50, 169, 226, 24, 6, 192, 160, 106, 25, 249, 211, 144, 223, 240, 156, 119, 97, 159, 61, 243, 177, 142, 15, 204, 111, 234, 248, 216, 9, 222, 20, 20, 119, 206, 155, 116, 97, 193, 73, 47, 204, 80, 53, 61, 217, 73, 189, 207, 10, 7, 5, 57, 216, 228, 127, 233, 23, 30, 50, 248, 127, 156, 181, 164, 172, 92, 185, 246, 152, 9, 114, 174, 55, 111, 172, 240, 81, 180, 5, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 84, 219, 10, 194, 48, 12, 109, 154, 109, 22, 244, 201, 47, 24, 232, 127, 137, 12, 223, 42, 250, 232, 231, 187, 66, 50, 178, 88, 181, 233, 182, 64, 73, 27, 206, 201, 101, 39, 12, 220, 220, 194, 120, 128, 238, 13, 121, 79, 62, 197, 81, 225, 25, 219, 187, 34, 3, 40, 199, 86, 215, 240, 110, 251, 26, 232, 236, 53, 146, 161, 177, 142, 225, 123, 89, 230, 54, 245, 207, 61, 75, 253, 211, 110, 180, 227, 233, 232, 189, 35, 31, 52, 193, 187, 207, 165, 153, 117, 66, 254, 64, 126, 120, 220, 159, 241, 246, 186, 12, 215, 24, 247, 50, 169, 226, 24, 6, 192, 160, 106, 25, 249, 211, 144, 223, 240, 156, 119, 97, 159, 61, 243, 177, 142, 15, 204, 111, 234, 248, 216, 9, 222, 20, 20, 119, 206, 155, 116, 97, 193, 73, 47, 204, 80, 53, 61, 217, 73, 189, 207, 10, 7, 5, 57, 216, 228, 127, 233, 23, 30, 50, 248, 127, 156, 181, 164, 172, 92, 185, 246, 152, 9, 114, 174, 55, 111, 172, 240, 81, 180, 5, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, 47, 57, 1, 149, 10, 117, 203, 130, 15, 99, 28, 226, 224, 84, 228, 161, 166, 128, 87, 215, 71, 246, 61, 231, 158, 57, 215, 46, 181, 38, 245, 68, 132, 134, 73, 161, 187, 239, 103, 121, 77, 4, 141, 225, 227, 183, 48, 65, 4, 97, 200, 107, 102, 4, 104, 77, 152, 136, 224, 236, 112, 36, 85, 40, 35, 208, 93, 155, 62, 65, 198, 57, 107, 84, 41, 231, 111, 63, 177, 200, 27, 50, 161, 18, 163, 123, 118, 112, 132, 72, 155, 253, 246, 36, 78, 56, 49, 128, 177, 238, 92, 113, 38, 128, 34, 9, 101, 92, 99, 130, 254, 162, 236, 253, 168, 120, 155, 47, 223, 63, 127, 69, 194, 173, 143, 121, 119, 65, 85, 250, 119, 84, 193, 110, 84, 118, 120, 194, 68, 131, 195, 54, 202, 254, 46, 70, 238, 226, 192, 221, 73, 31, 201, 196, 100, 97, 232, 231, 97, 40, 31, 220, 203, 198, 137, 21, 135, 251, 121, 113, 56, 81, 8, 17, 11, 169, 129, 239, 95, 21, 178, 83, 87, 16, 69, 209, 197, 207, 13, 171, 251, 126, 41, 184, 84, 73, 141, 179, 176, 128, 118, 102, 8, 38, 65, 65, 78, 41, 79, 64, 119, 190, 80, 173, 1, 13, 137, 93, 70, 105, 195, 1, 215, 46, 198, 206, 20, 131, 212, 57, 21, 145, 223, 9, 111, 173, 38, 124, 234, 44, 116, 34, 206, 72, 232, 2, 60, 174, 53, 13, 100, 193, 254, 96, 7, 213, 236, 237, 118, 234, 66, 110, 22, 14, 219, 225, 83, 134, 16, 26, 111, 92, 99, 134, 104, 246, 6, 236, 232, 185, 48, 208, 0, 60, 127, 249, 248, 209, 96, 46, 101, 171, 41, 193, 166, 214, 254, 94, 173, 61, 59, 205, 214, 48, 162, 134, 86, 165, 106, 182, 175, 10, 12, 132, 70, 17, 58, 115, 114, 166, 202, 52, 99, 185, 137, 122, 159, 101, 189, 174, 193, 220, 196, 253, 191, 231, 71, 101, 83, 235, 96, 175, 214, 27, 85, 151, 247, 60, 197, 221, 173, 246, 255, 104, 117, 176, 198, 234, 178, 77, 143, 37, 2, 107, 136, 140, 224, 221, 56, 79, 235, 104, 17, 212, 105, 129, 201, 45, 214, 228, 25, 80, 53, 95, 174, 214, 72, 73, 230, 6, 193, 229, 185, 92, 100, 188, 129, 157, 189, 128, 88, 98, 243, 104, 149, 231, 193, 26, 252, 225, 117, 113, 148, 185, 27, 196, 52, 21, 44, 151, 184, 149, 22, 192, 110, 190, 197, 131, 99, 6, 60, 90, 48, 174, 96, 171, 119, 203, 223, 195, 173, 133, 251, 151, 243, 22, 69, 105, 189, 219, 74, 251, 63, 169, 222, 111, 203, 15, 236, 197, 137, 145, 202, 166, 139, 47, 96, 150, 193, 53, 22, 46, 9, 127, 2, 175, 169, 227, 172, 228, 7, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, 47, 57, 1, 149, 10, 117, 203, 130, 15, 99, 28, 226, 224, 84, 228, 161, 166, 128, 87, 215, 71, 246, 61, 231, 158, 57, 215, 46, 181, 38, 245, 68, 132, 134, 73, 161, 187, 239, 103, 121, 77, 4, 141, 225, 227, 183, 48, 65, 4, 97, 200, 107, 102, 4, 104, 77, 152, 136, 224, 236, 112, 36, 85, 40, 35, 208, 93, 155, 62, 65, 198, 57, 107, 84, 41, 231, 111, 63, 177, 200, 27, 50, 161, 18, 163, 123, 118, 112, 132, 72, 155, 253, 246, 36, 78, 56, 49, 128, 177, 238, 92, 113, 38, 128, 34, 9, 101, 92, 99, 130, 254, 162, 236, 253, 168, 120, 155, 47, 223, 63, 127, 69, 194, 173, 143, 121, 119, 65, 85, 250, 119, 84, 193, 110, 84, 118, 120, 194, 68, 131, 195, 54, 202, 254, 46, 70, 238, 226, 192, 221, 73, 31, 201, 196, 100, 97, 232, 231, 97, 40, 31, 220, 203, 198, 137, 21, 135, 251, 121, 113, 56, 81, 8, 17, 11, 169, 129, 239, 95, 21, 178, 83, 87, 16, 69, 209, 197, 207, 13, 171, 251, 126, 41, 184, 84, 73, 141, 179, 176, 128, 118, 102, 8, 38, 65, 65, 78, 41, 79, 64, 119, 190, 80, 173, 1, 13, 137, 93, 70, 105, 195, 1, 215, 46, 198, 206, 20, 131, 212, 57, 21, 145, 223, 9, 111, 173, 38, 124, 234, 44, 116, 34, 206, 72, 232, 2, 60, 174, 53, 13, 100, 193, 254, 96, 7, 213, 236, 237, 118, 234, 66, 110, 22, 14, 219, 225, 83, 134, 16, 26, 111, 92, 99, 134, 104, 246, 6, 236, 232, 185, 48, 208, 0, 60, 127, 249, 248, 209, 96, 46, 101, 171, 41, 193, 166, 214, 254, 94, 173, 61, 59, 205, 214, 48, 162, 134, 86, 165, 106, 182, 175, 10, 12, 132, 70, 17, 58, 115, 114, 166, 202, 52, 99, 185, 137, 122, 159, 101, 189, 174, 193, 220, 196, 253, 191, 231, 71, 101, 83, 235, 96, 175, 214, 27, 85, 151, 247, 60, 197, 221, 173, 246, 255, 104, 117, 176, 198, 234, 178, 77, 143, 37, 2, 107, 136, 140, 224, 221, 56, 79, 235, 104, 17, 212, 105, 129, 201, 45, 214, 228, 25, 80, 53, 95, 174, 214, 72, 73, 230, 6, 193, 229, 185, 92, 100, 188, 129, 157, 189, 128, 88, 98, 243, 104, 149, 231, 193, 26, 252, 225, 117, 113, 148, 185, 27, 196, 52, 21, 44, 151, 184, 149, 22, 192, 110, 190, 197, 131, 99, 6, 60, 90, 48, 174, 96, 171, 119, 203, 223, 195, 173, 133, 251, 151, 243, 22, 69, 105, 189, 219, 74, 251, 63, 169, 222, 111, 203, 15, 236, 197, 137, 145, 202, 166, 139, 47, 96, 150, 193, 53, 22, 46, 9, 127, 2, 175, 169, 227, 172, 228, 7, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 82, 65, 78, 195, 48, 16, 140, 235, 22, 250, 140, 72, 240, 2, 120, 65, 9, 170, 224, 192, 169, 226, 140, 172, 196, 138, 44, 185, 113, 228, 248, 64, 142, 254, 65, 108, 131, 56, 112, 65, 130, 180, 66, 45, 127, 224, 192, 195, 104, 16, 78, 213, 22, 154, 88, 141, 79, 222, 181, 103, 118, 118, 119, 160, 86, 79, 47, 67, 37, 23, 23, 156, 80, 74, 226, 0, 81, 250, 224, 105, 89, 142, 56, 71, 185, 49, 133, 210, 95, 190, 183, 255, 0, 208, 248, 197, 107, 71, 212, 235, 138, 8, 54, 19, 201, 217, 132, 36, 49, 197, 166, 48, 109, 90, 108, 163, 190, 27, 97, 198, 14, 191, 63, 56, 170, 68, 78, 83, 138, 143, 237, 101, 248, 105, 64, 15, 22, 197, 106, 10, 203, 144, 85, 153, 251, 187, 112, 181, 179, 103, 89, 6, 44, 201, 132, 145, 179, 75, 194, 113, 40, 60, 57, 191, 78, 4, 142, 49, 127, 189, 61, 63, 107, 172, 10, 183, 241, 192, 13, 239, 201, 101, 101, 157, 8, 9, 20, 176, 52, 175, 105, 252, 181, 158, 154, 248, 48, 165, 254, 54, 30, 186, 225, 119, 234, 247, 93, 39, 245, 119, 167, 96, 173, 167, 38, 94, 140, 25, 199, 36, 78, 42, 192, 227, 252, 119, 95, 70, 190, 95, 97, 148, 254, 236, 88, 215, 67, 128, 242, 227, 6, 79, 25, 207, 71, 81, 196, 113, 150, 217, 135, 147, 127, 242, 167, 214, 38, 90, 89, 111, 148, 99, 130, 105, 4, 55, 195, 205, 72, 59, 213, 6, 186, 101, 141, 142, 55, 234, 232, 189, 129, 124, 155, 8, 150, 42, 189, 235, 181, 111, 81, 157, 181, 15, 223, 4, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } #[test] @@ -276,18 +286,18 @@ fn memory_op_circuit() { let program = Program { functions: vec![circuit], unconstrained_functions: vec![] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 81, 65, 10, 0, 32, 8, 115, 106, 255, 232, 255, 175, 172, 131, 70, 129, 7, 211, 129, 108, 135, 13, 28, 3, 189, 24, 251, 196, 180, 51, 27, 227, 210, 76, 49, 38, 165, 128, 110, 14, 159, 57, 201, 123, 187, 221, 170, 185, 114, 55, 205, 123, 207, 166, 190, 165, 4, 15, 104, 144, 91, 71, 10, 197, 194, 40, 2, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 81, 65, 10, 0, 32, 8, 115, 106, 255, 232, 255, 175, 172, 131, 70, 129, 7, 211, 129, 108, 135, 13, 28, 3, 189, 24, 251, 196, 180, 51, 27, 227, 210, 76, 49, 38, 165, 128, 110, 14, 159, 57, 201, 123, 187, 221, 170, 185, 114, 55, 205, 123, 207, 166, 190, 165, 4, 15, 104, 144, 91, 71, 10, 197, 194, 40, 2, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 147, 75, 78, 195, 48, 16, 134, 147, 180, 220, 131, 235, 176, 64, 28, 97, 228, 56, 3, 178, 136, 31, 204, 216, 133, 46, 219, 44, 216, 38, 237, 5, 16, 207, 166, 82, 133, 0, 33, 46, 192, 193, 48, 137, 120, 172, 104, 23, 168, 170, 55, 182, 199, 163, 255, 255, 52, 250, 157, 77, 219, 227, 96, 164, 87, 214, 112, 115, 185, 250, 58, 131, 17, 26, 175, 94, 101, 32, 66, 227, 225, 92, 121, 131, 204, 160, 76, 129, 23, 123, 15, 214, 73, 91, 32, 207, 39, 203, 67, 212, 150, 198, 7, 70, 249, 106, 145, 151, 86, 158, 130, 42, 146, 91, 21, 239, 179, 52, 91, 246, 21, 63, 118, 120, 223, 55, 78, 22, 253, 126, 228, 166, 63, 237, 215, 214, 85, 173, 117, 72, 226, 211, 185, 106, 117, 40, 193, 35, 105, 174, 95, 74, 101, 80, 16, 72, 171, 115, 101, 186, 103, 174, 111, 206, 64, 190, 239, 39, 127, 175, 244, 174, 67, 253, 47, 177, 145, 40, 3, 174, 19, 107, 102, 235, 149, 6, 27, 25, 38, 91, 155, 83, 178, 163, 115, 26, 110, 70, 255, 236, 72, 141, 132, 71, 112, 130, 98, 96, 163, 39, 207, 211, 108, 240, 228, 66, 94, 42, 249, 171, 90, 175, 8, 125, 32, 3, 29, 33, 55, 195, 71, 193, 140, 228, 65, 199, 88, 139, 19, 228, 250, 45, 38, 63, 194, 121, 18, 145, 184, 128, 239, 79, 81, 127, 0, 205, 96, 137, 59, 34, 3, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 147, 75, 78, 195, 48, 16, 134, 147, 180, 220, 131, 235, 176, 64, 28, 97, 228, 56, 3, 178, 136, 31, 204, 216, 133, 46, 219, 44, 216, 38, 237, 5, 16, 207, 166, 82, 133, 0, 33, 46, 192, 193, 48, 137, 120, 172, 104, 23, 168, 170, 55, 182, 199, 163, 255, 255, 52, 250, 157, 77, 219, 227, 96, 164, 87, 214, 112, 115, 185, 250, 58, 131, 17, 26, 175, 94, 101, 32, 66, 227, 225, 92, 121, 131, 204, 160, 76, 129, 23, 123, 15, 214, 73, 91, 32, 207, 39, 203, 67, 212, 150, 198, 7, 70, 249, 106, 145, 151, 86, 158, 130, 42, 146, 91, 21, 239, 179, 52, 91, 246, 21, 63, 118, 120, 223, 55, 78, 22, 253, 126, 228, 166, 63, 237, 215, 214, 85, 173, 117, 72, 226, 211, 185, 106, 117, 40, 193, 35, 105, 174, 95, 74, 101, 80, 16, 72, 171, 115, 101, 186, 103, 174, 111, 206, 64, 190, 239, 39, 127, 175, 244, 174, 67, 253, 47, 177, 145, 40, 3, 174, 19, 107, 102, 235, 149, 6, 27, 25, 38, 91, 155, 83, 178, 163, 115, 26, 110, 70, 255, 236, 72, 141, 132, 71, 112, 130, 98, 96, 163, 39, 207, 211, 108, 240, 228, 66, 94, 42, 249, 171, 90, 175, 8, 125, 32, 3, 29, 33, 55, 195, 71, 193, 140, 228, 65, 199, 88, 139, 19, 228, 250, 45, 38, 63, 194, 121, 18, 145, 184, 128, 239, 79, 81, 127, 0, 205, 96, 137, 59, 34, 3, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 142, 187, 9, 128, 64, 16, 68, 119, 111, 207, 62, 108, 199, 64, 172, 194, 192, 192, 15, 98, 98, 120, 29, 236, 39, 48, 53, 18, 177, 14, 11, 51, 184, 220, 59, 193, 73, 134, 129, 7, 243, 72, 101, 219, 11, 11, 87, 221, 246, 227, 188, 86, 67, 183, 24, 40, 186, 35, 238, 112, 198, 110, 38, 5, 51, 230, 187, 132, 247, 96, 38, 36, 154, 166, 40, 137, 192, 103, 63, 248, 209, 207, 103, 188, 161, 35, 22, 207, 252, 0, 167, 131, 176, 229, 104, 1, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } #[test] @@ -337,16 +347,16 @@ fn nested_acir_call_circuit() { let program = Program { functions: vec![main, nested_call, inner_call], unconstrained_functions: vec![] }; - let bytes = - Program::serialize_program_with_format(&program, acir::SerializationFormat::BincodeLegacy); - insta::assert_compact_debug_snapshot!(bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 81, 59, 10, 131, 64, 16, 157, 15, 222, 35, 101, 210, 37, 228, 8, 33, 144, 42, 88, 218, 216, 121, 0, 177, 179, 244, 8, 226, 5, 60, 133, 232, 113, 236, 44, 109, 236, 85, 88, 101, 92, 23, 119, 45, 124, 240, 96, 216, 125, 204, 188, 55, 195, 176, 5, 43, 206, 240, 38, 226, 68, 18, 255, 168, 8, 203, 187, 77, 196, 218, 128, 85, 120, 3, 39, 32, 9, 237, 51, 250, 39, 237, 171, 124, 212, 254, 183, 202, 178, 32, 188, 191, 187, 95, 218, 196, 249, 167, 29, 138, 94, 13, 115, 236, 187, 26, 148, 53, 30, 232, 25, 182, 33, 23, 156, 205, 35, 181, 182, 60, 228, 222, 151, 60, 165, 39, 225, 107, 119, 8, 253, 74, 122, 205, 96, 118, 108, 90, 204, 149, 193, 209, 189, 175, 53, 147, 9, 35, 191, 119, 205, 214, 247, 2, 0, 0]"); + let bytes_legacy = + Program::serialize_program_with_format(&program, SerializationFormat::BincodeLegacy); + insta::assert_compact_debug_snapshot!(bytes_legacy, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 81, 59, 10, 131, 64, 16, 157, 15, 222, 35, 101, 210, 37, 228, 8, 33, 144, 42, 88, 218, 216, 121, 0, 177, 179, 244, 8, 226, 5, 60, 133, 232, 113, 236, 44, 109, 236, 85, 88, 101, 92, 23, 119, 45, 124, 240, 96, 216, 125, 204, 188, 55, 195, 176, 5, 43, 206, 240, 38, 226, 68, 18, 255, 168, 8, 203, 187, 77, 196, 218, 128, 85, 120, 3, 39, 32, 9, 237, 51, 250, 39, 237, 171, 124, 212, 254, 183, 202, 178, 32, 188, 191, 187, 95, 218, 196, 249, 167, 29, 138, 94, 13, 115, 236, 187, 26, 148, 53, 30, 232, 25, 182, 33, 23, 156, 205, 35, 181, 182, 60, 228, 222, 151, 60, 165, 39, 225, 107, 119, 8, 253, 74, 122, 205, 96, 118, 108, 90, 204, 149, 193, 209, 189, 175, 53, 147, 9, 35, 191, 119, 205, 214, 247, 2, 0, 0]"); - let program_de = Program::deserialize_program(&bytes).unwrap(); - assert_eq!(program_de, program); + let bytes_msgpack = + Program::serialize_program_with_format(&program, SerializationFormat::Msgpack); + insta::assert_compact_debug_snapshot!(bytes_msgpack, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 211, 205, 74, 3, 49, 16, 0, 224, 221, 236, 139, 120, 212, 155, 226, 19, 72, 17, 60, 137, 71, 17, 36, 164, 217, 81, 2, 187, 217, 56, 73, 170, 30, 171, 130, 215, 253, 121, 129, 162, 98, 89, 161, 136, 138, 127, 55, 15, 190, 72, 111, 30, 189, 120, 55, 22, 86, 43, 45, 117, 45, 130, 57, 133, 97, 8, 51, 223, 76, 200, 65, 185, 101, 37, 55, 34, 145, 186, 56, 238, 85, 119, 42, 89, 12, 157, 91, 110, 17, 65, 26, 186, 43, 140, 4, 173, 169, 144, 33, 236, 5, 221, 68, 241, 36, 4, 93, 180, 207, 26, 44, 138, 142, 78, 68, 232, 159, 11, 169, 172, 209, 185, 231, 119, 19, 107, 62, 174, 25, 41, 21, 66, 40, 56, 51, 240, 52, 57, 51, 24, 206, 188, 88, 210, 26, 208, 108, 0, 38, 135, 101, 108, 35, 106, 0, 99, 157, 222, 68, 66, 2, 67, 202, 147, 184, 41, 36, 27, 20, 156, 231, 207, 51, 222, 228, 227, 19, 151, 51, 31, 174, 98, 127, 161, 51, 247, 176, 182, 124, 215, 110, 175, 111, 206, 46, 190, 172, 236, 63, 170, 172, 209, 127, 43, 94, 93, 82, 112, 186, 67, 249, 143, 79, 121, 215, 10, 69, 203, 213, 72, 21, 67, 199, 227, 234, 210, 153, 119, 165, 108, 51, 18, 124, 56, 230, 247, 16, 140, 69, 73, 91, 44, 178, 160, 211, 75, 54, 232, 136, 198, 142, 144, 109, 187, 192, 47, 157, 243, 191, 54, 241, 106, 152, 144, 90, 38, 228, 107, 176, 164, 26, 44, 25, 63, 216, 49, 122, 110, 7, 70, 249, 210, 239, 122, 89, 48, 37, 159, 95, 241, 101, 255, 193, 231, 79, 189, 82, 181, 80, 188, 17, 148, 123, 71, 226, 234, 55, 200, 92, 83, 33, 253, 252, 212, 233, 59, 226, 130, 57, 211, 226, 3, 0, 0]"); - let default_bytes = Program::serialize_program(&program); - insta::assert_compact_debug_snapshot!(default_bytes, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 211, 205, 74, 3, 49, 16, 0, 224, 221, 236, 139, 120, 212, 155, 226, 19, 72, 17, 60, 137, 71, 17, 36, 164, 217, 81, 2, 187, 217, 56, 73, 170, 30, 171, 130, 215, 253, 121, 129, 162, 98, 89, 161, 136, 138, 127, 55, 15, 190, 72, 111, 30, 189, 120, 55, 22, 86, 43, 45, 117, 45, 130, 57, 133, 97, 8, 51, 223, 76, 200, 65, 185, 101, 37, 55, 34, 145, 186, 56, 238, 85, 119, 42, 89, 12, 157, 91, 110, 17, 65, 26, 186, 43, 140, 4, 173, 169, 144, 33, 236, 5, 221, 68, 241, 36, 4, 93, 180, 207, 26, 44, 138, 142, 78, 68, 232, 159, 11, 169, 172, 209, 185, 231, 119, 19, 107, 62, 174, 25, 41, 21, 66, 40, 56, 51, 240, 52, 57, 51, 24, 206, 188, 88, 210, 26, 208, 108, 0, 38, 135, 101, 108, 35, 106, 0, 99, 157, 222, 68, 66, 2, 67, 202, 147, 184, 41, 36, 27, 20, 156, 231, 207, 51, 222, 228, 227, 19, 151, 51, 31, 174, 98, 127, 161, 51, 247, 176, 182, 124, 215, 110, 175, 111, 206, 46, 190, 172, 236, 63, 170, 172, 209, 127, 43, 94, 93, 82, 112, 186, 67, 249, 143, 79, 121, 215, 10, 69, 203, 213, 72, 21, 67, 199, 227, 234, 210, 153, 119, 165, 108, 51, 18, 124, 56, 230, 247, 16, 140, 69, 73, 91, 44, 178, 160, 211, 75, 54, 232, 136, 198, 142, 144, 109, 187, 192, 47, 157, 243, 191, 54, 241, 106, 152, 144, 90, 38, 228, 107, 176, 164, 26, 44, 25, 63, 216, 49, 122, 110, 7, 70, 249, 210, 239, 122, 89, 48, 37, 159, 95, 241, 101, 255, 193, 231, 79, 189, 82, 181, 80, 188, 17, 148, 123, 71, 226, 234, 55, 200, 92, 83, 33, 253, 252, 212, 233, 59, 226, 130, 57, 211, 226, 3, 0, 0]"); + let bytes_default = Program::serialize_program(&program); + insta::assert_compact_debug_snapshot!(bytes_default, @"[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 144, 161, 10, 2, 65, 20, 69, 223, 123, 243, 35, 70, 109, 138, 95, 32, 139, 96, 18, 163, 8, 6, 193, 109, 11, 202, 172, 197, 56, 127, 240, 222, 27, 193, 186, 193, 228, 7, 136, 182, 13, 254, 200, 54, 163, 197, 238, 40, 6, 147, 227, 134, 189, 237, 194, 229, 114, 56, 70, 253, 190, 48, 222, 29, 146, 69, 150, 237, 80, 1, 133, 202, 239, 102, 74, 119, 28, 228, 121, 106, 55, 179, 212, 174, 60, 171, 94, 91, 240, 59, 72, 97, 211, 93, 142, 109, 213, 43, 58, 231, 201, 240, 228, 220, 116, 222, 238, 223, 70, 219, 203, 90, 146, 234, 225, 239, 97, 100, 162, 55, 32, 32, 200, 28, 240, 180, 62, 2, 252, 129, 64, 209, 27, 250, 152, 32, 165, 151, 137, 224, 131, 197, 4, 34, 148, 102, 136, 48, 46, 229, 205, 0, 204, 79, 117, 204, 11, 148, 185, 1, 0, 0]"); - let program_de = Program::deserialize_program(&default_bytes).unwrap(); - assert_eq!(program_de, program); + assert_deserialization(&program, [bytes_legacy, bytes_msgpack, bytes_default]); } diff --git a/acvm-repo/acvm_js/test/shared/addition.ts b/acvm-repo/acvm_js/test/shared/addition.ts index 7df23931408..1fc9ae27174 100644 --- a/acvm-repo/acvm_js/test/shared/addition.ts +++ b/acvm-repo/acvm_js/test/shared/addition.ts @@ -2,17 +2,11 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `addition_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 144, 189, 74, 3, 65, 16, 199, 239, 46, 62, 136, 165, 118, 138, 79, 32, 34, 88, - 137, 165, 8, 50, 108, 246, 70, 89, 184, 253, 112, 118, 55, 106, 121, 90, 216, 222, 37, 47, 16, 176, 144, 8, 65, 84, - 252, 122, 135, 121, 4, 155, 116, 150, 54, 246, 174, 1, 197, 42, 201, 84, 195, 240, 159, 63, 252, 126, 197, 197, 232, - 40, 26, 25, 148, 53, 190, 189, 26, 255, 238, 96, 132, 198, 225, 147, 140, 68, 104, 2, 156, 170, 96, 208, 123, 80, 166, - 196, 179, 165, 27, 235, 164, 45, 209, 183, 245, 237, 166, 247, 72, 225, 0, 201, 94, 142, 116, 172, 32, 32, 105, 223, - 60, 86, 202, 160, 32, 144, 86, 119, 149, 17, 211, 242, 65, 255, 61, 91, 206, 102, 79, 158, 47, 18, 42, 126, 66, 107, - 229, 46, 241, 100, 157, 135, 171, 252, 186, 183, 205, 207, 92, 115, 189, 127, 184, 178, 193, 31, 59, 231, 252, 230, - 184, 221, 226, 9, 127, 241, 128, 63, 211, 75, 231, 250, 4, 228, 252, 230, 236, 193, 145, 234, 137, 128, 224, 4, 37, - 254, 4, 227, 251, 121, 113, 239, 98, 183, 82, 242, 223, 177, 25, 19, 134, 72, 6, 122, 162, 138, 201, 67, 231, 78, 76, - 61, 128, 78, 146, 196, 49, 250, 230, 37, 121, 76, 208, 129, 68, 50, 81, 194, 159, 226, 230, 27, 239, 33, 11, 251, 112, - 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 141, 204, 59, 14, 64, 48, 0, 128, 225, 62, 28, 196, 200, 70, 156, 64, 68, 98, 18, + 163, 72, 108, 58, 147, 214, 98, 236, 13, 250, 24, 172, 157, 29, 64, 216, 93, 164, 155, 209, 98, 215, 19, 224, 159, + 191, 252, 88, 201, 217, 120, 146, 47, 41, 99, 132, 142, 13, 161, 189, 22, 90, 29, 62, 120, 15, 194, 31, 6, 57, 19, + 117, 37, 181, 177, 9, 183, 42, 95, 57, 175, 219, 32, 57, 139, 105, 31, 100, 102, 111, 125, 57, 132, 63, 55, 64, 65, + 36, 36, 22, 226, 1, 27, 166, 206, 10, 172, 0, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts index b2a9184370d..56df50e4778 100644 --- a/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/complex_foreign_call.ts @@ -2,27 +2,18 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `complex_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 197, 85, 203, 110, 211, 64, 20, 181, 227, 20, 250, 25, 145, 224, 11, 224, 11, 74, - 80, 5, 11, 86, 21, 235, 209, 196, 190, 137, 70, 26, 207, 12, 119, 198, 165, 97, 55, 9, 136, 109, 30, 75, 54, 136, 54, - 47, 57, 1, 149, 10, 117, 203, 135, 240, 49, 140, 67, 28, 156, 138, 60, 212, 20, 240, 234, 250, 200, 190, 231, 220, 51, - 231, 218, 165, 214, 164, 158, 136, 208, 48, 41, 116, 247, 253, 44, 175, 137, 160, 49, 124, 252, 22, 38, 136, 32, 12, - 121, 205, 140, 0, 173, 9, 19, 17, 156, 29, 142, 164, 10, 101, 4, 186, 107, 211, 39, 200, 56, 103, 141, 42, 229, 252, - 237, 39, 22, 121, 67, 38, 84, 98, 116, 207, 14, 142, 16, 105, 179, 223, 158, 196, 9, 39, 6, 48, 214, 157, 43, 206, 4, - 80, 36, 161, 140, 107, 76, 208, 95, 148, 189, 31, 94, 197, 219, 124, 249, 254, 249, 43, 18, 110, 127, 206, 187, 19, - 178, 210, 191, 36, 11, 118, 36, 179, 195, 19, 38, 26, 28, 182, 145, 246, 119, 178, 115, 39, 27, 238, 82, 254, 72, 38, - 38, 139, 69, 63, 143, 69, 249, 224, 94, 54, 82, 172, 56, 220, 207, 139, 195, 137, 66, 136, 88, 72, 13, 124, 255, 170, - 144, 157, 186, 130, 40, 138, 46, 136, 110, 96, 221, 247, 75, 193, 165, 74, 106, 156, 133, 5, 180, 51, 67, 48, 9, 10, - 114, 74, 121, 2, 186, 243, 133, 106, 13, 104, 72, 236, 210, 74, 27, 14, 184, 118, 129, 118, 198, 24, 164, 206, 173, - 136, 252, 206, 122, 107, 53, 235, 83, 103, 163, 19, 113, 70, 66, 23, 229, 113, 173, 105, 32, 139, 248, 7, 59, 168, - 102, 111, 183, 83, 23, 119, 179, 112, 217, 14, 159, 50, 132, 208, 120, 227, 26, 51, 68, 179, 55, 96, 71, 207, 133, - 129, 6, 224, 249, 203, 199, 143, 6, 115, 41, 219, 93, 9, 54, 245, 246, 247, 235, 237, 217, 105, 182, 146, 17, 53, 180, - 42, 85, 179, 125, 85, 160, 32, 52, 138, 208, 217, 147, 83, 85, 166, 25, 205, 77, 212, 251, 44, 235, 117, 13, 230, 38, - 238, 255, 69, 71, 42, 155, 122, 7, 251, 245, 222, 168, 187, 188, 239, 73, 238, 238, 182, 255, 71, 183, 131, 53, 110, - 151, 109, 122, 44, 17, 88, 67, 100, 4, 239, 198, 121, 100, 71, 139, 180, 78, 11, 76, 110, 187, 38, 207, 128, 170, 249, - 134, 181, 70, 74, 50, 55, 9, 46, 143, 230, 34, 227, 13, 236, 236, 5, 196, 18, 155, 71, 171, 60, 15, 214, 224, 15, 175, - 139, 163, 204, 237, 32, 166, 169, 96, 185, 201, 173, 180, 0, 118, 243, 85, 30, 28, 51, 224, 209, 130, 113, 5, 91, 189, - 91, 254, 45, 110, 45, 220, 191, 156, 183, 40, 74, 235, 221, 86, 218, 127, 10, 246, 158, 171, 126, 96, 47, 78, 140, 84, - 54, 93, 124, 8, 179, 20, 174, 49, 113, 201, 248, 19, 97, 10, 106, 42, 245, 7, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 82, 65, 78, 195, 48, 16, 140, 235, 22, 250, 140, 72, 240, 2, 120, 65, 9, 170, + 224, 192, 169, 226, 140, 172, 196, 138, 44, 185, 113, 228, 248, 64, 142, 254, 65, 108, 131, 56, 112, 65, 130, 180, 66, + 45, 127, 224, 192, 195, 104, 16, 78, 213, 22, 154, 88, 141, 79, 222, 181, 103, 118, 118, 119, 160, 86, 79, 47, 67, 37, + 23, 23, 156, 80, 74, 226, 0, 81, 250, 224, 105, 89, 142, 56, 71, 185, 49, 133, 210, 95, 190, 183, 255, 0, 208, 248, + 197, 107, 71, 212, 235, 138, 8, 54, 19, 201, 217, 132, 36, 49, 197, 166, 48, 109, 90, 108, 163, 190, 27, 97, 198, 14, + 191, 63, 56, 170, 68, 78, 83, 138, 143, 237, 101, 248, 105, 64, 15, 22, 197, 106, 10, 203, 144, 85, 153, 251, 187, + 112, 181, 179, 103, 89, 6, 44, 201, 132, 145, 179, 75, 194, 113, 40, 60, 57, 191, 78, 4, 142, 49, 127, 189, 61, 63, + 107, 172, 10, 183, 241, 192, 13, 239, 201, 101, 101, 157, 8, 9, 20, 176, 52, 175, 105, 252, 181, 158, 154, 248, 48, + 165, 254, 54, 30, 186, 225, 119, 234, 247, 93, 39, 245, 119, 167, 96, 173, 167, 38, 94, 140, 25, 199, 36, 78, 42, 192, + 227, 252, 119, 95, 70, 190, 95, 97, 148, 254, 236, 88, 215, 67, 128, 242, 227, 6, 79, 25, 207, 71, 81, 196, 113, 150, + 217, 135, 147, 127, 242, 167, 214, 38, 90, 89, 111, 148, 99, 130, 105, 4, 55, 195, 205, 72, 59, 213, 6, 186, 101, 141, + 142, 55, 234, 232, 189, 129, 124, 155, 8, 150, 42, 189, 235, 181, 111, 81, 157, 181, 15, 223, 4, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/foreign_call.ts b/acvm-repo/acvm_js/test/shared/foreign_call.ts index eaf72b7a76c..d2eba854296 100644 --- a/acvm-repo/acvm_js/test/shared/foreign_call.ts +++ b/acvm-repo/acvm_js/test/shared/foreign_call.ts @@ -2,23 +2,14 @@ import { WitnessMap } from '@noir-lang/acvm_js'; // See `simple_brillig_foreign_call` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 165, 146, 207, 78, 27, 49, 16, 198, 119, 247, 212, 199, 232, 51, 180, 79, 208, 166, - 66, 234, 161, 39, 212, 179, 229, 216, 147, 213, 72, 94, 219, 29, 207, 166, 77, 111, 155, 180, 234, 53, 32, 245, 94, - 21, 242, 79, 155, 128, 0, 33, 174, 60, 8, 15, 131, 55, 144, 16, 34, 17, 144, 240, 201, 26, 123, 230, 155, 239, 55, - 147, 245, 103, 157, 210, 42, 70, 103, 195, 193, 159, 197, 234, 46, 172, 44, 224, 223, 165, 42, 137, 192, 178, 248, - 142, 108, 33, 4, 129, 86, 195, 143, 55, 19, 231, 149, 211, 16, 14, 170, 250, 35, 161, 49, 152, 183, 164, 49, 191, 254, - 163, 78, 198, 104, 125, 201, 241, 101, 188, 143, 54, 55, 48, 152, 21, 165, 17, 12, 84, 132, 225, 133, 65, 11, 146, - 132, 114, 69, 27, 173, 188, 147, 60, 188, 73, 222, 38, 187, 79, 154, 30, 125, 19, 234, 249, 127, 201, 196, 149, 188, - 86, 47, 188, 129, 108, 230, 9, 52, 42, 201, 112, 125, 238, 9, 187, 241, 34, 188, 164, 232, 45, 182, 20, 14, 211, 236, - 204, 151, 109, 131, 106, 35, 56, 92, 16, 112, 73, 86, 116, 165, 41, 33, 12, 79, 101, 8, 64, 44, 138, 232, 95, 230, 49, - 112, 21, 17, 197, 206, 153, 100, 180, 163, 197, 3, 189, 254, 99, 122, 53, 218, 110, 147, 168, 34, 155, 105, 187, 199, - 208, 48, 251, 91, 141, 90, 77, 242, 160, 142, 252, 248, 158, 66, 53, 254, 132, 4, 138, 211, 105, 27, 89, 4, 252, 9, - 213, 228, 179, 101, 200, 129, 142, 190, 190, 127, 55, 90, 118, 242, 2, 255, 187, 106, 103, 175, 171, 157, 86, 243, - 102, 198, 90, 178, 108, 57, 223, 27, 92, 108, 72, 8, 169, 53, 69, 58, 43, 169, 100, 222, 200, 108, 71, 179, 19, 215, - 233, 4, 224, 237, 120, 90, 213, 123, 142, 0, 115, 219, 8, 252, 158, 174, 24, 142, 239, 240, 205, 55, 132, 226, 96, 23, - 95, 160, 112, 212, 251, 176, 165, 120, 181, 217, 206, 210, 146, 224, 158, 135, 135, 77, 24, 237, 33, 24, 189, 222, - 206, 39, 202, 156, 45, 223, 119, 20, 168, 142, 247, 217, 249, 170, 190, 95, 145, 6, 71, 127, 226, 29, 70, 160, 180, - 54, 116, 188, 164, 188, 178, 125, 11, 131, 35, 244, 228, 97, 3, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 149, 143, 49, 14, 130, 48, 20, 134, 41, 46, 30, 195, 51, 232, 9, 20, 99, 226, 224, + 68, 156, 13, 129, 23, 210, 164, 180, 164, 52, 38, 140, 189, 1, 45, 18, 87, 19, 5, 7, 244, 14, 14, 30, 76, 8, 177, 36, + 14, 162, 111, 126, 223, 247, 255, 255, 72, 171, 227, 105, 172, 100, 189, 224, 152, 16, 28, 58, 30, 33, 7, 75, 201, + 202, 197, 52, 36, 144, 103, 74, 63, 39, 214, 247, 67, 104, 240, 165, 51, 70, 49, 1, 251, 161, 145, 157, 101, 141, 183, + 198, 116, 15, 92, 236, 252, 38, 178, 144, 165, 195, 104, 34, 114, 89, 45, 49, 7, 95, 32, 121, 93, 83, 1, 33, 240, 243, + 118, 54, 29, 246, 127, 242, 246, 127, 60, 146, 183, 118, 121, 224, 9, 207, 97, 113, 106, 52, 86, 239, 51, 197, 234, + 21, 227, 128, 67, 218, 2, 69, 213, 141, 80, 242, 190, 129, 136, 241, 116, 30, 4, 28, 146, 196, 240, 102, 119, 185, + 194, 64, 130, 95, 255, 228, 197, 21, 44, 86, 186, 79, 125, 247, 120, 1, 82, 78, 27, 216, 177, 1, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000005'], diff --git a/acvm-repo/acvm_js/test/shared/memory_op.ts b/acvm-repo/acvm_js/test/shared/memory_op.ts index 767d834978b..04eb8bcdff4 100644 --- a/acvm-repo/acvm_js/test/shared/memory_op.ts +++ b/acvm-repo/acvm_js/test/shared/memory_op.ts @@ -1,16 +1,10 @@ // See `memory_op_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 83, 75, 78, 195, 48, 16, 77, 210, 114, 15, 174, 195, 2, 113, 132, 145, 227, - 12, 200, 34, 254, 48, 99, 23, 186, 108, 179, 96, 155, 180, 23, 64, 124, 155, 74, 21, 2, 132, 184, 12, 135, 193, 36, - 226, 179, 130, 44, 16, 170, 55, 158, 159, 222, 123, 51, 154, 201, 230, 237, 97, 48, 210, 43, 107, 184, 57, 223, 124, - 216, 96, 132, 198, 139, 103, 25, 136, 208, 120, 56, 85, 222, 32, 51, 40, 83, 224, 217, 206, 157, 117, 210, 22, 200, - 203, 217, 122, 31, 181, 165, 233, 158, 81, 190, 90, 229, 165, 149, 199, 160, 138, 228, 90, 69, 127, 145, 102, 235, 62, - 226, 167, 14, 111, 251, 194, 217, 170, 255, 15, 220, 252, 171, 252, 210, 186, 170, 181, 14, 73, 188, 51, 87, 173, 14, - 37, 120, 36, 205, 245, 83, 169, 12, 10, 2, 105, 117, 174, 76, 151, 230, 250, 234, 4, 228, 107, 178, 155, 252, 252, - 210, 155, 78, 235, 159, 161, 77, 68, 25, 240, 55, 180, 102, 49, 0, 106, 52, 140, 50, 249, 191, 89, 37, 91, 59, 171, - 241, 192, 6, 30, 29, 169, 137, 240, 8, 78, 80, 92, 220, 200, 202, 203, 52, 27, 61, 184, 144, 151, 74, 126, 139, 214, - 27, 66, 31, 200, 64, 167, 145, 155, 241, 189, 96, 70, 242, 160, 227, 122, 139, 35, 228, 250, 37, 94, 64, 148, 231, 73, - 68, 205, 5, 124, 30, 71, 253, 6, 10, 180, 163, 42, 42, 3, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 142, 187, 9, 128, 64, 16, 68, 119, 111, 207, 62, 108, 199, 64, 172, 194, 192, + 192, 15, 98, 98, 120, 29, 236, 39, 48, 53, 18, 177, 14, 11, 51, 184, 220, 59, 193, 73, 134, 129, 7, 243, 72, 101, 219, + 11, 11, 87, 221, 246, 227, 188, 86, 67, 183, 24, 40, 186, 35, 238, 112, 198, 110, 38, 5, 51, 230, 187, 132, 247, 96, + 38, 36, 154, 166, 40, 137, 192, 103, 63, 248, 209, 207, 103, 188, 161, 35, 22, 207, 252, 0, 167, 131, 176, 229, 104, + 1, 0, 0, ]); export const initialWitnessMap = new Map([ diff --git a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts index 23344eaff66..6c415411f94 100644 --- a/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts +++ b/acvm-repo/acvm_js/test/shared/multi_scalar_mul.ts @@ -1,14 +1,10 @@ // See `multi_scalar_mul_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 144, 75, 75, 3, 65, 16, 132, 201, 230, 225, 227, 103, 69, 240, 230, 201, 131, - 199, 161, 157, 109, 165, 113, 210, 51, 116, 247, 196, 92, 87, 4, 175, 27, 5, 207, 158, 92, 114, 136, 47, 16, 255, 158, - 67, 196, 33, 183, 143, 42, 170, 232, 174, 230, 110, 115, 149, 217, 27, 69, 214, 245, 195, 246, 159, 29, 195, 2, 95, - 190, 125, 22, 65, 54, 119, 75, 198, 168, 234, 136, 91, 92, 29, 15, 49, 249, 216, 162, 174, 187, 143, 121, 0, 127, 51, - 143, 171, 211, 146, 59, 129, 16, 186, 183, 179, 28, 140, 206, 61, 4, 144, 130, 247, 175, 41, 18, 155, 62, 117, 195, - 197, 95, 199, 168, 82, 83, 105, 60, 232, 46, 160, 143, 85, 154, 84, 154, 110, 146, 96, 75, 30, 12, 171, 54, 27, 98, - 182, 148, 75, 239, 193, 225, 209, 87, 18, 90, 22, 215, 37, 144, 114, 181, 161, 232, 243, 168, 25, 79, 166, 179, 207, - 148, 47, 3, 249, 61, 163, 223, 10, 90, 22, 118, 75, 8, 25, 119, 241, 119, 80, 69, 49, 183, 40, 189, 112, 141, 218, - 255, 148, 95, 202, 26, 38, 64, 140, 173, 171, 243, 244, 191, 238, 86, 173, 160, 44, 1, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 61, 198, 171, 10, 128, 48, 20, 0, 80, 116, 190, 63, 75, 193, 102, 50, 152, 199, 48, + 12, 47, 19, 220, 6, 214, 253, 193, 30, 162, 213, 102, 19, 63, 81, 45, 183, 29, 226, 221, 113, 86, 206, 60, 53, 80, 54, + 213, 243, 218, 106, 193, 26, 10, 96, 238, 78, 131, 226, 61, 163, 64, 151, 143, 91, 48, 215, 192, 149, 24, 165, 140, + 80, 49, 138, 120, 100, 130, 74, 81, 89, 200, 139, 114, 143, 98, 146, 164, 153, 253, 109, 237, 11, 181, 107, 246, 16, + 122, 0, 0, 0, ]); export const initialWitnessMap = new Map([ [1, '0x0000000000000000000000000000000000000000000000000000000000000001'], diff --git a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts index 6c4dce8e8e7..787ce50ef9f 100644 --- a/acvm-repo/acvm_js/test/shared/nested_acir_call.ts +++ b/acvm-repo/acvm_js/test/shared/nested_acir_call.ts @@ -2,20 +2,13 @@ import { WitnessMap, StackItem, WitnessStack } from '@noir-lang/acvm_js'; // See `nested_acir_call_circuit` integration test in `acir/tests/test_program_serialization.rs`. export const bytecode = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 205, 212, 205, 74, 3, 49, 16, 0, 224, 108, 246, 69, 60, 234, 77, 241, 9, 164, 8, - 158, 196, 163, 8, 18, 210, 108, 148, 192, 110, 54, 230, 167, 234, 177, 42, 120, 221, 221, 190, 64, 81, 177, 84, 40, - 162, 226, 223, 205, 7, 152, 71, 240, 210, 155, 71, 47, 222, 77, 11, 171, 149, 150, 218, 22, 15, 230, 20, 194, 36, 204, - 124, 51, 4, 31, 181, 119, 156, 100, 86, 164, 210, 52, 78, 59, 229, 158, 72, 154, 240, 230, 61, 115, 90, 115, 105, 201, - 190, 176, 146, 27, 67, 132, 140, 248, 65, 216, 74, 21, 75, 35, 110, 26, 245, 139, 10, 141, 227, 147, 51, 17, 5, 151, - 66, 42, 103, 77, 129, 130, 86, 234, 108, 111, 155, 227, 182, 210, 60, 18, 140, 90, 254, 50, 62, 50, 28, 140, 188, 90, - 49, 134, 107, 187, 197, 117, 122, 220, 78, 92, 76, 44, 215, 137, 201, 238, 98, 33, 57, 213, 132, 165, 73, 85, 72, 218, - 79, 184, 40, 94, 209, 28, 26, 191, 2, 220, 11, 90, 140, 214, 53, 116, 151, 160, 185, 0, 79, 27, 171, 240, 0, 117, 168, - 111, 110, 207, 47, 195, 219, 218, 33, 60, 43, 200, 43, 208, 133, 15, 104, 192, 187, 191, 18, 158, 239, 17, 246, 251, - 203, 232, 86, 105, 81, 243, 57, 19, 69, 181, 231, 242, 121, 154, 28, 221, 40, 87, 141, 5, 27, 60, 11, 58, 154, 91, - 167, 37, 169, 209, 216, 113, 147, 93, 211, 126, 133, 36, 241, 164, 116, 215, 31, 76, 233, 94, 252, 185, 17, 154, 218, - 8, 79, 102, 132, 191, 27, 143, 203, 198, 227, 209, 141, 31, 161, 233, 103, 100, 152, 51, 251, 169, 153, 135, 51, 114, - 6, 37, 103, 254, 15, 56, 131, 217, 71, 110, 34, 36, 52, 132, 244, 232, 137, 124, 61, 86, 83, 95, 100, 68, 190, 62, - 129, 236, 19, 155, 126, 197, 103, 18, 4, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 181, 144, 161, 10, 2, 65, 20, 69, 223, 123, 243, 35, 70, 109, 138, 95, 32, 139, 96, + 18, 163, 8, 6, 193, 109, 11, 202, 172, 197, 56, 127, 240, 222, 27, 193, 186, 193, 228, 7, 136, 182, 13, 254, 200, 54, + 163, 197, 238, 40, 6, 147, 227, 134, 189, 237, 194, 229, 114, 56, 70, 253, 190, 48, 222, 29, 146, 69, 150, 237, 80, 1, + 133, 202, 239, 102, 74, 119, 28, 228, 121, 106, 55, 179, 212, 174, 60, 171, 94, 91, 240, 59, 72, 97, 211, 93, 142, + 109, 213, 43, 58, 231, 201, 240, 228, 220, 116, 222, 238, 223, 70, 219, 203, 90, 146, 234, 225, 239, 97, 100, 162, 55, + 32, 32, 200, 28, 240, 180, 62, 2, 252, 129, 64, 209, 27, 250, 152, 32, 165, 151, 137, 224, 131, 197, 4, 34, 148, 102, + 136, 48, 46, 229, 205, 0, 204, 79, 117, 204, 11, 148, 185, 1, 0, 0, ]); export const initialWitnessMap: WitnessMap = new Map([ @@ -60,8 +53,7 @@ export const expectedWitnessStack: WitnessStack = [ ]; export const expectedCompressedWitnessStack = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 229, 143, 177, 9, 192, 32, 16, 69, 207, 75, 19, 50, 69, 86, 11, 137, 133, 4, 108, - 78, 72, 90, 197, 21, 28, 65, 92, 196, 193, 108, 180, 245, 44, 5, 127, 253, 120, 188, 143, 54, 146, 185, 238, 55, 184, - 168, 244, 35, 127, 76, 159, 50, 90, 18, 57, 200, 39, 244, 119, 8, 30, 169, 90, 209, 180, 158, 215, 238, 3, 90, 228, - 145, 109, 56, 110, 197, 207, 48, 101, 92, 1, 173, 227, 137, 55, 142, 2, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 221, 143, 193, 13, 0, 32, 8, 3, 11, 124, 140, 83, 56, 171, 113, 1, 73, 220, 200, + 193, 220, 192, 242, 36, 244, 125, 185, 92, 109, 31, 215, 137, 59, 240, 95, 23, 142, 184, 44, 46, 106, 1, 145, 114, + 196, 2, 57, 85, 127, 33, 85, 206, 3, 228, 187, 103, 149, 66, 2, 0, 0, ]); diff --git a/acvm-repo/acvm_js/test/shared/witness_compression.ts b/acvm-repo/acvm_js/test/shared/witness_compression.ts index ba12688d2de..732cc3fe45f 100644 --- a/acvm-repo/acvm_js/test/shared/witness_compression.ts +++ b/acvm-repo/acvm_js/test/shared/witness_compression.ts @@ -9,10 +9,9 @@ // after recompiling Noir to print the witness byte array to be written to file after execution export const expectedCompressedWitnessMap = Uint8Array.from([ - 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 133, 204, 193, 13, 0, 17, 16, 70, 225, 49, 118, 251, 216, 214, 54, 56, 136, 196, - 101, 36, 92, 57, 184, 43, 66, 52, 162, 48, 29, 248, 223, 249, 203, 227, 58, 37, 253, 38, 140, 54, 125, 180, 174, 208, - 202, 62, 69, 39, 210, 105, 127, 116, 79, 41, 72, 152, 241, 69, 99, 242, 64, 66, 47, 36, 250, 0, 73, 112, 132, 122, - 236, 0, 0, 0, + 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 133, 204, 65, 17, 0, 32, 12, 196, 192, 107, 15, 124, 160, 150, 127, 209, 132, 176, + 58, 104, 242, 222, 137, 171, 158, 174, 254, 209, 92, 4, 146, 76, 190, 152, 201, 66, 162, 141, 196, 13, 57, 211, 99, + 86, 216, 0, 0, 0, ]); export const expectedWitnessMap = new Map([ From 1cb59fe043e1fe53b2f4931e69e3521ea3f24d47 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:25:24 +0000 Subject: [PATCH 29/30] Apply suggestion from @TomAFrench --- test_programs/gates_report.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index f8aded8b941..3a6c41c1b4e 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -7,8 +7,6 @@ BACKEND=${BACKEND:-bb} excluded_dirs=( "workspace" "workspace_default_member" - "verify_honk_proof" - "verify_rollup_honk_proof" # UltraCircuitBuilder (standalone Noir application) does not support CallData/ReturnData block constraints. Use MegaCircuitBuilder (Aztec app) or fall back to RAM and ROM operations. "databus" "databus_composite_calldata" From 48d0422896637707d18d30dbb4cc8e514ed5d997 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:25:32 +0000 Subject: [PATCH 30/30] Apply suggestion from @TomAFrench --- test_programs/gates_report.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test_programs/gates_report.sh b/test_programs/gates_report.sh index 3a6c41c1b4e..689592583a4 100755 --- a/test_programs/gates_report.sh +++ b/test_programs/gates_report.sh @@ -12,7 +12,6 @@ excluded_dirs=( "databus_composite_calldata" "databus_two_calldata" "databus_two_calldata_simple" - "double_verify_honk_proof" # For circuits which use #[fold]: circuit_buf_to_acir_format: expected single function in ACIR program "fold_2_to_17" "fold_after_inlined_calls"