Scale trait and move to u32 blocknumbers (#3357)

* Scale trait and move to u32 blocknumbers.

* Fixes

* Cleanups

* Update node/runtime/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix up some of the factory stuff.

* Update core/sr-primitives/src/traits.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Move Nonce/Index to u32 (#3361)

* Force a non-borked version of upstream crate

* Line lengths and runtime version bump
This commit is contained in:
Gavin Wood
2019-08-11 15:03:06 +02:00
committed by GitHub
parent d1161b7d36
commit 14bb115193
29 changed files with 151 additions and 82 deletions
+7 -7
View File
@@ -27,7 +27,7 @@ pub mod currency {
/// Time.
pub mod time {
use node_primitives::Moment;
use node_primitives::{Moment, BlockNumber};
/// Since BABE is probabilistic this is the average expected block time that
/// we are targetting. Blocks will be produced at a minimum duration defined
@@ -46,17 +46,17 @@ pub mod time {
pub const SLOT_DURATION: Moment = 1650;
pub const EPOCH_DURATION_IN_BLOCKS: Moment = 10 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: Moment = {
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: u64 = {
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64;
(EPOCH_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as Moment
(EPOCH_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as u64
};
// These time units are defined in number of blocks.
pub const MINUTES: Moment = 60 / SECS_PER_BLOCK;
pub const HOURS: Moment = MINUTES * 60;
pub const DAYS: Moment = HOURS * 24;
pub const MINUTES: BlockNumber = 60 / (SECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
}
// CRITICAL NOTE: The system module maintains two constants: a _maximum_ block weight and a
+3 -3
View File
@@ -80,8 +80,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 137,
impl_version: 137,
spec_version: 138,
impl_version: 138,
apis: RUNTIME_API_VERSIONS,
};
@@ -179,7 +179,7 @@ impl timestamp::Trait for Runtime {
}
parameter_types! {
pub const UncleGenerations: u64 = 5;
pub const UncleGenerations: BlockNumber = 5;
}
impl authorship::Trait for Runtime {