Commit 3710edfe authored by Oliver Tale-Yazdi's avatar Oliver Tale-Yazdi Committed by GitHub
Browse files

[FRAME Core] New pallets: `safe-mode` and `tx-pause` (#12092)



* Add safe-mode

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update pallet

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add to kitchensink-runtime

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Spelling

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Rename to tx-pause

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add SafeMode pallet

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* fmt

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Automatically disable safe-mode in on_init…

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add permissionless enable+extend

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add repay+slash stake methods

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add docs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix stakes storage

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Genesis config for safe-mode pallet

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Genesis config for safe-mode pallet

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Rename ExtrinsicName to FunctionName

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Origin variable duration

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Rename FunctionName -> CallName

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Rename and docs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Pallet safe mode tests (#12148)

* Add safe-mode mock runtime
* Add safe-mode tests
* Add ForceEnable- and ForceExtendOrigin
* Start dummy benchmarks
Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Tests for `pallet-tx-pause` (#12259)

* mock added
* tests added
* dummy benchmarks started

* rename to active/inactive
tests broken, in progress

* Runtime types, fix tests

* WIP safe mode and tx pause {continued} (#12371)

* test coverage on safe mode and tx pause
* benchmarks & tests
* tests passing, use FullNameOf to check tx-pause unfilterables
* naming updates

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>

* Set block number

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* dummy weights generated, safe mode

* add repay_reservation call with RepaymentDelay per #10033 feature requirements

* make call name optional to allow pausing pallets, handle `Contains` correctly for this throughout, doc comments started

* move to full_name notation for all interfaces, last commit introduced 1 more storage read.

* refactor is_paused

* safe math on safe mode

* Make stuff compile

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Compile

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Cleanup & renames

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Cleanup TxPause pallet

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix benches

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* fmt

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Refactor to fungibles::* and rename stuf

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Make compile

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix node config

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Typos

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Remove CausalHoldReason

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Refactor benchmarks and runtime configs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add traits

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Remove old code

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Cleanup safe-mode benches

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/safe-mode/Cargo.toml

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/safe-mode/Cargo.toml

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Docs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Remove getters

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update Cargo.lock

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Remove phantom

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix test

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Remove phantom

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Apply suggestions from code review

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Use new as Origin benchmarking syntax

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Docs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix node

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix tx-pause benches

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Renames

* Remove duplicate test

* Add docs

* docs

* Apply suggestions from code review

Co-authored-by: default avatarLiam Aharon <[email protected]>
Co-authored-by: default avatarMuharem Ismailov <[email protected]>
Co-authored-by: default avatarGonçalo Pestana <[email protected]>

* Cleanup tests

* docs

* Cleanup GenesisConfigs

* Doc traits

* Remove PauseTooLongNames

* docs

* Use V2 benchmarking

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Use RuntimeHoldReason

* Fix kitchensink runtime

* Fix CI

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix CI

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Review

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Rename Stake to Deposit

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add docs

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Add Notify and test it

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix kitchensink

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Update frame/safe-mode/src/tests.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/safe-mode/src/tests.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/tx_pause.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/tx-pause/src/lib.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/tx-pause/src/lib.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/tx-pause/src/mock.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Simplify code

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Update frame/support/src/traits/safe_mode.rs

Co-authored-by: default avatarLiam Aharon <[email protected]>

* Fixup merge

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Make stuff compile

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Make tx-pause compile again

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix features

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* Fix more features

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

* ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_safe_mode

* Update weights

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>

---------

Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
Co-authored-by: default avatarDan Shields <[email protected]>
Co-authored-by: default avatarDan Shields <[email protected]>
Co-authored-by: default avatarLiam Aharon <[email protected]>
Co-authored-by: default avatarMuharem Ismailov <[email protected]>
Co-authored-by: default avatarGonçalo Pestana <[email protected]>
Co-authored-by: command-bot <>
parent 46bd466e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment