@@ -27,6 +27,7 @@ use frame_support::{
2727} ;
2828use frame_system:: { EnsureRoot , EnsureRootWithSuccess , EnsureSigned } ;
2929use pallet_commitments:: { CanCommit , OnMetadataCommitment } ;
30+ use pallet_governance:: { BUILDING_COLLECTIVE_SIZE , ECONOMIC_COLLECTIVE_SIZE } ;
3031use pallet_grandpa:: { AuthorityId as GrandpaId , fg_primitives} ;
3132use pallet_registry:: CanRegisterIdentity ;
3233pub use pallet_shield;
@@ -55,7 +56,8 @@ use sp_core::{
5556use sp_runtime:: Cow ;
5657use sp_runtime:: generic:: Era ;
5758use sp_runtime:: {
58- AccountId32 , ApplyExtrinsicResult , ConsensusEngineId , Percent , generic, impl_opaque_keys,
59+ AccountId32 , ApplyExtrinsicResult , ConsensusEngineId , FixedU128 , Percent , generic,
60+ impl_opaque_keys,
5961 traits:: {
6062 AccountIdLookup , BlakeTwo256 , Block as BlockT , DispatchInfoOf , Dispatchable , One ,
6163 PostDispatchInfoOf , UniqueSaturatedInto , Verify ,
@@ -1038,22 +1040,19 @@ parameter_types! {
10381040 pub const SubtensorInitialMinAllowedUids : u16 = 64 ;
10391041 pub const SubtensorInitialMinLockCost : u64 = 1_000_000_000_000 ; // 1000 TAO
10401042 pub const SubtensorInitialSubnetOwnerCut : u16 = 11_796 ; // 18 percent
1041- // pub const SubtensorInitialSubnetLimit: u16 = 12; // (DEPRECATED)
10421043 pub const SubtensorInitialNetworkLockReductionInterval : u64 = 14 * 7200 ;
10431044 pub const SubtensorInitialNetworkRateLimit : u64 = 7200 ;
10441045 pub const SubtensorInitialKeySwapCost : u64 = 100_000_000 ; // 0.1 TAO
10451046 pub const InitialAlphaHigh : u16 = 58982 ; // Represents 0.9 as per the production default
10461047 pub const InitialAlphaLow : u16 = 45875 ; // Represents 0.7 as per the production default
10471048 pub const InitialLiquidAlphaOn : bool = false ; // Default value for LiquidAlphaOn
10481049 pub const InitialYuma3On : bool = false ; // Default value for Yuma3On
1049- // pub const SubtensorInitialNetworkMaxStake: u64 = u64::MAX; // (DEPRECATED)
10501050 pub const InitialColdkeySwapScheduleDuration : BlockNumber = 5 * 24 * 60 * 60 / 12 ; // 5 days
10511051 pub const InitialColdkeySwapRescheduleDuration : BlockNumber = 24 * 60 * 60 / 12 ; // 1 day
10521052 pub const InitialDissolveNetworkScheduleDuration : BlockNumber = 5 * 24 * 60 * 60 / 12 ; // 5 days
10531053 pub const SubtensorInitialTaoWeight : u64 = 971_718_665_099_567_868 ; // 0.05267697438728329% tao weight.
10541054 pub const InitialEmaPriceHalvingPeriod : u64 = 201_600_u64 ; // 4 weeks
1055- // 7 * 24 * 60 * 60 / 12 = 7 days
1056- pub const DurationOfStartCall : u64 = prod_or_fast!( 7 * 24 * 60 * 60 / 12 , 10 ) ;
1055+ pub const DurationOfStartCall : u64 = prod_or_fast!( 7 * 24 * 60 * 60 / 12 , 10 ) ; // 7 days
10571056 pub const SubtensorInitialKeySwapOnSubnetCost : u64 = 1_000_000 ; // 0.001 TAO
10581057 pub const HotkeySwapOnSubnetInterval : BlockNumber = 5 * 24 * 60 * 60 / 12 ; // 5 days
10591058 pub const LeaseDividendsDistributionInterval : BlockNumber = 100 ; // 100 blocks
@@ -1551,6 +1550,60 @@ impl pallet_contracts::Config for Runtime {
15511550 type ApiVersion = ( ) ;
15521551}
15531552
1553+ parameter_types ! {
1554+ pub const MaxAllowedProposers : u32 = 20 ;
1555+ pub MaxProposalWeight : Weight = Perbill :: from_percent( 20 ) * BlockWeights :: get( ) . max_block;
1556+ pub const MaxProposals : u32 = 20 ;
1557+ pub const MaxScheduled : u32 = 20 ;
1558+ pub const MotionDuration : BlockNumber = prod_or_fast!( 50_400 , 50 ) ; // 7 days
1559+ pub const InitialSchedulingDelay : BlockNumber = prod_or_fast!( 300 , 30 ) ; // 1 hour
1560+ pub const AdditionalDelayFactor : FixedU128 = FixedU128 :: from_rational( 3 , 2 ) ; // 1.5
1561+ pub const CollectiveRotationPeriod : BlockNumber = prod_or_fast!( 432_000 , 100 ) ; // 60 days
1562+ pub const CleanupPeriod : BlockNumber = prod_or_fast!( 21_600 , 50 ) ; // 3 days
1563+ pub const FastTrackThreshold : Percent = Percent :: from_percent( 67 ) ;
1564+ pub const CancellationThreshold : Percent = Percent :: from_percent( 51 ) ;
1565+ }
1566+
1567+ impl pallet_governance:: Config for Runtime {
1568+ type RuntimeCall = RuntimeCall ;
1569+ type WeightInfo = pallet_governance:: weights:: SubstrateWeight < Self > ;
1570+ type Currency = Balances ;
1571+ type Preimages = Preimage ;
1572+ type Scheduler = Scheduler ;
1573+ type SetAllowedProposersOrigin = EnsureRoot < AccountId > ;
1574+ type SetTriumvirateOrigin = EnsureRoot < AccountId > ;
1575+ type CollectiveMembersProvider = CollectiveMembersProvider ;
1576+ type MaxAllowedProposers = MaxAllowedProposers ;
1577+ type MaxProposalWeight = MaxProposalWeight ;
1578+ type MaxProposals = MaxProposals ;
1579+ type MaxScheduled = MaxScheduled ;
1580+ type MotionDuration = MotionDuration ;
1581+ type InitialSchedulingDelay = InitialSchedulingDelay ;
1582+ type AdditionalDelayFactor = AdditionalDelayFactor ;
1583+ type CollectiveRotationPeriod = CollectiveRotationPeriod ;
1584+ type CleanupPeriod = CleanupPeriod ;
1585+ type CancellationThreshold = CancellationThreshold ;
1586+ type FastTrackThreshold = FastTrackThreshold ;
1587+ }
1588+
1589+ pub struct CollectiveMembersProvider ;
1590+
1591+ impl pallet_governance:: CollectiveMembersProvider < Runtime > for CollectiveMembersProvider {
1592+ fn get_economic_collective ( ) -> (
1593+ BoundedVec < AccountId , ConstU32 < ECONOMIC_COLLECTIVE_SIZE > > ,
1594+ Weight ,
1595+ ) {
1596+ ( BoundedVec :: new ( ) , Weight :: zero ( ) )
1597+ }
1598+
1599+ fn get_building_collective ( ) -> (
1600+ BoundedVec < AccountId , ConstU32 < BUILDING_COLLECTIVE_SIZE > > ,
1601+ Weight ,
1602+ ) {
1603+ ( BoundedVec :: new ( ) , Weight :: zero ( ) )
1604+ }
1605+ }
1606+
15541607// Create the runtime by composing the FRAME pallets that were previously configured.
15551608construct_runtime ! (
15561609 pub struct Runtime
@@ -1589,6 +1642,7 @@ construct_runtime!(
15891642 Swap : pallet_subtensor_swap = 28 ,
15901643 Contracts : pallet_contracts = 29 ,
15911644 MevShield : pallet_shield = 30 ,
1645+ Governance : pallet_governance = 31 ,
15921646 }
15931647) ;
15941648
@@ -1661,6 +1715,7 @@ mod benches {
16611715 [ pallet_crowdloan, Crowdloan ]
16621716 [ pallet_subtensor_swap, Swap ]
16631717 [ pallet_shield, MevShield ]
1718+ [ pallet_governance, Governance ]
16641719 ) ;
16651720}
16661721
0 commit comments