git.delta.rocks / unique-network / refs/commits / 64ac6cdfa3e0

difftreelog

fix enable governance on Unique

Daniel Shiposha2023-11-02parent: #4f574e9.patch.diff
in: master

9 files changed

modified.github/workflows/governance.ymldiffbeforeafterboth
before · .github/workflows/governance.yml
1# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings2name: governance tests34# Triger: only call from main workflow(re-usable workflows)5on:6  workflow_call:78# A workflow run is made up of one or more jobs that can run sequentially or in parallel9jobs:10  prepare-execution-marix:11    name: Prepare execution matrix1213    runs-on: self-hosted-ci14    outputs:15      matrix: ${{ steps.create_matrix.outputs.matrix }}1617    steps:18      - name: Clean Workspace19        uses: AutoModality/action-clean@v1.1.02021      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it22      - uses: actions/checkout@v3.1.023        with:24          ref: ${{ github.head_ref }} #Checking out head commit2526      - name: Read .env file27        uses: xom9ikk/dotenv@v22829      - name: Create Execution matrix30        uses: CertainLach/create-matrix-action@v431        id: create_matrix32        with:33          matrix: |34            network {quartz}, wasm_name {quartz}35            network {opal}, wasm_name {opal}36            network {sapphire}, wasm_name {quartz}3738  dev_build_int_tests:39    needs: prepare-execution-marix40    # The type of runner that the job will run on41    runs-on: [self-hosted-ci, medium]42    timeout-minutes: 13804344    name: ${{ matrix.network }}45    strategy:46      matrix:47        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}4849    continue-on-error: true #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.5051    steps:52      - name: Clean Workspace53        uses: AutoModality/action-clean@v1.1.05455      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it56      - uses: actions/checkout@v3.1.057        with:58          ref: ${{ github.head_ref }} #Checking out head commit5960      - name: Read .env file61        uses: xom9ikk/dotenv@v26263      - name: Generate ENV related extend file for docker-compose64        uses: cuchi/jinja2-action@v1.2.065        with:66          template: .docker/docker-compose.gov.j267          output_file: .docker/docker-compose.${{ matrix.network }}.yml68          variables: |69            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}70            NETWORK=${{ matrix.network }}71            WASM_NAME=${{ matrix.wasm_name }}7273      - name: Show build configuration74        run: cat .docker/docker-compose.${{ matrix.network }}.yml7576      - name: Build the stack77        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans7879      - uses: actions/setup-node@v3.5.180        with:81          node-version: 188283      - name: Run tests84        working-directory: tests85        run: |86          yarn install87          yarn add mochawesome88          ./scripts/wait_for_first_block.sh89          echo "Ready to start tests"90          NOW=$(date +%s) && yarn testGovernance --reporter mochawesome --reporter-options reportFilename=test-${NOW}91        env:92          RPC_URL: http://127.0.0.1:9944/9394      - name: Test Report95        uses: phoenix-actions/test-reporting@v1096        id: test-report97        if: success() || failure() # run this step even if previous step failed98        with:99          name: int test results - ${{ matrix.network }} # Name of the check run which will be created100          path: tests/mochawesome-report/test-*.json # Path to test results101          reporter: mochawesome-json102          fail-on-error: 'false'103104      - name: Read output variables105        run: |106          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"107108      - name: Stop running containers109        if: always() # run this step always110        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" down111112      - name: Remove builder cache113        if: always() # run this step always114        run: |115          docker builder prune -f -a116          docker system prune -f117          docker image prune -f -a
after · .github/workflows/governance.yml
1# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings2name: governance tests34# Triger: only call from main workflow(re-usable workflows)5on:6  workflow_call:78# A workflow run is made up of one or more jobs that can run sequentially or in parallel9jobs:10  prepare-execution-marix:11    name: Prepare execution matrix1213    runs-on: self-hosted-ci14    outputs:15      matrix: ${{ steps.create_matrix.outputs.matrix }}1617    steps:18      - name: Clean Workspace19        uses: AutoModality/action-clean@v1.1.02021      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it22      - uses: actions/checkout@v3.1.023        with:24          ref: ${{ github.head_ref }} #Checking out head commit2526      - name: Read .env file27        uses: xom9ikk/dotenv@v22829      - name: Create Execution matrix30        uses: CertainLach/create-matrix-action@v431        id: create_matrix32        with:33          matrix: |34            network {unique}, wasm_name {unique}35            network {quartz}, wasm_name {quartz}36            network {opal}, wasm_name {opal}37            network {sapphire}, wasm_name {quartz}3839  dev_build_int_tests:40    needs: prepare-execution-marix41    # The type of runner that the job will run on42    runs-on: [self-hosted-ci, medium]43    timeout-minutes: 13804445    name: ${{ matrix.network }}46    strategy:47      matrix:48        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}4950    continue-on-error: true #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.5152    steps:53      - name: Clean Workspace54        uses: AutoModality/action-clean@v1.1.05556      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it57      - uses: actions/checkout@v3.1.058        with:59          ref: ${{ github.head_ref }} #Checking out head commit6061      - name: Read .env file62        uses: xom9ikk/dotenv@v26364      - name: Generate ENV related extend file for docker-compose65        uses: cuchi/jinja2-action@v1.2.066        with:67          template: .docker/docker-compose.gov.j268          output_file: .docker/docker-compose.${{ matrix.network }}.yml69          variables: |70            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}71            NETWORK=${{ matrix.network }}72            WASM_NAME=${{ matrix.wasm_name }}7374      - name: Show build configuration75        run: cat .docker/docker-compose.${{ matrix.network }}.yml7677      - name: Build the stack78        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans7980      - uses: actions/setup-node@v3.5.181        with:82          node-version: 188384      - name: Run tests85        working-directory: tests86        run: |87          yarn install88          yarn add mochawesome89          ./scripts/wait_for_first_block.sh90          echo "Ready to start tests"91          NOW=$(date +%s) && yarn testGovernance --reporter mochawesome --reporter-options reportFilename=test-${NOW}92        env:93          RPC_URL: http://127.0.0.1:9944/9495      - name: Test Report96        uses: phoenix-actions/test-reporting@v1097        id: test-report98        if: success() || failure() # run this step even if previous step failed99        with:100          name: int test results - ${{ matrix.network }} # Name of the check run which will be created101          path: tests/mochawesome-report/test-*.json # Path to test results102          reporter: mochawesome-json103          fail-on-error: 'false'104105      - name: Read output variables106        run: |107          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"108109      - name: Stop running containers110        if: always() # run this step always111        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" down112113      - name: Remove builder cache114        if: always() # run this step always115        run: |116          docker builder prune -f -a117          docker system prune -f118          docker image prune -f -a
addedruntime/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>;
+}
modifiedruntime/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! {
modifiedruntime/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! {
modifiedruntime/common/construct_runtime.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime.rs
+++ b/runtime/common/construct_runtime.rs
@@ -50,7 +50,7 @@
 				Tokens: orml_tokens = 39,
 				// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
 
-				#[cfg(feature = "collator-selection")]
+				#[cfg(feature = "governance")]
 				Identity: pallet_identity = 40,
 
 				#[cfg(feature = "preimage")]
modifiedruntime/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()),
 		}
modifiedruntime/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)),
modifiedruntime/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")]
modifiedruntime/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 = []