From 444aafdf83730ae252fe7db0763bb40aa6809c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Thu, 27 May 2021 11:41:49 +0100 Subject: [PATCH] primitives: export the current slot number storage key (#3022) --- polkadot/Cargo.lock | 1 + polkadot/primitives/Cargo.toml | 2 ++ polkadot/primitives/src/v1/mod.rs | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index a1666ab791..f2fa573204 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -6271,6 +6271,7 @@ dependencies = [ "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", + "sp-consensus-slots", "sp-core", "sp-inherents", "sp-io", diff --git a/polkadot/primitives/Cargo.toml b/polkadot/primitives/Cargo.toml index bd59162117..bb1d350a5e 100644 --- a/polkadot/primitives/Cargo.toml +++ b/polkadot/primitives/Cargo.toml @@ -10,6 +10,7 @@ parity-scale-codec = { version = "2.0.0", default-features = false, features = [ primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -42,6 +43,7 @@ std = [ "trie/std", "sp-api/std", "sp-authority-discovery/std", + "sp-consensus-slots/std", "sp-keystore", "sp-std/std", "sp-io/std", diff --git a/polkadot/primitives/src/v1/mod.rs b/polkadot/primitives/src/v1/mod.rs index dc11e25fd5..8950f689fa 100644 --- a/polkadot/primitives/src/v1/mod.rs +++ b/polkadot/primitives/src/v1/mod.rs @@ -57,6 +57,7 @@ pub use crate::v0::{ValidatorPair, CollatorPair}; pub use sp_staking::SessionIndex; pub use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +pub use sp_consensus_slots::Slot; /// Signed data. mod signed; @@ -82,6 +83,12 @@ pub mod well_known_keys { // ::HrmpEgressChannelsIndex::prefix_hash(); // + /// The current slot number. + /// + /// The storage entry should be accessed as a `Slot` encoded value. + pub const CURRENT_SLOT: &[u8] = + &hex!["1cb6f36e027abb2091cfb5110ab5087f06155b3cd9a8c9e5e9a23fd5dc13a5ed"]; + /// The currently active host configuration. /// /// The storage entry should be accessed as an `AbridgedHostConfiguration` encoded value.