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
+4 -5
View File
@@ -478,6 +478,10 @@ mod tests {
type MaximumBlockLength = MaximumBlockLength;
}
parameter_types! {
pub const UncleGenerations: u64 = 5;
}
impl Trait for Test {
type FindAuthor = AuthorGiven;
type UncleGenerations = UncleGenerations;
@@ -506,10 +510,6 @@ mod tests {
}
}
parameter_types! {
pub const UncleGenerations: u64 = 5;
}
pub struct VerifyBlock;
impl VerifySeal<Header, u64> for VerifyBlock {
@@ -550,7 +550,6 @@ mod tests {
header
}
fn create_header(number: u64, parent_hash: H256, state_root: H256) -> Header {
Header::new(
number,
+2 -1
View File
@@ -80,6 +80,7 @@ decl_storage! {
decl_event!(
pub enum Event<T, I=DefaultInstance> where
<T as system::Trait>::AccountId,
<T as Trait<I>>::Event,
{
/// The given member was added; see the transaction for who.
MemberAdded,
@@ -90,7 +91,7 @@ decl_event!(
/// The membership was reset; see the transaction for who the new set is.
MembersReset,
/// Phantom member, never used.
Dummy(sr_std::marker::PhantomData<(AccountId, I)>),
Dummy(sr_std::marker::PhantomData<(AccountId, Event)>),
}
);
+5 -4
View File
@@ -90,7 +90,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use rstd::{result, ops::{Mul, Div}, cmp};
use rstd::{result, cmp};
use codec::Encode;
#[cfg(feature = "std")]
use codec::Decode;
@@ -98,7 +98,9 @@ use codec::Decode;
use inherents::ProvideInherentData;
use srml_support::{StorageValue, Parameter, decl_storage, decl_module, for_each_tuple};
use srml_support::traits::{Time, Get};
use sr_primitives::traits::{SimpleArithmetic, Zero, SaturatedConversion};
use sr_primitives::traits::{
SimpleArithmetic, Zero, SaturatedConversion, Scale
};
use sr_primitives::weights::SimpleDispatchInfo;
use system::ensure_none;
use inherents::{RuntimeString, InherentIdentifier, ProvideInherent, IsFatalError, InherentData};
@@ -207,8 +209,7 @@ for_each_tuple!(impl_timestamp_set);
pub trait Trait: system::Trait {
/// Type used for expressing timestamp.
type Moment: Parameter + Default + SimpleArithmetic
+ Mul<Self::BlockNumber, Output = Self::Moment>
+ Div<Self::BlockNumber, Output = Self::Moment>;
+ Scale<Self::BlockNumber, Output = Self::Moment>;
/// Something which can be notified when the timestamp is set. Set this to `()` if not needed.
type OnTimestampSet: OnTimestampSet<Self::Moment>;