Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tx-pause pallet to make it easier to pause stuff #771

Merged
merged 20 commits into from
Dec 19, 2022

Conversation

ghzlatarev
Copy link
Contributor

@ghzlatarev ghzlatarev commented Aug 24, 2022

Description

closes: #769

  • Splits the UpdateOrigin to PauseOrigin and UnpauseOrigin . PauseOrigin can be both technical committee (1/2) or governance. UnpauseOrigin is only governance
  • Added a list of unpausable pallets - governance + balances
  • Add a special case for function name txp_pause_all_pallets which signifies that the whole pallet is filtered and added a new pause extrinsic that accepts an array of pallet names, to make it easier to pause en-masse quickly. Again the pause-origin is used.
  • add pause_pallets and unpause_pallets where parameter is pallet_name, while function_names is get from metadata by GetMetadata trait
  • add pause_transactions and unpause_transactions which parameter is both pallet_name and Vec<function_name>
  • NOTE: MaxCallNames is used for (pre-charge) weight calculation, and it means the extrinsic count of one pallet, current setting to 10. or we may increase to 20?

image


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Added one label out of the L- group to this PR
  • Added one or more labels out of A- and C- groups to this PR
  • Re-reviewed Files changed in the Github PR explorer.

Situational Notes:

  • If adding functionality, write unit tests!
  • If importing a new pallet, choose a proper module index for it, and allow it in BaseFilter. Ensure every extrinsic works from front-end. If there's corresponding tool, ensure both work for each other.
  • If needed, update our Javascript/Typescript APIs. These APIs are officially used by exchanges or community developers.
  • If modifying existing runtime storage items, make sure to implement storage migrations for the runtime and test them with try-runtime. This includes migrations inherited from upstream changes, and you can search the diffs for modifications of #[pallet::storage] items to check for any.
  • If runtime changes, need to update the version numbers properly:
    • authoring_version: The version of the authorship interface. An authoring node will not attempt to author blocks unless this is equal to its native runtime.
    • spec_version: The version of the runtime specification. A full node will not attempt to use its native runtime in substitute for the on-chain Wasm runtime unless all of spec_name, spec_version, and authoring_version are the same between Wasm and native.
    • impl_version: The version of the implementation of the specification. Nodes are free to ignore this; it serves only as an indication that the code is different; as long as the other two versions are the same then while the actual code may be different, it is nonetheless required to do the same thing. Non-consensus-breaking optimizations are about the only changes that could be made which would result in only the impl_version changing.
    • transaction_version: The version of the extrinsics interface. This number must be updated in the following circumstances: extrinsic parameters (number, order, or types) have been changed; extrinsics or pallets have been removed; or the pallet order in the construct_runtime! macro or extrinsic order in a pallet has been changed. You can run the metadata_diff.yml workflow for help. If this number is updated, then the spec_version must also be updated
  • Verify benchmarks & weights have been updated for any modified runtime logics

…ausable pallets

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
@ghzlatarev ghzlatarev added L-changed Log: Issues and PRs related to changes A-governance Area: Issues and PRs related to Governance labels Aug 24, 2022
@ghzlatarev ghzlatarev self-assigned this Aug 24, 2022
ghzlatarev and others added 5 commits August 24, 2022 17:43
Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
@zqhxuyuan zqhxuyuan marked this pull request as ready for review October 18, 2022 08:12
@ghzlatarev ghzlatarev assigned zqhxuyuan and unassigned ghzlatarev Oct 18, 2022
@ghzlatarev ghzlatarev added the A-calamari Area: Issues and PRs related to the Calamari Runtime label Oct 18, 2022
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
pallets/tx-pause/src/lib.rs Show resolved Hide resolved
pallets/tx-pause/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
ferrell-code
ferrell-code previously approved these changes Oct 31, 2022
Copy link
Contributor

@ferrell-code ferrell-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks sound to me. a few suggestions

pallets/tx-pause/src/lib.rs Show resolved Hide resolved
runtime/calamari/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
@Garandor
Copy link
Contributor

Garandor commented Nov 5, 2022

One thing to consider, if the network is being spammed, can we somehow force the pause_system extrinsic to be preferred in the client? Otherwise we could run the case where we run pause but it never gets included in a block

Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and suggestions

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See open question at #771 (comment)

I'm not convinced we need string parameters and extrinsic pausing

@Garandor Garandor added this to the v4.0.0 milestone Dec 19, 2022
Garandor
Garandor previously approved these changes Dec 19, 2022
Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Garandor Garandor self-requested a review December 19, 2022 18:05
Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after run-tests fix

Signed-off-by: Adam Reif <Garandor@manta.network>
@Garandor Garandor merged commit aa83001 into manta Dec 19, 2022
@Garandor Garandor deleted the ghzlatarev/tx-pause-update branch December 19, 2022 23:36
ferrell-code pushed a commit that referenced this pull request Dec 27, 2022
* Split UpdateOrigin to PauseOrigin and Upnause origin. Add list of unpausable pallets

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>

* Fix tests and add new ones

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>

* Add pause_pallets extrinsic to pause multiple pallets

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>

* Fix benchmark tests

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>

* Use 2/6 tech committee for PauseOrigin

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>

* update tx-pause tests

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* pause_pallets and weight draft

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* update weight calculation

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* weight test works

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* fix clippy

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* TxPause pallet whitelist in filter

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* change MaxCallNames to 25

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* rename to NonPausablePallets

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* EnsureMembers not work on manta yet

Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>

* fix syntax change

Signed-off-by: Adam Reif <Garandor@manta.network>

Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
Signed-off-by: zqhxuyuan <zqhxuyuan@gmail.com>
Signed-off-by: Adam Reif <Garandor@manta.network>
Co-authored-by: zqhxuyuan <zqhxuyuan@gmail.com>
Co-authored-by: Adam Reif <garandor@manta.network>
Signed-off-by: Charles Ferrell <charlie@manta.network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-calamari Area: Issues and PRs related to the Calamari Runtime A-governance Area: Issues and PRs related to Governance L-changed Log: Issues and PRs related to changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TX-pause updates & Maintenance Mode
4 participants