-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
tx-pause
to all runtimes (#1381)
* Add `tx-pause` to all runtimes * Add tests * Fix tests
- Loading branch information
Showing
23 changed files
with
196 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,8 @@ mod preimage; | |
|
||
mod proxy; | ||
|
||
mod tx_pause; | ||
|
||
// XCM stuff. | ||
mod xcmp_queue; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of Darwinia. | ||
// | ||
// Copyright (C) 2018-2023 Darwinia Network | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// | ||
// Darwinia is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Darwinia is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
// darwinia | ||
use crate::*; | ||
|
||
/// Calls that cannot be paused by the tx-pause pallet. | ||
pub struct TxPauseWhitelistedCalls; | ||
impl frame_support::traits::Contains<pallet_tx_pause::RuntimeCallNameOf<Runtime>> | ||
for TxPauseWhitelistedCalls | ||
{ | ||
fn contains(full_name: &pallet_tx_pause::RuntimeCallNameOf<Runtime>) -> bool { | ||
matches!( | ||
(full_name.0.as_slice(), full_name.1.as_slice()), | ||
(b"System", b"remark_with_event") | ||
) | ||
} | ||
} | ||
|
||
impl pallet_tx_pause::Config for Runtime { | ||
type MaxNameLen = ConstU32<256>; | ||
type PauseOrigin = RootOrAtLeastTwoThird<TechnicalCollective>; | ||
type RuntimeCall = RuntimeCall; | ||
type RuntimeEvent = RuntimeEvent; | ||
type UnpauseOrigin = RootOrAtLeastTwoThird<TechnicalCollective>; | ||
// TODO: Update the benchmark weight info | ||
type WeightInfo = (); | ||
type WhitelistedCalls = TxPauseWhitelistedCalls; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,8 @@ mod preimage; | |
|
||
mod proxy; | ||
|
||
mod tx_pause; | ||
|
||
// XCM stuff. | ||
mod xcmp_queue; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of Darwinia. | ||
// | ||
// Copyright (C) 2018-2023 Darwinia Network | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// | ||
// Darwinia is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Darwinia is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
// darwinia | ||
use crate::*; | ||
|
||
/// Calls that cannot be paused by the tx-pause pallet. | ||
pub struct TxPauseWhitelistedCalls; | ||
impl frame_support::traits::Contains<pallet_tx_pause::RuntimeCallNameOf<Runtime>> | ||
for TxPauseWhitelistedCalls | ||
{ | ||
fn contains(full_name: &pallet_tx_pause::RuntimeCallNameOf<Runtime>) -> bool { | ||
matches!( | ||
(full_name.0.as_slice(), full_name.1.as_slice()), | ||
(b"System", b"remark_with_event") | ||
) | ||
} | ||
} | ||
|
||
impl pallet_tx_pause::Config for Runtime { | ||
type MaxNameLen = ConstU32<256>; | ||
type PauseOrigin = RootOrAtLeastTwoThird<TechnicalCollective>; | ||
type RuntimeCall = RuntimeCall; | ||
type RuntimeEvent = RuntimeEvent; | ||
type UnpauseOrigin = RootOrAtLeastTwoThird<TechnicalCollective>; | ||
// TODO: Update the benchmark weight info | ||
type WeightInfo = (); | ||
type WhitelistedCalls = TxPauseWhitelistedCalls; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.