diff --git a/node/service/src/chain_spec/moonbase.rs b/node/service/src/chain_spec/moonbase.rs index c6db37a070..ea4e35c3a5 100644 --- a/node/service/src/chain_spec/moonbase.rs +++ b/node/service/src/chain_spec/moonbase.rs @@ -28,9 +28,10 @@ use moonbase_runtime::{ currency::UNIT, AccountId, AuthorFilterConfig, AuthorMappingConfig, Balance, BalancesConfig, CouncilCollectiveConfig, CrowdloanRewardsConfig, DemocracyConfig, EVMConfig, EligibilityValue, EthereumChainIdConfig, EthereumConfig, GenesisAccount, GenesisConfig, InflationInfo, - MaintenanceModeConfig, ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, - Precompiles, Range, SudoConfig, SystemConfig, TechCommitteeCollectiveConfig, - TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY, + MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, + ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range, SudoConfig, SystemConfig, + TechCommitteeCollectiveConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, + HOURS, WASM_BINARY, }; use nimbus_primitives::NimbusId; use pallet_transaction_payment::Multiplier; @@ -68,6 +69,8 @@ pub fn development_chain_spec(mnemonic: Option, num_accounts: Option Alith vec![( accounts[0], @@ -136,6 +139,11 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), ], + // Open Tech committee members: Alith and Baltathar + vec![ + AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), + AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), + ], // Collator Candidates vec![ // Alice -> Alith @@ -225,6 +233,7 @@ pub fn testnet_genesis( council_members: Vec, tech_comittee_members: Vec, treasury_council_members: Vec, + open_tech_committee_members: Vec, candidates: Vec<(AccountId, NimbusId, Balance)>, delegations: Vec<(AccountId, AccountId, Balance, Percent)>, endowed_accounts: Vec, @@ -304,6 +313,10 @@ pub fn testnet_genesis( phantom: Default::default(), members: treasury_council_members, }, + open_tech_committee_collective: OpenTechCommitteeCollectiveConfig { + phantom: Default::default(), + members: open_tech_committee_members, + }, author_filter: AuthorFilterConfig { eligible_count: EligibilityValue::new_unchecked(50), }, diff --git a/node/service/src/chain_spec/moonriver.rs b/node/service/src/chain_spec/moonriver.rs index 559d82cd0a..e145b3baae 100644 --- a/node/service/src/chain_spec/moonriver.rs +++ b/node/service/src/chain_spec/moonriver.rs @@ -29,9 +29,10 @@ use moonriver_runtime::{ currency::MOVR, AccountId, AuthorFilterConfig, AuthorMappingConfig, Balance, BalancesConfig, CouncilCollectiveConfig, CrowdloanRewardsConfig, DemocracyConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig, GenesisAccount, GenesisConfig, InflationInfo, - MaintenanceModeConfig, ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, - Precompiles, Range, SystemConfig, TechCommitteeCollectiveConfig, TransactionPaymentConfig, - TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY, + MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, + ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range, SystemConfig, + TechCommitteeCollectiveConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, + HOURS, WASM_BINARY, }; use nimbus_primitives::NimbusId; use pallet_transaction_payment::Multiplier; @@ -66,6 +67,8 @@ pub fn development_chain_spec(mnemonic: Option, num_accounts: Option Alith vec![( AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), @@ -132,6 +135,11 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), ], + // Open Tech committee members: Alith and Baltathar + vec![ + AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), + AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), + ], // Collator Candidates vec![ // Alice -> Alith @@ -220,6 +228,7 @@ pub fn testnet_genesis( council_members: Vec, tech_comittee_members: Vec, treasury_council_members: Vec, + open_tech_committee_members: Vec, candidates: Vec<(AccountId, NimbusId, Balance)>, delegations: Vec<(AccountId, AccountId, Balance, Percent)>, endowed_accounts: Vec, @@ -296,6 +305,10 @@ pub fn testnet_genesis( phantom: Default::default(), members: treasury_council_members, }, + open_tech_committee_collective: OpenTechCommitteeCollectiveConfig { + phantom: Default::default(), + members: open_tech_committee_members, + }, author_filter: AuthorFilterConfig { eligible_count: EligibilityValue::new_unchecked(50), }, diff --git a/node/service/src/chain_spec/test_spec.rs b/node/service/src/chain_spec/test_spec.rs index 0fc8e940a3..4f5e643b5e 100644 --- a/node/service/src/chain_spec/test_spec.rs +++ b/node/service/src/chain_spec/test_spec.rs @@ -40,7 +40,7 @@ pub fn staking_spec(para_id: ParaId) -> ChainSpec { AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), ], - // Council members: Alith and Baltathar + // Tech Committee members: Alith and Baltathar vec![ AccountId::from(hex!("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b")), AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), @@ -51,6 +51,11 @@ pub fn staking_spec(para_id: ParaId) -> ChainSpec { AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), ], + // Open Tech Committee members: Alith and Baltathar + vec![ + AccountId::from(hex!("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b")), + AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), + ], // Collators vec![ ( diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index da9137ccf2..c537bc8aa6 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -1314,6 +1314,7 @@ mod tests { vec![], vec![], vec![], + vec![], 1000 * UNIT, ParaId::new(0), 0, diff --git a/runtime/moonbase/src/governance/councils.rs b/runtime/moonbase/src/governance/councils.rs index 7c915525e9..8e9bb13ce7 100644 --- a/runtime/moonbase/src/governance/councils.rs +++ b/runtime/moonbase/src/governance/councils.rs @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Moonbeam. If not, see . -//! Councils for Gov1 +//! Councils for Gov1 and Gov2 use super::*; pub type CouncilInstance = pallet_collective::Instance1; pub type TechCommitteeInstance = pallet_collective::Instance2; pub type TreasuryCouncilInstance = pallet_collective::Instance3; +pub type OpenTechCommitteeInstance = pallet_collective::Instance4; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; @@ -66,3 +67,18 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; } + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; + /// The maximum amount of time (in blocks) for technical committee members to vote on motions. + /// Motions may end in fewer blocks if enough votes are cast to determine the result. + type MotionDuration = ConstU32<{ 14 * DAYS }>; + /// The maximum number of proposals that can be open in the technical committee at once. + type MaxProposals = ConstU32<100>; + /// The maximum number of technical committee members. + type MaxMembers = ConstU32<100>; + type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} diff --git a/runtime/moonbase/src/governance/referenda.rs b/runtime/moonbase/src/governance/referenda.rs index 685c19dc84..959c2e7a76 100644 --- a/runtime/moonbase/src/governance/referenda.rs +++ b/runtime/moonbase/src/governance/referenda.rs @@ -63,9 +63,9 @@ impl pallet_whitelist::Config for Runtime { MapSuccess< pallet_collective::EnsureProportionAtLeast< Self::AccountId, - TechCommitteeInstance, - 2, - 3, + OpenTechCommitteeInstance, + 5, + 9, >, Replace>, >, diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 2da03f60f3..7617359b1e 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -100,6 +100,7 @@ use sp_version::RuntimeVersion; use nimbus_primitives::CanAuthor; mod precompiles; +use precompiles::PrecompileName; pub use precompiles::{ MoonbasePrecompiles, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, LOCAL_ASSET_PRECOMPILE_ADDRESS_PREFIX, @@ -805,11 +806,13 @@ fn is_governance_precompile(precompile_name: &precompiles::PrecompileName) -> bo PrecompileName::DemocracyPrecompile | PrecompileName::CouncilInstance | PrecompileName::TechCommitteeInstance - | PrecompileName::TreasuryCouncilInstance, + | PrecompileName::TreasuryCouncilInstance + | PrecompileName::OpenTechCommitteeInstance, ) } -use precompiles::PrecompileName; +// Be careful: Each time this filter is modified, the substrate filter must also be modified +// consistently. impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { fn is_evm_proxy_call_allowed( &self, @@ -893,6 +896,7 @@ impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { } } +// Be careful: Each time this filter is modified, the EVM filter must also be modified consistently. impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { @@ -1301,6 +1305,8 @@ construct_runtime! { Origins: governance::custom_origins::{Origin} = 43, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 44, Whitelist: pallet_whitelist::{Pallet, Call, Storage, Event} = 45, + OpenTechCommitteeCollective: + pallet_collective::::{Pallet, Call, Storage, Event, Origin, Config} = 46, } } diff --git a/runtime/moonbase/src/precompiles.rs b/runtime/moonbase/src/precompiles.rs index bdb65e4bff..bf385e2635 100644 --- a/runtime/moonbase/src/precompiles.rs +++ b/runtime/moonbase/src/precompiles.rs @@ -17,7 +17,7 @@ use crate::{ asset_config::{ForeignAssetInstance, LocalAssetInstance}, xcm_config::XcmExecutorConfig, - CouncilInstance, TechCommitteeInstance, TreasuryCouncilInstance, + CouncilInstance, OpenTechCommitteeInstance, TechCommitteeInstance, TreasuryCouncilInstance, }; use frame_support::parameter_types; use moonbeam_relay_encoder::westend::WestendEncoder; @@ -118,6 +118,7 @@ type MoonbasePrecompilesAt = ( PrecompileAt, CollectivePrecompile>, PrecompileAt, CollectivePrecompile>, PrecompileAt, CollectivePrecompile>, + PrecompileAt, CollectivePrecompile>, ); /// The PrecompileSet installed in the Moonbase runtime. diff --git a/runtime/moonbase/tests/integration_test.rs b/runtime/moonbase/tests/integration_test.rs index a8b9f9d767..30be22f0c5 100644 --- a/runtime/moonbase/tests/integration_test.rs +++ b/runtime/moonbase/tests/integration_test.rs @@ -157,6 +157,9 @@ fn verify_pallet_prefixes() { is_pallet_prefix::("CouncilCollective"); is_pallet_prefix::("TechCommitteeCollective"); is_pallet_prefix::("Treasury"); + is_pallet_prefix::( + "OpenTechCommitteeCollective", + ); is_pallet_prefix::("AuthorInherent"); is_pallet_prefix::("AuthorFilter"); is_pallet_prefix::("CrowdloanRewards"); @@ -304,6 +307,12 @@ fn test_collectives_storage_item_prefixes() { { assert_eq!(pallet_name, b"TreasuryCouncilCollective".to_vec()); } + + for StorageInfo { pallet_name, .. } in + ::storage_info() + { + assert_eq!(pallet_name, b"OpenTechCommitteeCollective".to_vec()); + } } #[test] @@ -354,6 +363,7 @@ fn verify_pallet_indices() { is_pallet_index::(38); is_pallet_index::(39); is_pallet_index::(40); + is_pallet_index::(46); } #[test] @@ -2936,7 +2946,7 @@ fn precompile_existence() { let precompiles = Precompiles::new(); let precompile_addresses: std::collections::BTreeSet<_> = vec![ 1, 2, 3, 4, 5, 6, 7, 8, 9, 1024, 1026, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, - 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, + 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2068, ] .into_iter() .map(H160::from_low_u64_be) diff --git a/runtime/moonriver/src/governance/councils.rs b/runtime/moonriver/src/governance/councils.rs index 7c915525e9..8e9bb13ce7 100644 --- a/runtime/moonriver/src/governance/councils.rs +++ b/runtime/moonriver/src/governance/councils.rs @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Moonbeam. If not, see . -//! Councils for Gov1 +//! Councils for Gov1 and Gov2 use super::*; pub type CouncilInstance = pallet_collective::Instance1; pub type TechCommitteeInstance = pallet_collective::Instance2; pub type TreasuryCouncilInstance = pallet_collective::Instance3; +pub type OpenTechCommitteeInstance = pallet_collective::Instance4; impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; @@ -66,3 +67,18 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; } + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; + /// The maximum amount of time (in blocks) for technical committee members to vote on motions. + /// Motions may end in fewer blocks if enough votes are cast to determine the result. + type MotionDuration = ConstU32<{ 14 * DAYS }>; + /// The maximum number of proposals that can be open in the technical committee at once. + type MaxProposals = ConstU32<100>; + /// The maximum number of technical committee members. + type MaxMembers = ConstU32<100>; + type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index b9f54ff89d..14fc47c3e4 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -110,6 +110,8 @@ pub mod governance; pub mod xcm_config; use governance::councils::*; +pub use governance::councils::*; + /// MOVR, the native token, uses 18 decimals of precision. pub mod currency { use super::Balance; @@ -1162,6 +1164,8 @@ construct_runtime! { pallet_collective::::{Pallet, Call, Storage, Event, Origin, Config} = 71, TreasuryCouncilCollective: pallet_collective::::{Pallet, Call, Storage, Event, Origin, Config} = 72, + OpenTechCommitteeCollective: + pallet_collective::::{Pallet, Call, Storage, Event, Origin, Config} = 73, // Treasury stuff. Treasury: pallet_treasury::{Pallet, Storage, Config, Event, Call} = 80, diff --git a/runtime/moonriver/src/precompiles.rs b/runtime/moonriver/src/precompiles.rs index 38e579663b..11258a3fa7 100644 --- a/runtime/moonriver/src/precompiles.rs +++ b/runtime/moonriver/src/precompiles.rs @@ -17,7 +17,7 @@ use crate::{ asset_config::{ForeignAssetInstance, LocalAssetInstance}, xcm_config::XcmExecutorConfig, - CouncilInstance, TechCommitteeInstance, TreasuryCouncilInstance, + CouncilInstance, OpenTechCommitteeInstance, TechCommitteeInstance, TreasuryCouncilInstance, }; use frame_support::parameter_types; use moonbeam_relay_encoder::kusama::KusamaEncoder; @@ -128,6 +128,7 @@ pub type MoonriverPrecompiles = PrecompileSetBuilder< PrecompileAt, CollectivePrecompile>, PrecompileAt, CollectivePrecompile>, PrecompileAt, CollectivePrecompile>, + PrecompileAt, CollectivePrecompile>, ), >, // Prefixed precompile sets (XC20) diff --git a/runtime/moonriver/tests/integration_test.rs b/runtime/moonriver/tests/integration_test.rs index cb53cc6e11..4c3c963598 100644 --- a/runtime/moonriver/tests/integration_test.rs +++ b/runtime/moonriver/tests/integration_test.rs @@ -121,6 +121,9 @@ fn verify_pallet_prefixes() { is_pallet_prefix::("Democracy"); is_pallet_prefix::("CouncilCollective"); is_pallet_prefix::("TechCommitteeCollective"); + is_pallet_prefix::( + "OpenTechCommitteeCollective", + ); is_pallet_prefix::("Treasury"); is_pallet_prefix::("AuthorInherent"); is_pallet_prefix::("AuthorFilter"); @@ -250,6 +253,12 @@ fn test_collectives_storage_item_prefixes() { { assert_eq!(pallet_name, b"TechCommitteeCollective".to_vec()); } + + for StorageInfo { pallet_name, .. } in + ::storage_info() + { + assert_eq!(pallet_name, b"OpenTechCommitteeCollective".to_vec()); + } } #[test] @@ -293,6 +302,7 @@ fn verify_pallet_indices() { is_pallet_index::(70); is_pallet_index::(71); is_pallet_index::(72); + is_pallet_index::(73); // Treasury is_pallet_index::(80); // Crowdloan @@ -2738,7 +2748,7 @@ fn precompile_existence() { let precompiles = Precompiles::new(); let precompile_addresses: std::collections::BTreeSet<_> = vec![ 1, 2, 3, 4, 5, 6, 7, 8, 9, 1024, 1026, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, - 2056, 2057, 2058, 2060, 2062, 2063, 2064, + 2056, 2057, 2058, 2060, 2062, 2063, 2064, 2068, ] .into_iter() .map(H160::from_low_u64_be)