Commit 524602da authored by Gav Wood's avatar Gav Wood
Browse files

Introduce sudo module

parent 26082b48
......@@ -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],
......
......@@ -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<C, TxApi> consensus::Proposer<Block, AuraConsensusData> for Proposer<C, TxA
// set up delay until next allowed timestamp.
let current_timestamp = current_timestamp();
let delay_future = if current_timestamp.0 >= 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<C, TxApi> consensus::Proposer<Block, AuraConsensusData> for Proposer<C, TxA
}
}
fn current_timestamp() -> 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<C, TxApi> CreateProposal<C, TxApi> 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,
......
......@@ -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<u64>;
/// 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
......
......@@ -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<Block>;
/// BlockId type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedMortalExtrinsic<Address, Index, Call, Signature>;
pub type UncheckedExtrinsic = generic::UncheckedMortalExtrinsic<Address, Nonce, Call, Signature>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, balances::ChainContext<Runtime>, Balances, AllModules>;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment