Skip to content

Commit

Permalink
chore: turn all assert!(false, ... into panic!(...
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zk committed Nov 28, 2024
1 parent d7a5472 commit e9b6177
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion fhevm-engine/coprocessor/src/tests/scheduling_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async fn schedule_multi_erc20() -> Result<(), Box<dyn std::error::Error>> {
"10" if i % 4 == 1 => (), // select trxa
"90" if i % 4 == 2 => (), // bals - trxa
"30" if i % 4 == 3 => (), // bald + trxa
s => assert!(false, "unexpected result: {} for output {i}", s),
s => panic!("unexpected result: {} for output {i}", s),
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion fhevm-engine/executor/tests/scheduling_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ async fn schedule_multi_erc20() {
}
}
}
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}
12 changes: 6 additions & 6 deletions fhevm-engine/executor/tests/scheduling_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ async fn schedule_dependent_computations() {
),
}
}
_ => assert!(false, "unexpected handle 0x{:x}", ct.handle[0]),
_ => panic!("unexpected handle 0x{:x}", ct.handle[0]),
}
}
}
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

Expand Down Expand Up @@ -539,11 +539,11 @@ async fn schedule_y_patterns() {
),
}
}
_ => assert!(false, "unexpected handle 0x{:x}", ct.handle[0]),
_ => panic!("unexpected handle 0x{:x}", ct.handle[0]),
}
}
}
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

Expand Down Expand Up @@ -831,10 +831,10 @@ async fn schedule_diamond_reduction_dependence_pattern() {
),
}
}
_ => assert!(false, "unexpected handle 0x{:x}", ct.handle[0]),
_ => panic!("unexpected handle 0x{:x}", ct.handle[0]),
}
}
}
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}
34 changes: 17 additions & 17 deletions fhevm-engine/executor/tests/sync_compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ async fn get_input_ciphertext() {
Resp::ResultCiphertexts(cts) => match (cts.ciphertexts.first(), cts.ciphertexts.len()) {
(Some(ct), 1) => {
if ct.handle != input_handle || ct.serialization.is_empty() {
assert!(false, "response handle or ciphertext are unexpected");
panic!("response handle or ciphertext are unexpected");
}
}
_ => assert!(false, "no response"),
_ => panic!("no response"),
},
Resp::Error(e) => assert!(false, "error: {}", e),
Resp::Error(e) => panic!("error: {}", e),
}
}

Expand Down Expand Up @@ -111,20 +111,20 @@ async fn compute_on_two_serialized_ciphertexts() {
Resp::ResultCiphertexts(cts) => match (cts.ciphertexts.first(), cts.ciphertexts.len()) {
(Some(ct), 1) => {
if ct.handle != vec![0xaa; HANDLE_LEN] {
assert!(false, "response handle is unexpected");
panic!("response handle is unexpected");
}
let ct = SupportedFheCiphertexts::decompress(3, &ct.serialization).unwrap();
match ct
.decrypt(&test.as_ref().keys.client_key.clone().unwrap())
.as_str()
{
"21" => (),
s => assert!(false, "unexpected result: {}", s),
s => panic!("unexpected result: {}", s),
}
}
_ => assert!(false, "unexpected amount of result ciphertexts returned"),
_ => panic!("unexpected amount of result ciphertexts returned"),
},
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

Expand Down Expand Up @@ -178,20 +178,20 @@ async fn compute_on_compact_and_serialized_ciphertexts() {
Resp::ResultCiphertexts(cts) => match (cts.ciphertexts.first(), cts.ciphertexts.len()) {
(Some(ct), 1) => {
if ct.handle != vec![0xaa; HANDLE_LEN] {
assert!(false, "response handle is unexpected");
panic!("response handle is unexpected");
}
let ct = SupportedFheCiphertexts::decompress(3, &ct.serialization).unwrap();
match ct
.decrypt(&test.as_ref().keys.client_key.clone().unwrap())
.as_str()
{
"21" => (),
s => assert!(false, "unexpected result: {}", s),
s => panic!("unexpected result: {}", s),
}
}
_ => assert!(false, "unexpected amount of result ciphertexts returned"),
_ => panic!("unexpected amount of result ciphertexts returned"),
},
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

Expand Down Expand Up @@ -256,20 +256,20 @@ async fn compute_on_result_ciphertext() {
Resp::ResultCiphertexts(cts) => match (cts.ciphertexts.get(1), cts.ciphertexts.len()) {
(Some(ct), 2) => {
if ct.handle != vec![0xbb; HANDLE_LEN] {
assert!(false, "response handle is unexpected");
panic!("response handle is unexpected");
}
let ct = SupportedFheCiphertexts::decompress(3, &ct.serialization).unwrap();
match ct
.decrypt(&test.as_ref().keys.client_key.clone().unwrap())
.as_str()
{
"32" => (),
s => assert!(false, "unexpected result: {}", s),
s => panic!("unexpected result: {}", s),
}
}
_ => assert!(false, "unexpected amount of result ciphertexts returned"),
_ => panic!("unexpected amount of result ciphertexts returned"),
},
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

Expand Down Expand Up @@ -314,11 +314,11 @@ async fn trivial_encryption_scalar_less_than_32_bytes() {
.as_str()
{
"10" => (),
s => assert!(false, "unexpected result: {}", s),
s => panic!("unexpected result: {}", s),
}
}
_ => panic!("unexpected amount of result ciphertexts returned: {}", cts.ciphertexts.len()),
},
Resp::Error(e) => assert!(false, "error response: {}", e),
Resp::Error(e) => panic!("error response: {}", e),
}
}

0 comments on commit e9b6177

Please sign in to comment.