Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate BEEFY BLS crypto to bls12-381 curve #4931

Merged
merged 15 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add 'sp-std' application crypto after merge.
Remove redundant variable in bls test.
  • Loading branch information
drskalman committed Jul 23, 2024
commit b234464e1203ab0d5f4f99de8034d76e4eb8f750
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions substrate/primitives/application-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]


[dependencies]
sp-std = { workspace = true }
sp-core = { workspace = true }
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
Expand Down
7 changes: 3 additions & 4 deletions substrate/primitives/core/src/bls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::crypto::{
SignatureBytes, UncheckedFrom,
};

use alloc::vec::Vec;
use sp_std::vec::Vec;

use w3f_bls::{
DoublePublicKey, DoublePublicKeyScheme, DoubleSignature, EngineBLS, Keypair, Message,
Expand Down Expand Up @@ -308,11 +308,10 @@ mod tests {
Public::unchecked_from(array_bytes::hex2array_unchecked(hex_expected_pub_key))
);
let message = b"";
let signature = array_bytes::hex2array_unchecked(hex_expected_signature);
let expected_signature_bytes = array_bytes::hex2array_unchecked(hex_expected_signature);

let expected_signature = Signature::unchecked_from(signature);
let expected_signature = Signature::unchecked_from(expected_signature_bytes);
let signature = pair.sign(&message[..]);
let signature_bytes: &[u8] = signature.as_ref();
assert!(signature == expected_signature);
assert!(Pair::verify(&signature, &message[..], &public));
}
Expand Down