Companion for #6273 (Introduce stacked filtering) (#1212)

* Fix for new Substrate

* Fix

* Remove Utility constraint in NonTransfer

* Bump

* Fixes

* Allow limited utilities in proxy filters.

* Fix

* Add SudoBalances proxy restrictions
This commit is contained in:
Gavin Wood
2020-06-08 17:23:56 +02:00
committed by GitHub
parent 780f4a564e
commit c7f957ceec
24 changed files with 333 additions and 230 deletions
+172 -154
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4,7 +4,7 @@ path = "src/main.rs"
[package] [package]
name = "polkadot" name = "polkadot"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "polkadot-availability-store" name = "polkadot-availability-store"
description = "Persistent database for parachain data" description = "Persistent database for parachain data"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-cli" name = "polkadot-cli"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot Relay-chain Client Node" description = "Polkadot Relay-chain Client Node"
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-collator" name = "polkadot-collator"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation" description = "Collator node implementation"
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-erasure-coding" name = "polkadot-erasure-coding"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-network" name = "polkadot-network"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol" description = "Polkadot-specific networking protocol"
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-network-test" name = "polkadot-network-test"
version = "0.8.3" version = "0.8.4"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-parachain" name = "polkadot-parachain"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains" description = "Types and utilities for creating and working with parachains"
edition = "2018" edition = "2018"
@@ -1,6 +1,6 @@
[package] [package]
name = "test-parachain-adder" name = "test-parachain-adder"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition" description = "Test parachain which adds to a number as its state transition"
edition = "2018" edition = "2018"
@@ -1,6 +1,6 @@
[package] [package]
name = "test-parachain-halt" name = "test-parachain-halt"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which executes forever" description = "Test parachain which executes forever"
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-primitives" name = "polkadot-primitives"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-rpc" name = "polkadot-rpc"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-runtime-common" name = "polkadot-runtime-common"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+3 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "kusama-runtime" name = "kusama-runtime"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@@ -46,6 +46,7 @@ identity = { package = "pallet-identity", git = "https://github.com/paritytech/s
im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
multisig = { package = "pallet-multisig", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -118,6 +119,7 @@ std = [
"im-online/std", "im-online/std",
"indices/std", "indices/std",
"membership/std", "membership/std",
"multisig/std",
"nicks/std", "nicks/std",
"offences/std", "offences/std",
"proxy/std", "proxy/std",
+44 -20
View File
@@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"), spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"), impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2, authoring_version: 2,
spec_version: 2000, spec_version: 2004,
impl_version: 0, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 1, transaction_version: 1,
@@ -100,12 +100,14 @@ pub fn native_version() -> NativeVersion {
} }
/// Avoid processing transactions from slots and parachain registrar. /// Avoid processing transactions from slots and parachain registrar.
pub struct IsCallable; pub struct BaseFilter;
impl Filter<Call> for IsCallable { impl Filter<Call> for BaseFilter {
fn filter(call: &Call) -> bool { fn filter(call: &Call) -> bool {
!matches!(call, Call::Slots(_) | Call::Registrar(_)) !matches!(call, Call::Slots(_) | Call::Registrar(_))
} }
} }
pub struct IsCallable;
frame_support::impl_filter_stack!(IsCallable, BaseFilter, Call, is_callable);
parameter_types! { parameter_types! {
pub const Version: RuntimeVersion = VERSION; pub const Version: RuntimeVersion = VERSION;
@@ -688,20 +690,26 @@ impl identity::Trait for Runtime {
type ForceOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>; type ForceOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
} }
parameter_types! {
// One storage item; value is size 4+4+16+32 bytes = 56 bytes.
pub const MultisigDepositBase: Balance = 30 * CENTS;
// Additional storage item size of 32 bytes.
pub const MultisigDepositFactor: Balance = 5 * CENTS;
pub const MaxSignatories: u16 = 100;
}
impl utility::Trait for Runtime { impl utility::Trait for Runtime {
type Event = Event;
type Call = Call;
type IsCallable = IsCallable;
}
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 multisig::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
type Currency = Balances; type Currency = Balances;
type MultisigDepositBase = MultisigDepositBase; type DepositBase = DepositBase;
type MultisigDepositFactor = MultisigDepositFactor; type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories; type MaxSignatories = MaxSignatories;
type IsCallable = IsCallable; type IsCallable = IsCallable;
} }
@@ -783,16 +791,29 @@ impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool { fn filter(&self, c: &Call) -> bool {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(c,
Call::Balances(..) | Call::Vesting(vesting::Call::vested_transfer(..))
| Call::Indices(indices::Call::transfer(..))
),
ProxyType::Governance => matches!(c, ProxyType::Governance => matches!(c,
Call::Democracy(..) | Call::Council(..) | Call::TechnicalCommittee(..) Call::Democracy(..) | Call::Council(..) | Call::TechnicalCommittee(..)
| Call::ElectionsPhragmen(..) | Call::Treasury(..) | Call::ElectionsPhragmen(..) | Call::Treasury(..)
| Call::Utility(utility::Call::batch(..))
| Call::Utility(utility::Call::as_limited_sub(..))
), ),
ProxyType::NonTransfer => !matches!(c, ProxyType::Staking => matches!(c,
Call::Balances(..) | Call::Utility(..) Call::Staking(..) | Call::Utility(utility::Call::batch(..))
| Call::Vesting(vesting::Call::vested_transfer(..)) | Call::Utility(utility::Call::as_limited_sub(..))
| Call::Indices(indices::Call::transfer(..))
), ),
ProxyType::Staking => matches!(c, Call::Staking(..)), }
}
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,
} }
} }
} }
@@ -856,7 +877,7 @@ construct_runtime! {
Registrar: registrar::{Module, Call, Storage, Event, Config<T>}, Registrar: registrar::{Module, Call, Storage, Event, Config<T>},
// Utility module. // Utility module.
Utility: utility::{Module, Call, Storage, Event<T>}, Utility: utility::{Module, Call, Event},
// Less simple identity module. // Less simple identity module.
Identity: identity::{Module, Call, Storage, Event<T>}, Identity: identity::{Module, Call, Storage, Event<T>},
@@ -874,7 +895,10 @@ construct_runtime! {
Scheduler: scheduler::{Module, Call, Storage, Event<T>}, Scheduler: scheduler::{Module, Call, Storage, Event<T>},
// Proxy module. Late addition. // Proxy module. Late addition.
Proxy: proxy::{Module, Call, Storage, Event<T>} Proxy: proxy::{Module, Call, Storage, Event<T>},
// Multisig module. Late addition.
Multisig: multisig::{Module, Call, Storage, Event<T>},
} }
} }
+3 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-runtime" name = "polkadot-runtime"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@@ -45,6 +45,7 @@ identity = { package = "pallet-identity", git = "https://github.com/paritytech/s
im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
multisig = { package = "pallet-multisig", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -115,6 +116,7 @@ std = [
"im-online/std", "im-online/std",
"indices/std", "indices/std",
"membership/std", "membership/std",
"multisig/std",
"nicks/std", "nicks/std",
"offences/std", "offences/std",
"proxy/std", "proxy/std",
+47 -19
View File
@@ -89,7 +89,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("polkadot"), spec_name: create_runtime_str!("polkadot"),
impl_name: create_runtime_str!("parity-polkadot"), impl_name: create_runtime_str!("parity-polkadot"),
authoring_version: 0, authoring_version: 0,
spec_version: 3, spec_version: 4,
impl_version: 0, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 0, transaction_version: 0,
@@ -104,8 +104,8 @@ pub fn native_version() -> NativeVersion {
} }
} }
pub struct IsCallable; pub struct BaseFilter;
impl Filter<Call> for IsCallable { impl Filter<Call> for BaseFilter {
fn filter(call: &Call) -> bool { fn filter(call: &Call) -> bool {
match call { match call {
Call::Parachains(parachains::Call::set_heads(..)) => true, Call::Parachains(parachains::Call::set_heads(..)) => true,
@@ -127,11 +127,13 @@ impl Filter<Call> for IsCallable {
Call::Session(_) | Call::FinalityTracker(_) | Call::Grandpa(_) | Call::ImOnline(_) | Call::Session(_) | Call::FinalityTracker(_) | Call::Grandpa(_) | Call::ImOnline(_) |
Call::AuthorityDiscovery(_) | Call::AuthorityDiscovery(_) |
Call::Utility(_) | Call::Claims(_) | Call::Vesting(_) | Call::Sudo(_) | Call::Utility(_) | Call::Claims(_) | Call::Vesting(_) | Call::Sudo(_) |
Call::Identity(_) | Call::Proxy(_) => Call::Identity(_) | Call::Proxy(_) | Call::Multisig(_) =>
true, true,
} }
} }
} }
pub struct IsCallable;
frame_support::impl_filter_stack!(IsCallable, BaseFilter, Call, is_callable);
parameter_types! { parameter_types! {
pub const Version: RuntimeVersion = VERSION; pub const Version: RuntimeVersion = VERSION;
@@ -720,20 +722,26 @@ impl vesting::Trait for Runtime {
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
} }
parameter_types! {
// One storage item; value is size 4+4+16+32 bytes = 56 bytes.
pub const MultisigDepositBase: Balance = 30 * CENTS;
// Additional storage item size of 32 bytes.
pub const MultisigDepositFactor: Balance = 5 * CENTS;
pub const MaxSignatories: u16 = 100;
}
impl utility::Trait for Runtime { impl utility::Trait for Runtime {
type Event = Event;
type Call = Call;
type IsCallable = IsCallable;
}
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 multisig::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
type Currency = Balances; type Currency = Balances;
type MultisigDepositBase = MultisigDepositBase; type DepositBase = DepositBase;
type MultisigDepositFactor = MultisigDepositFactor; type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories; type MaxSignatories = MaxSignatories;
type IsCallable = IsCallable; type IsCallable = IsCallable;
} }
@@ -758,6 +766,7 @@ pub enum ProxyType {
NonTransfer, NonTransfer,
Governance, Governance,
Staking, Staking,
SudoBalances,
} }
impl Default for ProxyType { fn default() -> Self { Self::Any } } impl Default for ProxyType { fn default() -> Self { Self::Any } }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<Call> for ProxyType {
@@ -765,15 +774,31 @@ impl InstanceFilter<Call> for ProxyType {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(c, ProxyType::NonTransfer => !matches!(c,
Call::Balances(..) | Call::Utility(..) Call::Balances(..) | Call::Vesting(vesting::Call::vested_transfer(..))
| Call::Vesting(vesting::Call::vested_transfer(..))
| Call::Indices(indices::Call::transfer(..)) | Call::Indices(indices::Call::transfer(..))
), ),
ProxyType::Governance => matches!(c, ProxyType::Governance => matches!(c,
Call::Democracy(..) | Call::Council(..) | Call::TechnicalCommittee(..) Call::Democracy(..) | Call::Council(..) | Call::TechnicalCommittee(..)
| Call::ElectionsPhragmen(..) | Call::Treasury(..) | Call::ElectionsPhragmen(..) | Call::Treasury(..)
| Call::Utility(utility::Call::batch(..))
| Call::Utility(utility::Call::as_limited_sub(..))
), ),
ProxyType::Staking => matches!(c, Call::Staking(..)), ProxyType::Staking => matches!(c,
Call::Staking(..) | Call::Utility(utility::Call::batch(..))
| Call::Utility(utility::Call::as_limited_sub(..))
),
ProxyType::SudoBalances => matches!(c,
Call::Sudo(sudo::Call::sudo(x)) if matches!(x.as_ref(), &Call::Balances(..))
),
}
}
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,
} }
} }
} }
@@ -841,7 +866,7 @@ construct_runtime! {
// Vesting. Usable initially, but removed once all vesting is finished. // Vesting. Usable initially, but removed once all vesting is finished.
Vesting: vesting::{Module, Call, Storage, Event<T>, Config<T>}, Vesting: vesting::{Module, Call, Storage, Event<T>, Config<T>},
// Cunning utilities. Usable initially. // Cunning utilities. Usable initially.
Utility: utility::{Module, Call, Storage, Event<T>}, Utility: utility::{Module, Call, Event},
// Sudo. Last module. Usable initially, but removed once governance enabled. // Sudo. Last module. Usable initially, but removed once governance enabled.
Sudo: sudo::{Module, Call, Storage, Config<T>, Event<T>}, Sudo: sudo::{Module, Call, Storage, Config<T>, Event<T>},
@@ -850,7 +875,10 @@ construct_runtime! {
Identity: identity::{Module, Call, Storage, Event<T>}, Identity: identity::{Module, Call, Storage, Event<T>},
// Proxy module. Late addition. // Proxy module. Late addition.
Proxy: proxy::{Module, Call, Storage, Event<T>} Proxy: proxy::{Module, Call, Storage, Event<T>},
// Multisig dispatch. Late addition.
Multisig: multisig::{Module, Call, Storage, Event<T>},
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-test-runtime" name = "polkadot-test-runtime"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
+3 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "westend-runtime" name = "westend-runtime"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@@ -46,6 +46,7 @@ identity = { package = "pallet-identity", git = "https://github.com/paritytech/s
im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } im-online = { package = "pallet-im-online", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } indices = { package = "pallet-indices", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } membership = { package = "pallet-membership", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
multisig = { package = "pallet-multisig", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } proxy = { package = "pallet-proxy", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -121,6 +122,7 @@ std = [
"im-online/std", "im-online/std",
"indices/std", "indices/std",
"membership/std", "membership/std",
"multisig/std",
"nicks/std", "nicks/std",
"offences/std", "offences/std",
"proxy/std", "proxy/std",
+44 -17
View File
@@ -82,7 +82,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("westend"), spec_name: create_runtime_str!("westend"),
impl_name: create_runtime_str!("parity-westend"), impl_name: create_runtime_str!("parity-westend"),
authoring_version: 2, authoring_version: 2,
spec_version: 20, spec_version: 24,
impl_version: 0, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 1, transaction_version: 1,
@@ -98,12 +98,14 @@ pub fn native_version() -> NativeVersion {
} }
/// Avoid processing transactions from slots and parachain registrar. /// Avoid processing transactions from slots and parachain registrar.
pub struct IsCallable; pub struct BaseFilter;
impl Filter<Call> for IsCallable { impl Filter<Call> for BaseFilter {
fn filter(call: &Call) -> bool { fn filter(call: &Call) -> bool {
!matches!(call, Call::Registrar(_)) !matches!(call, Call::Registrar(_))
} }
} }
pub struct IsCallable;
frame_support::impl_filter_stack!(IsCallable, BaseFilter, Call, is_callable);
parameter_types! { parameter_types! {
pub const Version: RuntimeVersion = VERSION; pub const Version: RuntimeVersion = VERSION;
@@ -520,20 +522,26 @@ impl identity::Trait for Runtime {
type ForceOrigin = system::EnsureRoot<AccountId>; type ForceOrigin = system::EnsureRoot<AccountId>;
} }
parameter_types! {
// One storage item; value is size 4+4+16+32 bytes = 56 bytes.
pub const MultisigDepositBase: Balance = 30 * CENTS;
// Additional storage item size of 32 bytes.
pub const MultisigDepositFactor: Balance = 5 * CENTS;
pub const MaxSignatories: u16 = 100;
}
impl utility::Trait for Runtime { impl utility::Trait for Runtime {
type Event = Event;
type Call = Call;
type IsCallable = IsCallable;
}
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 multisig::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
type Currency = Balances; type Currency = Balances;
type MultisigDepositBase = MultisigDepositBase; type DepositBase = DepositBase;
type MultisigDepositFactor = MultisigDepositFactor; type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories; type MaxSignatories = MaxSignatories;
type IsCallable = IsCallable; type IsCallable = IsCallable;
} }
@@ -585,6 +593,7 @@ pub enum ProxyType {
Any, Any,
NonTransfer, NonTransfer,
Staking, Staking,
SudoBalances,
} }
impl Default for ProxyType { fn default() -> Self { Self::Any } } impl Default for ProxyType { fn default() -> Self { Self::Any } }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<Call> for ProxyType {
@@ -592,9 +601,24 @@ impl InstanceFilter<Call> for ProxyType {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(c, ProxyType::NonTransfer => !matches!(c,
Call::Balances(..) | Call::Utility(..) | Call::Indices(indices::Call::transfer(..)) Call::Balances(..) | Call::Indices(indices::Call::transfer(..))
), ),
ProxyType::Staking => matches!(c, Call::Staking(..)), ProxyType::Staking => matches!(c,
Call::Staking(..) | Call::Utility(utility::Call::batch(..))
| Call::Utility(utility::Call::as_limited_sub(..))
),
ProxyType::SudoBalances => matches!(c,
Call::Sudo(sudo::Call::sudo(x)) if matches!(x.as_ref(), &Call::Balances(..))
),
}
}
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,
} }
} }
} }
@@ -646,7 +670,7 @@ construct_runtime! {
Registrar: registrar::{Module, Call, Storage, Event, Config<T>}, Registrar: registrar::{Module, Call, Storage, Event, Config<T>},
// Utility module. // Utility module.
Utility: utility::{Module, Call, Storage, Event<T>}, Utility: utility::{Module, Call, Event},
// Less simple identity module. // Less simple identity module.
Identity: identity::{Module, Call, Storage, Event<T>}, Identity: identity::{Module, Call, Storage, Event<T>},
@@ -664,7 +688,10 @@ construct_runtime! {
Sudo: sudo::{Module, Call, Storage, Event<T>, Config<T>}, Sudo: sudo::{Module, Call, Storage, Event<T>, Config<T>},
// Proxy module. Late addition. // Proxy module. Late addition.
Proxy: proxy::{Module, Call, Storage, Event<T>} Proxy: proxy::{Module, Call, Storage, Event<T>},
// Multisig module. Late addition.
Multisig: multisig::{Module, Call, Storage, Event<T>},
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-service" name = "polkadot-service"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-statement-table" name = "polkadot-statement-table"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "polkadot-validation" name = "polkadot-validation"
version = "0.8.3" version = "0.8.4"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018" edition = "2018"