Skip to content

Commit

Permalink
Revert test change
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Apr 17, 2024
1 parent 29037c3 commit 06b78f9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/crypto/tests/bls12_381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,22 @@ fn bls12_381_hash_to_g2_works() {

let prepared_x = test_data.output.x.replace("0x", "");
let (x1, x2) = prepared_x.split_once(',').unwrap();
let mut decoded_x = hex::decode(format!("{x2}{x1}")).unwrap();
// Set the compression tag
decoded_x[0] |= 0b1000_0000;
let decoded_x = hex::decode(format!("{x2}{x1}")).unwrap();

let prepared_y = test_data.output.y.replace("0x", "");
let (y1, y2) = prepared_y.split_once(',').unwrap();
let decoded_y = hex::decode(format!("{y2}{y1}")).unwrap();
let uncompressed = [decoded_x.as_slice(), &decoded_y].concat();

let affine = ark_bls12_381::G2Affine::deserialize_uncompressed(&uncompressed[..]).unwrap();
let mut compressed_affine = [0; BLS12_381_G2_POINT_LEN];
affine
.serialize_compressed(&mut compressed_affine[..])
.unwrap();

assert_eq!(
g2_point.as_slice(),
decoded_x.as_slice(),
g2_point,
compressed_affine,
"Failed with test vector {}",
path.display()

Check warning on line 219 in packages/crypto/tests/bls12_381.rs

View check run for this annotation

Codecov / codecov/patch

packages/crypto/tests/bls12_381.rs#L218-L219

Added lines #L218 - L219 were not covered by tests
);
Expand Down

0 comments on commit 06b78f9

Please sign in to comment.