diff --git a/bridges/modules/beefy/src/mock.rs b/bridges/modules/beefy/src/mock.rs index 1a028f1593..212c6c5d43 100644 --- a/bridges/modules/beefy/src/mock.rs +++ b/bridges/modules/beefy/src/mock.rs @@ -138,7 +138,6 @@ impl ChainWithBeefy for TestBridgedChain { type MmrHash = ::Output; type BeefyMmrLeafExtra = (); type AuthorityId = BeefyId; - type Signature = sp_beefy::crypto::AuthoritySignature; type AuthorityIdToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum; } diff --git a/bridges/modules/beefy/src/utils.rs b/bridges/modules/beefy/src/utils.rs index 11d601ae88..028e61e96b 100644 --- a/bridges/modules/beefy/src/utils.rs +++ b/bridges/modules/beefy/src/utils.rs @@ -1,9 +1,9 @@ use crate::{ BridgedBeefyAuthorityId, BridgedBeefyAuthoritySet, BridgedBeefyAuthoritySetInfo, - BridgedBeefyCommitmentHasher, BridgedBeefyMmrLeaf, BridgedBeefySignedCommitment, BridgedChain, - BridgedMmrHash, BridgedMmrHashing, BridgedMmrProof, Config, Error, LOG_TARGET, + BridgedBeefyMmrLeaf, BridgedBeefySignedCommitment, BridgedChain, BridgedMmrHash, + BridgedMmrHashing, BridgedMmrProof, Config, Error, LOG_TARGET, }; -use bp_beefy::{merkle_root, verify_mmr_leaves_proof, BeefyVerify, MmrDataOrHash}; +use bp_beefy::{merkle_root, verify_mmr_leaves_proof, BeefyAuthorityId, MmrDataOrHash}; use codec::Encode; use frame_support::ensure; use sp_runtime::traits::{Convert, Hash}; @@ -72,7 +72,7 @@ fn verify_signatures, I: 'static>( authority_set.validators().iter().zip(commitment.signatures.iter()).enumerate() { if let Some(sig) = maybe_sig { - if BeefyVerify::>::verify(sig, &msg, authority) { + if authority.verify(sig, &msg) { missing_signatures = missing_signatures.saturating_sub(1); if missing_signatures == 0 { break diff --git a/bridges/primitives/beefy/src/lib.rs b/bridges/primitives/beefy/src/lib.rs index f16c108200..8b2b05d551 100644 --- a/bridges/primitives/beefy/src/lib.rs +++ b/bridges/primitives/beefy/src/lib.rs @@ -29,8 +29,8 @@ pub use sp_beefy::{ crypto::{AuthorityId as EcdsaValidatorId, AuthoritySignature as EcdsaValidatorSignature}, known_payloads::MMR_ROOT_ID as MMR_ROOT_PAYLOAD_ID, mmr::{BeefyAuthoritySet, MmrLeafVersion}, - BeefyAuthorityId, BeefyVerify, Commitment, Payload as BeefyPayload, SignedCommitment, - ValidatorSet, ValidatorSetId, BEEFY_ENGINE_ID, + BeefyAuthorityId, Commitment, Payload as BeefyPayload, SignedCommitment, ValidatorSet, + ValidatorSetId, BEEFY_ENGINE_ID, }; use bp_runtime::{BasicOperatingMode, BlockNumberOf, Chain, HashOf}; @@ -39,7 +39,7 @@ use frame_support::Parameter; use scale_info::TypeInfo; use sp_runtime::{ traits::{Convert, MaybeSerializeDeserialize}, - RuntimeDebug, + RuntimeAppPublic, RuntimeDebug, }; use sp_std::prelude::*; @@ -72,7 +72,8 @@ pub trait ChainWithBeefy: Chain { + Copy + AsRef<[u8]> + Default - + MaybeSerializeDeserialize; + + MaybeSerializeDeserialize + + PartialOrd; /// The type expected for the MMR leaf extra data. type BeefyMmrLeafExtra: Parameter; @@ -80,12 +81,7 @@ pub trait ChainWithBeefy: Chain { /// A way to identify a BEEFY validator. /// /// Corresponds to the `BeefyId` field of the `pallet-beefy` configuration. - type AuthorityId: BeefyAuthorityId + Parameter; - - /// The signature type used by BEEFY. - /// - /// Corresponds to the `BeefyId` field of the `pallet-beefy` configuration. - type Signature: BeefyVerify + Parameter; + type AuthorityId: BeefyAuthorityId + Parameter; /// A way to convert validator id to its raw representation in the BEEFY merkle tree. /// @@ -101,7 +97,8 @@ pub type BeefyAuthoritySetOf = ValidatorSet>; /// BEEFY authority set, containing both validator identifiers and the numeric set id. pub type BeefyAuthoritySetInfoOf = sp_beefy::mmr::BeefyAuthoritySet>; /// BEEFY validator signature used by given Substrate chain. -pub type BeefyValidatorSignatureOf = ::Signature; +pub type BeefyValidatorSignatureOf = + <::AuthorityId as RuntimeAppPublic>::Signature; /// Signed BEEFY commitment used by given Substrate chain. pub type BeefySignedCommitmentOf = SignedCommitment, BeefyValidatorSignatureOf>; diff --git a/bridges/primitives/chain-millau/src/lib.rs b/bridges/primitives/chain-millau/src/lib.rs index 5c3b7f18ab..afe8fbca69 100644 --- a/bridges/primitives/chain-millau/src/lib.rs +++ b/bridges/primitives/chain-millau/src/lib.rs @@ -162,7 +162,6 @@ impl ChainWithBeefy for Millau { type MmrHash = ::Output; type BeefyMmrLeafExtra = (); type AuthorityId = bp_beefy::EcdsaValidatorId; - type Signature = bp_beefy::EcdsaValidatorSignature; type AuthorityIdToMerkleLeaf = bp_beefy::BeefyEcdsaToEthereum; }