git.delta.rocks / unique-network / refs/commits / ae09c8df0c85

difftreelog

Merge branch 'develop' into feature/multi-assets-redone

Alexander Aksenov2022-09-15parents: #285030f #85b56f6.patch.diff
in: master

12 files changed

modified.github/workflows/ci-master.ymldiffbeforeafterboth
--- a/.github/workflows/ci-master.yml
+++ b/.github/workflows/ci-master.yml
@@ -18,16 +18,13 @@
     uses: ./.github/workflows/node-only-update_v2.yml
 
   forkless:
-    if: ${{ contains( github.event.pull_request.labels.*.name, 'forkless') }}
     uses: ./.github/workflows/forkless.yml
 
   canary:
-    if: ${{ contains( github.event.pull_request.labels.*.name, 'canary') }}
     uses: ./.github/workflows/canary.yml
     secrets: inherit # pass all secrets
 
   xcm:
-    if: ${{ contains( github.event.pull_request.labels.*.name, 'xcm') }}
     uses: ./.github/workflows/xcm.yml
     secrets: inherit # pass all secrets
 
deleted.github/workflows/market-test.ymldiffbeforeafterboth

no changes

modified.github/workflows/market-test_v2.ymldiffbeforeafterboth
--- a/.github/workflows/market-test_v2.yml
+++ b/.github/workflows/market-test_v2.yml
@@ -45,7 +45,7 @@
           repository: 'UniqueNetwork/market-e2e-tests'
           ssh-key: ${{ secrets.GH_PAT }}
           path: 'qa-tests'
-          ref: 'ci_test_v2'
+          ref: 'master'
 
       - name: Read .env file
         uses: xom9ikk/dotenv@v1.0.2
modified.github/workflows/node-only-update_v2.ymldiffbeforeafterboth
--- a/.github/workflows/node-only-update_v2.yml
+++ b/.github/workflows/node-only-update_v2.yml
@@ -10,7 +10,7 @@
 # A workflow run is made up of one or more jobs that can run sequentially or in parallel
 jobs:
 
-  execution-marix:
+  nodes-execution-matrix:
 
     name: execution matrix
 
@@ -42,8 +42,8 @@
 
 
 
-  forkless-update-nodata:
-    needs: execution-marix
+  nodes-only-update:
+    needs: nodes-execution-matrix
     # The type of runner that the job will run on
     runs-on: [self-hosted-ci,large]
 
@@ -57,7 +57,7 @@
 
     strategy:
       matrix:
-        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
+        include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}
 
     steps:
 
@@ -156,12 +156,18 @@
           exit 0
         shell: bash
 
+      - name: Checkout at '${{ matrix.mainnet_branch }}' branch
+        uses: actions/checkout@master
+        with:
+          ref: ${{ matrix.mainnet_branch }}  #Checking out head commit
+          path: ${{ matrix.mainnet_branch }}
+
+
       - name: Run tests before Node Parachain upgrade
-        working-directory: tests
+        working-directory: ${{ matrix.mainnet_branch }}/tests
         run: |
           yarn install
           yarn add mochawesome
-          node scripts/readyness.js
           echo "Ready to start tests"
           yarn polkadot-types
           NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
@@ -174,7 +180,7 @@
         if: success() || failure()    # run this step even if previous step failed
         with:
           name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created
-          path: tests/mochawesome-report/test-*.json    # Path to test results
+          path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-*.json    # Path to test results
           reporter: mochawesome-json
           fail-on-error: 'false'
 
@@ -263,8 +269,9 @@
       - name: Remove builder cache
         if: always()                   # run this step always
         run: |
-          docker builder prune -f
+          docker builder prune -f -a
           docker system prune -f
+          docker image prune -f -a
 
       - name: Clean Workspace
         if: always()
modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6600,7 +6600,7 @@
 
 [[package]]
 name = "pallet-unique"
-version = "0.1.4"
+version = "0.2.0"
 dependencies = [
  "ethereum",
  "evm-coder",
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -594,14 +594,14 @@
 								last_id,
 								*income_acc.borrow(),
 								ExistenceRequirement::KeepAlive,
-							)
-							.and_then(|_| {
-								Self::add_lock_balance(last_id, *income_acc.borrow())?;
-								<TotalStaked<T>>::try_mutate(|staked| {
-									staked
-										.checked_add(&*income_acc.borrow())
-										.ok_or(ArithmeticError::Overflow.into())
-								})
+							)?;
+
+							Self::add_lock_balance(last_id, *income_acc.borrow())?;
+							<TotalStaked<T>>::try_mutate(|staked| -> DispatchResult {
+								*staked = staked
+									.checked_add(&*income_acc.borrow())
+									.ok_or(ArithmeticError::Overflow)?;
+								Ok(())
 							})?;
 
 							Self::deposit_event(Event::StakingRecalculation(
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -82,7 +82,7 @@
 
 pub type SignedExtra = (
 	frame_system::CheckSpecVersion<Runtime>,
-	// system::CheckTxVersion<Runtime>,
+	frame_system::CheckTxVersion<Runtime>,
 	frame_system::CheckGenesis<Runtime>,
 	frame_system::CheckEra<Runtime>,
 	frame_system::CheckNonce<Runtime>,
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -50,7 +50,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 927020,
+	spec_version: 927030,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 2,
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -50,7 +50,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 927020,
+	spec_version: 927030,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 2,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -50,7 +50,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 927020,
+	spec_version: 927030,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 2,
modifiedtests/src/app-promotion.test.tsdiffbeforeafterboth
--- a/tests/src/app-promotion.test.ts
+++ b/tests/src/app-promotion.test.ts
@@ -661,6 +661,26 @@
     });
   });
 
+  it('should increase total staked', async() => {
+    await usingPlaygrounds(async (helper) => {
+      const staker = accounts.pop()!;
+      const totalStakedBefore = await helper.staking.getTotalStaked();
+      await helper.staking.stake(staker, 100n * nominal);
+
+      // Wait for rewards and pay
+      const stakedInBlock = (await helper.staking.getTotalStakedPerBlock({Substrate: staker.address}))[0][0];
+      await helper.wait.forRelayBlockNumber(rewardAvailableInBlock(stakedInBlock));
+      await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100));
+
+      const totalStakedAfter = await helper.staking.getTotalStaked();
+      expect(totalStakedAfter >= totalStakedBefore + calculateIncome(100n * nominal, 10n)).to.be.true;
+
+      // staker can unstake
+      await helper.staking.unstake(staker);
+      expect(await helper.staking.getTotalStaked()).to.be.equal(totalStakedAfter - calculateIncome(100n * nominal, 10n));
+    });
+  });
+
   it('should credit 0.05% for staking period', async () => {    
     await usingPlaygrounds(async helper => {
       const staker = accounts.pop()!;
addedtests/src/tx-version-presence.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/tx-version-presence.test.ts
@@ -0,0 +1,32 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import { Metadata } from '@polkadot/types';
+import {itSub, usingPlaygrounds, expect} from './util/playgrounds';
+
+let metadata: Metadata;
+
+describe('TxVersion is present', () => {
+  before(async () => {
+    await usingPlaygrounds(async helper => {
+      metadata = await helper.api!.rpc.state.getMetadata();
+    });
+  });
+
+  itSub('Signed extension CheckTxVersion is present', async () => {
+    expect(metadata.asLatest.extrinsic.signedExtensions.map(se => se.identifier.toString())).to.include('CheckTxVersion');
+  });
+});