mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +00:00
New extrinsic dispatch model (#678)
* System and Balances switched to new call model * Fixed up executive for new pardigm * Consensus works with Origin * Timestamp ported over * Session now compatible * Ported staking * Treasury compatible * Expunge MaybeEmpty * Make democracy work * Council compatible * Remove some aux-dispatch stuff and fix balances * Rename aux -> origin, fix contracts * Fix test * Fix example * Update macro to remove superfluous cruft * Make work with new macro * Tests * Fix some tests * Tests * Fix grumbles * Final grumble
This commit is contained in:
@@ -64,7 +64,7 @@ pub use runtime_primitives::BuildStorage;
|
||||
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
|
||||
/// Runtime runtime type used to parameterize the various modules.
|
||||
/// Runtime type used to collate and parameterize the various modules.
|
||||
pub struct Runtime;
|
||||
|
||||
/// Runtime version.
|
||||
@@ -76,15 +76,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
impl_version: 0,
|
||||
};
|
||||
|
||||
/// Version module for this concrete runtime.
|
||||
pub type Version = version::Module<Runtime>;
|
||||
|
||||
impl version::Trait for Runtime {
|
||||
const VERSION: RuntimeVersion = VERSION;
|
||||
}
|
||||
|
||||
impl system::Trait for Runtime {
|
||||
type PublicAux = Self::AccountId;
|
||||
type Origin = Origin;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = Hash;
|
||||
@@ -154,7 +147,7 @@ impl staking::Trait for Runtime {
|
||||
pub type Staking = staking::Module<Runtime>;
|
||||
|
||||
impl democracy::Trait for Runtime {
|
||||
type Proposal = PrivCall;
|
||||
type Proposal = Call;
|
||||
}
|
||||
|
||||
/// Democracy module for this concrete runtime.
|
||||
@@ -179,20 +172,13 @@ impl_outer_log! {
|
||||
}
|
||||
}
|
||||
|
||||
impl DigestItem for Log {
|
||||
type AuthoritiesChange = consensus::AuthoritiesChange<SessionKey>;
|
||||
|
||||
fn as_authorities_change(&self) -> Option<&Self::AuthoritiesChange> {
|
||||
match *self {
|
||||
Log::consensus(ref item) => item.as_authorities_change(),
|
||||
}
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
impl_outer_dispatch! {
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
|
||||
pub enum Call where aux: <Runtime as system::Trait>::PublicAux {
|
||||
pub enum Call where origin: Origin {
|
||||
Consensus,
|
||||
Balances,
|
||||
Session,
|
||||
@@ -202,38 +188,8 @@ impl_outer_dispatch! {
|
||||
Council,
|
||||
CouncilVoting,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
|
||||
pub enum PrivCall {
|
||||
Consensus,
|
||||
Balances,
|
||||
Session,
|
||||
Staking,
|
||||
Democracy,
|
||||
Council,
|
||||
CouncilVoting,
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = balances::Address<Runtime>;
|
||||
/// Block header type as expected by this runtime.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256, Log>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// 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::UncheckedExtrinsic<Address, Index, Call, Signature>;
|
||||
/// Extrinsic type as expected by this runtime. This is not the type that is signed.
|
||||
pub type Extrinsic = generic::Extrinsic<Address, Index, Call>;
|
||||
/// Extrinsic type that is signed.
|
||||
pub type BareExtrinsic = generic::Extrinsic<AccountId, Index, Call>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
|
||||
(((((), Council), Democracy), Staking), Session)>;
|
||||
|
||||
impl_outer_config! {
|
||||
pub struct GenesisConfig for Runtime {
|
||||
ConsensusConfig => consensus,
|
||||
@@ -247,9 +203,35 @@ impl_outer_config! {
|
||||
}
|
||||
}
|
||||
|
||||
impl DigestItem for Log {
|
||||
type AuthoritiesChange = consensus::AuthoritiesChange<SessionKey>;
|
||||
|
||||
fn as_authorities_change(&self) -> Option<&Self::AuthoritiesChange> {
|
||||
match *self {
|
||||
Log::consensus(ref item) => item.as_authorities_change(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = balances::Address<Runtime>;
|
||||
/// Block header type as expected by this runtime.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256, Log>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// 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::UncheckedExtrinsic<Address, Index, Call, Signature>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
|
||||
(((((), Council), Democracy), Staking), Session)>;
|
||||
|
||||
pub mod api {
|
||||
impl_stubs!(
|
||||
version => |()| super::Version::version(),
|
||||
version => |()| super::VERSION,
|
||||
authorities => |()| super::Consensus::authorities(),
|
||||
events => |()| super::System::events(),
|
||||
initialise_block => |header| super::Executive::initialise_block(&header),
|
||||
|
||||
Reference in New Issue
Block a user