Skip to content

Commit

Permalink
remove keccak256 test additions and add size regression from issue #4535
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Aug 19, 2024
1 parent 0ebc06e commit 85f4017
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "brillig_loop_size_regression"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
struct EnumEmulation {
a: Option<Field>,
b: Option<Field>,
c: Option<Field>,
}

unconstrained fn main() -> pub Field {
let mut emulated_enum = EnumEmulation { a: Option::some(1), b: Option::none(), c: Option::none() };

for _ in 0..1 {
assert_eq(emulated_enum.a.unwrap(), 1);
}

emulated_enum.a = Option::some(2);
emulated_enum.a.unwrap()
}
20 changes: 0 additions & 20 deletions test_programs/execution_success/keccak256/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,5 @@ fn main(x: Field, result: [u8; 32]) {
let hash_c = std::hash::keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size_big);

assert(hash_a != hash_c);

// DO NOT MERGE: The code below is a pure duplication of what comes above.
// This is purely for testing the Brillig opcode report and should not be merged into master.

// We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field
// The padding is taken care of by the program
let digest = std::hash::keccak256([x as u8], 1);
assert(digest == result);

//#1399: variable message size
let message_size = 4;
let hash_a = std::hash::keccak256([1, 2, 3, 4], message_size);
let hash_b = std::hash::keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size);

assert(hash_a == hash_b);

let message_size_big = 8;
let hash_c = std::hash::keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size_big);

assert(hash_a != hash_c);
}
// docs:end:keccak256

0 comments on commit 85f4017

Please sign in to comment.