diff --git a/Cargo.lock b/Cargo.lock index 520d1334..2913fd6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -587,6 +587,7 @@ version = "0.1.0" dependencies = [ "hex-literal", "parity-scale-codec", + "scale-info", "sp-api", "sp-application-crypto", "sp-core", @@ -4134,6 +4135,7 @@ dependencies = [ "frame-system", "pallet-session", "parity-scale-codec", + "scale-info", "serde", "sp-core", "sp-io", @@ -4159,6 +4161,7 @@ dependencies = [ "pallet-mmr-primitives", "pallet-session", "parity-scale-codec", + "scale-info", "serde", "sp-core", "sp-io", @@ -6361,6 +6364,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "scale-info" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e62ff266e136db561a007c84569985805f84a1d5a08278e52c36aacb6e061b" +dependencies = [ + "bitvec 0.20.4", + "cfg-if 1.0.0", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b648fa291891a4c80187a25532f6a7d96b82c70353e30b868b14632b8fe043d6" +dependencies = [ + "proc-macro-crate 1.0.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "schannel" version = "0.1.19" diff --git a/beefy-gadget/Cargo.toml b/beefy-gadget/Cargo.toml index e4b83eaf..5ba39003 100644 --- a/beefy-gadget/Cargo.toml +++ b/beefy-gadget/Cargo.toml @@ -15,7 +15,7 @@ thiserror = "1.0" wasm-timer = "0.2.5" codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] } -prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master"} +prometheus = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/beefy-mmr-pallet/Cargo.toml b/beefy-mmr-pallet/Cargo.toml index 31673caa..83f0d774 100644 --- a/beefy-mmr-pallet/Cargo.toml +++ b/beefy-mmr-pallet/Cargo.toml @@ -11,6 +11,7 @@ hex = { version = "0.4", optional = true } codec = { version = "2.0.0", package = "parity-scale-codec", default-features = false, features = ["derive"] } libsecp256k1 = { version = "0.6.0", default-features = false } log = { version = "0.4.13", default-features = false } +scale-info = { version = "0.10.0", default-features = false, features = ["derive"] } serde = { version = "1.0.126", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/beefy-pallet/Cargo.toml b/beefy-pallet/Cargo.toml index 936164e9..208cdc6f 100644 --- a/beefy-pallet/Cargo.toml +++ b/beefy-pallet/Cargo.toml @@ -7,6 +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 = "0.10.0", default-features = false, features = ["derive"] } serde = { version = "1.0.126", optional = true } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -28,6 +29,7 @@ sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "ma default = ["std"] std = [ "codec/std", + "scale-info/std", "serde", "beefy-primitives/std", "frame-support/std", diff --git a/beefy-primitives/Cargo.toml b/beefy-primitives/Cargo.toml index e76d34a5..d5351f9b 100644 --- a/beefy-primitives/Cargo.toml +++ b/beefy-primitives/Cargo.toml @@ -7,6 +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 = "0.10.0", default-features = false, features = ["derive"], optional = true } 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" } diff --git a/beefy-primitives/src/lib.rs b/beefy-primitives/src/lib.rs index 16432fd4..bcecdca9 100644 --- a/beefy-primitives/src/lib.rs +++ b/beefy-primitives/src/lib.rs @@ -79,6 +79,7 @@ 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))] pub struct ValidatorSet { /// Public keys of the validator set elements pub validators: Vec, @@ -104,6 +105,7 @@ pub type MmrRootHash = H256; /// A consensus log item for BEEFY. #[derive(Decode, Encode)] +#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))] pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] @@ -121,6 +123,7 @@ pub enum ConsensusLog { /// 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))] pub struct VoteMessage { /// Commit to information extracted from a finalized block pub commitment: Commitment, diff --git a/beefy-primitives/src/mmr.rs b/beefy-primitives/src/mmr.rs index e3e1b6a7..5c863d84 100644 --- a/beefy-primitives/src/mmr.rs +++ b/beefy-primitives/src/mmr.rs @@ -80,6 +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))] pub struct BeefyNextAuthoritySet { /// Id of the next set. ///