-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[FRAME Core] New pallets: safe-mode
and tx-pause
#12092
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
We are missing the origin where some user can "transfer a huge amount of dot" to trigger a tx pause or safe mode for a temporary period of time. |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/parachain-technical-summit-next-steps/51/8 |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/parachain-technical-summit-next-steps/51/1 |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
I think they're fine as two pallets which can be used to work together. There should be a means of specifying an Any deposit made for inducing safe mode should not be returned by default. A simple solution would be for it to go into the treasury and be paid back only by an explicit treasury spend. A more sophisticated solution would have it be reserved and refunded by a particular Beyond that, I think design-wise it's good. |
Then we should have some sane-defaults that the pallets dont ban each other.
Okay. I assume the required stake is either also returned by that or scales with a configured formula.
Currently only a PS: I will probably rename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a few suggestions related only to safe-mode
for now, although take them with a grain of salt: perhaps I am missing something.
@ggwpez we need a impl for #[pallet::genesis_config]
&& #[pallet::genesis_build]
, are you intending on adding these?
Doing a read here, I have some thoughts I hope it's not too much to discuss here 🙏 Doubts & Questions:
Design changes?
|
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Happy birthday 🥳 Going to merge as |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
bot bench substrate-pallet --pallet=pallet_safe_mode |
@ggwpez https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3437154 was started for your command Comment |
bot bench substrate-pallet --pallet=pallet_tx_pause |
@ggwpez https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3437155 was started for your command Comment |
…=dev --target_dir=substrate --pallet=pallet_safe_mode
@ggwpez Command |
@ggwpez Command |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: 1 review requesting changes and 2 approving reviews by reviewers with write access. |
Bot merge |
Adds two new pallets:
SafeMode
andTxPause
. Closes paritytech/polkadot-sdk#274, closes paritytech/polkadot-sdk#302. Depends on paritytech/polkadot-sdk#208SafeMode pallet
The safe-mode pallet provides a big STOP button to to put the chain in safe-mode and thereby only permitting a certain subset of operations. The pallet provides a
WhitelistedCalls
which contains all calls that can be executed in safe-mode.It can be permissionessly enabled by anyone by reserving a large deposit. The safe-mode pallet is used by the runtime as call filter:
Calls
enter:
Enter the safe-mode permissionlessly for
EnterDuration
blocks.Reserves an
EnableDepositAmount
amount of balance from the caller.This call can be disabled by configuring
EnterDepositAmount
toNone
.The intention is to allow heavily invested entities to stop the chain in case they are convinced that there is an ongoing attack that can be prevented or mitigated via the safe-mode. Governance would then investigate and refund the deposit afterwards. Abuse can be disincentivized through the possibility of slashing said deposit.
force_enter:
Allows only only
ForceEnterOrigin
to forcefully enter the safe-mode for a number of blocks that can be configured viaEnsureOrigin
.This could be done by a technical governance body in order to quickly respond to an attack or exploit.
extend:
Extend the safe-mode permissionlessly for
ExtendDuration
more blocks.Reserves
ExtendDepositAmount
from the caller's account.This call can be disabled by configuring
ExtendDepositAmount
toNone
.Same intention as
enter
, just about prolonging instead of initiating the safe-mode.force_extend:
Allows only only
ForceExtendOrigin
to forcefully extend the safe-mode for a number of blocks that can be configured viaEnsureOrigin
.force_exit:
Permissioned call to instantly disable the safe-mode.
release_deposit(account, block_number):
Permissionlessly repay the deposit to the
account
that enabled the safe-mode in blockblock_number
. Can only be called if the safe-mode is exited and and ifReleaseDelay
is configured toSome(delay)
has passed.force_slash_deposit(account, block_number):
Permissioned call to slash the deposit of the
account
that enabled the safe-mode in blockblock_number
.on_initialize:
Disables the safe-mode if its duration ran out in this block.
TxPause pallet
The TxPause pallet can be used to pause specific calls. Think of it as a dynamic call filter that can be controlled with extrinsics.
It currently features per-call pausing, but per-pallet pausing would also be possible. This is similar to what many para-chains currently have deployed.
This pallet currently operates on pallet and call names instead of indices. Depends on paritytech/polkadot-sdk#208
Can also be used as call-filter by the runtime together with the
SafeMode
:Calls
pause_call(pallet, function):
Permissioned call to pause a specific call.
unpause_call(pallet, function):
Permissioned call to unpause a specific call.
TODOS: