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

feat: governance-pre-authorised-calls #3964

Merged
merged 13 commits into from
Sep 11, 2023

Conversation

Janislav
Copy link
Contributor

@Janislav Janislav commented Sep 7, 2023

Pull Request

Closes: PRO-815

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

Please include a succinct description of the purpose and content of the PR. What problem does it solve, and how? Link issues, discussions, other PRs, and anything else that will help the reviewer.

@linear
Copy link

linear bot commented Sep 7, 2023

PRO-815 Governance pre-authorised calls

We need to be able to "pre-authorise" governance calls so that the governance council can prepare a 'big red button' safe mode extrinsic that can be dispatched by any governance council member.

We can add a flag or option to the 'propose' extrinsic that modifies the behaviour such that the call will not be dispatched immediately but requires an explicit call to a new dispatch_whitelisted_call extrinsic in order to be executed.

We still want to default to the old behaviour whereby the call is dispatched as soon as it passes the voting threshold.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #3964 (41be65f) into main (a9a25eb) will decrease coverage by 0%.
The diff coverage is 52%.

@@          Coverage Diff           @@
##            main   #3964    +/-   ##
======================================
- Coverage     72%     72%    -0%     
======================================
  Files        366     366            
  Lines      57082   57211   +129     
  Branches   57082   57211   +129     
======================================
+ Hits       41210   41261    +51     
- Misses     13786   13849    +63     
- Partials    2086    2101    +15     
Files Changed Coverage Δ
api/lib/src/lib.rs 33% <0%> (-<1%) ⬇️
state-chain/pallets/cf-governance/src/weights.rs 35% <34%> (-4%) ⬇️
state-chain/pallets/cf-governance/src/lib.rs 69% <73%> (-1%) ⬇️
...te-chain/pallets/cf-governance/src/benchmarking.rs 96% <100%> (+<1%) ⬆️
state-chain/pallets/cf-governance/src/tests.rs 100% <100%> (ø)

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Janislav Janislav marked this pull request as ready for review September 7, 2023 15:05
@Janislav Janislav requested a review from dandanlen September 7, 2023 15:15
Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

Thanks Jan, looking good, just a couple of minor comments.

@@ -127,6 +129,11 @@ pub mod pallet {
#[pallet::getter(fn gov_key_whitelisted_call_hash)]
pub(super) type GovKeyWhitelistedCallHash<T> = StorageValue<_, GovCallHash, OptionQuery>;

/// Whitelisted pre authorised calls.
#[pallet::storage]
pub(super) type WhitelistedGovCalls<T> =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use either whitelisted or pre-authorised, no need for two different words for the same thing.

@@ -65,11 +65,13 @@ pub mod pallet {
pub call: OpaqueCall,
/// Accounts who have already approved the proposal.
pub approved: BTreeSet<AccountId>,
/// Proposal is pre authorised.
pub pre_authorised: bool,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think an enum would make it clearer what the two options are (ie. automatic/implicit dispatch vs manual/explicit). Otherwise it's not immediately obvious that pre-authorised=false implies that the call will be automatically dispatched.

@dandanlen dandanlen changed the title feature/PRO-815/governance-pre-authorised-calls feat: governance-pre-authorised-calls Sep 11, 2023
@dandanlen dandanlen enabled auto-merge (squash) September 11, 2023 08:27
@dandanlen
Copy link
Collaborator

I made minor naming change + made it so that the Proposal doesn't need a default impl.

@dandanlen dandanlen merged commit 33e9da9 into main Sep 11, 2023
44 checks passed
@dandanlen dandanlen deleted the feature/PRO-815/governance-pre-authorised-calls branch September 11, 2023 09:14
dandanlen added a commit that referenced this pull request Sep 18, 2023
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: dandanlen <3168260+dandanlen@users.noreply.github.com>
dandanlen added a commit that referenced this pull request Sep 28, 2023
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: dandanlen <3168260+dandanlen@users.noreply.github.com>
dandanlen added a commit that referenced this pull request Oct 9, 2023
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: dandanlen <3168260+dandanlen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants