Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: add tx-pause to all runtimes
  • Loading branch information
sander2 committed Jan 20, 2023
commit f4d8c211cd132e098397f84d361164a816e22afd
4 changes: 4 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions parachain/runtime/interlay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ supply = { path = "../../../crates/supply", default-features = false }
collator-selection = { path = "../../../crates/collator-selection", default-features = false }
clients-info = { path = "../../../crates/clients-info", default-features = false }
traits = { path = "../../../crates/traits", default-features = false }
tx-pause = { path = "../../../crates/tx-pause", default-features = false }

primitives = { package = "interbtc-primitives", path = "../../../primitives", default-features = false }

Expand Down Expand Up @@ -213,6 +214,7 @@ std = [
"collator-selection/std",
"clients-info/std",
"traits/std",
"tx-pause/std",

"primitives/std",

Expand Down Expand Up @@ -256,6 +258,7 @@ runtime-benchmarks = [
"redeem/runtime-benchmarks",
"replace/runtime-benchmarks",
"vault-registry/runtime-benchmarks",
"tx-pause/runtime-benchmarks",
]
disable-runtime-api = []
try-runtime = [
Expand Down
25 changes: 20 additions & 5 deletions parachain/runtime/interlay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,11 @@ impl Contains<RuntimeCall> for BaseCallFilter {
if matches!(
call,
RuntimeCall::System(_)
| RuntimeCall::Authorship(_)
| RuntimeCall::Session(_)
| RuntimeCall::Timestamp(_)
| RuntimeCall::ParachainSystem(_)
| RuntimeCall::Sudo(_)
| RuntimeCall::Democracy(_)
| RuntimeCall::Escrow(_)
| RuntimeCall::TechnicalCommittee(_)
| RuntimeCall::Sudo(_)
) {
// always allow core calls
true
Expand All @@ -188,7 +185,8 @@ impl Contains<RuntimeCall> for BaseCallFilter {
// governance bypasses this call filter).
false
} else {
true
// normal operation: allow all calls that are not explicitly paused
TxPause::contains(call)
}
}
}
Expand Down Expand Up @@ -1136,6 +1134,22 @@ impl clients_info::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const MaxNameLen: u32 = 128;
pub const PauseTooLongNames: bool = false;
}

impl tx_pause::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PauseOrigin = EnsureRoot<AccountId>;
type UnpauseOrigin = EnsureRoot<AccountId>;
type WhitelistCallNames = Nothing;
type MaxNameLen = MaxNameLen;
type PauseTooLongNames = PauseTooLongNames;
type WeightInfo = ();
}

construct_runtime! {
pub enum Runtime where
Block = Block,
Expand All @@ -1152,6 +1166,7 @@ construct_runtime! {
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 7,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 8,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 9,
TxPause: tx_pause::{Pallet, Call, Storage, Event<T>} = 10,

// # Tokens & Balances
Currency: currency::{Pallet} = 20,
Expand Down
3 changes: 3 additions & 0 deletions parachain/runtime/kintsugi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ supply = { path = "../../../crates/supply", default-features = false }
collator-selection = { path = "../../../crates/collator-selection", default-features = false }
clients-info = { path = "../../../crates/clients-info", default-features = false }
traits = { path = "../../../crates/traits", default-features = false }
tx-pause = { path = "../../../crates/tx-pause", default-features = false }

primitives = { package = "interbtc-primitives", path = "../../../primitives", default-features = false }

Expand Down Expand Up @@ -219,6 +220,7 @@ std = [
"collator-selection/std",
"clients-info/std",
"traits/std",
"tx-pause/std",

"primitives/std",

Expand Down Expand Up @@ -262,6 +264,7 @@ runtime-benchmarks = [
"redeem/runtime-benchmarks",
"replace/runtime-benchmarks",
"vault-registry/runtime-benchmarks",
"tx-pause/runtime-benchmarks",
]
disable-runtime-api = []
try-runtime = [
Expand Down
24 changes: 20 additions & 4 deletions parachain/runtime/kintsugi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,11 @@ impl Contains<RuntimeCall> for BaseCallFilter {
if matches!(
call,
RuntimeCall::System(_)
| RuntimeCall::Authorship(_)
| RuntimeCall::Timestamp(_)
| RuntimeCall::ParachainSystem(_)
| RuntimeCall::Sudo(_)
| RuntimeCall::Democracy(_)
| RuntimeCall::Escrow(_)
| RuntimeCall::TechnicalCommittee(_)
| RuntimeCall::Sudo(_)
) {
// always allow core calls
true
Expand All @@ -185,7 +183,8 @@ impl Contains<RuntimeCall> for BaseCallFilter {
// governance bypasses this call filter).
false
} else {
true
// normal operation: allow all calls that are not explicitly paused
TxPause::contains(call)
}
}
}
Expand Down Expand Up @@ -1134,6 +1133,22 @@ impl clients_info::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const MaxNameLen: u32 = 128;
pub const PauseTooLongNames: bool = false;
}

impl tx_pause::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PauseOrigin = EnsureRoot<AccountId>;
type UnpauseOrigin = EnsureRoot<AccountId>;
type WhitelistCallNames = Nothing;
type MaxNameLen = MaxNameLen;
type PauseTooLongNames = PauseTooLongNames;
type WeightInfo = ();
}

construct_runtime! {
pub enum Runtime where
Block = Block,
Expand All @@ -1150,6 +1165,7 @@ construct_runtime! {
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 7,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 8,
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 9,
TxPause: tx_pause::{Pallet, Call, Storage, Event<T>} = 10,

// # Tokens & Balances
Currency: currency::{Pallet} = 20,
Expand Down
3 changes: 3 additions & 0 deletions parachain/runtime/testnet-interlay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ collator-selection = { path = "../../../crates/collator-selection", default-feat
clients-info = { path = "../../../crates/clients-info", default-features = false }
loans = { path = "../../../crates/loans", default-features = false }
traits = { path = "../../../crates/traits", default-features = false }
tx-pause = { path = "../../../crates/tx-pause", default-features = false }

primitives = { package = "interbtc-primitives", path = "../../../primitives", default-features = false }

Expand Down Expand Up @@ -220,6 +221,7 @@ std = [
"clients-info/std",
"loans/std",
"traits/std",
"tx-pause/std",

"primitives/std",

Expand Down Expand Up @@ -265,6 +267,7 @@ runtime-benchmarks = [
"redeem/runtime-benchmarks",
"replace/runtime-benchmarks",
"vault-registry/runtime-benchmarks",
"tx-pause/runtime-benchmarks",
]
disable-runtime-api = []
dev-interlay = []
Expand Down
22 changes: 19 additions & 3 deletions parachain/runtime/testnet-interlay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ impl Contains<RuntimeCall> for BaseCallFilter {
if matches!(
call,
RuntimeCall::System(_)
| RuntimeCall::Authorship(_)
| RuntimeCall::Timestamp(_)
| RuntimeCall::ParachainSystem(_)
| RuntimeCall::Sudo(_)
| RuntimeCall::Democracy(_)
| RuntimeCall::Escrow(_)
Expand All @@ -188,7 +186,8 @@ impl Contains<RuntimeCall> for BaseCallFilter {
// governance bypasses this call filter).
false
} else {
true
// normal operation: allow all calls that are not explicitly paused
TxPause::contains(call)
}
}
}
Expand Down Expand Up @@ -1106,6 +1105,22 @@ impl clients_info::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const MaxNameLen: u32 = 128;
pub const PauseTooLongNames: bool = false;
}

impl tx_pause::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PauseOrigin = EnsureRoot<AccountId>;
type UnpauseOrigin = EnsureRoot<AccountId>;
type WhitelistCallNames = Nothing;
type MaxNameLen = MaxNameLen;
type PauseTooLongNames = PauseTooLongNames;
type WeightInfo = ();
}

impl loans::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type PalletId = LoansPalletId;
Expand Down Expand Up @@ -1135,6 +1150,7 @@ construct_runtime! {
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 7,
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 8,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 9,
TxPause: tx_pause::{Pallet, Call, Storage, Event<T>} = 10,

// # Tokens & Balances
Currency: currency::{Pallet} = 20,
Expand Down
3 changes: 3 additions & 0 deletions parachain/runtime/testnet-kintsugi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ clients-info = { path = "../../../crates/clients-info", default-features = false
loans = { path = "../../../crates/loans", default-features = false }
traits = { path = "../../../crates/traits", default-features = false }
farming = { path = "../../../crates/farming", default-features = false }
tx-pause = { path = "../../../crates/tx-pause", default-features = false }

primitives = { package = "interbtc-primitives", path = "../../../primitives", default-features = false }

Expand Down Expand Up @@ -229,6 +230,7 @@ std = [
"loans/std",
"traits/std",
"farming/std",
"tx-pause/std",

"primitives/std",

Expand Down Expand Up @@ -281,6 +283,7 @@ runtime-benchmarks = [
"replace/runtime-benchmarks",
"vault-registry/runtime-benchmarks",
"farming/runtime-benchmarks",
"tx-pause/runtime-benchmarks",
]
disable-runtime-api = []
dev-interlay = []
Expand Down
22 changes: 19 additions & 3 deletions parachain/runtime/testnet-kintsugi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ impl Contains<RuntimeCall> for BaseCallFilter {
if matches!(
call,
RuntimeCall::System(_)
| RuntimeCall::Authorship(_)
| RuntimeCall::Timestamp(_)
| RuntimeCall::ParachainSystem(_)
| RuntimeCall::Sudo(_)
| RuntimeCall::Democracy(_)
| RuntimeCall::Escrow(_)
Expand All @@ -190,7 +188,8 @@ impl Contains<RuntimeCall> for BaseCallFilter {
// governance bypasses this call filter).
false
} else {
true
// normal operation: allow all calls that are not explicitly paused
TxPause::contains(call)
}
}
}
Expand Down Expand Up @@ -1136,6 +1135,22 @@ impl clients_info::Config for Runtime {
type WeightInfo = ();
}

parameter_types! {
pub const MaxNameLen: u32 = 128;
pub const PauseTooLongNames: bool = false;
}

impl tx_pause::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PauseOrigin = EnsureRoot<AccountId>;
type UnpauseOrigin = EnsureRoot<AccountId>;
type WhitelistCallNames = Nothing;
type MaxNameLen = MaxNameLen;
type PauseTooLongNames = PauseTooLongNames;
type WeightInfo = ();
}

impl loans::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type PalletId = LoansPalletId;
Expand Down Expand Up @@ -1165,6 +1180,7 @@ construct_runtime! {
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 7,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 8,
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 9,
TxPause: tx_pause::{Pallet, Call, Storage, Event<T>} = 10,

// # Tokens & Balances
Currency: currency::{Pallet} = 20,
Expand Down