Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajbouw committed May 2, 2021
1 parent 2cae733 commit 971d330
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
16 changes: 4 additions & 12 deletions src/precompiles/blake2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,30 +225,22 @@ mod tests {

assert!(matches!(
test_blake2f_empty(),
Err(ExitError::Other(Borrowed(
"input length invalid, must be 213 bytes"
)))
Err(ExitError::Other(Borrowed("ERR_BLAKE2F_INVALID_LEN")))
));

assert!(matches!(
test_blake2f_invalid_len_1(),
Err(ExitError::Other(Borrowed(
"input length invalid, must be 213 bytes"
)))
Err(ExitError::Other(Borrowed("ERR_BLAKE2F_INVALID_LEN")))
));

assert!(matches!(
test_blake2f_invalid_len_2(),
Err(ExitError::Other(Borrowed(
"input length invalid, must be 213 bytes"
)))
Err(ExitError::Other(Borrowed("ERR_BLAKE2F_INVALID_LEN")))
));

assert!(matches!(
test_blake2f_invalid_flag(),
Err(ExitError::Other(Borrowed(
"incorrect final block indicator flag",
)))
Err(ExitError::Other(Borrowed("ERR_BLAKE2F_FINAL_FLAG",)))
));

let expected = hex::decode(
Expand Down
12 changes: 4 additions & 8 deletions src/precompiles/bn128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ mod tests {
let res = BN128Add::<Byzantium>::run(&input, 500, &new_context());
assert!(matches!(
res,
Err(ExitError::Other(Borrowed("invalid curve point")))
Err(ExitError::Other(Borrowed("ERR_BN128_INVALID_POINT")))
));
}

Expand Down Expand Up @@ -503,7 +503,7 @@ mod tests {
let res = BN128Mul::<Byzantium>::run(&input, 40_000, &new_context());
assert!(matches!(
res,
Err(ExitError::Other(Borrowed("invalid curve point")))
Err(ExitError::Other(Borrowed("ERR_BN128_INVALID_POINT")))
));
}

Expand Down Expand Up @@ -580,9 +580,7 @@ mod tests {
let res = BN128Pair::<Byzantium>::run(&input, 260_000, &new_context());
assert!(matches!(
res,
Err(ExitError::Other(Borrowed(
"invalid `a` argument, not on curve"
)))
Err(ExitError::Other(Borrowed("ERR_BN128_INVALID_A")))
));

// invalid input length
Expand All @@ -598,9 +596,7 @@ mod tests {
let res = BN128Pair::<Byzantium>::run(&input, 260_000, &new_context());
assert!(matches!(
res,
Err(ExitError::Other(Borrowed(
"input length invalid, must be multiple of 192",
)))
Err(ExitError::Other(Borrowed("ERR_BN128_INVALID_LEN",)))
));
}
}
3 changes: 1 addition & 2 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ pub use core::{convert::TryInto, marker::PhantomData, mem};
#[cfg(feature = "std")]
pub use std::{
borrow::Cow::Borrowed, borrow::ToOwned, boxed::Box, collections::HashMap, convert::TryInto,
error::Error, fmt, marker::PhantomData, mem, string::String, string::ToString, vec,
vec::Vec,
error::Error, fmt, marker::PhantomData, mem, string::String, string::ToString, vec, vec::Vec,
};

pub use primitive_types::{H160, H256, U256};
Expand Down

0 comments on commit 971d330

Please sign in to comment.