Skip to content

Commit d6f0d09

Browse files
committed
Remove unused BeefyAuthorityId
The BEEFY keystore doesn't support simple BLS keys
1 parent 91a9b31 commit d6f0d09

File tree

1 file changed

+1
-35
lines changed
  • substrate/primitives/consensus/beefy/src

1 file changed

+1
-35
lines changed

substrate/primitives/consensus/beefy/src/lib.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ pub mod ecdsa_crypto {
142142
143143
#[cfg(feature = "bls-experimental")]
144144
pub mod bls_crypto {
145-
use super::{AuthorityIdBound, BeefyAuthorityId, Hash, RuntimeAppPublic, KEY_TYPE};
145+
use super::KEY_TYPE;
146146
use sp_application_crypto::{app_crypto, bls381};
147-
use sp_core::{bls381::Pair as BlsPair, crypto::Wraps, Pair as _};
148147

149148
app_crypto!(bls381, KEY_TYPE);
150149

@@ -153,23 +152,6 @@ pub mod bls_crypto {
153152

154153
/// Signature for a BEEFY authority using BLS as its crypto.
155154
pub type AuthoritySignature = Signature;
156-
157-
impl<MsgHash: Hash> BeefyAuthorityId<MsgHash> for AuthorityId
158-
where
159-
<MsgHash as Hash>::Output: Into<[u8; 32]>,
160-
{
161-
fn verify(&self, signature: &<Self as RuntimeAppPublic>::Signature, msg: &[u8]) -> bool {
162-
// `w3f-bls` library uses IETF hashing standard and as such does not expose
163-
// a choice of hash-to-field function.
164-
// We are directly calling into the library to avoid introducing new host call.
165-
// and because BeefyAuthorityId::verify is being called in the runtime so we don't have
166-
167-
BlsPair::verify(signature.as_inner_ref(), msg, self.as_inner_ref())
168-
}
169-
}
170-
impl AuthorityIdBound for AuthorityId {
171-
type BoundedSignature = Signature;
172-
}
173155
}
174156

175157
/// BEEFY cryptographic types for (ECDSA,BLS) crypto pair
@@ -611,22 +593,6 @@ mod tests {
611593
));
612594
}
613595

614-
#[test]
615-
#[cfg(feature = "bls-experimental")]
616-
fn bls_beefy_verify_works() {
617-
let msg = &b"test-message"[..];
618-
let (pair, _) = bls_crypto::Pair::generate();
619-
620-
let signature: bls_crypto::Signature = pair.as_inner_ref().sign(&msg).into();
621-
622-
// Verification works if same hashing function is used when signing and verifying.
623-
assert!(BeefyAuthorityId::<Keccak256>::verify(&pair.public(), &signature, msg));
624-
625-
// Other public key doesn't work
626-
let (other_pair, _) = bls_crypto::Pair::generate();
627-
assert!(!BeefyAuthorityId::<Keccak256>::verify(&other_pair.public(), &signature, msg,));
628-
}
629-
630596
#[test]
631597
#[cfg(feature = "bls-experimental")]
632598
fn ecdsa_bls_beefy_verify_works() {

0 commit comments

Comments
 (0)