Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
merge with master
  • Loading branch information
Gautam Dhameja committed Mar 11, 2019
commit 2f526c13d5b6ca96b7734819b0c4fb1943b6495f
20 changes: 7 additions & 13 deletions srml/timestamp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2018 Parity Technologies (UK) Ltd.
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -85,17 +85,17 @@

#![cfg_attr(not(feature = "std"), no_std)]

use parity_codec::Encode;
#[cfg(feature = "std")]
use parity_codec_derive::Decode;
use parity_codec_derive::Encode;
use parity_codec::Decode;
#[cfg(feature = "std")]
use inherents::ProvideInherentData;
use srml_support::{StorageValue, Parameter, decl_storage, decl_module};
use srml_support::for_each_tuple;
use runtime_primitives::traits::{As, SimpleArithmetic, Zero};
use system::ensure_inherent;
use rstd::{result, ops::{Mul, Div}, cmp};
use inherents::{RuntimeString, InherentIdentifier, ProvideInherent, IsFatalError, InherentData};
#[cfg(feature = "std")]
use inherents::ProvideInherentData;

/// The identifier for the `timestamp` inherent.
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"timstap0";
Expand Down Expand Up @@ -201,7 +201,7 @@ macro_rules! impl_timestamp_set {
for_each_tuple!(impl_timestamp_set);

/// The module configuration trait
pub trait Trait: consensus::Trait + system::Trait {
pub trait Trait: system::Trait {
/// Type used for expressing timestamp.
type Moment: Parameter + Default + SimpleArithmetic
+ Mul<Self::BlockNumber, Output = Self::Moment>
Expand Down Expand Up @@ -240,7 +240,6 @@ decl_module! {

decl_storage! {
trait Store for Module<T: Trait> as Timestamp {

/// Current time for the current block.
pub Now get(now) build(|_| T::Moment::sa(0)): T::Moment;

Expand Down Expand Up @@ -327,7 +326,7 @@ mod tests {
use substrate_primitives::H256;
use runtime_primitives::BuildStorage;
use runtime_primitives::traits::{BlakeTwo256, IdentityLookup};
use runtime_primitives::testing::{Digest, DigestItem, Header, UintAuthorityId};
use runtime_primitives::testing::{Digest, DigestItem, Header};

impl_outer_origin! {
pub enum Origin for Test {}
Expand All @@ -348,11 +347,6 @@ mod tests {
type Event = ();
type Log = DigestItem;
}
impl consensus::Trait for Test {
type Log = DigestItem;
type SessionKey = UintAuthorityId;
type InherentOfflineReport = ();
}
impl Trait for Test {
type Moment = u64;
type OnTimestampSet = ();
Expand Down