mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 13:51:11 +00:00
Introduce sudo module
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
use super::MAX_TRANSACTIONS_SIZE;
|
use super::MAX_TRANSACTIONS_SIZE;
|
||||||
|
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use polkadot_primitives::{Block, Hash, BlockNumber, Timestamp};
|
use polkadot_primitives::{Block, Hash, BlockNumber};
|
||||||
use polkadot_primitives::parachain::Id as ParaId;
|
use polkadot_primitives::parachain::Id as ParaId;
|
||||||
|
|
||||||
error_chain! {
|
error_chain! {
|
||||||
@@ -66,7 +66,7 @@ error_chain! {
|
|||||||
/// upon any initial validity checks failing.
|
/// upon any initial validity checks failing.
|
||||||
pub fn evaluate_initial(
|
pub fn evaluate_initial(
|
||||||
proposal: &Block,
|
proposal: &Block,
|
||||||
_now: Timestamp,
|
_now: u64,
|
||||||
parent_hash: &Hash,
|
parent_hash: &Hash,
|
||||||
parent_number: BlockNumber,
|
parent_number: BlockNumber,
|
||||||
_active_parachains: &[ParaId],
|
_active_parachains: &[ParaId],
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ use codec::Encode;
|
|||||||
use extrinsic_store::Store as ExtrinsicStore;
|
use extrinsic_store::Store as ExtrinsicStore;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use polkadot_primitives::{
|
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::{Id as ParaId, Chain, DutyRoster, BlockData, Extrinsic as ParachainExtrinsic, CandidateReceipt, CandidateSignature};
|
||||||
use polkadot_primitives::parachain::{AttestedCandidate, ParachainHost, Statement as PrimitiveStatement};
|
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.
|
// set up delay until next allowed timestamp.
|
||||||
let current_timestamp = current_timestamp();
|
let current_timestamp = current_timestamp();
|
||||||
let delay_future = if current_timestamp.0 >= believed_timestamp {
|
let delay_future = if current_timestamp >= believed_timestamp {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(Delay::new(
|
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)
|
time::SystemTime::now().duration_since(time::UNIX_EPOCH)
|
||||||
.expect("now always later than unix epoch; qed")
|
.expect("now always later than unix epoch; qed")
|
||||||
.as_secs()
|
.as_secs()
|
||||||
@@ -699,7 +699,7 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
|
|||||||
let active_parachains = runtime_api.active_parachains(&self.parent_id)?;
|
let active_parachains = runtime_api.active_parachains(&self.parent_id)?;
|
||||||
assert!(evaluation::evaluate_initial(
|
assert!(evaluation::evaluate_initial(
|
||||||
&new_block,
|
&new_block,
|
||||||
self.believed_minimum_timestamp.into(),
|
self.believed_minimum_timestamp,
|
||||||
&self.parent_hash,
|
&self.parent_hash,
|
||||||
self.parent_number,
|
self.parent_number,
|
||||||
&active_parachains,
|
&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
|
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
|
||||||
/// never know...
|
/// 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
|
/// 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".
|
/// exactly equivalent to what the substrate calls an "authority".
|
||||||
@@ -76,15 +76,12 @@ pub type ChainId = u32;
|
|||||||
pub type Hash = primitives::H256;
|
pub type Hash = primitives::H256;
|
||||||
|
|
||||||
/// Index of a transaction in the relay chain. 32-bit should be plenty.
|
/// 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.
|
/// Alias to 512-bit hash when used in the context of a signature on the relay chain.
|
||||||
/// Equipped with logic for possibly "unsigned" messages.
|
/// Equipped with logic for possibly "unsigned" messages.
|
||||||
pub type Signature = runtime_primitives::Ed25519Signature;
|
pub type Signature = runtime_primitives::Ed25519Signature;
|
||||||
|
|
||||||
/// A timestamp: seconds since the unix epoch.
|
|
||||||
pub type Timestamp = Compact<u64>;
|
|
||||||
|
|
||||||
/// The balance of an account.
|
/// The balance of an account.
|
||||||
/// 128-bits (or 38 significant decimal figures) will allow for 10m currency (10^7) at a resolution
|
/// 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
|
/// 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 rstd::prelude::*;
|
||||||
use substrate_primitives::u32_trait::{_2, _4};
|
use substrate_primitives::u32_trait::{_2, _4};
|
||||||
use primitives::{
|
use primitives::{
|
||||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, SessionKey, Signature,
|
AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, SessionKey, Signature,
|
||||||
parachain,
|
parachain,
|
||||||
};
|
};
|
||||||
use client::{
|
use client::{
|
||||||
@@ -122,7 +122,7 @@ pub fn native_version() -> NativeVersion {
|
|||||||
|
|
||||||
impl system::Trait for Runtime {
|
impl system::Trait for Runtime {
|
||||||
type Origin = Origin;
|
type Origin = Origin;
|
||||||
type Index = Index;
|
type Index = Nonce;
|
||||||
type BlockNumber = BlockNumber;
|
type BlockNumber = BlockNumber;
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
@@ -259,9 +259,9 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
|||||||
/// BlockId type as expected by this runtime.
|
/// BlockId type as expected by this runtime.
|
||||||
pub type BlockId = generic::BlockId<Block>;
|
pub type BlockId = generic::BlockId<Block>;
|
||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// 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.
|
/// 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.
|
/// Executive: handles dispatch to the various modules.
|
||||||
pub type Executive = executive::Executive<Runtime, Block, balances::ChainContext<Runtime>, Balances, AllModules>;
|
pub type Executive = executive::Executive<Runtime, Block, balances::ChainContext<Runtime>, Balances, AllModules>;
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user