Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/chainx-org/ChainX into up…
Browse files Browse the repository at this point in the history
…date-substrate-566ad0
  • Loading branch information
liuchengxu committed Feb 22, 2021
2 parents 9075572 + f0fd87c commit 0c16466
Show file tree
Hide file tree
Showing 9 changed files with 22,439 additions and 22,081 deletions.
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44,136 changes: 22,068 additions & 22,068 deletions cli/src/res/malan.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions runtime/chainx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pallet-indices = { version = "3.0.0", default-features = false }
pallet-membership = { version = "3.0.0", default-features = false }
pallet-multisig = { version = "3.0.0", default-features = false }
pallet-offences = { version = "3.0.0", default-features = false }
pallet-proxy = { version = "3.0.0", default-features = false }
pallet-randomness-collective-flip = { version = "3.0.0", default-features = false }
pallet-scheduler = { version = "3.0.0", default-features = false }
pallet-session = { version = "3.0.0", default-features = false, features = ["historical"] }
Expand Down Expand Up @@ -139,6 +140,7 @@ std = [
"pallet-membership/std",
"pallet-multisig/std",
"pallet-offences/std",
"pallet-proxy/std",
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
Expand Down
121 changes: 116 additions & 5 deletions runtime/chainx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

use codec::Encode;
use codec::{Decode, Encode};
use static_assertions::const_assert;

use sp_api::impl_runtime_apis;
Expand All @@ -31,7 +31,7 @@ use sp_runtime::{
InvalidTransaction, TransactionPriority, TransactionSource, TransactionValidity,
TransactionValidityError, ValidTransaction,
},
ApplyExtrinsicResult, DispatchError, ModuleId, Perbill, Percent, Permill,
ApplyExtrinsicResult, DispatchError, ModuleId, Perbill, Percent, Permill, RuntimeDebug,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
#[cfg(feature = "std")]
Expand Down Expand Up @@ -105,7 +105,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("chainx"),
impl_name: create_runtime_str!("chainx-net"),
authoring_version: 1,
spec_version: 9,
spec_version: 10,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -795,6 +795,115 @@ impl pallet_identity::Config for Runtime {
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// One storage item; key size 32, value size 8; .
pub const ProxyDepositBase: Balance = deposit(1, 8);
// Additional storage item size of 33 bytes.
pub const ProxyDepositFactor: Balance = deposit(0, 33);
pub const MaxProxies: u16 = 32;
pub const AnnouncementDepositBase: Balance = deposit(1, 8);
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
pub const MaxPending: u16 = 32;
}

/// The type used to represent the kinds of proxying allowed.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
pub enum ProxyType {
Any = 0,
NonTransfer = 1,
Governance = 2,
Staking = 3,
IdentityJudgement = 4,
CancelProxy = 5,
}

impl Default for ProxyType {
fn default() -> Self {
Self::Any
}
}

impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => matches!(
c,
Call::System(..)
| Call::Scheduler(..)
| Call::Babe(..)
| Call::Timestamp(..)
| Call::Indices(pallet_indices::Call::claim(..))
| Call::Indices(pallet_indices::Call::free(..))
| Call::Indices(pallet_indices::Call::freeze(..))
// Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet
| Call::Authorship(..)
| Call::XStaking(..)
| Call::Offences(..)
| Call::Session(..)
| Call::Grandpa(..)
| Call::ImOnline(..)
| Call::AuthorityDiscovery(..)
| Call::Democracy(..)
| Call::Council(..)
| Call::TechnicalCommittee(..)
| Call::Elections(..)
| Call::TechnicalMembership(..)
| Call::Treasury(..)
| Call::Utility(..)
| Call::Identity(..)
| Call::Proxy(..)
| Call::Multisig(..)
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..)
| Call::Council(..)
| Call::TechnicalCommittee(..)
| Call::Elections(..)
| Call::Treasury(..)
| Call::Utility(..)
),
ProxyType::Staking => matches!(
c,
Call::XStaking(..) | Call::Session(..) | Call::Utility(..)
),
ProxyType::IdentityJudgement => matches!(
c,
Call::Identity(pallet_identity::Call::provide_judgement(..)) | Call::Utility(..)
),
ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement(..)))
}
}
}
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
(ProxyType::NonTransfer, _) => true,
_ => false,
}
}
}

impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}

///////////////////////////////////////////
// orml
///////////////////////////////////////////
Expand Down Expand Up @@ -994,8 +1103,10 @@ construct_runtime!(
// we put it at the end for keeping the extrinsic ordering.
XTransactionFee: xpallet_transaction_fee::{Module, Event<T>} = 35,

Bounties: pallet_bounties::{Module, Call, Storage, Event<T>} = 37,
Tips: pallet_tips::{Module, Call, Storage, Event<T>} = 38,
Proxy: pallet_proxy::{Module, Call, Storage, Event<T>} = 37,

Bounties: pallet_bounties::{Module, Call, Storage, Event<T>} = 38,
Tips: pallet_tips::{Module, Call, Storage, Event<T>} = 39,
}
);

Expand Down
2 changes: 2 additions & 0 deletions runtime/dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pallet-indices = { version = "3.0.0", default-features = false }
pallet-membership = { version = "3.0.0", default-features = false }
pallet-multisig = { version = "3.0.0", default-features = false }
pallet-offences = { version = "3.0.0", default-features = false }
pallet-proxy = { version = "3.0.0", default-features = false }
pallet-randomness-collective-flip = { version = "3.0.0", default-features = false }
pallet-scheduler = { version = "3.0.0", default-features = false }
pallet-session = { version = "3.0.0", default-features = false, features = ["historical"] }
Expand Down Expand Up @@ -140,6 +141,7 @@ std = [
"pallet-membership/std",
"pallet-multisig/std",
"pallet-offences/std",
"pallet-proxy/std",
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
Expand Down
115 changes: 113 additions & 2 deletions runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

use codec::Encode;
use codec::{Decode, Encode};
use static_assertions::const_assert;

use sp_api::impl_runtime_apis;
Expand All @@ -31,7 +31,7 @@ use sp_runtime::{
InvalidTransaction, TransactionPriority, TransactionSource, TransactionValidity,
TransactionValidityError, ValidTransaction,
},
ApplyExtrinsicResult, DispatchError, ModuleId, Perbill, Percent, Permill,
ApplyExtrinsicResult, DispatchError, ModuleId, Perbill, Percent, Permill, RuntimeDebug,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
#[cfg(feature = "std")]
Expand Down Expand Up @@ -797,6 +797,115 @@ impl pallet_identity::Config for Runtime {
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// One storage item; key size 32, value size 8; .
pub const ProxyDepositBase: Balance = deposit(1, 8);
// Additional storage item size of 33 bytes.
pub const ProxyDepositFactor: Balance = deposit(0, 33);
pub const MaxProxies: u16 = 32;
pub const AnnouncementDepositBase: Balance = deposit(1, 8);
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
pub const MaxPending: u16 = 32;
}

/// The type used to represent the kinds of proxying allowed.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
pub enum ProxyType {
Any = 0,
NonTransfer = 1,
Governance = 2,
Staking = 3,
IdentityJudgement = 4,
CancelProxy = 5,
}

impl Default for ProxyType {
fn default() -> Self {
Self::Any
}
}

impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => matches!(
c,
Call::System(..)
| Call::Scheduler(..)
| Call::Babe(..)
| Call::Timestamp(..)
| Call::Indices(pallet_indices::Call::claim(..))
| Call::Indices(pallet_indices::Call::free(..))
| Call::Indices(pallet_indices::Call::freeze(..))
// Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet
| Call::Authorship(..)
| Call::XStaking(..)
| Call::Offences(..)
| Call::Session(..)
| Call::Grandpa(..)
| Call::ImOnline(..)
| Call::AuthorityDiscovery(..)
| Call::Democracy(..)
| Call::Council(..)
| Call::TechnicalCommittee(..)
| Call::Elections(..)
| Call::TechnicalMembership(..)
| Call::Treasury(..)
| Call::Utility(..)
| Call::Identity(..)
| Call::Proxy(..)
| Call::Multisig(..)
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..)
| Call::Council(..)
| Call::TechnicalCommittee(..)
| Call::Elections(..)
| Call::Treasury(..)
| Call::Utility(..)
),
ProxyType::Staking => matches!(
c,
Call::XStaking(..) | Call::Session(..) | Call::Utility(..)
),
ProxyType::IdentityJudgement => matches!(
c,
Call::Identity(pallet_identity::Call::provide_judgement(..)) | Call::Utility(..)
),
ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement(..)))
}
}
}
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
(ProxyType::NonTransfer, _) => true,
_ => false,
}
}
}

impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
}

///////////////////////////////////////////
// orml
///////////////////////////////////////////
Expand Down Expand Up @@ -999,6 +1108,8 @@ construct_runtime!(

// Put Sudo last so that the extrinsic ordering stays the same once it's removed.
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},

Proxy: pallet_proxy::{Module, Call, Storage, Event<T>},
}
);

Expand Down
2 changes: 2 additions & 0 deletions runtime/malan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pallet-indices = { version = "3.0.0", default-features = false }
pallet-membership = { version = "3.0.0", default-features = false }
pallet-multisig = { version = "3.0.0", default-features = false }
pallet-offences = { version = "3.0.0", default-features = false }
pallet-proxy = { version = "3.0.0", default-features = false }
pallet-randomness-collective-flip = { version = "3.0.0", default-features = false }
pallet-scheduler = { version = "3.0.0", default-features = false }
pallet-session = { version = "3.0.0", default-features = false, features = ["historical"] }
Expand Down Expand Up @@ -140,6 +141,7 @@ std = [
"pallet-membership/std",
"pallet-multisig/std",
"pallet-offences/std",
"pallet-proxy/std",
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
Expand Down

0 comments on commit 0c16466

Please sign in to comment.