difftreelog
Merge branch 'develop' into feature/multi-assets-redone
in: master
12 files changed
.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
.github/workflows/market-test.ymldiffbeforeafterboth--- a/.github/workflows/market-test.yml
+++ /dev/null
@@ -1,227 +0,0 @@
-name: market api tests
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push or pull request events but only for the master branch
- pull_request:
- branches:
- - master
- types:
- - opened
- - reopened
- - synchronize #commit(s) pushed to the pull request
- - ready_for_review
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
-
- market_test:
- # The type of runner that the job will run on
- runs-on: [self-hosted-ci,large]
- timeout-minutes: 1380
-
- strategy:
- matrix:
- include:
- - network: "opal"
- features: "opal-runtime"
- - network: "quartz"
- features: "quartz-runtime"
- - network: "unique"
- features: "unique-runtime"
-
- name: draft job
-
- 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.
-
-
- steps:
-# - name: Skip if pull request is in Draft
- # `if: github.event.pull_request.draft == true` should be kept here, at
- # the step level, rather than at the job level. The latter is not
- # recommended because when the PR is moved from "Draft" to "Ready to
- # review" the workflow will immediately be passing (since it was skipped),
- # even though it hasn't actually ran, since it takes a few seconds for
- # the workflow to start. This is also disclosed in:
- # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
- # That scenario would open an opportunity for the check to be bypassed:
- # 1. Get your PR approved
- # 2. Move it to Draft
- # 3. Push whatever commits you want
- # 4. Move it to "Ready for review"; now the workflow is passing (it was
- # skipped) and "Check reviews" is also passing (it won't be updated
- # until the workflow is finished)
-# if: github.event.pull_request.draft == true
-# run: exit 1
-
- - name: Clean Workspace
- uses: AutoModality/action-clean@v1.1.0
-
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - name: Checkout master repo
- uses: actions/checkout@master
- with:
- ref: ${{ github.head_ref }} #Checking out head commit
-
- - name: Checkout Market e2e tests
- uses: actions/checkout@v3
- with:
- repository: 'UniqueNetwork/market-e2e-tests'
- ssh-key: '${{ secrets.GH_PAT }}'
- path: 'qa-tests'
- ref: 'QA-65_maxandreev'
-
- - name: Read .env file
- uses: xom9ikk/dotenv@v1.0.2
-
- - name: Copy qa-tests/.env.example to qa-tests/.env
- working-directory: qa-tests
- run: cp .env.docker .env
-
- - name: Show content of qa-test/.env
- working-directory: qa-tests
- run: cat .env
-
- - name: Read qa -test .env file
- uses: xom9ikk/dotenv@v1.0.2
- with:
- path: qa-tests/
-
- - name: Generate ENV related extend file for docker-compose
- uses: cuchi/jinja2-action@v1.2.0
- with:
- template: qa-tests/.docker/docker-compose.tmp-market.j2
- output_file: qa-tests/.docker/docker-compose.${{ matrix.network }}.yml
- variables: |
- REPO_URL=${{ github.server_url }}/${{ github.repository }}.git
- RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
- POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}
- FEATURE=${{ matrix.features }}
- BRANCH=${{ github.head_ref }}
-
-
- - name: Show build configuration
- working-directory: qa-tests
- run: cat .docker/docker-compose.${{ matrix.network }}.yml
-
- - name: Start node-parachain
- working-directory: qa-tests
- run: docker-compose -f ".docker/docker-compose.market.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate node-parachain
-
- - name: Start nonce-app
- working-directory: qa-tests
- run: docker-compose -f ".docker/docker-compose.market.yml" up -d --build --remove-orphans --force-recreate nonce-app
-
- - uses: actions/setup-node@v3
- with:
- node-version: 16
-
- - name: Setup TypeScript
- working-directory: qa-tests
- run: |
- npm install
- npm install -g ts-node
-
- - name: Copy qa-tests/.env.example to qa-tests/.env
- working-directory: qa-tests
- run: |
- rm -rf .env
- cp .env.example .env
-
-
- - name: Show content of qa-test/.env
- working-directory: qa-tests
- run: cat .env
-
-
- - name: Read qa -test .env file
- uses: xom9ikk/dotenv@v1.0.2
- with:
- path: qa-tests/
-
- - name: Generate accounts
- working-directory: qa-tests
- run: ts-node ./src/scripts/create-market-accounts.ts
-
- - name: Deploy contracts
- run: |
- cd qa-tests
- ts-node ./src/scripts/deploy-contract.ts
-
- - name: Import test data
- working-directory: qa-tests
- run: ts-node ./src/scripts/create-test-collections.ts
-
- - name: Show content of qa-test .env
- working-directory: qa-tests
- run: cat .env
-
- - name: Copy qa-tests/.env.example to qa-tests/.env
- working-directory: qa-tests
- run: |
- rm -rf .env.docker
- cp .env .env.docker
- sed -i '/UNIQUE_WS_ENDPOINT/c UNIQUE_WS_ENDPOINT=ws://node-parachain:9944' .env.docker
-
- - name: Read qa -test .env file
- uses: xom9ikk/dotenv@v1.0.2
- with:
- path: qa-tests/
-
- - name: local-market:start
- run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" up -d --build
-
- - name: Wait for market readyness
- working-directory: qa-tests
- run: src/scripts/wait-market-ready.sh
- shell: bash
-
- - name: Install dependecies
- working-directory: qa-tests
- run: |
- npm ci
- npm install -D @playwright/test
- npx playwright install-deps
- npx playwright install
-
- - name:
- working-directory: qa-tests
- run: |
- npx playwright test --workers=8 --quiet .*.api.test.ts --reporter=github --config playwright.config.ts
-
- - name: Show env variables
- if: success() || failure()
- run: printenv
-
- - name: look up for report
- if: success() || failure()
- run: |
- ls -la
- ls -la qa-tests/
-
-
- - name: Stop running containers
- if: always() # run this step always
- run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" down --volumes
-
- - name: Remove builder cache
- if: always() # run this step always
- run: |
- docker builder prune -f
- docker system prune -f
-
- - name: Clean Workspace
- if: always()
- uses: AutoModality/action-clean@v1.1.0
-
-
-
-
.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
.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()
Cargo.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",
pallets/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(
runtime/common/mod.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/>.1617pub mod config;18pub mod construct_runtime;19pub mod dispatch;20pub mod ethereum;21pub mod instance;22pub mod runtime_apis;23pub mod scheduler;24pub mod sponsoring;25pub mod weights;2627#[cfg(test)]28pub mod tests;2930use sp_core::H160;31use frame_support::traits::{Currency, OnUnbalanced, Imbalance};32use sp_runtime::{33 generic,34 traits::{BlakeTwo256, BlockNumberProvider},35 impl_opaque_keys,36};37use sp_std::vec::Vec;3839#[cfg(feature = "std")]40use sp_version::NativeVersion;4142use crate::{43 Runtime, Call, Balances, Treasury, Aura, Signature, AllPalletsReversedWithSystemFirst,44 InherentDataExt,45};46use up_common::types::{AccountId, BlockNumber};4748#[macro_export]49macro_rules! unsupported {50 () => {51 pallet_common::unsupported!($crate::Runtime)52 };53}5455/// The address format for describing accounts.56pub type Address = sp_runtime::MultiAddress<AccountId, ()>;57/// Block header type as expected by this runtime.58pub type Header = generic::Header<BlockNumber, BlakeTwo256>;59/// Block type as expected by this runtime.60pub type Block = generic::Block<Header, UncheckedExtrinsic>;61/// A Block signed with a Justification62pub type SignedBlock = generic::SignedBlock<Block>;63/// BlockId type as expected by this runtime.64pub type BlockId = generic::BlockId<Block>;6566impl_opaque_keys! {67 pub struct SessionKeys {68 pub aura: Aura,69 }70}7172/// The version information used to identify this runtime when compiled natively.73#[cfg(feature = "std")]74pub fn native_version() -> NativeVersion {75 NativeVersion {76 runtime_version: crate::VERSION,77 can_author_with: Default::default(),78 }79}8081pub type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;8283pub type SignedExtra = (84 frame_system::CheckSpecVersion<Runtime>,85 // system::CheckTxVersion<Runtime>,86 frame_system::CheckGenesis<Runtime>,87 frame_system::CheckEra<Runtime>,88 frame_system::CheckNonce<Runtime>,89 frame_system::CheckWeight<Runtime>,90 ChargeTransactionPayment,91 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,92 pallet_ethereum::FakeTransactionFinalizer<Runtime>,93);9495/// Unchecked extrinsic type as expected by this runtime.96pub type UncheckedExtrinsic =97 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;9899/// Extrinsic type that has already been checked.100pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;101102/// Executive: handles dispatch to the various modules.103pub type Executive = frame_executive::Executive<104 Runtime,105 Block,106 frame_system::ChainContext<Runtime>,107 Runtime,108 AllPalletsReversedWithSystemFirst,109>;110111type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;112113pub struct DealWithFees;114impl OnUnbalanced<NegativeImbalance> for DealWithFees {115 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {116 if let Some(fees) = fees_then_tips.next() {117 // for fees, 100% to treasury118 let mut split = fees.ration(100, 0);119 if let Some(tips) = fees_then_tips.next() {120 // for tips, if any, 100% to treasury121 tips.ration_merge_into(100, 0, &mut split);122 }123 Treasury::on_unbalanced(split.0);124 // Author::on_unbalanced(split.1);125 }126 }127}128129pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);130131impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider132 for RelayChainBlockNumberProvider<T>133{134 type BlockNumber = BlockNumber;135136 fn current_block_number() -> Self::BlockNumber {137 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()138 .map(|d| d.relay_parent_number)139 .unwrap_or_default()140 }141}142143pub(crate) struct CheckInherents;144145impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {146 fn check_inherents(147 block: &Block,148 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,149 ) -> sp_inherents::CheckInherentsResult {150 let relay_chain_slot = relay_state_proof151 .read_slot()152 .expect("Could not read the relay chain slot from the proof");153154 let inherent_data =155 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(156 relay_chain_slot,157 sp_std::time::Duration::from_secs(6),158 )159 .create_inherent_data()160 .expect("Could not create the timestamp inherent data");161162 inherent_data.check_extrinsics(block)163 }164}165166#[derive(codec::Encode, codec::Decode)]167pub enum XCMPMessage<XAccountId, XBalance> {168 /// Transfer tokens to the given account from the Parachain account.169 TransferToken(XAccountId, XBalance),170}1// 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/>.1617pub mod config;18pub mod construct_runtime;19pub mod dispatch;20pub mod ethereum;21pub mod instance;22pub mod runtime_apis;23pub mod scheduler;24pub mod sponsoring;25pub mod weights;2627#[cfg(test)]28pub mod tests;2930use sp_core::H160;31use frame_support::traits::{Currency, OnUnbalanced, Imbalance};32use sp_runtime::{33 generic,34 traits::{BlakeTwo256, BlockNumberProvider},35 impl_opaque_keys,36};37use sp_std::vec::Vec;3839#[cfg(feature = "std")]40use sp_version::NativeVersion;4142use crate::{43 Runtime, Call, Balances, Treasury, Aura, Signature, AllPalletsReversedWithSystemFirst,44 InherentDataExt,45};46use up_common::types::{AccountId, BlockNumber};4748#[macro_export]49macro_rules! unsupported {50 () => {51 pallet_common::unsupported!($crate::Runtime)52 };53}5455/// The address format for describing accounts.56pub type Address = sp_runtime::MultiAddress<AccountId, ()>;57/// Block header type as expected by this runtime.58pub type Header = generic::Header<BlockNumber, BlakeTwo256>;59/// Block type as expected by this runtime.60pub type Block = generic::Block<Header, UncheckedExtrinsic>;61/// A Block signed with a Justification62pub type SignedBlock = generic::SignedBlock<Block>;63/// BlockId type as expected by this runtime.64pub type BlockId = generic::BlockId<Block>;6566impl_opaque_keys! {67 pub struct SessionKeys {68 pub aura: Aura,69 }70}7172/// The version information used to identify this runtime when compiled natively.73#[cfg(feature = "std")]74pub fn native_version() -> NativeVersion {75 NativeVersion {76 runtime_version: crate::VERSION,77 can_author_with: Default::default(),78 }79}8081pub type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;8283pub type SignedExtra = (84 frame_system::CheckSpecVersion<Runtime>,85 frame_system::CheckTxVersion<Runtime>,86 frame_system::CheckGenesis<Runtime>,87 frame_system::CheckEra<Runtime>,88 frame_system::CheckNonce<Runtime>,89 frame_system::CheckWeight<Runtime>,90 ChargeTransactionPayment,91 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,92 pallet_ethereum::FakeTransactionFinalizer<Runtime>,93);9495/// Unchecked extrinsic type as expected by this runtime.96pub type UncheckedExtrinsic =97 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;9899/// Extrinsic type that has already been checked.100pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;101102/// Executive: handles dispatch to the various modules.103pub type Executive = frame_executive::Executive<104 Runtime,105 Block,106 frame_system::ChainContext<Runtime>,107 Runtime,108 AllPalletsReversedWithSystemFirst,109>;110111type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;112113pub struct DealWithFees;114impl OnUnbalanced<NegativeImbalance> for DealWithFees {115 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {116 if let Some(fees) = fees_then_tips.next() {117 // for fees, 100% to treasury118 let mut split = fees.ration(100, 0);119 if let Some(tips) = fees_then_tips.next() {120 // for tips, if any, 100% to treasury121 tips.ration_merge_into(100, 0, &mut split);122 }123 Treasury::on_unbalanced(split.0);124 // Author::on_unbalanced(split.1);125 }126 }127}128129pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);130131impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider132 for RelayChainBlockNumberProvider<T>133{134 type BlockNumber = BlockNumber;135136 fn current_block_number() -> Self::BlockNumber {137 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()138 .map(|d| d.relay_parent_number)139 .unwrap_or_default()140 }141}142143pub(crate) struct CheckInherents;144145impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {146 fn check_inherents(147 block: &Block,148 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,149 ) -> sp_inherents::CheckInherentsResult {150 let relay_chain_slot = relay_state_proof151 .read_slot()152 .expect("Could not read the relay chain slot from the proof");153154 let inherent_data =155 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(156 relay_chain_slot,157 sp_std::time::Duration::from_secs(6),158 )159 .create_inherent_data()160 .expect("Could not create the timestamp inherent data");161162 inherent_data.check_extrinsics(block)163 }164}165166#[derive(codec::Encode, codec::Decode)]167pub enum XCMPMessage<XAccountId, XBalance> {168 /// Transfer tokens to the given account from the Parachain account.169 TransferToken(XAccountId, XBalance),170}runtime/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,
runtime/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,
runtime/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,
tests/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()!;
tests/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');
+ });
+});