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

Remove Gov V1 collectives #2643

Merged
merged 27 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5c3330a
remove council and tech committee collective and add migration to cle…
noandrea Feb 2, 2024
a87163d
fix test_spec
noandrea Feb 2, 2024
400d22a
use revert precompile for council and collective removal
noandrea Feb 19, 2024
6278760
Merge branch 'master' into noandrea-remove-gov-v1
noandrea Feb 19, 2024
e164749
update maintenance mode requirements
noandrea Feb 19, 2024
445c4a3
Merge branch 'master' into noandrea-remove-gov-v1
noandrea Feb 19, 2024
7b6aee6
fix compilation errors after merge
noandrea Feb 19, 2024
ee59045
fix remove precompile for council and tech committee
noandrea Feb 19, 2024
c55ac69
Merge branch 'master' into noandrea-remove-gov-v1
noandrea Feb 19, 2024
5132936
cleanup migration parameters
noandrea Feb 19, 2024
6cf28be
fix cargo fmt error
noandrea Feb 19, 2024
abe8bd6
added new helper (#2663)
timbrinded Feb 20, 2024
42baf32
Disable gov v1 based tests
noandrea Feb 20, 2024
41ea8ff
fix ts lint errors
noandrea Feb 20, 2024
c916c50
remove councils in moonriver
noandrea Feb 20, 2024
48e5482
remove councils on moonbeam
noandrea Feb 20, 2024
98be74a
fix esLint errors
noandrea Feb 20, 2024
e4c3037
Update runtime/moonriver/src/asset_config.rs
librelois Feb 20, 2024
439ba9f
Update runtime/moonbase/src/asset_config.rs
librelois Feb 20, 2024
04a15d4
Update runtime/moonbeam/src/asset_config.rs
librelois Feb 20, 2024
c233a03
remove unused pallets names
librelois Feb 20, 2024
af5be3f
fix integration tests
noandrea Feb 20, 2024
3d22600
fix integration tests
noandrea Feb 20, 2024
ccca37b
fix dev-tests
noandrea Feb 20, 2024
ddaf0c0
lint test files
RomarQ Feb 20, 2024
a6205b9
remove smoke2 folder
RomarQ Feb 20, 2024
01f6482
allow OpenTechCollective to manage foreing assets
noandrea Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 6 additions & 31 deletions node/service/src/chain_spec/moonbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use moonbase_runtime::{
currency::UNIT, AccountId, AuthorFilterConfig, AuthorMappingConfig, Balance, BalancesConfig,
CouncilCollectiveConfig, CrowdloanRewardsConfig, DemocracyConfig, EVMConfig, EligibilityValue,
EthereumChainIdConfig, EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
CrowdloanRewardsConfig, DemocracyConfig, EVMConfig, EligibilityValue, EthereumChainIdConfig,
EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig, SudoConfig, SystemConfig,
TechCommitteeCollectiveConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig,
XcmTransactorConfig, HOURS, WASM_BINARY,
TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, XcmTransactorConfig, HOURS,
WASM_BINARY,
};
use nimbus_primitives::NimbusId;
use pallet_transaction_payment::Multiplier;
Expand Down Expand Up @@ -69,14 +69,10 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
testnet_genesis(
// Alith is Sudo
accounts[0],
// Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Tech comitee members: Alith and Baltathar
vec![accounts[0], accounts[1]],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Open Tech committee members: Alith and Baltathar
vec![accounts[0], accounts[1]],
// Open Tech committee members: Alith, Baltathar and Charleth
vec![accounts[0], accounts[1], accounts[2]],
// Collator Candidate: Alice -> Alith
vec![(
accounts[0],
Expand Down Expand Up @@ -128,17 +124,6 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
testnet_genesis(
// Alith is Sudo
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")),
// Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")),
AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")),
],
// Tech comitee members: Alith and Baltathar
vec![
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")),
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
Expand Down Expand Up @@ -236,8 +221,6 @@ pub fn moonbase_inflation_config() -> InflationInfo<Balance> {

pub fn testnet_genesis(
root_key: AccountId,
council_members: Vec<AccountId>,
tech_comittee_members: Vec<AccountId>,
treasury_council_members: Vec<AccountId>,
open_tech_committee_members: Vec<AccountId>,
candidates: Vec<(AccountId, NimbusId, Balance)>,
Expand Down Expand Up @@ -316,14 +299,6 @@ pub fn testnet_genesis(
blocks_per_round: BLOCKS_PER_ROUND,
num_selected_candidates: NUM_SELECTED_CANDIDATES,
},
council_collective: CouncilCollectiveConfig {
phantom: Default::default(),
members: council_members,
},
tech_committee_collective: TechCommitteeCollectiveConfig {
phantom: Default::default(),
members: tech_comittee_members,
},
treasury_council_collective: TreasuryCouncilCollectiveConfig {
phantom: Default::default(),
members: treasury_council_members,
Expand Down
36 changes: 5 additions & 31 deletions node/service/src/chain_spec/moonbeam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ use hex_literal::hex;
use moonbase_runtime::EligibilityValue;
use moonbeam_runtime::{
currency::GLMR, currency::SUPPLY_FACTOR, AccountId, AuthorFilterConfig, AuthorMappingConfig,
Balance, BalancesConfig, CouncilCollectiveConfig, CrowdloanRewardsConfig, DemocracyConfig,
EVMConfig, EthereumChainIdConfig, EthereumConfig, GenesisAccount, InflationInfo,
MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig, ParachainInfoConfig,
ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig,
SystemConfig, TechCommitteeCollectiveConfig, TransactionPaymentConfig,
TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY,
Balance, BalancesConfig, CrowdloanRewardsConfig, DemocracyConfig, EVMConfig,
EthereumChainIdConfig, EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig, SystemConfig,
TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY,
};
use nimbus_primitives::NimbusId;
use pallet_transaction_payment::Multiplier;
Expand Down Expand Up @@ -61,10 +60,6 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
ChainType::Development,
move || {
testnet_genesis(
// Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Tech comitee members: Alith and Baltathar
vec![accounts[0], accounts[1]],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Open Tech committee members: Alith and Baltathar
Expand Down Expand Up @@ -118,17 +113,6 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
ChainType::Local,
move || {
testnet_genesis(
// Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")),
AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")),
],
// Tech comitee members: Alith and Baltathar
vec![
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")),
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
Expand Down Expand Up @@ -225,8 +209,6 @@ pub fn moonbeam_inflation_config() -> InflationInfo<Balance> {
}

pub fn testnet_genesis(
council_members: Vec<AccountId>,
tech_comittee_members: Vec<AccountId>,
treasury_council_members: Vec<AccountId>,
open_tech_committee_members: Vec<AccountId>,
candidates: Vec<(AccountId, NimbusId, Balance)>,
Expand Down Expand Up @@ -302,14 +284,6 @@ pub fn testnet_genesis(
blocks_per_round: BLOCKS_PER_ROUND,
num_selected_candidates: NUM_SELECTED_CANDIDATES,
},
council_collective: CouncilCollectiveConfig {
phantom: Default::default(),
members: council_members,
},
tech_committee_collective: TechCommitteeCollectiveConfig {
phantom: Default::default(),
members: tech_comittee_members,
},
treasury_council_collective: TreasuryCouncilCollectiveConfig {
phantom: Default::default(),
members: treasury_council_members,
Expand Down
34 changes: 4 additions & 30 deletions node/service/src/chain_spec/moonriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ use hex_literal::hex;
use moonbase_runtime::EligibilityValue;
use moonriver_runtime::{
currency::MOVR, AccountId, AuthorFilterConfig, AuthorMappingConfig, Balance, BalancesConfig,
CouncilCollectiveConfig, CrowdloanRewardsConfig, DemocracyConfig, EVMConfig,
EthereumChainIdConfig, EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig, SystemConfig,
TechCommitteeCollectiveConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig,
CrowdloanRewardsConfig, DemocracyConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig,
GenesisAccount, InflationInfo, MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig,
ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range,
RuntimeGenesisConfig, SystemConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig,
HOURS, WASM_BINARY,
};
use nimbus_primitives::NimbusId;
Expand Down Expand Up @@ -61,10 +60,6 @@ pub fn development_chain_spec(mnemonic: Option<String>, num_accounts: Option<u32
ChainType::Development,
move || {
testnet_genesis(
// Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Tech comitee members: Alith and Baltathar
vec![accounts[0], accounts[1]],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![accounts[1], accounts[2], accounts[3]],
// Open Tech committee members: Alith and Baltathar
Expand Down Expand Up @@ -118,17 +113,6 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
ChainType::Local,
move || {
testnet_genesis(
// Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")),
AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")),
],
// Tech comitee members: Alith and Baltathar
vec![
AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")),
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
Expand Down Expand Up @@ -225,8 +209,6 @@ pub fn moonriver_inflation_config() -> InflationInfo<Balance> {
}

pub fn testnet_genesis(
council_members: Vec<AccountId>,
tech_comittee_members: Vec<AccountId>,
treasury_council_members: Vec<AccountId>,
open_tech_committee_members: Vec<AccountId>,
candidates: Vec<(AccountId, NimbusId, Balance)>,
Expand Down Expand Up @@ -302,14 +284,6 @@ pub fn testnet_genesis(
blocks_per_round: BLOCKS_PER_ROUND,
num_selected_candidates: NUM_SELECTED_CANDIDATES,
},
council_collective: CouncilCollectiveConfig {
phantom: Default::default(),
members: council_members,
},
tech_committee_collective: TechCommitteeCollectiveConfig {
phantom: Default::default(),
members: tech_comittee_members,
},
treasury_council_collective: TreasuryCouncilCollectiveConfig {
phantom: Default::default(),
members: treasury_council_members,
Expand Down
11 changes: 0 additions & 11 deletions node/service/src/chain_spec/test_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ pub fn staking_spec(para_id: ParaId) -> ChainSpec {
testnet_genesis(
// Root
AccountId::from(hex!("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b")),
// Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")),
AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")),
],
// Tech Committee members: Alith and Baltathar
vec![
AccountId::from(hex!("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b")),
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
],
// Treasury Council members: Baltathar, Charleth and Dorothy
vec![
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
Expand Down
2 changes: 0 additions & 2 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,8 +1737,6 @@ mod tests {
vec![],
vec![],
vec![],
vec![],
vec![],
1000 * UNIT,
ParaId::new(0),
0,
Expand Down
2 changes: 0 additions & 2 deletions precompiles/collective/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ pub(crate) fn roll_to(n: BlockNumber) {
// We may be able to simulate this by poking its storage directly, but I don't see any value
// added from doing that.
while System::block_number() < n {
CouncilCollective::on_finalize(System::block_number());
Treasury::on_finalize(System::block_number());
// Times tamp::on_finalize(System::block_number());
Evm::on_finalize(System::block_number());
Expand All @@ -333,7 +332,6 @@ pub(crate) fn roll_to(n: BlockNumber) {
Evm::on_initialize(System::block_number());
Timestamp::on_initialize(System::block_number());
Treasury::on_initialize(System::block_number());
CouncilCollective::on_initialize(System::block_number());
}
}

Expand Down
74 changes: 61 additions & 13 deletions runtime/common/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use frame_support::ensure;
#[cfg(feature = "try-runtime")]
use frame_support::migration::get_storage_value;
use frame_support::{
pallet_prelude::GetStorageVersion,
parameter_types,
sp_runtime::traits::{Block as BlockT, Header as HeaderT},
traits::PalletInfoAccess,
traits::OnRuntimeUpgrade,
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
Expand Down Expand Up @@ -178,21 +178,67 @@ where
}
}

pub struct CommonMigrations<Runtime, Council, Tech, Treasury, OpenTech>(
PhantomData<(Runtime, Council, Tech, Treasury, OpenTech)>,
);
parameter_types! {
pub const CouncilPalletName: &'static str = "Council";
pub const TechnicalCommitteePalletName: &'static str = "TechnicalCommittee";
}

impl<Runtime, Council, Tech, Treasury, OpenTech> GetMigrations
for CommonMigrations<Runtime, Council, Tech, Treasury, OpenTech>
pub struct PalletCollectiveDropGovV1Collectives<Runtime>(pub PhantomData<Runtime>);
impl<Runtime> Migration for PalletCollectiveDropGovV1Collectives<Runtime>
where
Runtime: frame_system::Config,
{
fn friendly_name(&self) -> &str {
"MM_RemoveGovV1Collectives"
}

fn migrate(&self, _available_weight: Weight) -> Weight {
log::info!("Removing Council and Tech from pallet_collective");

let mut weight = Weight::zero();

let w = frame_support::migrations::RemovePallet::<
CouncilPalletName,
<Runtime as frame_system::Config>::DbWeight,
>::on_runtime_upgrade();
weight = weight.saturating_add(w);

let w = frame_support::migrations::RemovePallet::<
TechnicalCommitteePalletName,
<Runtime as frame_system::Config>::DbWeight,
>::on_runtime_upgrade();
weight = weight.saturating_add(w);
weight
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade(&self) -> Result<Vec<u8>, sp_runtime::DispatchError> {
frame_support::migrations::RemovePallet::<
TechnicalCommitteePalletName,
<Runtime as frame_system::Config>::DbWeight,
>::pre_upgrade();

Ok(vec![])
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(&self, _state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
frame_support::migrations::RemovePallet::<
TechnicalCommitteePalletName,
<Runtime as frame_system::Config>::DbWeight,
>::post_upgrade(_state);
Ok(())
}
}

pub struct CommonMigrations<Runtime>(PhantomData<Runtime>);

impl<Runtime> GetMigrations for CommonMigrations<Runtime>
where
Runtime: pallet_author_mapping::Config,
Runtime: pallet_parachain_staking::Config,
Runtime: pallet_scheduler::Config,
Runtime: AuthorSlotFilterConfig,
Council: GetStorageVersion + PalletInfoAccess + 'static,
Tech: GetStorageVersion + PalletInfoAccess + 'static,
Treasury: GetStorageVersion + PalletInfoAccess + 'static,
OpenTech: GetStorageVersion + PalletInfoAccess + 'static,
Runtime: pallet_democracy::Config,
Runtime: pallet_preimage::Config,
Runtime: pallet_asset_manager::Config,
Expand Down Expand Up @@ -269,13 +315,13 @@ where
// PalletXcmTransactorMigrateXcmV2ToV3::<Runtime>(Default::default());
//let remove_min_bond_for_old_orbiter_collators =
// RemoveMinBondForOrbiterCollators::<Runtime>(Default::default());

// RT2700
// let missing_balances_migrations = MissingBalancesMigrations::<Runtime>(Default::default());
// let fix_pallet_versions =
// FixIncorrectPalletVersions::<Runtime, Treasury, OpenTech>(Default::default());
// let pallet_referenda_migrate_v0_to_v1 =
// PalletReferendaMigrateV0ToV1::<Runtime>(Default::default());
let pallet_collective_drop_gov_v1_collectives =
PalletCollectiveDropGovV1Collectives::<Runtime>(Default::default());

vec![
// completed in runtime 800
Expand Down Expand Up @@ -330,6 +376,8 @@ where
// Box::new(missing_balances_migrations),
// Box::new(fix_pallet_versions),
// Box::new(pallet_referenda_migrate_v0_to_v1),
// completed in runtime 2800
Box::new(pallet_collective_drop_gov_v1_collectives),
]
}
}
Loading
Loading