Skip to content

Commit

Permalink
Merge pull request #670 from galacticcouncil/sunset_govv1
Browse files Browse the repository at this point in the history
feat: Sunset gov v1
  • Loading branch information
vgantchev authored Sep 18, 2024
2 parents d6f885a + 0504224 commit c7a0f1b
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 649 deletions.
9 changes: 3 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.0.3"
version = "1.0.4"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand All @@ -26,10 +26,7 @@ pallet-marketplace = { workspace = true}
primitives = { default-features = false, path = "../primitives" }

pallet-treasury = { workspace = true }
pallet-democracy = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-elections-phragmen = { workspace = true }
pallet-tips = { workspace = true }

# collator support
pallet-collator-selection = { workspace = true }
Expand Down Expand Up @@ -148,7 +145,6 @@ std = [
"pallet-asset-registry/std",
"pallet-aura/std",
"pallet-balances/std",
"pallet-elections-phragmen/std",
"pallet-nft/std",
"pallet-marketplace/std",
"pallet-session/std",
Expand Down Expand Up @@ -178,9 +174,7 @@ std = [
"sp-version/std",
"pallet-treasury/std",
"pallet-collective/std",
"pallet-democracy/std",
"pallet-scheduler/std",
"pallet-tips/std",
"pallet-collator-selection/std",
"pallet-authorship/std",
"basilisk-runtime/std",
Expand Down
9 changes: 5 additions & 4 deletions integration-tests/src/transact_call_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ fn blocked_transact_calls_should_not_pass_filter() {

OtherParachain::execute_with(|| {
// filtered by SafeCallFilter
let call = pallet_tips::Call::<basilisk_runtime::Runtime>::report_awesome {
reason: vec![0, 10],
who: BOB.into(),
let call = pallet_treasury::Call::<basilisk_runtime::Runtime>::spend_local {
amount: UNITS,
beneficiary: ALICE.into(),
};

let bsx_loc = Location::new(
1,
cumulus_primitives_core::Junctions::X2(Arc::new(
Expand Down Expand Up @@ -150,7 +151,7 @@ fn blocked_transact_calls_should_not_pass_filter() {
Transact {
require_weight_at_most: Weight::from_parts(10_000_000_000, 0u64),
origin_kind: OriginKind::Native,
call: basilisk_runtime::RuntimeCall::Tips(call).encode().into(),
call: basilisk_runtime::RuntimeCall::Treasury(call).encode().into(),
},
ExpectTransactStatus(MaybeErrorCode::Success),
RefundSurplus,
Expand Down
2 changes: 0 additions & 2 deletions launch-configs/chopsticks/basilisk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ import-storage:
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- 1
- free: '100000000000000000000'
Council:
Members: [5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
TechnicalCommittee:
Members: [5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk"
version = "15.0.0"
version = "16.0.0"
description = "Basilisk node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
7 changes: 0 additions & 7 deletions node/src/chain_spec/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
INITIAL_BALANCE,
),
],
// council_members
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
// tech_committee_members
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -102,11 +100,6 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
vec![(1, INITIAL_TOKEN_BALANCE), (2, INITIAL_TOKEN_BALANCE)],
),
],
// elections
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
INITIAL_TOKEN_BALANCE,
)],
// parachain ID
PARA_ID.into(),
);
Expand Down
8 changes: 0 additions & 8 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ where
pub fn parachain_genesis(
initial_authorities: (Vec<(AccountId, AuraId)>, Balance), // (initial auths, candidacy bond)
endowed_accounts: Vec<(AccountId, Balance)>,
council_members: Vec<AccountId>,
tech_committee_members: Vec<AccountId>,
registered_assets: Vec<(Vec<u8>, Balance, Option<AssetId>)>,
accepted_assets: Vec<(AssetId, Price)>, // (Asset id, Fallback price) - asset which fee can be paid with
token_balances: Vec<(AccountId, Vec<(AssetId, Balance)>)>,
elections: Vec<(AccountId, Balance)>,
parachain_id: ParaId,
) -> serde_json::Value {
serde_json::json!({
Expand Down Expand Up @@ -130,17 +128,11 @@ pub fn parachain_genesis(
"candidacyBond": initial_authorities.1,
"desiredCandidates": 0u32,
},
"council": {
"members": council_members,
},
"duster": {
"accountBlacklist": vec![get_account_id_from_seed::<sr25519::Public>("Duster")],
"rewardAccount": Some(get_account_id_from_seed::<sr25519::Public>("Duster")),
"dustAccount": Some(get_account_id_from_seed::<sr25519::Public>("Duster"))
},
"elections": {
"members": elections,
},
"emaOracle": {
},
"multiTransactionPayment": {
Expand Down
4 changes: 0 additions & 4 deletions node/src/chain_spec/paseo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ pub fn _parachain_config_paseo() -> Result<ChainSpec, String> {
INITIAL_BALANCE,
), // collator-02
],
// council_members
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
// tech_committee_members
vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo
// registered_assets
Expand All @@ -81,8 +79,6 @@ pub fn _parachain_config_paseo() -> Result<ChainSpec, String> {
vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))],
// token_balances
vec![],
// elections
vec![],
// parachain ID
PARA_ID.into(),
);
Expand Down
4 changes: 0 additions & 4 deletions node/src/chain_spec/rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ pub fn _parachain_config_rococo() -> Result<ChainSpec, String> {
INITIAL_BALANCE,
), // collator-02
],
// council_members
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
// tech_committee_members
vec![hex!["3418b257de81886bef265495f3609def9a083869f32ef5a03f7351956497d41a"].into()], // same as sudo
// registered_assets
Expand All @@ -79,8 +77,6 @@ pub fn _parachain_config_rococo() -> Result<ChainSpec, String> {
vec![(1, Price::from_float(0.0000212)), (2, Price::from_float(0.000806))],
// token_balances
vec![],
// elections
vec![],
// parachain ID
PARA_ID.into(),
);
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk-runtime"
version = "119.0.0"
version = "120.0.0"
authors = ["GalacticCouncil"]
edition = "2021"
homepage = "https://github.com/galacticcouncil/Basilisk-node"
Expand Down
2 changes: 1 addition & 1 deletion runtime/basilisk/src/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use sp_runtime::{traits::IdentityLookup, DispatchError};

pub mod origins;
mod tracks;
// Old governance configurations.
// Old governance pallet, remove once storage is safe to wipe (6mo voting lockup).
pub mod old;

pub type TechCommitteeMajority = EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 2>;
Expand Down
120 changes: 9 additions & 111 deletions runtime/basilisk/src/governance/old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,12 @@ use crate::governance::TechnicalCollective;
use crate::*;

use primitives::constants::{
currency::{CENTS, DOLLARS, UNITS},
currency::DOLLARS,
time::{DAYS, HOURS},
};

use frame_support::{
parameter_types,
sp_runtime::{Perbill, Percent},
traits::{EitherOfDiverse, LockIdentifier},
};
use frame_support::parameter_types;
use frame_system::{EnsureRoot, EnsureSigned};
use pallet_collective::EnsureProportionAtLeast;
use sp_staking::currency_to_vote::U128CurrencyToVote;

pub type MajorityCouncilOrRoot =
EitherOfDiverse<EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>, EnsureRoot<AccountId>>;
pub type UnanimousCouncilOrRoot =
EitherOfDiverse<EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>, EnsureRoot<AccountId>>;
pub type SuperMajorityCouncilOrRoot =
EitherOfDiverse<EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>, EnsureRoot<AccountId>>;
pub type UnanimousTechCommitteeOrRoot =
EitherOfDiverse<EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>, EnsureRoot<AccountId>>;
pub type MajorityTechCommitteeOrRoot =
EitherOfDiverse<EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 2>, EnsureRoot<AccountId>>;

parameter_types! {
pub const LaunchPeriod: BlockNumber = 3 * DAYS;
Expand Down Expand Up @@ -75,107 +58,22 @@ impl pallet_democracy::Config for Runtime {
type MaxProposals = MaxProposals;
type MaxDeposits = ConstU32<100>;
type MaxBlacklisted = ConstU32<100>;
/// A straight majority of the council can decide what their next motion is.
type ExternalOrigin = MajorityCouncilOrRoot;
/// A majority can have the next scheduled referendum be a straight majority-carries vote
type ExternalMajorityOrigin = MajorityCouncilOrRoot;
/// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote.
type ExternalDefaultOrigin = UnanimousCouncilOrRoot;
type ExternalOrigin = EnsureRoot<AccountId>;
type ExternalMajorityOrigin = EnsureRoot<AccountId>;
type ExternalDefaultOrigin = EnsureRoot<AccountId>;
/// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote
/// be tabled immediately and with a shorter voting/enactment period.
type FastTrackOrigin = MajorityTechCommitteeOrRoot;
type InstantOrigin = UnanimousTechCommitteeOrRoot;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin = SuperMajorityCouncilOrRoot;
type FastTrackOrigin = EnsureRoot<AccountId>;
type InstantOrigin = EnsureRoot<AccountId>;
type CancellationOrigin = EnsureRoot<AccountId>;
type BlacklistOrigin = EnsureRoot<AccountId>;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree.
type CancelProposalOrigin = UnanimousTechCommitteeOrRoot;
type CancelProposalOrigin = EnsureRoot<AccountId>;
// Any single technical committee member may veto a coming council proposal, however they can
// only do it once and it lasts only for the cooloff period.
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
type PalletsOrigin = OriginCaller;
type Slash = Treasury;
type SubmitOrigin = EnsureSigned<AccountId>;
}

parameter_types! {
// Bond for candidacy into governance
pub const CandidacyBond: Balance = 5 * DOLLARS;
// 1 storage item created, key size is 32 bytes, value size is 16+16.
pub const VotingBondBase: Balance = CENTS;
// additional data per vote is 32 bytes (account id).
pub const VotingBondFactor: Balance = CENTS;
pub const TermDuration: BlockNumber = 7 * DAYS;
pub const DesiredMembers: u32 = 7;
pub const DesiredRunnersUp: u32 = 9;
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
pub const MaxElectionCandidates: u32 = 100;
pub const MaxElectionVoters: u32 = 768;
pub const MaxVotesPerVoter: u32 = 10;
}

impl pallet_elections_phragmen::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type PalletId = ElectionsPhragmenPalletId;
type Currency = Balances;
type ChangeMembers = Council;
type InitializeMembers = (); // Set to () if defined in chain spec
type CurrencyToVote = U128CurrencyToVote;
type CandidacyBond = CandidacyBond;
type VotingBondBase = VotingBondBase;
type VotingBondFactor = VotingBondFactor;
type LoserCandidate = Treasury;
type KickedMember = Treasury;
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type MaxCandidates = MaxElectionCandidates;
type MaxVoters = MaxElectionVoters;
type MaxVotesPerVoter = MaxVotesPerVoter;
type WeightInfo = weights::pallet_elections_phragmen::BasiliskWeight<Runtime>;
}

parameter_types! {
pub const CouncilMotionDuration: BlockNumber = 5 * DAYS;
pub const CouncilMaxProposals: u32 = 13;
pub const CouncilMaxMembers: u32 = 7;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block;
}

type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = weights::pallet_collective::BasiliskWeight<Runtime>; // use the weights from TechnicalCommittee because we are not able to benchmark both pallets
type MaxProposalWeight = MaxProposalWeight;
type SetMembersOrigin = EnsureRoot<AccountId>;
}

parameter_types! {
pub const DataDepositPerByte: Balance = CENTS;
pub const TipCountdown: BlockNumber = 24 * HOURS;
pub const TipFindersFee: Percent = Percent::from_percent(1);
pub const TipReportDepositBase: Balance = 10 * DOLLARS;
pub const TipReportDepositPerByte: Balance = CENTS;
pub const MaximumReasonLength: u32 = 1024;
pub const MaxTipAmount: u128 = 200_000_000 * UNITS;
}

impl pallet_tips::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MaximumReasonLength = MaximumReasonLength;
type DataDepositPerByte = DataDepositPerByte;
type TipCountdown = TipCountdown;
type TipFindersFee = TipFindersFee;
type TipReportDepositBase = TipReportDepositBase;
type MaxTipAmount = MaxTipAmount;
type Tippers = Elections;
type WeightInfo = weights::pallet_tips::BasiliskWeight<Runtime>;
}
Loading

0 comments on commit c7a0f1b

Please sign in to comment.