Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

OpenGov improvements for Kusama #6372

Merged
merged 12 commits into from
Dec 5, 2022
Next Next commit
Tweaks to optimise gov2
  • Loading branch information
gavofyork committed Nov 30, 2022
commit 6f18e65afdf10fb3721fa05556011810fb861a88
2 changes: 2 additions & 0 deletions runtime/common/src/crowdloan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

pub mod migration;

// TODO: Expose the total amount held.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't ReservedAmount from the Auctions pallet capture everything in crowdloans and self-funded bids?

Copy link
Member Author

Choose a reason for hiding this comment

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

Self-funded bids can still be used in governance.

Copy link
Contributor

@joepetrowski joepetrowski Dec 3, 2022

Choose a reason for hiding this comment

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


use crate::{
slot_range::SlotRange,
traits::{Auctioneer, Registrar},
Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/src/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl pallet_conviction_voting::Config for Runtime {
type Currency = Balances;
type VoteLockingPeriod = VoteLockingPeriod;
type MaxVotes = ConstU32<512>;
// TODO: Should be `total_issuance` minus funds trapped in system pots (NIS, crowdloans, treasury)
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
muharem marked this conversation as resolved.
Show resolved Hide resolved
type Polls = Referenda;
}
Expand Down
2 changes: 2 additions & 0 deletions runtime/kusama/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub mod pallet_custom_origins {
}
decl_unit_ensures!(
StakingAdmin,
Treasurer,
FellowshipAdmin,
GeneralAdmin,
AuctionAdmin,
Expand Down Expand Up @@ -173,6 +174,7 @@ pub mod pallet_custom_origins {
SmallSpender = 10 * GRAND,
MediumSpender = 100 * GRAND,
BigSpender = 1_000 * GRAND,
Treasurer = 10_000 * GRAND,
}
}

Expand Down
44 changes: 22 additions & 22 deletions runtime/kusama/src/governance/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
pallet_referenda::TrackInfo {
name: "root",
max_deciding: 1,
decision_deposit: 1_000 * GRAND,
prepare_period: 3 * HOURS,
decision_deposit: 100 * GRAND,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 3 * HOURS,
Expand All @@ -85,8 +85,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
pallet_referenda::TrackInfo {
name: "whitelisted_caller",
max_deciding: 10,
decision_deposit: 10_000 * GRAND,
prepare_period: 3 * HOURS,
decision_deposit: 100 * GRAND,
Copy link
Contributor

@brenzi brenzi Dec 3, 2022

Choose a reason for hiding this comment

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

thank you for this. But doesn't this setup now mean that one can maliciously jam this track with just 10*100 GRAND, which is only 3.33k KSM. Or is there a "decision gate" requiring the whitlelisting to be done to enter deciding?
Why not set max_deciding to 1000? Thanks to the fellowship we can always filter referenda on this track by whitelisting status

Copy link
Contributor

Choose a reason for hiding this comment

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

The root track would have the same issue then. I wonder if the better option is to set the Root track to a high decision deposit and also allow the WhitelistOrigin to remove proposals from the WhitelistedCaller track, essentially saying "we're not going to Whitelist this call so there's no need for a Whitelist track referendum".

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated QUID and increased the max_deciding so this is now 100 kKSM to jam it. With ReferendumKiller origin, we can remove spam and slash the spammer's deposits.

prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 10 * MINUTES,
min_enactment_period: 30 * MINUTES,
Expand All @@ -100,7 +100,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "staking_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder why min_enactment_period of the staking admin track would be less than of the root?

Copy link
Member Author

Choose a reason for hiding this comment

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

Root is hugely dangerous, so we're being a bit more conservative on the enactment time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I expressed it wrong, the root min_enactment_period less than staking_admin now.
root 3 hours vs staking_admin 2 days

Expand All @@ -114,7 +114,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "treasurer",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Expand All @@ -128,7 +128,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "lease_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Expand All @@ -142,7 +142,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "fellowship_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Expand All @@ -156,7 +156,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "general_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Expand All @@ -170,7 +170,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "auction_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 2 * DAYS,
Expand All @@ -184,7 +184,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "referendum_canceller",
max_deciding: 1_000,
decision_deposit: 50 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES,
Expand All @@ -198,7 +198,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "referendum_killer",
max_deciding: 1_000,
decision_deposit: 50 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES,
Expand All @@ -212,10 +212,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "small_tipper",
max_deciding: 200,
decision_deposit: 5 * QUID,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 28 * DAYS,
min_enactment_period: 24 * HOURS,
min_approval: APP_SMALL_TIPPER,
min_support: SUP_SMALL_TIPPER,
},
Expand All @@ -226,10 +226,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "big_tipper",
max_deciding: 100,
decision_deposit: 50 * QUID,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 6 * HOURS,
min_enactment_period: 28 * DAYS,
min_enactment_period: 24 * HOURS,
min_approval: APP_BIG_TIPPER,
min_support: SUP_BIG_TIPPER,
},
Expand All @@ -240,10 +240,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "small_spender",
max_deciding: 50,
decision_deposit: 500 * QUID,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 12 * HOURS,
min_enactment_period: 28 * DAYS,
min_enactment_period: 24 * HOURS,
min_approval: APP_SMALL_SPENDER,
min_support: SUP_SMALL_SPENDER,
},
Expand All @@ -254,10 +254,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "medium_spender",
max_deciding: 20,
decision_deposit: 1_500 * QUID,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 24 * HOURS,
min_enactment_period: 28 * DAYS,
min_enactment_period: 24 * HOURS,
min_approval: APP_MEDIUM_SPENDER,
min_support: SUP_MEDIUM_SPENDER,
},
Expand All @@ -268,10 +268,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
name: "big_spender",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 4,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
Copy link
Contributor

@brenzi brenzi Dec 3, 2022

Choose a reason for hiding this comment

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

any chance we can set decision_period to 7 DAYS for all spenders and tippers? The curves are quite demanding on the support threshold. 28 days means a lot of planning and exchange rate uncertainty, which is harmful for ecosystem dev teams

Copy link
Member Author

Choose a reason for hiding this comment

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

Reduced to 14 days throughout, with tippers at 7 days.

The curves are designed to be safe. If a faster conclusion is desired by teams, then I think they really ought to be helping increase turnout for their proposal from token holders/voters.

confirm_period: 48 * HOURS,
min_enactment_period: 28 * DAYS,
min_enactment_period: 24 * HOURS,
min_approval: APP_BIG_SPENDER,
min_support: SUP_BIG_SPENDER,
},
Expand Down
4 changes: 2 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ parameter_types! {
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
type ApproveOrigin = EnsureRoot<AccountId>;
type RejectOrigin = EnsureRoot<AccountId>;
type ApproveOrigin = Treasurer;
type RejectOrigin = Treasurer;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
Expand Down