diff --git a/polkadot/consensus/src/evaluation.rs b/polkadot/consensus/src/evaluation.rs index 596e09caef..1833366559 100644 --- a/polkadot/consensus/src/evaluation.rs +++ b/polkadot/consensus/src/evaluation.rs @@ -19,7 +19,7 @@ use super::MAX_TRANSACTIONS_SIZE; use codec::Encode; -use polkadot_primitives::{Block, Hash, BlockNumber, Timestamp}; +use polkadot_primitives::{Block, Hash, BlockNumber}; use polkadot_primitives::parachain::Id as ParaId; error_chain! { @@ -66,7 +66,7 @@ error_chain! { /// upon any initial validity checks failing. pub fn evaluate_initial( proposal: &Block, - _now: Timestamp, + _now: u64, parent_hash: &Hash, parent_number: BlockNumber, _active_parachains: &[ParaId], diff --git a/polkadot/consensus/src/lib.rs b/polkadot/consensus/src/lib.rs index 0c08077790..8c7bcaf228 100644 --- a/polkadot/consensus/src/lib.rs +++ b/polkadot/consensus/src/lib.rs @@ -73,7 +73,7 @@ use codec::Encode; use extrinsic_store::Store as ExtrinsicStore; use parking_lot::Mutex; use polkadot_primitives::{ - Hash, Block, BlockId, BlockNumber, Header, Timestamp, SessionKey, InherentData + Hash, Block, BlockId, BlockNumber, Header, SessionKey, InherentData }; use polkadot_primitives::parachain::{Id as ParaId, Chain, DutyRoster, BlockData, Extrinsic as ParachainExtrinsic, CandidateReceipt, CandidateSignature}; use polkadot_primitives::parachain::{AttestedCandidate, ParachainHost, Statement as PrimitiveStatement}; @@ -538,11 +538,11 @@ impl consensus::Proposer for Proposer= believed_timestamp { + let delay_future = if current_timestamp >= believed_timestamp { None } else { Some(Delay::new( - Instant::now() + Duration::from_secs(current_timestamp.0 - believed_timestamp) + Instant::now() + Duration::from_secs(current_timestamp - believed_timestamp) )) }; @@ -568,7 +568,7 @@ impl consensus::Proposer for Proposer Timestamp { +fn current_timestamp() -> u64 { time::SystemTime::now().duration_since(time::UNIX_EPOCH) .expect("now always later than unix epoch; qed") .as_secs() @@ -699,7 +699,7 @@ impl CreateProposal where let active_parachains = runtime_api.active_parachains(&self.parent_id)?; assert!(evaluation::evaluate_initial( &new_block, - self.believed_minimum_timestamp.into(), + self.believed_minimum_timestamp, &self.parent_hash, self.parent_number, &active_parachains, diff --git a/polkadot/primitives/src/lib.rs b/polkadot/primitives/src/lib.rs index 340c0d3125..a2204a637c 100644 --- a/polkadot/primitives/src/lib.rs +++ b/polkadot/primitives/src/lib.rs @@ -63,7 +63,7 @@ pub type AccountId = primitives::hash::H256; /// The type for looking up accounts. We don't expect more than 4 billion of them, but you /// never know... -pub type AccountIndex = u64; +pub type AccountIndex = u32; /// The Ed25519 pub key of an session that belongs to an authority of the relay chain. This is /// exactly equivalent to what the substrate calls an "authority". @@ -76,15 +76,12 @@ pub type ChainId = u32; pub type Hash = primitives::H256; /// Index of a transaction in the relay chain. 32-bit should be plenty. -pub type Index = u32; +pub type Nonce = u64; /// Alias to 512-bit hash when used in the context of a signature on the relay chain. /// Equipped with logic for possibly "unsigned" messages. pub type Signature = runtime_primitives::Ed25519Signature; -/// A timestamp: seconds since the unix epoch. -pub type Timestamp = Compact; - /// The balance of an account. /// 128-bits (or 38 significant decimal figures) will allow for 10m currency (10^7) at a resolution /// to all for one second's worth of an annualised 50% reward be paid to a unit holder (10^11 unit diff --git a/polkadot/runtime/src/lib.rs b/polkadot/runtime/src/lib.rs index e8f3a49ddc..108a5b8391 100644 --- a/polkadot/runtime/src/lib.rs +++ b/polkadot/runtime/src/lib.rs @@ -66,7 +66,7 @@ mod parachains; use rstd::prelude::*; use substrate_primitives::u32_trait::{_2, _4}; use primitives::{ - AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature, + AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, SessionKey, Signature, parachain, }; use client::{ @@ -122,7 +122,7 @@ pub fn native_version() -> NativeVersion { impl system::Trait for Runtime { type Origin = Origin; - type Index = Index; + type Index = Nonce; type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; @@ -259,9 +259,9 @@ pub type SignedBlock = generic::SignedBlock; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedMortalExtrinsic; +pub type UncheckedExtrinsic = generic::UncheckedMortalExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = executive::Executive, Balances, AllModules>; diff --git a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm index c5f741f3fb..c75b414b41 100644 Binary files a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm and b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm differ diff --git a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm index 473cda94f6..b35ffe943b 100755 Binary files a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm and b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm differ