Introduce sudo module

This commit is contained in:
Gav Wood
2018-12-21 12:54:16 +01:00
parent 3f70ee8ff9
commit a7cd223104
6 changed files with 13 additions and 16 deletions
+2 -2
View File
@@ -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],
+5 -5
View File
@@ -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,