Skip to content

Commit

Permalink
update Substrate/Polkadot/Cumulus deps to master (paritytech#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored Jan 17, 2023
1 parent 2328b8c commit 79db685
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
1 change: 0 additions & 1 deletion modules/beefy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ impl ChainWithBeefy for TestBridgedChain {
type MmrHash = <Keccak256 as Hash>::Output;
type BeefyMmrLeafExtra = ();
type AuthorityId = BeefyId;
type Signature = sp_beefy::crypto::AuthoritySignature;
type AuthorityIdToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
}

Expand Down
8 changes: 4 additions & 4 deletions modules/beefy/src/utils.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -72,7 +72,7 @@ fn verify_signatures<T: Config<I>, I: 'static>(
authority_set.validators().iter().zip(commitment.signatures.iter()).enumerate()
{
if let Some(sig) = maybe_sig {
if BeefyVerify::<BridgedBeefyCommitmentHasher<T, I>>::verify(sig, &msg, authority) {
if authority.verify(sig, &msg) {
missing_signatures = missing_signatures.saturating_sub(1);
if missing_signatures == 0 {
break
Expand Down
19 changes: 8 additions & 11 deletions primitives/beefy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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::*;

Expand Down Expand Up @@ -72,20 +72,16 @@ pub trait ChainWithBeefy: Chain {
+ Copy
+ AsRef<[u8]>
+ Default
+ MaybeSerializeDeserialize;
+ MaybeSerializeDeserialize
+ PartialOrd;

/// The type expected for the MMR leaf extra data.
type BeefyMmrLeafExtra: Parameter;

/// 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<Self::CommitmentHasher, Signer = Self::AuthorityId> + Parameter;
type AuthorityId: BeefyAuthorityId<Self::CommitmentHasher> + Parameter;

/// A way to convert validator id to its raw representation in the BEEFY merkle tree.
///
Expand All @@ -101,7 +97,8 @@ pub type BeefyAuthoritySetOf<C> = ValidatorSet<BeefyAuthorityIdOf<C>>;
/// BEEFY authority set, containing both validator identifiers and the numeric set id.
pub type BeefyAuthoritySetInfoOf<C> = sp_beefy::mmr::BeefyAuthoritySet<MmrHashOf<C>>;
/// BEEFY validator signature used by given Substrate chain.
pub type BeefyValidatorSignatureOf<C> = <C as ChainWithBeefy>::Signature;
pub type BeefyValidatorSignatureOf<C> =
<<C as ChainWithBeefy>::AuthorityId as RuntimeAppPublic>::Signature;
/// Signed BEEFY commitment used by given Substrate chain.
pub type BeefySignedCommitmentOf<C> =
SignedCommitment<BlockNumberOf<C>, BeefyValidatorSignatureOf<C>>;
Expand Down
1 change: 0 additions & 1 deletion primitives/chain-millau/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ impl ChainWithBeefy for Millau {
type MmrHash = <Keccak256 as sp_runtime::traits::Hash>::Output;
type BeefyMmrLeafExtra = ();
type AuthorityId = bp_beefy::EcdsaValidatorId;
type Signature = bp_beefy::EcdsaValidatorSignature;
type AuthorityIdToMerkleLeaf = bp_beefy::BeefyEcdsaToEthereum;
}

Expand Down

0 comments on commit 79db685

Please sign in to comment.