difftreelog
fix enable governance on Unique
in: master
9 files changed
.github/workflows/governance.ymldiffbeforeafterboth--- a/.github/workflows/governance.yml
+++ b/.github/workflows/governance.yml
@@ -31,6 +31,7 @@
id: create_matrix
with:
matrix: |
+ network {unique}, wasm_name {unique}
network {quartz}, wasm_name {quartz}
network {opal}, wasm_name {opal}
network {sapphire}, wasm_name {quartz}
runtime/common/config/governance/identity.rsdiffbeforeafterboth--- /dev/null
+++ b/runtime/common/config/governance/identity.rs
@@ -0,0 +1,33 @@
+use frame_support::parameter_types;
+use up_common::constants::{MILLIUNIQUE, UNIQUE};
+
+use crate::{
+ runtime_common::config::governance, Balance, Balances, Runtime, RuntimeEvent, Treasury,
+};
+
+parameter_types! {
+ // These do not matter as we forbid non-gov operations with the identity pallet
+ pub const BasicDeposit: Balance = 10 * UNIQUE;
+ pub const FieldDeposit: Balance = 25 * MILLIUNIQUE;
+ pub const SubAccountDeposit: Balance = 2 * UNIQUE;
+ pub const MaxSubAccounts: u32 = 100;
+ pub const MaxAdditionalFields: u32 = 100;
+ pub const MaxRegistrars: u32 = 20;
+}
+
+impl pallet_identity::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type Currency = Balances;
+ type BasicDeposit = BasicDeposit;
+ type FieldDeposit = FieldDeposit;
+ type MaxAdditionalFields = MaxAdditionalFields;
+ type MaxRegistrars = MaxRegistrars;
+ type MaxSubAccounts = MaxSubAccounts;
+ type SubAccountDeposit = SubAccountDeposit;
+
+ type RegistrarOrigin = governance::RootOrTechnicalCommitteeMember;
+ type ForceOrigin = governance::RootOrTechnicalCommitteeMember;
+
+ type Slashed = Treasury;
+ type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
+}
runtime/common/config/governance/mod.rsdiffbeforeafterboth--- a/runtime/common/config/governance/mod.rs
+++ b/runtime/common/config/governance/mod.rs
@@ -55,6 +55,8 @@
pub mod scheduler;
pub use scheduler::*;
+pub mod identity;
+
impl pallet_gov_origins::Config for Runtime {}
morph_types! {
runtime/common/config/pallets/collator_selection.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/collator_selection.rs
+++ b/runtime/common/config/pallets/collator_selection.rs
@@ -22,14 +22,13 @@
CollatorSelectionLicenseBondOverride,
};
use sp_runtime::Perbill;
-use up_common::constants::{MILLIUNIQUE, UNIQUE};
#[cfg(feature = "governance")]
use crate::config::governance;
use crate::{
config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},
Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,
- RuntimeHoldReason, Session, SessionKeys, Treasury,
+ RuntimeHoldReason, Session, SessionKeys,
};
parameter_types! {
pub const SessionOffset: BlockNumber = 0;
@@ -59,43 +58,9 @@
}
parameter_types! {
- // These do not matter as we forbid non-sudo operations with the identity pallet
- pub const BasicDeposit: Balance = 10 * UNIQUE;
- pub const FieldDeposit: Balance = 25 * MILLIUNIQUE;
- pub const SubAccountDeposit: Balance = 2 * UNIQUE;
- pub const MaxSubAccounts: u32 = 100;
- pub const MaxAdditionalFields: u32 = 100;
- pub const MaxRegistrars: u32 = 20;
- pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";
pub LicenseBond: Balance = CollatorSelectionLicenseBondOverride::<Runtime>::get();
pub DesiredCollators: u32 = CollatorSelectionDesiredCollatorsOverride::<Runtime>::get();
pub KickThreshold: BlockNumber = CollatorSelectionKickThresholdOverride::<Runtime>::get();
-}
-
-impl pallet_identity::Config for Runtime {
- type RuntimeEvent = RuntimeEvent;
- type Currency = Balances;
- type BasicDeposit = BasicDeposit;
- type FieldDeposit = FieldDeposit;
- type MaxAdditionalFields = MaxAdditionalFields;
- type MaxRegistrars = MaxRegistrars;
- type MaxSubAccounts = MaxSubAccounts;
- type SubAccountDeposit = SubAccountDeposit;
-
- #[cfg(feature = "governance")]
- type RegistrarOrigin = governance::RootOrTechnicalCommitteeMember;
-
- #[cfg(feature = "governance")]
- type ForceOrigin = governance::RootOrTechnicalCommitteeMember;
-
- #[cfg(not(feature = "governance"))]
- type RegistrarOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;
-
- #[cfg(not(feature = "governance"))]
- type ForceOrigin = EnsureRoot<<Self as frame_system::Config>::AccountId>;
-
- type Slashed = Treasury;
- type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
runtime/common/construct_runtime.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#[macro_export]18macro_rules! construct_runtime {19 () => {20 frame_support::construct_runtime! {2122 pub enum Runtime {23 System: frame_system = 0,24 StateTrieMigration: pallet_state_trie_migration = 1,2526 ParachainSystem: cumulus_pallet_parachain_system = 20,27 ParachainInfo: parachain_info = 21,2829 #[cfg(feature = "collator-selection")]30 Authorship: pallet_authorship = 22,3132 #[cfg(feature = "collator-selection")]33 CollatorSelection: pallet_collator_selection = 23,3435 #[cfg(feature = "collator-selection")]36 Session: pallet_session = 24,3738 Aura: pallet_aura = 25,39 AuraExt: cumulus_pallet_aura_ext = 26,4041 Balances: pallet_balances = 30,42 // RandomnessCollectiveFlip = 3143 Timestamp: pallet_timestamp = 32,44 TransactionPayment: pallet_transaction_payment = 33,45 Treasury: pallet_treasury = 34,46 Sudo: pallet_sudo = 35,47 Vesting: orml_vesting = 37,4849 XTokens: orml_xtokens = 38,50 Tokens: orml_tokens = 39,51 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,5253 #[cfg(feature = "collator-selection")]54 Identity: pallet_identity = 40,5556 #[cfg(feature = "preimage")]57 Preimage: pallet_preimage = 41,5859 #[cfg(feature = "governance")]60 Democracy: pallet_democracy = 42,6162 #[cfg(feature = "governance")]63 Council: pallet_collective::<Instance1> = 43,6465 #[cfg(feature = "governance")]66 TechnicalCommittee: pallet_collective::<Instance2> = 44,6768 #[cfg(feature = "governance")]69 CouncilMembership: pallet_membership::<Instance1> = 45,7071 #[cfg(feature = "governance")]72 TechnicalCommitteeMembership: pallet_membership::<Instance2> = 46,7374 #[cfg(feature = "governance")]75 FellowshipCollective: pallet_ranked_collective = 47,7677 #[cfg(feature = "governance")]78 FellowshipReferenda: pallet_referenda = 48,7980 #[cfg(feature = "governance")]81 Scheduler: pallet_scheduler = 49,8283 #[cfg(feature = "governance")]84 Origins: pallet_gov_origins = 99,8586 // XCM helpers.87 XcmpQueue: cumulus_pallet_xcmp_queue = 50,88 PolkadotXcm: pallet_xcm = 51,89 CumulusXcm: cumulus_pallet_xcm = 52,90 DmpQueue: cumulus_pallet_dmp_queue = 53,9192 // Unique Pallets93 Inflation: pallet_inflation = 60,94 Unique: pallet_unique::{Pallet, Call, Storage} = 61,9596 // #[cfg(feature = "scheduler")]97 // UniqueScheduler: pallet_unique_scheduler_v2 = 62,9899 Configuration: pallet_configuration = 63,100101 Charging: pallet_charge_transaction = 64,102 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,103 Common: pallet_common = 66,104 Fungible: pallet_fungible = 67,105106 #[cfg(feature = "refungible")]107 Refungible: pallet_refungible = 68,108109 Nonfungible: pallet_nonfungible = 69,110 Structure: pallet_structure = 70,111112 // RmrkCore: pallet_proxy_rmrk_core = 71,113114 // RmrkEquip: pallet_proxy_rmrk_equip = 72,115116 #[cfg(feature = "app-promotion")]117 AppPromotion: pallet_app_promotion = 73,118119 #[cfg(feature = "foreign-assets")]120 ForeignAssets: pallet_foreign_assets = 80,121122 // Frontier123 EVM: pallet_evm = 100,124 Ethereum: pallet_ethereum = 101,125126 EvmCoderSubstrate: pallet_evm_coder_substrate = 150,127 EvmContractHelpers: pallet_evm_contract_helpers = 151,128 EvmTransactionPayment: pallet_evm_transaction_payment = 152,129 EvmMigration: pallet_evm_migration = 153,130131 Maintenance: pallet_maintenance = 154,132133 BalancesAdapter: pallet_balances_adapter = 155,134135 Utility: pallet_utility = 156,136137 #[cfg(feature = "pallet-test-utils")]138 TestUtils: pallet_test_utils = 255,139 }140 }141 };142}runtime/common/identity.rsdiffbeforeafterboth--- a/runtime/common/identity.rs
+++ b/runtime/common/identity.rs
@@ -16,7 +16,7 @@
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
-#[cfg(feature = "collator-selection")]
+#[cfg(feature = "governance")]
use sp_runtime::transaction_validity::InvalidTransaction;
use sp_runtime::{
traits::{DispatchInfoOf, SignedExtension},
@@ -59,7 +59,7 @@
_len: usize,
) -> TransactionValidity {
match call {
- #[cfg(feature = "collator-selection")]
+ #[cfg(feature = "governance")]
RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
_ => Ok(ValidTransaction::default()),
}
runtime/common/maintenance.rsdiffbeforeafterboth--- a/runtime/common/maintenance.rs
+++ b/runtime/common/maintenance.rs
@@ -78,9 +78,12 @@
}
#[cfg(feature = "collator-selection")]
- RuntimeCall::CollatorSelection(_)
- | RuntimeCall::Session(_)
- | RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
+ RuntimeCall::CollatorSelection(_) | RuntimeCall::Session(_) => {
+ Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
+ }
+
+ #[cfg(feature = "governance")]
+ RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
#[cfg(feature = "pallet-test-utils")]
RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -551,7 +551,7 @@
#[cfg(feature = "collator-selection")]
list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
- #[cfg(feature = "collator-selection")]
+ #[cfg(feature = "governance")]
list_benchmark!(list, extra, pallet_identity, Identity);
#[cfg(feature = "foreign-assets")]
@@ -615,7 +615,7 @@
#[cfg(feature = "collator-selection")]
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
- #[cfg(feature = "collator-selection")]
+ #[cfg(feature = "governance")]
add_benchmark!(params, batches, pallet_identity, Identity);
#[cfg(feature = "foreign-assets")]
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -214,7 +214,7 @@
'pallet-xcm/try-runtime',
'parachain-info/try-runtime',
]
-unique-runtime = ['app-promotion', 'foreign-assets', 'refungible']
+unique-runtime = ['app-promotion', 'foreign-assets', 'refungible', 'governance', 'preimage']
app-promotion = []
collator-selection = []