Skip to content

Commit f1b9151

Browse files
author
AztecBot
committed
chore: Sync to noir-lang/noir
feat: Allow nested arrays and vectors in Brillig foreign calls (AztecProtocol/aztec-packages#4478) feat: allow brillig to read arrays directly from memory (AztecProtocol/aztec-packages#4460) feat(avm): back in avm context with macro - refactor context (AztecProtocol/aztec-packages#4438) chore!: rename bigint_neg into bigint_sub (AztecProtocol/aztec-packages#4420) chore: add bigint solver in ACVM and add a unit test for bigints in Noir (AztecProtocol/aztec-packages#4415) feat!: Add expression width into acir (AztecProtocol/aztec-packages#4014) feat: Add bit size to const opcode (AztecProtocol/aztec-packages#4385) feat(aztec-nr): initial work for aztec public vm macro (AztecProtocol/aztec-packages#4400) chore: surpress chained macro warning (AztecProtocol/aztec-packages#4396) feat!: init storage macro (AztecProtocol/aztec-packages#4200) chore(acir)!: Move `is_recursive` flag to be part of the circuit definition (AztecProtocol/aztec-packages#4221)
1 parent 9a70040 commit f1b9151

61 files changed

Lines changed: 2332 additions & 855 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

acvm-repo/acir/codegen/acir.cpp

Lines changed: 914 additions & 524 deletions
Large diffs are not rendered by default.

acvm-repo/acir/src/circuit/black_box_functions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub enum BlackBoxFunc {
5050
/// BigInt addition
5151
BigIntAdd,
5252
/// BigInt subtraction
53-
BigIntNeg,
53+
BigIntSub,
5454
/// BigInt multiplication
5555
BigIntMul,
5656
/// BigInt division
@@ -91,7 +91,7 @@ impl BlackBoxFunc {
9191
BlackBoxFunc::RecursiveAggregation => "recursive_aggregation",
9292
BlackBoxFunc::EcdsaSecp256r1 => "ecdsa_secp256r1",
9393
BlackBoxFunc::BigIntAdd => "bigint_add",
94-
BlackBoxFunc::BigIntNeg => "bigint_neg",
94+
BlackBoxFunc::BigIntSub => "bigint_sub",
9595
BlackBoxFunc::BigIntMul => "bigint_mul",
9696
BlackBoxFunc::BigIntDiv => "bigint_div",
9797
BlackBoxFunc::BigIntFromLeBytes => "bigint_from_le_bytes",
@@ -120,7 +120,7 @@ impl BlackBoxFunc {
120120
"keccakf1600" => Some(BlackBoxFunc::Keccakf1600),
121121
"recursive_aggregation" => Some(BlackBoxFunc::RecursiveAggregation),
122122
"bigint_add" => Some(BlackBoxFunc::BigIntAdd),
123-
"bigint_neg" => Some(BlackBoxFunc::BigIntNeg),
123+
"bigint_sub" => Some(BlackBoxFunc::BigIntSub),
124124
"bigint_mul" => Some(BlackBoxFunc::BigIntMul),
125125
"bigint_div" => Some(BlackBoxFunc::BigIntDiv),
126126
"bigint_from_le_bytes" => Some(BlackBoxFunc::BigIntFromLeBytes),

acvm-repo/acir/src/circuit/brillig.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use super::opcodes::BlockId;
12
use crate::native_types::{Expression, Witness};
23
use brillig::Opcode as BrilligOpcode;
34
use serde::{Deserialize, Serialize};
@@ -8,6 +9,7 @@ use serde::{Deserialize, Serialize};
89
pub enum BrilligInputs {
910
Single(Expression),
1011
Array(Vec<Expression>),
12+
MemoryArray(BlockId),
1113
}
1214

1315
/// Outputs for the Brillig VM. Once the VM has completed

acvm-repo/acir/src/circuit/mod.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,30 @@ use serde::{de::Error as DeserializationError, Deserialize, Deserializer, Serial
1515

1616
use std::collections::BTreeSet;
1717

18+
/// Specifies the maximum width of the expressions which will be constrained.
19+
///
20+
/// Unbounded Expressions are useful if you are eventually going to pass the ACIR
21+
/// into a proving system which supports R1CS.
22+
///
23+
/// Bounded Expressions are useful if you are eventually going to pass the ACIR
24+
/// into a proving system which supports PLONK, where arithmetic expressions have a
25+
/// finite fan-in.
26+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
27+
pub enum ExpressionWidth {
28+
#[default]
29+
Unbounded,
30+
Bounded {
31+
width: usize,
32+
},
33+
}
34+
1835
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
1936
pub struct Circuit {
2037
// current_witness_index is the highest witness index in the circuit. The next witness to be added to this circuit
2138
// will take on this value. (The value is cached here as an optimization.)
2239
pub current_witness_index: u32,
2340
pub opcodes: Vec<Opcode>,
41+
pub expression_width: ExpressionWidth,
2442

2543
/// The set of private inputs to the circuit.
2644
pub private_parameters: BTreeSet<Witness>,
@@ -240,7 +258,7 @@ mod tests {
240258
opcodes::{BlackBoxFuncCall, FunctionInput},
241259
Circuit, Compression, Opcode, PublicInputs,
242260
};
243-
use crate::native_types::Witness;
261+
use crate::{circuit::ExpressionWidth, native_types::Witness};
244262
use acir_field::FieldElement;
245263

246264
fn and_opcode() -> Opcode {
@@ -318,6 +336,7 @@ mod tests {
318336
fn serialization_roundtrip() {
319337
let circuit = Circuit {
320338
current_witness_index: 5,
339+
expression_width: ExpressionWidth::Unbounded,
321340
opcodes: vec![and_opcode(), range_opcode()],
322341
private_parameters: BTreeSet::new(),
323342
public_parameters: PublicInputs(BTreeSet::from_iter(vec![Witness(2), Witness(12)])),
@@ -340,6 +359,7 @@ mod tests {
340359
fn test_serialize() {
341360
let circuit = Circuit {
342361
current_witness_index: 0,
362+
expression_width: ExpressionWidth::Unbounded,
343363
opcodes: vec![
344364
Opcode::AssertZero(crate::native_types::Expression {
345365
mul_terms: vec![],

acvm-repo/acir/src/circuit/opcodes/black_box_function_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub enum BlackBoxFuncCall {
120120
rhs: u32,
121121
output: u32,
122122
},
123-
BigIntNeg {
123+
BigIntSub {
124124
lhs: u32,
125125
rhs: u32,
126126
output: u32,
@@ -193,7 +193,7 @@ impl BlackBoxFuncCall {
193193
BlackBoxFuncCall::Keccakf1600 { .. } => BlackBoxFunc::Keccakf1600,
194194
BlackBoxFuncCall::RecursiveAggregation { .. } => BlackBoxFunc::RecursiveAggregation,
195195
BlackBoxFuncCall::BigIntAdd { .. } => BlackBoxFunc::BigIntAdd,
196-
BlackBoxFuncCall::BigIntNeg { .. } => BlackBoxFunc::BigIntNeg,
196+
BlackBoxFuncCall::BigIntSub { .. } => BlackBoxFunc::BigIntSub,
197197
BlackBoxFuncCall::BigIntMul { .. } => BlackBoxFunc::BigIntMul,
198198
BlackBoxFuncCall::BigIntDiv { .. } => BlackBoxFunc::BigIntDiv,
199199
BlackBoxFuncCall::BigIntFromLeBytes { .. } => BlackBoxFunc::BigIntFromLeBytes,
@@ -223,7 +223,7 @@ impl BlackBoxFuncCall {
223223
vec![*lhs, *rhs]
224224
}
225225
BlackBoxFuncCall::BigIntAdd { .. }
226-
| BlackBoxFuncCall::BigIntNeg { .. }
226+
| BlackBoxFuncCall::BigIntSub { .. }
227227
| BlackBoxFuncCall::BigIntMul { .. }
228228
| BlackBoxFuncCall::BigIntDiv { .. }
229229
| BlackBoxFuncCall::BigIntToLeBytes { .. } => Vec::new(),
@@ -328,7 +328,7 @@ impl BlackBoxFuncCall {
328328
| BlackBoxFuncCall::RecursiveAggregation { .. }
329329
| BlackBoxFuncCall::BigIntFromLeBytes { .. }
330330
| BlackBoxFuncCall::BigIntAdd { .. }
331-
| BlackBoxFuncCall::BigIntNeg { .. }
331+
| BlackBoxFuncCall::BigIntSub { .. }
332332
| BlackBoxFuncCall::BigIntMul { .. }
333333
| BlackBoxFuncCall::BigIntDiv { .. } => {
334334
vec![]

acvm-repo/acir/src/circuit/opcodes/memory_operation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::native_types::{Expression, Witness};
22
use serde::{Deserialize, Serialize};
33

4-
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Copy, Default)]
4+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash, Copy, Default)]
55
pub struct BlockId(pub u32);
66

77
/// Operation on a block of memory

acvm-repo/acir/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,18 @@ mod reflection {
3131
path::{Path, PathBuf},
3232
};
3333

34-
use brillig::{BinaryFieldOp, BinaryIntOp, BlackBoxOp, Opcode as BrilligOpcode, ValueOrArray};
34+
use brillig::{
35+
BinaryFieldOp, BinaryIntOp, BlackBoxOp, HeapValueType, Opcode as BrilligOpcode,
36+
ValueOrArray,
37+
};
3538
use serde_reflection::{Tracer, TracerConfig};
3639

3740
use crate::{
3841
circuit::{
3942
brillig::{BrilligInputs, BrilligOutputs},
4043
directives::Directive,
4144
opcodes::BlackBoxFuncCall,
42-
Circuit, Opcode, OpcodeLocation,
45+
Circuit, ExpressionWidth, Opcode, OpcodeLocation,
4346
},
4447
native_types::{Witness, WitnessMap},
4548
};
@@ -57,6 +60,7 @@ mod reflection {
5760

5861
let mut tracer = Tracer::new(TracerConfig::default());
5962
tracer.trace_simple_type::<Circuit>().unwrap();
63+
tracer.trace_simple_type::<ExpressionWidth>().unwrap();
6064
tracer.trace_simple_type::<Opcode>().unwrap();
6165
tracer.trace_simple_type::<OpcodeLocation>().unwrap();
6266
tracer.trace_simple_type::<BinaryFieldOp>().unwrap();
@@ -68,6 +72,7 @@ mod reflection {
6872
tracer.trace_simple_type::<BlackBoxOp>().unwrap();
6973
tracer.trace_simple_type::<Directive>().unwrap();
7074
tracer.trace_simple_type::<ValueOrArray>().unwrap();
75+
tracer.trace_simple_type::<HeapValueType>().unwrap();
7176

7277
let registry = tracer.registry().unwrap();
7378

acvm-repo/acir/tests/test_program_serialization.rs

Lines changed: 59 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use acir::{
2020
native_types::{Expression, Witness},
2121
};
2222
use acir_field::FieldElement;
23-
use brillig::{HeapArray, MemoryAddress, ValueOrArray};
23+
use brillig::{HeapArray, HeapValueType, MemoryAddress, ValueOrArray};
2424

2525
#[test]
2626
fn addition_circuit() {
@@ -45,12 +45,12 @@ fn addition_circuit() {
4545
let bytes = Circuit::serialize_circuit(&circuit);
4646

4747
let expected_serialization: Vec<u8> = vec![
48-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 144, 187, 13, 192, 32, 12, 68, 249, 100, 32, 27,
49-
219, 96, 119, 89, 37, 40, 176, 255, 8, 17, 18, 5, 74, 202, 240, 154, 235, 158, 238, 238,
50-
112, 206, 121, 247, 37, 206, 60, 103, 194, 63, 208, 111, 116, 133, 197, 69, 144, 153, 91,
51-
73, 13, 9, 47, 72, 86, 85, 128, 165, 102, 69, 69, 81, 185, 147, 18, 53, 101, 45, 86, 173,
52-
128, 33, 83, 195, 46, 70, 125, 202, 226, 190, 94, 16, 166, 103, 108, 13, 203, 151, 254,
53-
245, 233, 224, 1, 1, 52, 166, 127, 120, 1, 0, 0,
48+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 208, 49, 14, 192, 32, 8, 5, 80, 212, 30, 8, 4, 20,
49+
182, 94, 165, 166, 122, 255, 35, 52, 77, 28, 76, 58, 214, 191, 124, 166, 23, 242, 15, 0, 8,
50+
240, 77, 154, 125, 206, 198, 127, 161, 176, 209, 138, 139, 197, 88, 68, 122, 205, 157, 152,
51+
46, 204, 222, 76, 81, 180, 21, 35, 35, 53, 189, 179, 49, 119, 19, 171, 222, 188, 162, 147,
52+
112, 167, 161, 206, 99, 98, 105, 223, 95, 248, 26, 113, 90, 97, 185, 97, 217, 56, 173, 35,
53+
63, 243, 81, 87, 163, 125, 1, 0, 0,
5454
];
5555

5656
assert_eq!(bytes, expected_serialization)
@@ -75,9 +75,9 @@ fn fixed_base_scalar_mul_circuit() {
7575
let bytes = Circuit::serialize_circuit(&circuit);
7676

7777
let expected_serialization: Vec<u8> = vec![
78-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 138, 91, 10, 0, 48, 12, 194, 178, 215, 215, 46, 189,
79-
163, 175, 165, 10, 21, 36, 10, 57, 192, 160, 146, 188, 226, 139, 78, 113, 69, 183, 190, 61,
80-
111, 218, 182, 231, 124, 122, 8, 177, 65, 92, 0, 0, 0,
78+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 138, 91, 10, 0, 32, 16, 2, 109, 171, 175, 46, 221,
79+
209, 247, 229, 130, 130, 140, 200, 92, 0, 11, 157, 228, 35, 127, 212, 200, 29, 61, 116, 76,
80+
220, 217, 250, 171, 91, 113, 160, 66, 104, 242, 97, 0, 0, 0,
8181
];
8282

8383
assert_eq!(bytes, expected_serialization)
@@ -102,9 +102,9 @@ fn pedersen_circuit() {
102102
let bytes = Circuit::serialize_circuit(&circuit);
103103

104104
let expected_serialization: Vec<u8> = vec![
105-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 138, 9, 10, 0, 64, 8, 2, 103, 15, 232, 255, 31, 142,
106-
138, 10, 34, 65, 84, 198, 15, 28, 82, 145, 178, 182, 86, 191, 238, 183, 24, 131, 205, 79,
107-
203, 0, 166, 242, 158, 93, 92, 0, 0, 0,
105+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 93, 74, 135, 9, 0, 48, 8, 75, 171, 224, 255, 15, 139,
106+
27, 196, 64, 200, 100, 0, 15, 133, 80, 57, 89, 219, 127, 39, 173, 126, 235, 236, 247, 151,
107+
48, 224, 71, 90, 33, 97, 0, 0, 0,
108108
];
109109

110110
assert_eq!(bytes, expected_serialization)
@@ -143,22 +143,22 @@ fn schnorr_verify_circuit() {
143143
let bytes = Circuit::serialize_circuit(&circuit);
144144

145145
let expected_serialization: Vec<u8> = vec![
146-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 210, 87, 78, 2, 1, 20, 134, 209, 177, 247, 222, 123,
147-
71, 68, 68, 68, 68, 68, 68, 68, 68, 68, 221, 133, 251, 95, 130, 145, 27, 206, 36, 78, 50,
148-
57, 16, 94, 200, 253, 191, 159, 36, 73, 134, 146, 193, 19, 142, 243, 183, 255, 14, 179,
149-
233, 247, 145, 254, 59, 217, 127, 71, 57, 198, 113, 78, 48, 125, 167, 56, 205, 25, 206,
150-
114, 142, 243, 92, 224, 34, 151, 184, 204, 21, 174, 114, 141, 235, 220, 224, 38, 183, 184,
151-
205, 29, 238, 114, 143, 251, 60, 224, 33, 143, 120, 204, 19, 158, 242, 140, 25, 158, 51,
152-
203, 11, 230, 120, 201, 60, 175, 88, 224, 53, 139, 188, 97, 137, 183, 44, 243, 142, 21,
153-
222, 179, 202, 7, 214, 248, 200, 58, 159, 216, 224, 51, 155, 124, 97, 235, 223, 142, 241,
154-
188, 250, 222, 230, 27, 59, 124, 103, 151, 31, 236, 241, 147, 95, 252, 246, 57, 158, 104,
155-
47, 186, 139, 214, 162, 179, 104, 44, 250, 74, 219, 154, 242, 63, 162, 165, 232, 40, 26,
156-
138, 126, 162, 157, 232, 38, 154, 137, 94, 162, 149, 232, 36, 26, 137, 62, 162, 141, 232,
157-
34, 154, 136, 30, 162, 133, 232, 32, 26, 136, 253, 99, 251, 195, 100, 176, 121, 236, 29,
158-
91, 159, 218, 56, 99, 219, 172, 77, 115, 182, 204, 219, 176, 96, 187, 162, 205, 74, 182,
159-
42, 219, 168, 98, 155, 170, 77, 106, 182, 168, 219, 160, 225, 246, 77, 55, 111, 185, 113,
160-
219, 109, 59, 110, 218, 117, 203, 158, 27, 166, 55, 75, 239, 150, 184, 101, 250, 252, 1,
161-
55, 204, 92, 74, 220, 3, 0, 0,
146+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 77, 210, 7, 74, 3, 1, 20, 69, 209, 177, 247, 222, 123,
147+
239, 189, 119, 141, 93, 99, 220, 133, 251, 95, 130, 152, 103, 78, 32, 3, 195, 33, 4, 66,
148+
248, 239, 254, 20, 69, 209, 84, 212, 158, 216, 206, 223, 234, 219, 204, 146, 239, 91, 170,
149+
111, 103, 245, 109, 101, 27, 219, 217, 193, 250, 219, 197, 110, 246, 176, 151, 125, 236,
150+
231, 0, 7, 57, 196, 97, 142, 112, 148, 99, 28, 231, 4, 39, 57, 197, 105, 206, 112, 150,
151+
115, 156, 231, 2, 23, 185, 196, 101, 174, 112, 149, 107, 92, 231, 6, 55, 185, 197, 109,
152+
238, 112, 151, 123, 220, 231, 1, 15, 121, 196, 99, 158, 240, 148, 103, 60, 231, 5, 47, 121,
153+
197, 107, 222, 240, 150, 119, 188, 231, 3, 75, 124, 228, 83, 195, 142, 121, 158, 125, 126,
154+
225, 43, 223, 248, 206, 15, 126, 178, 204, 47, 86, 248, 237, 119, 43, 76, 127, 105, 47,
155+
189, 165, 181, 116, 150, 198, 234, 125, 117, 249, 47, 233, 41, 45, 165, 163, 52, 148, 126,
156+
210, 78, 186, 73, 51, 233, 37, 173, 164, 147, 52, 146, 62, 210, 70, 186, 72, 19, 233, 33,
157+
45, 164, 131, 52, 144, 253, 23, 139, 218, 238, 217, 60, 123, 103, 235, 236, 156, 141, 179,
158+
239, 166, 93, 183, 237, 185, 107, 199, 125, 251, 29, 218, 237, 216, 94, 167, 118, 58, 183,
159+
207, 165, 93, 174, 237, 113, 107, 135, 123, 247, 47, 185, 251, 147, 59, 191, 184, 239, 155,
160+
187, 126, 184, 103, 217, 29, 235, 55, 171, 223, 173, 104, 184, 231, 255, 243, 7, 236, 52,
161+
239, 128, 225, 3, 0, 0,
162162
];
163163

164164
assert_eq!(bytes, expected_serialization)
@@ -186,7 +186,9 @@ fn simple_brillig_foreign_call() {
186186
brillig::Opcode::ForeignCall {
187187
function: "invert".into(),
188188
destinations: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))],
189+
destination_value_types: vec![HeapValueType::Simple],
189190
inputs: vec![ValueOrArray::MemoryAddress(MemoryAddress::from(0))],
191+
input_value_types: vec![HeapValueType::Simple],
190192
},
191193
brillig::Opcode::Stop { return_data_offset: 0, return_data_size: 1 },
192194
],
@@ -204,11 +206,11 @@ fn simple_brillig_foreign_call() {
204206
let bytes = Circuit::serialize_circuit(&circuit);
205207

206208
let expected_serialization: Vec<u8> = vec![
207-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 143, 177, 10, 192, 32, 12, 68, 207, 148, 150, 118,
208-
234, 175, 216, 63, 232, 207, 116, 232, 210, 161, 136, 223, 175, 98, 132, 27, 212, 69, 31,
209-
132, 28, 23, 8, 119, 59, 0, 131, 204, 66, 154, 41, 222, 173, 219, 142, 113, 153, 121, 191,
210-
44, 231, 21, 237, 144, 88, 43, 249, 11, 71, 156, 77, 245, 251, 249, 231, 119, 189, 214,
211-
204, 89, 187, 11, 25, 130, 54, 1, 36, 1, 124, 242, 107, 1, 0, 0,
209+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 173, 143, 65, 10, 192, 32, 12, 4, 215, 148, 150, 246,
210+
212, 175, 216, 31, 244, 51, 61, 244, 226, 65, 196, 247, 171, 24, 33, 136, 122, 209, 129,
211+
144, 176, 132, 101, 247, 4, 160, 144, 217, 196, 45, 41, 218, 203, 91, 207, 241, 168, 117,
212+
94, 90, 230, 37, 238, 144, 216, 27, 249, 11, 87, 156, 131, 239, 223, 248, 207, 186, 81,
213+
235, 150, 67, 173, 221, 189, 95, 18, 34, 97, 64, 0, 116, 135, 40, 214, 136, 1, 0, 0,
212214
];
213215

214216
assert_eq!(bytes, expected_serialization)
@@ -258,6 +260,7 @@ fn complex_brillig_foreign_call() {
258260
brillig::Opcode::Const {
259261
destination: MemoryAddress(0),
260262
value: brillig::Value::from(32_usize),
263+
bit_size: 32,
261264
},
262265
brillig::Opcode::CalldataCopy {
263266
destination_address: MemoryAddress(1),
@@ -271,11 +274,20 @@ fn complex_brillig_foreign_call() {
271274
ValueOrArray::HeapArray(HeapArray { pointer: 0.into(), size: 3 }),
272275
ValueOrArray::MemoryAddress(MemoryAddress::from(1)),
273276
],
277+
input_value_types: vec![
278+
HeapValueType::Array { size: 3, value_types: vec![HeapValueType::Simple] },
279+
HeapValueType::Simple,
280+
],
274281
destinations: vec![
275282
ValueOrArray::HeapArray(HeapArray { pointer: 0.into(), size: 3 }),
276283
ValueOrArray::MemoryAddress(MemoryAddress::from(35)),
277284
ValueOrArray::MemoryAddress(MemoryAddress::from(36)),
278285
],
286+
destination_value_types: vec![
287+
HeapValueType::Array { size: 3, value_types: vec![HeapValueType::Simple] },
288+
HeapValueType::Simple,
289+
HeapValueType::Simple,
290+
],
279291
},
280292
brillig::Opcode::Stop { return_data_offset: 32, return_data_size: 5 },
281293
],
@@ -293,14 +305,15 @@ fn complex_brillig_foreign_call() {
293305
let bytes = Circuit::serialize_circuit(&circuit);
294306

295307
let expected_serialization: Vec<u8> = vec![
296-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 83, 65, 10, 132, 48, 12, 76, 218, 237, 174, 123,
297-
242, 11, 130, 62, 160, 250, 2, 255, 34, 222, 20, 61, 250, 124, 11, 78, 49, 4, 193, 131, 21,
298-
52, 16, 210, 132, 105, 50, 77, 210, 140, 136, 152, 54, 177, 65, 13, 206, 12, 95, 74, 196,
299-
181, 176, 254, 154, 212, 156, 46, 151, 191, 139, 163, 121, 1, 71, 123, 3, 199, 184, 15, 15,
300-
157, 119, 202, 185, 36, 237, 159, 61, 248, 63, 159, 160, 46, 232, 23, 254, 15, 54, 67, 156,
301-
96, 11, 213, 119, 82, 248, 116, 179, 104, 188, 163, 125, 15, 89, 213, 253, 139, 154, 221,
302-
52, 206, 67, 191, 88, 5, 213, 52, 75, 113, 174, 96, 205, 201, 157, 24, 207, 197, 211, 157,
303-
6, 50, 18, 233, 158, 72, 89, 1, 53, 215, 75, 175, 196, 4, 0, 0,
308+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 84, 73, 14, 131, 48, 12, 28, 147, 166, 165, 167,
309+
126, 161, 82, 251, 128, 180, 47, 224, 47, 85, 111, 32, 56, 242, 124, 130, 24, 68, 176, 2,
310+
23, 130, 4, 35, 89, 206, 50, 137, 71, 182, 147, 28, 128, 96, 128, 241, 150, 113, 44, 156,
311+
135, 24, 121, 5, 189, 219, 134, 143, 164, 187, 203, 237, 165, 49, 59, 129, 70, 179, 131,
312+
198, 177, 31, 14, 90, 239, 148, 117, 73, 154, 63, 19, 121, 63, 23, 111, 214, 219, 149, 243,
313+
27, 125, 206, 117, 208, 63, 85, 222, 161, 248, 32, 167, 72, 162, 245, 235, 44, 166, 94, 20,
314+
21, 251, 30, 196, 253, 213, 85, 83, 254, 91, 163, 168, 90, 234, 43, 24, 191, 213, 190, 172,
315+
156, 235, 17, 126, 59, 49, 142, 68, 120, 75, 220, 7, 166, 84, 90, 68, 72, 194, 139, 180,
316+
136, 25, 58, 46, 103, 45, 188, 25, 5, 0, 0,
304317
];
305318

306319
assert_eq!(bytes, expected_serialization)
@@ -332,11 +345,10 @@ fn memory_op_circuit() {
332345
let bytes = Circuit::serialize_circuit(&circuit);
333346

334347
let expected_serialization: Vec<u8> = vec![
335-
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 146, 49, 14, 0, 32, 8, 3, 139, 192, 127, 240, 7,
336-
254, 255, 85, 198, 136, 9, 131, 155, 48, 216, 165, 76, 77, 57, 80, 0, 140, 45, 117, 111,
337-
238, 228, 179, 224, 174, 225, 110, 111, 234, 213, 185, 148, 156, 203, 121, 89, 86, 13, 215,
338-
126, 131, 43, 153, 187, 115, 40, 185, 62, 153, 3, 136, 83, 60, 30, 96, 2, 12, 235, 225,
339-
124, 14, 3, 0, 0,
348+
31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 213, 145, 187, 17, 0, 32, 8, 67, 195, 111, 31, 220, 192,
349+
253, 167, 178, 144, 2, 239, 236, 132, 194, 52, 129, 230, 93, 8, 6, 64, 176, 101, 225, 28,
350+
78, 49, 43, 238, 154, 225, 254, 166, 209, 205, 165, 98, 174, 212, 177, 188, 187, 92, 255,
351+
173, 92, 173, 190, 93, 82, 80, 78, 123, 14, 127, 60, 97, 1, 210, 144, 46, 242, 19, 3, 0, 0,
340352
];
341353

342354
assert_eq!(bytes, expected_serialization)

acvm-repo/acvm/src/compiler/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::collections::HashMap;
22

3-
use acir::circuit::{Circuit, OpcodeLocation};
4-
5-
use crate::ExpressionWidth;
3+
use acir::circuit::{Circuit, ExpressionWidth, OpcodeLocation};
64

75
// The various passes that we can use over ACIR
86
mod optimizers;

0 commit comments

Comments
 (0)