diff --git a/invarch/runtime/Cargo.toml b/invarch/runtime/Cargo.toml index 2cca67bf..8e672a9b 100644 --- a/invarch/runtime/Cargo.toml +++ b/invarch/runtime/Cargo.toml @@ -108,6 +108,8 @@ parachain-info = { workspace = true } [features] +fast-net = [] + metadata-hash = ["substrate-wasm-builder/metadata-hash"] default = ["std"] diff --git a/invarch/runtime/src/governance/councils.rs b/invarch/runtime/src/governance/councils.rs index e4b07c36..35ef906a 100644 --- a/invarch/runtime/src/governance/councils.rs +++ b/invarch/runtime/src/governance/councils.rs @@ -2,7 +2,7 @@ use super::*; -pub type TinkerCouncil = pallet_collective::Instance1; +pub type Council = pallet_collective::Instance1; parameter_types! { pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; @@ -12,7 +12,7 @@ parameter_types! { } -impl pallet_collective::Config for Runtime { +impl pallet_collective::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type RuntimeEvent = RuntimeEvent; type Proposal = RuntimeCall; @@ -25,6 +25,6 @@ impl pallet_collective::Config for Runtime { type MaxMembers = MaxMembers; type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; type WeightInfo = pallet_collective::weights::SubstrateWeight; - type SetMembersOrigin = EitherOf; + type SetMembersOrigin = CouncilApproveOrigin; type MaxProposalWeight = MaxProposalWeight; } diff --git a/invarch/runtime/src/governance/mod.rs b/invarch/runtime/src/governance/mod.rs index 2b636364..248e8871 100644 --- a/invarch/runtime/src/governance/mod.rs +++ b/invarch/runtime/src/governance/mod.rs @@ -1,4 +1,4 @@ -use self::councils::TinkerCouncil; +use self::councils::Council; use super::*; // use crate::xcm_config::CollectivesLocation; @@ -8,8 +8,8 @@ use frame_system::EnsureRootWithSuccess; mod origins; pub use origins::{ - pallet_custom_origins, CouncilAdmin, GeneralManagement, ReferendumCanceller, ReferendumKiller, - Spender, WhitelistedCaller, + pallet_custom_origins, GeneralManagement, ReferendumCanceller, ReferendumKiller, Spender, + WhitelistedCaller, }; mod tracks; pub use tracks::TracksInfo; @@ -41,12 +41,11 @@ parameter_types! { pub const MaxBalance: Balance = Balance::max_value(); } -pub type AllCouncil = pallet_collective::EnsureProportionAtLeast; +pub type AllCouncil = pallet_collective::EnsureProportionAtLeast; pub type CouncilMoreThanApprove = - pallet_collective::EnsureProportionMoreThan; -pub type ConcilHalf = pallet_collective::EnsureProportionAtLeast; -pub type CouncilThreeFifths = - pallet_collective::EnsureProportionAtLeast; + pallet_collective::EnsureProportionMoreThan; +pub type ConcilHalf = pallet_collective::EnsureProportionAtLeast; +pub type CouncilThreeFifths = pallet_collective::EnsureProportionAtLeast; pub type TreasurySpender = EitherOf, Spender>; pub type RootOrGeneralManagement = EitherOf, GeneralManagement>; diff --git a/invarch/runtime/src/governance/origins.rs b/invarch/runtime/src/governance/origins.rs index 54ba53c5..16896515 100644 --- a/invarch/runtime/src/governance/origins.rs +++ b/invarch/runtime/src/governance/origins.rs @@ -16,8 +16,6 @@ pub mod pallet_custom_origins { #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] #[pallet::origin] pub enum Origin { - /// Origin for managing the composition of the council. - CouncilAdmin, /// Origin able to cancel a referenda. ReferendumCanceller, /// Origin able to kill referenda. @@ -26,9 +24,9 @@ pub mod pallet_custom_origins { WhitelistedCaller, /// Origin for general management that does not require a runtime upgrade. GeneralManagement, - /// Origin able to spend around $??? from the treasury at once. + /// Origin able to spend around 10K from the treasury at once. SmallSpender, - /// Origin able to spend up to $??? from the treasury at once. + /// Origin able to spend up to 1MIL from the treasury at once. BigSpender, } @@ -63,7 +61,6 @@ pub mod pallet_custom_origins { () => {} } decl_unit_ensures!( - CouncilAdmin, ReferendumCanceller, ReferendumKiller, WhitelistedCaller, diff --git a/invarch/runtime/src/governance/tracks.rs b/invarch/runtime/src/governance/tracks.rs index dfcf7c41..fc02fe12 100644 --- a/invarch/runtime/src/governance/tracks.rs +++ b/invarch/runtime/src/governance/tracks.rs @@ -8,9 +8,6 @@ const fn percent(x: i32) -> sp_arithmetic::FixedI64 { use pallet_referenda::Curve; const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50)); -const APP_COUNCIL_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100)); -const SUP_COUNCIL_ADMIN: Curve = - Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50)); const APP_GENERAL_MANAGEMENT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100)); const SUP_GENERAL_MANAGEMENT: Curve = @@ -30,28 +27,28 @@ const APP_WHITELISTED_CALLER: Curve = Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100)); const SUP_WHITELISTED_CALLER: Curve = Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50)); -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] = [ +const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 7] = [ ( 0, pallet_referenda::TrackInfo { name: "root", max_deciding: 1, decision_deposit: 100 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 4 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 2 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 7 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 24 * HOURS, min_approval: APP_ROOT, min_support: SUP_ROOT, @@ -63,21 +60,21 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] name: "whitelisted_caller", max_deciding: 100, decision_deposit: 10 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 2 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 30 * MINUTES, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 10 * MINUTES, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 10 * MINUTES, min_approval: APP_WHITELISTED_CALLER, min_support: SUP_WHITELISTED_CALLER, @@ -89,73 +86,47 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] name: "general_management", max_deciding: 10, decision_deposit: 10 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 4 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 2 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 24 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 10 * MINUTES, min_approval: APP_GENERAL_MANAGEMENT, min_support: SUP_GENERAL_MANAGEMENT, }, ), - ( - 13, - pallet_referenda::TrackInfo { - name: "council_admin", - max_deciding: 10, - decision_deposit: 10 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] - prepare_period: 4 * MINUTES, - #[cfg(feature = "on-chain-release-build")] - prepare_period: 2 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] - decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] - decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] - confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] - confirm_period: 3 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] - min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] - min_enactment_period: 10 * MINUTES, - min_approval: APP_COUNCIL_ADMIN, - min_support: SUP_COUNCIL_ADMIN, - }, - ), ( 20, pallet_referenda::TrackInfo { name: "referendum_canceller", max_deciding: 1_000, decision_deposit: 10 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 4 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 2 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 7 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 3 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 10 * MINUTES, min_approval: APP_REFERENDUM_CANCELLER, min_support: SUP_REFERENDUM_CANCELLER, @@ -167,21 +138,21 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] name: "referendum_killer", max_deciding: 1_000, decision_deposit: 50 * GRAND, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 4 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 2 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 3 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 10 * MINUTES, min_approval: APP_REFERENDUM_KILLER, min_support: SUP_REFERENDUM_KILLER, @@ -193,21 +164,21 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] name: "small_spender", max_deciding: 50, decision_deposit: 100 * UNIT, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 4 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 2 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 24 * HOURS, min_approval: APP_SMALL_SPENDER, min_support: SUP_SMALL_SPENDER, @@ -219,21 +190,21 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 8] name: "big_spender", max_deciding: 50, decision_deposit: 400 * UNIT, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] prepare_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] prepare_period: 4 * HOURS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] decision_period: 10 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] decision_period: 28 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] confirm_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] confirm_period: 7 * DAYS, - #[cfg(not(feature = "on-chain-release-build"))] + #[cfg(feature = "fast-net")] min_enactment_period: 5 * MINUTES, - #[cfg(feature = "on-chain-release-build")] + #[cfg(not(feature = "fast-net"))] min_enactment_period: 24 * HOURS, min_approval: APP_BIG_SPENDER, min_support: SUP_BIG_SPENDER, @@ -258,8 +229,6 @@ impl pallet_referenda::TracksInfo for TracksInfo { match custom_origin { origins::Origin::WhitelistedCaller => Ok(1), origins::Origin::GeneralManagement => Ok(2), - // General admin - origins::Origin::CouncilAdmin => Ok(13), // Referendum admins origins::Origin::ReferendumCanceller => Ok(20), origins::Origin::ReferendumKiller => Ok(21), diff --git a/invarch/runtime/src/lib.rs b/invarch/runtime/src/lib.rs index 90938921..6e61ba95 100644 --- a/invarch/runtime/src/lib.rs +++ b/invarch/runtime/src/lib.rs @@ -24,9 +24,9 @@ use frame_system::{ }; mod governance; pub use governance::{ - pallet_custom_origins, CouncilAdmin, CouncilApproveOrigin, CouncilRejectOrigin, - GeneralManagement, ReferendumCanceller, ReferendumKiller, RootOrGeneralManagement, - TreasurySpender, WhitelistedCaller, + pallet_custom_origins, CouncilApproveOrigin, CouncilRejectOrigin, GeneralManagement, + ReferendumCanceller, ReferendumKiller, RootOrGeneralManagement, TreasurySpender, + WhitelistedCaller, }; use pallet_identity::legacy::IdentityInfo; use polkadot_runtime_common::BlockHashCount;