Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Remove optional scale-info feature (#292)
Browse files Browse the repository at this point in the history
* Make scale-info dependency non-optional

* Remove feature gated TypeInfo derives

* Import TypeInfo

* Update substrate

* Fix up runtime
  • Loading branch information
ascjones authored Sep 15, 2021
1 parent a54f151 commit b2a2f7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion primitives/beefy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"], optional = true }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }

sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
Expand All @@ -24,6 +24,7 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"sp-api/std",
"sp-application-crypto/std",
"sp-core/std",
Expand Down
10 changes: 4 additions & 6 deletions primitives/beefy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub mod witness;
pub use commitment::{Commitment, SignedCommitment, VersionedCommitment};

use codec::{Codec, Decode, Encode};
use scale_info::TypeInfo;
use sp_core::H256;
use sp_std::prelude::*;

Expand Down Expand Up @@ -78,8 +79,7 @@ pub const GENESIS_AUTHORITY_SET_ID: u64 = 0;
pub type ValidatorSetId = u64;

/// A set of BEEFY authorities, a.k.a. validators.
#[derive(Decode, Encode, Debug, PartialEq, Clone)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
#[derive(Decode, Encode, Debug, PartialEq, Clone, TypeInfo)]
pub struct ValidatorSet<AuthorityId> {
/// Public keys of the validator set elements
pub validators: Vec<AuthorityId>,
Expand All @@ -104,8 +104,7 @@ pub type AuthorityIndex = u32;
pub type MmrRootHash = H256;

/// A consensus log item for BEEFY.
#[derive(Decode, Encode)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
#[derive(Decode, Encode, TypeInfo)]
pub enum ConsensusLog<AuthorityId: Codec> {
/// The authorities have changed.
#[codec(index = 1)]
Expand All @@ -122,8 +121,7 @@ pub enum ConsensusLog<AuthorityId: Codec> {
///
/// A vote message is a direct vote created by a BEEFY node on every voting round
/// and is gossiped to its peers.
#[derive(Debug, Decode, Encode)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
#[derive(Debug, Decode, Encode, TypeInfo)]
pub struct VoteMessage<Hash, Number, Id, Signature> {
/// Commit to information extracted from a finalized block
pub commitment: Commitment<Number, Hash>,
Expand Down
4 changes: 2 additions & 2 deletions primitives/beefy/src/mmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//! or are completely standalone, but heavily inspired by Polkadot.

use codec::{Decode, Encode};
use scale_info::TypeInfo;

/// A standard leaf that gets added every block to the MMR constructed by Substrate's `pallet_mmr`.
#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)]
Expand Down Expand Up @@ -79,8 +80,7 @@ impl MmrLeafVersion {
}

/// Details of the next BEEFY authority set.
#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
#[derive(Debug, Default, PartialEq, Eq, Clone, Encode, Decode, TypeInfo)]
pub struct BeefyNextAuthoritySet<MerkleRoot> {
/// Id of the next set.
///
Expand Down

0 comments on commit b2a2f7f

Please sign in to comment.