Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions runtime/asgard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "p
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
Expand Down Expand Up @@ -137,6 +138,7 @@ std = [
"pallet-collective/std",
"pallet-democracy/std",
"pallet-elections-phragmen/std",
"pallet-identity/std",
"pallet-indices/std",
"pallet-membership/std",
"pallet-multisig/std",
Expand Down
67 changes: 49 additions & 18 deletions runtime/asgard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,6 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u16 = 100;
}

impl pallet_multisig::Config for Runtime {
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Event = Event;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// One storage item; key size 32, value size 8; .
pub const ProxyDepositBase: Balance = deposit(1, 8);
Expand Down Expand Up @@ -322,6 +304,7 @@ pub enum ProxyType {
NonTransfer = 1,
Governance = 2,
CancelProxy = 3,
IdentityJudgement = 4,
}

impl Default for ProxyType {
Expand Down Expand Up @@ -371,6 +354,10 @@ impl InstanceFilter<Call> for ProxyType {
ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. }))
},
ProxyType::IdentityJudgement => matches!(
c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..)
),
}
}

Expand Down Expand Up @@ -417,6 +404,49 @@ impl pallet_scheduler::Config for Runtime {
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u16 = 100;
}

impl pallet_multisig::Config for Runtime {
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Event = Event;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// Minimum 4 CENTS/byte
pub const BasicDeposit: Balance = deposit(1, 258);
pub const FieldDeposit: Balance = deposit(0, 66);
pub const SubAccountDeposit: Balance = deposit(1, 53);
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
}

impl pallet_identity::Config for Runtime {
type Event = Event;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit;
type SubAccountDeposit = SubAccountDeposit;
type MaxSubAccounts = MaxSubAccounts;
type MaxAdditionalFields = MaxAdditionalFields;
type MaxRegistrars = MaxRegistrars;
type Slashed = Treasury;
type ForceOrigin = MoreThanHalfCouncil;
type RegistrarOrigin = MoreThanHalfCouncil;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
pub const IndexDeposit: Balance = 1 * DOLLARS;
}
Expand Down Expand Up @@ -1485,6 +1515,7 @@ construct_runtime! {
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 51,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 52,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 53,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 54,

// Vesting. Usable initially, but removed once all vesting is finished.
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
Expand Down
4 changes: 4 additions & 0 deletions runtime/bifrost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "p
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.11", default-features = false }
Expand Down Expand Up @@ -125,8 +127,10 @@ std = [
"pallet-bounties/std",
"pallet-collective/std",
"pallet-democracy/std",
"pallet-identity/std",
"pallet-indices/std",
"pallet-multisig/std",
"pallet-proxy/std",
"pallet-randomness-collective-flip/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
Expand Down
166 changes: 153 additions & 13 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ use core::convert::TryInto;
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, match_type, parameter_types,
traits::{Contains, Everything, IsInVec, Nothing, Randomness},
traits::{Contains, Everything, InstanceFilter, IsInVec, Nothing, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight,
},
PalletId, StorageValue,
PalletId, RuntimeDebug, StorageValue,
};
use frame_system::limits::{BlockLength, BlockWeights};
pub use pallet_balances::Call as BalancesCall;
Expand Down Expand Up @@ -77,7 +77,7 @@ use bifrost_runtime_common::{
CouncilCollective, EnsureRootOrAllTechnicalCommittee, MoreThanHalfCouncil,
SlowAdjustingFeeUpdate, TechnicalCollective,
};
use codec::Encode;
use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, time::*};
use cumulus_primitives_core::ParaId as CumulusParaId;
use frame_support::{
Expand Down Expand Up @@ -297,21 +297,116 @@ impl pallet_utility::Config for Runtime {
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u16 = 100;
// 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,
MaxEncodedLen,
scale_info::TypeInfo,
)]
pub enum ProxyType {
Any = 0,
NonTransfer = 1,
Governance = 2,
CancelProxy = 3,
IdentityJudgement = 4,
}

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::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::Session(..) |
Call::Democracy(..) |
Call::Council(..) |
Call::TechnicalCommittee(..) |
Call::PhragmenElection(..) |
Call::TechnicalMembership(..) |
Call::Treasury(..) |
Call::Bounties(..) |
Call::Tips(..) |
Call::Vesting(pallet_vesting::Call::vest{..}) |
Call::Vesting(pallet_vesting::Call::vest_other{..}) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Utility(..) |
Call::Proxy(..) |
Call::Multisig(..)
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..) |
Call::Council(..) | Call::TechnicalCommittee(..) |
Call::PhragmenElection(..) |
Call::Treasury(..) | Call::Bounties(..) |
Call::Tips(..) | Call::Utility(..)
),
ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. }))
},
ProxyType::IdentityJudgement => matches!(
c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..)
),
}
}

impl pallet_multisig::Config for Runtime {
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 AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type Call = Call;
type CallHasher = BlakeTwo256;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Event = Event;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
type MaxPending = MaxPending;
type MaxProxies = MaxProxies;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type ProxyType = ProxyType;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
Expand All @@ -331,6 +426,49 @@ impl pallet_scheduler::Config for Runtime {
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
}

parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
pub const DepositBase: Balance = deposit(1, 88);
// Additional storage item size of 32 bytes.
pub const DepositFactor: Balance = deposit(0, 32);
pub const MaxSignatories: u16 = 100;
}

impl pallet_multisig::Config for Runtime {
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type Event = Event;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// Minimum 4 CENTS/byte
pub const BasicDeposit: Balance = deposit(1, 258);
pub const FieldDeposit: Balance = deposit(0, 66);
pub const SubAccountDeposit: Balance = deposit(1, 53);
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
}

impl pallet_identity::Config for Runtime {
type Event = Event;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit;
type SubAccountDeposit = SubAccountDeposit;
type MaxSubAccounts = MaxSubAccounts;
type MaxAdditionalFields = MaxAdditionalFields;
type MaxRegistrars = MaxRegistrars;
type Slashed = Treasury;
type ForceOrigin = MoreThanHalfCouncil;
type RegistrarOrigin = MoreThanHalfCouncil;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
pub const IndexDeposit: Balance = 1 * DOLLARS;
}
Expand Down Expand Up @@ -1331,7 +1469,9 @@ construct_runtime! {
// utilities
Utility: pallet_utility::{Pallet, Call, Event} = 50,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 51,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 52,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 53,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 54,

// Vesting. Usable initially, but removed once all vesting is finished.
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 60,
Expand Down