Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardoalt committed Nov 19, 2024
1 parent 6b5906e commit 7f57646
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 36 deletions.
9 changes: 8 additions & 1 deletion pipeline/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,14 @@ pub fn gen_halo2_proof(pipeline: Pipeline<Bn254Field>, backend: BackendVariant)
// Setup
let output_dir = pipeline.output_dir().clone().unwrap();
let setup_file_path = output_dir.join("params.bin");
let max_degree = pil.degrees().into_iter().max().unwrap();
let max_degree = pil
.degree_ranges()
.into_iter()
.map(|range| range.max)
.collect::<Vec<_>>()
.into_iter()
.max()
.unwrap();
buffered_write_file(&setup_file_path, |writer| {
powdr_backend::BackendType::Halo2
.factory::<Bn254Field>()
Expand Down
1 change: 1 addition & 0 deletions test_data/asm/permutations/binary4.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ machine Binary4 with

// check that we can reference the call_selectors
let sum_sel = std::array::sum(sel);
std::utils::force_bool(sum_sel);

col fixed FACTOR(i) { 1 << (((i + 1) % 8) * 4) };

Expand Down
7 changes: 0 additions & 7 deletions test_data/asm/permutations/block_to_block.asm
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ machine Main with degree: 256 {
Binary4 bin;
Binary4x bin4;

// two permutations to machine bin
instr or X, Y -> Z link ~> Z = bin.or(X, Y);
instr or_into_B X, Y link ~> B' = bin.or(X, Y);

// permutation to machine bin4
instr or4 X, Y, Z, W -> R link ~> R = bin4.or4(X, Y, Z, W);
Expand All @@ -58,11 +56,6 @@ machine Main with degree: 256 {
A <== or(1,2);
assert_eq A, 3;

or_into_B 2,3;
assert_eq B, 3;
or_into_B 1,2;
assert_eq B, 3;

A <== or4(1,2,4,8);
assert_eq A, 15;
A <== or4(15,16,32,64);
Expand Down
7 changes: 0 additions & 7 deletions test_data/asm/permutations/vm_to_block.asm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ machine Main with degree: 128 {

Binary4 bin;

// two permutations to machine bin
instr or X, Y -> Z link ~> Z = bin.or(X, Y);
instr or_into_B X, Y link ~> B' = bin.or(X, Y);

instr assert_eq X, Y { X = Y }

Expand All @@ -25,11 +23,6 @@ machine Main with degree: 128 {
A <== or(3,4);
assert_eq A, 7;

or_into_B 2,3;
assert_eq B, 3;
or_into_B 1,2;
assert_eq B, 3;

return;
}
}
21 changes: 0 additions & 21 deletions test_data/asm/permutations/vm_to_block_multiple_links.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,11 @@ machine Main with degree: 32 {
instr sub X, Y -> Z link ~> Z = arith.sub(X, Y);
instr assert_eq X, Y { X = Y }

// instructions activating multiple permutations
instr add_one X -> Y
link ~> B = arith.add(X, 2)
link ~> Y = arith.sub(B, 1)
{
}

// multiple links with flags
instr add_or_sub X, Y -> Z
link if ADD ~> Z = arith.add(X, Y)
link if (1 - ADD) ~> Z = arith.sub(X, Y);

function main {
A <== add(1, 1);
A <== add(A, 1);
A <== sub(A, 1);
assert_eq A, 2;
A <== add_one(A);
assert_eq A, 3;

ADD <=X= 1;
A <== add_or_sub(2,5);
assert_eq A, 7;
ADD <=X= 0;
A <== add_or_sub(A,5);
assert_eq A, 2;

return;
}
Expand Down

0 comments on commit 7f57646

Please sign in to comment.