git.delta.rocks / unique-network / refs/commits / 22e4325fd490

difftreelog

Merge pull request #1033 from UniqueNetwork/fix/enable-gov-on-unique

Yaroslav Bolyukin2023-11-03parents: #4f574e9 #88b31e7.patch.diff
in: master

10 files changed

modified.github/workflows/governance.ymldiffbeforeafterboth
30 uses: CertainLach/create-matrix-action@v430 uses: CertainLach/create-matrix-action@v4
31 id: create_matrix31 id: create_matrix
32 with:32 with:
33 matrix: |33 matrix: |
34 network {quartz}, wasm_name {quartz}34 network {unique}, wasm_name {unique}
35 network {quartz}, wasm_name {quartz}
35 network {opal}, wasm_name {opal}36 network {opal}, wasm_name {opal}
36 network {sapphire}, wasm_name {quartz}37 network {sapphire}, wasm_name {quartz}
3738
38 dev_build_int_tests:39 dev_build_int_tests:
39 needs: prepare-execution-marix40 needs: prepare-execution-marix
addedruntime/common/config/governance/identity.rsdiffbeforeafterboth

no changes

modifiedruntime/common/config/governance/mod.rsdiffbeforeafterboth
55pub mod scheduler;55pub mod scheduler;
56pub use scheduler::*;56pub use scheduler::*;
57
58pub mod identity;
5759
58impl pallet_gov_origins::Config for Runtime {}60impl pallet_gov_origins::Config for Runtime {}
5961
modifiedruntime/common/config/pallets/collator_selection.rsdiffbeforeafterboth
22 CollatorSelectionLicenseBondOverride,22 CollatorSelectionLicenseBondOverride,
23};23};
24use sp_runtime::Perbill;24use sp_runtime::Perbill;
25use up_common::constants::{MILLIUNIQUE, UNIQUE};
2625
27#[cfg(feature = "governance")]26#[cfg(feature = "governance")]
28use crate::config::governance;27use crate::config::governance;
29use crate::{28use crate::{
30 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},29 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},
31 Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,30 Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,
32 RuntimeHoldReason, Session, SessionKeys, Treasury,31 RuntimeHoldReason, Session, SessionKeys,
33};32};
34parameter_types! {33parameter_types! {
35 pub const SessionOffset: BlockNumber = 0;34 pub const SessionOffset: BlockNumber = 0;
59}58}
6059
61parameter_types! {60parameter_types! {
62 // These do not matter as we forbid non-sudo operations with the identity pallet
63 pub const BasicDeposit: Balance = 10 * UNIQUE;
64 pub const FieldDeposit: Balance = 25 * MILLIUNIQUE;
65 pub const SubAccountDeposit: Balance = 2 * UNIQUE;
66 pub const MaxSubAccounts: u32 = 100;
67 pub const MaxAdditionalFields: u32 = 100;
68 pub const MaxRegistrars: u32 = 20;
69 pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";
70 pub LicenseBond: Balance = CollatorSelectionLicenseBondOverride::<Runtime>::get();61 pub LicenseBond: Balance = CollatorSelectionLicenseBondOverride::<Runtime>::get();
71 pub DesiredCollators: u32 = CollatorSelectionDesiredCollatorsOverride::<Runtime>::get();62 pub DesiredCollators: u32 = CollatorSelectionDesiredCollatorsOverride::<Runtime>::get();
72 pub KickThreshold: BlockNumber = CollatorSelectionKickThresholdOverride::<Runtime>::get();63 pub KickThreshold: BlockNumber = CollatorSelectionKickThresholdOverride::<Runtime>::get();
73}64}
74
75impl pallet_identity::Config for Runtime {
76 type RuntimeEvent = RuntimeEvent;
77 type Currency = Balances;
78 type BasicDeposit = BasicDeposit;
79 type FieldDeposit = FieldDeposit;
80 type MaxAdditionalFields = MaxAdditionalFields;
81 type MaxRegistrars = MaxRegistrars;
82 type MaxSubAccounts = MaxSubAccounts;
83 type SubAccountDeposit = SubAccountDeposit;
84
85 #[cfg(feature = "governance")]
86 type RegistrarOrigin = governance::RootOrTechnicalCommitteeMember;
87
88 #[cfg(feature = "governance")]
89 type ForceOrigin = governance::RootOrTechnicalCommitteeMember;
90
91 #[cfg(not(feature = "governance"))]
92 type RegistrarOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;
93
94 #[cfg(not(feature = "governance"))]
95 type ForceOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;
96
97 type Slashed = Treasury;
98 type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
99}
10065
101parameter_types! {66parameter_types! {
102 pub const PotId: PalletId = PalletId(*b"PotStake");67 pub const PotId: PalletId = PalletId(*b"PotStake");
modifiedruntime/common/construct_runtime.rsdiffbeforeafterboth
50 Tokens: orml_tokens = 39,50 Tokens: orml_tokens = 39,
51 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,51 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
5252
53 #[cfg(feature = "collator-selection")]53 #[cfg(feature = "governance")]
54 Identity: pallet_identity = 40,54 Identity: pallet_identity = 40,
5555
56 #[cfg(feature = "preimage")]56 #[cfg(feature = "preimage")]
modifiedruntime/common/identity.rsdiffbeforeafterboth
1616
17use parity_scale_codec::{Decode, Encode};17use parity_scale_codec::{Decode, Encode};
18use scale_info::TypeInfo;18use scale_info::TypeInfo;
19#[cfg(feature = "collator-selection")]19#[cfg(feature = "governance")]
20use sp_runtime::transaction_validity::InvalidTransaction;20use sp_runtime::transaction_validity::InvalidTransaction;
21use sp_runtime::{21use sp_runtime::{
22 traits::{DispatchInfoOf, SignedExtension},22 traits::{DispatchInfoOf, SignedExtension},
59 _len: usize,59 _len: usize,
60 ) -> TransactionValidity {60 ) -> TransactionValidity {
61 match call {61 match call {
62 #[cfg(feature = "collator-selection")]62 #[cfg(feature = "governance")]
63 RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),63 RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
64 _ => Ok(ValidTransaction::default()),64 _ => Ok(ValidTransaction::default()),
65 }65 }
modifiedruntime/common/maintenance.rsdiffbeforeafterboth
78 }78 }
7979
80 #[cfg(feature = "collator-selection")]80 #[cfg(feature = "collator-selection")]
81 RuntimeCall::CollatorSelection(_)81 RuntimeCall::CollatorSelection(_) | RuntimeCall::Session(_) => {
82 | RuntimeCall::Session(_)82 Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
83 }
84
85 #[cfg(feature = "governance")]
83 | RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),86 RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
8487
85 #[cfg(feature = "pallet-test-utils")]88 #[cfg(feature = "pallet-test-utils")]
86 RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),89 RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
551 #[cfg(feature = "collator-selection")]551 #[cfg(feature = "collator-selection")]
552 list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);552 list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
553553
554 #[cfg(feature = "collator-selection")]554 #[cfg(feature = "governance")]
555 list_benchmark!(list, extra, pallet_identity, Identity);555 list_benchmark!(list, extra, pallet_identity, Identity);
556556
557 #[cfg(feature = "foreign-assets")]557 #[cfg(feature = "foreign-assets")]
615 #[cfg(feature = "collator-selection")]615 #[cfg(feature = "collator-selection")]
616 add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);616 add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
617617
618 #[cfg(feature = "collator-selection")]618 #[cfg(feature = "governance")]
619 add_benchmark!(params, batches, pallet_identity, Identity);619 add_benchmark!(params, batches, pallet_identity, Identity);
620620
621 #[cfg(feature = "foreign-assets")]621 #[cfg(feature = "foreign-assets")]
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
214 'pallet-xcm/try-runtime',214 'pallet-xcm/try-runtime',
215 'parachain-info/try-runtime',215 'parachain-info/try-runtime',
216]216]
217unique-runtime = ['app-promotion', 'foreign-assets', 'refungible']217unique-runtime = ['app-promotion', 'foreign-assets', 'refungible', 'governance', 'preimage']
218218
219app-promotion = []219app-promotion = []
220collator-selection = []220collator-selection = []
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
68 const refungible = 'refungible';68 const refungible = 'refungible';
69 const foreignAssets = 'foreignassets';69 const foreignAssets = 'foreignassets';
70 const appPromotion = 'apppromotion';70 const appPromotion = 'apppromotion';
71 const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];71 const collatorSelection = ['authorship', 'session', 'collatorselection'];
72 const preimage = ['preimage'];72 const preimage = ['preimage'];
73 const governance = [73 const governance = [
74 'council',74 'council',
80 'scheduler',80 'scheduler',
81 'technicalcommittee',81 'technicalcommittee',
82 'technicalcommitteemembership',82 'technicalcommitteemembership',
83 'identity',
83 ];84 ];
84 const testUtils = 'testutils';85 const testUtils = 'testutils';
8586
108 refungible,109 refungible,
109 foreignAssets,110 foreignAssets,
110 appPromotion,111 appPromotion,
112 ...preimage,
113 ...governance,
111 );114 );
112 }115 }
113 });116 });