Skip to content

Commit

Permalink
Merge branch 'main' into precompute_g1_points
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Apr 19, 2024
2 parents 22c8e42 + cac8af1 commit c5f9ed5
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions tests/tests/ecpairing_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,12 @@ async fn ecpairing_fuzz_positive() {
];
for input in inputs {
let input_bytes = Some(Bytes::from(hex::decode(input).unwrap()));
let eth_response = eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone()).await.unwrap();
let era_response = era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes).await.unwrap();
let eth_response = eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone())
.await
.unwrap();
let era_response = era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes)
.await
.unwrap();
let (era_output, gas_used) = parse_call_result(&era_response);
write_ecpairing_gas_result(gas_used);
assert_eq!(era_output.len(), 32);
Expand All @@ -385,8 +389,12 @@ async fn ecpairing_fuzz_negative() {
];
for input in inputs {
let input_bytes = Some(Bytes::from(hex::decode(input).unwrap()));
let eth_response = eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone()).await.unwrap();
let era_response = era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes).await.unwrap();
let eth_response = eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone())
.await
.unwrap();
let era_response = era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes)
.await
.unwrap();
let (era_output, gas_used) = parse_call_result(&era_response);
write_ecpairing_gas_result(gas_used);
assert_eq!(era_output.len(), 32);
Expand Down Expand Up @@ -414,8 +422,14 @@ async fn ecpairing_fuzz_invalid_g1_point() {
];
for input in inputs {
let input_bytes = Some(Bytes::from(hex::decode(input).unwrap()));
assert!(eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone()).await.is_err());
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes).await.is_err());
assert!(
eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone())
.await
.is_err()
);
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes)
.await
.is_err());
}
}

Expand All @@ -439,8 +453,14 @@ async fn ecpairing_fuzz_invalid_g2_point() {
];
for input in inputs {
let input_bytes = Some(Bytes::from(hex::decode(input).unwrap()));
assert!(eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone()).await.is_err());
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes).await.is_err());
assert!(
eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone())
.await
.is_err()
);
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes)
.await
.is_err());
}
}

Expand Down Expand Up @@ -529,7 +549,13 @@ async fn ecpairing_fuzz_invalid_g2_subgroup() {
];
for input in inputs {
let input_bytes = Some(Bytes::from(hex::decode(input).unwrap()));
assert!(eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone()).await.is_err());
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes).await.is_err());
assert!(
eth_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes.clone())
.await
.is_err()
);
assert!(era_call(ECPAIRING_PRECOMPILE_ADDRESS, None, input_bytes)
.await
.is_err());
}
}

0 comments on commit c5f9ed5

Please sign in to comment.