From b6fa77302cc371a59660dc906ba2b03c55781659 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Thu, 18 Jul 2024 11:42:23 +0200 Subject: [PATCH 01/10] removed joinCollator filter --- runtime/laos/src/configs/system.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/runtime/laos/src/configs/system.rs b/runtime/laos/src/configs/system.rs index 1b9d6381f..4116cafea 100644 --- a/runtime/laos/src/configs/system.rs +++ b/runtime/laos/src/configs/system.rs @@ -18,7 +18,7 @@ use crate::{ weights::RocksDbWeight, AccountId, Balance, Block, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, RuntimeVersion, VERSION, }; -use frame_support::{parameter_types, traits::Contains}; +use frame_support::parameter_types; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; parameter_types! { @@ -61,7 +61,7 @@ impl frame_system::Config for Runtime { /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// The basic call filter to use in dispatchable. - type BaseCallFilter = BaseCallFilter; + type BaseCallFilter = (); /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); /// Block & extrinsics weights: base values and limits. @@ -75,19 +75,6 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } -pub struct BaseCallFilter; -impl Contains for BaseCallFilter { - fn contains(c: &RuntimeCall) -> bool { - use pallet_parachain_staking::Call::*; - - match c { - // New candidates are not allowed. - RuntimeCall::ParachainStaking(join_candidates { .. }) => false, - _ => true, - } - } -} - // tests #[cfg(test)] mod tests { From 09934dd5382fe4aa48c5e52bf08b3bfcf70d24f5 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Thu, 18 Jul 2024 12:24:04 +0200 Subject: [PATCH 02/10] reset BaseCallFilter because it is used by proxy --- runtime/laos/src/configs/system.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/runtime/laos/src/configs/system.rs b/runtime/laos/src/configs/system.rs index 4116cafea..03af47f6d 100644 --- a/runtime/laos/src/configs/system.rs +++ b/runtime/laos/src/configs/system.rs @@ -18,7 +18,7 @@ use crate::{ weights::RocksDbWeight, AccountId, Balance, Block, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, RuntimeVersion, VERSION, }; -use frame_support::parameter_types; +use frame_support::{parameter_types, traits::Contains}; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; parameter_types! { @@ -61,7 +61,7 @@ impl frame_system::Config for Runtime { /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// The basic call filter to use in dispatchable. - type BaseCallFilter = (); + type BaseCallFilter = BaseCallFilter; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); /// Block & extrinsics weights: base values and limits. @@ -75,6 +75,13 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } +pub struct BaseCallFilter; +impl Contains for BaseCallFilter { + fn contains(_: &RuntimeCall) -> bool { + true + } +} + // tests #[cfg(test)] mod tests { From 26cfb3b4ed10661b4ccb217abb6e19c92b1d372f Mon Sep 17 00:00:00 2001 From: luispdm <17044119+luispdm@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:33:16 +0200 Subject: [PATCH 03/10] run all e2e tests on main and tags only; order release jobs sequentially --- .github/workflows/build.yml | 58 +-------------------------- .github/workflows/{qa.yml => e2e.yml} | 23 ++--------- .github/workflows/main.yml | 10 +++++ .github/workflows/release.yml | 8 +++- e2e-tests/package.json | 3 +- 5 files changed, 23 insertions(+), 79 deletions(-) rename .github/workflows/{qa.yml => e2e.yml} (78%) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48cd024af..f26676420 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,7 @@ jobs: - name: Check clippy run: | SKIP_WASM_BUILD=1 cargo clippy --all-targets --workspace --features runtime-benchmarks --features try-runtime -- -D warnings + test: runs-on: group: laos @@ -100,60 +101,3 @@ jobs: - name: Try Runtime for Laos Omega run: | RUST_LOG=try-runtime ./target/release/laos try-runtime --runtime ./target/release/wbuild/laos-runtime/laos_runtime.wasm on-runtime-upgrade --checks=pre-and-post live --uri ws://174.138.104.13:9944 - - e2e-tests: - runs-on: - group: laos - labels: ubuntu-16-cores - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup - - uses: ./.github/actions/cache - with: - cache-key: build_and_push - - - name: Build - run: | - cargo build --release --locked - - - name: Copy polkadot relay chain binary - run: | - wget https://github.com/paritytech/polkadot/releases/download/v0.9.42/polkadot - chmod +x ./polkadot - - name: Copy Astar parachain binary - run: | - wget https://github.com/AstarNetwork/Astar/releases/download/v5.23.0/astar-collator-v5.23.0-ubuntu-x86_64.tar.gz - tar xf astar-collator-v5.23.0-ubuntu-x86_64.tar.gz - chmod +x ./astar-collator - - - name: Copy zombienet binary - run: | - wget https://github.com/paritytech/zombienet/releases/download/v1.3.106/zombienet-linux-x64 - chmod +x ./zombienet-linux-x64 - - - name: Run zombienet - run: | - export ZOMBIENET_RELAYCHAIN_COMMAND=./polkadot - export ZOMBIENET_LAOS_COMMAND=./target/release/laos - export ZOMBIENET_ASTAR_COMMAND=./astar-collator - ./zombienet-linux-x64 spawn ./zombienet/native.toml -p native & - echo "Zombienet started" - - - name: Wait for zombienet - run: | - timeout 36 sh -c 'until nc -z $0 $1; do echo -n .; sleep 1; done' localhost 9999 - - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install dependencies - run: | - npm install - working-directory: ./e2e-tests - - - name: Run tests - run: | - npm run build && npm run test - working-directory: ./e2e-tests diff --git a/.github/workflows/qa.yml b/.github/workflows/e2e.yml similarity index 78% rename from .github/workflows/qa.yml rename to .github/workflows/e2e.yml index f95c63dfe..e444cb6f8 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/e2e.yml @@ -1,24 +1,10 @@ -name: QA +name: E2E Tests -# Controls when the action will run. on: + workflow_call: workflow_dispatch: jobs: - check: - runs-on: - group: laos - labels: ubuntu-16-cores - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup - - uses: ./.github/actions/cache - with: - cache-key: build_and_push - - name: Check - run: | - cargo check --all-targets --release --features runtime-benchmarks --features try-runtime - e2e-tests: runs-on: group: laos @@ -71,8 +57,7 @@ jobs: npm install working-directory: ./e2e-tests - - name: Run QA tests + - name: Run e2e tests run: | - npm run build && npm run qa + npm run build && npm run test working-directory: ./e2e-tests - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..7b405487a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,10 @@ +name: Main + +on: + push: + branches: + - 'main' + +jobs: + e2e-tests: + uses: ./.github/workflows/e2e.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8617ce80..6e9d132b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,8 +33,12 @@ jobs: outputs: is_release_version: ${{ steps.check_version.outputs.is_release_version }} - prepare-release: + e2e-tests: needs: check-version + uses: ./.github/workflows/e2e.yml + + prepare-release: + needs: e2e-tests runs-on: ubuntu-latest strategy: matrix: @@ -113,7 +117,9 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + dockerize_and_push: + needs: prepare-release runs-on: group: laos labels: ubuntu-16-cores diff --git a/e2e-tests/package.json b/e2e-tests/package.json index c3f27fbe1..5ed69b781 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -7,8 +7,7 @@ "fmt-check": "prettier ./tests --check", "fmt": "prettier ./tests --write", "build": "cp -r ../pallets/laos-evolution/src/precompiles/evolution_collection_factory/contracts contracts && cp -r ../pallets/laos-evolution/src/precompiles/evolution_collection/contracts contracts && cp -r ../pallets/asset-metadata-extender/src/precompiles/asset_metadata_extender/contracts contracts && truffle compile && rm -rf contracts", - "test": "mocha -r ts-node/register -t 70000 --grep '@qa' --invert 'tests/**/*.ts'", - "qa": "mocha -r ts-node/register -t 200000 --grep '@qa' 'tests/**/*.ts'", + "test": "mocha -r ts-node/register 'tests/**/*.ts'", "test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'" }, "author": "", From 835714b3a3b60b43d5e9117d8aabeb9c8c7cbc9c Mon Sep 17 00:00:00 2001 From: luispdm <17044119+luispdm@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:52:33 +0200 Subject: [PATCH 04/10] test change branch name --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b405487a..6ac4d9b74 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Main on: push: branches: - - 'main' + - 'feature/change-e2e-tests-ci' jobs: e2e-tests: From a65cfa66956e2708597c555d6c407f8774c0cc04 Mon Sep 17 00:00:00 2001 From: luispdm <17044119+luispdm@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:56:59 +0200 Subject: [PATCH 05/10] Revert "test change branch name" This reverts commit 835714b3a3b60b43d5e9117d8aabeb9c8c7cbc9c. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ac4d9b74..7b405487a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Main on: push: branches: - - 'feature/change-e2e-tests-ci' + - 'main' jobs: e2e-tests: From 33fb406c9b5b2df5475deb3a0a8442e5ac1479d0 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Thu, 18 Jul 2024 14:16:04 +0200 Subject: [PATCH 06/10] fix test --- runtime/laos/src/configs/system.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/runtime/laos/src/configs/system.rs b/runtime/laos/src/configs/system.rs index 03af47f6d..eb8f8849d 100644 --- a/runtime/laos/src/configs/system.rs +++ b/runtime/laos/src/configs/system.rs @@ -89,7 +89,6 @@ mod tests { use crate::{ currency::UNIT, tests::{new_test_ext, ExtBuilder, ALICE, BOB}, - Runtime, }; use core::str::FromStr; use frame_support::{assert_err, assert_ok, dispatch::PostDispatchInfo, pallet_prelude::Pays}; @@ -198,10 +197,16 @@ mod tests { } #[test] - fn join_candidates_should_not_be_allowed() { + fn join_candidates_should_be_allowed() { new_test_ext().execute_with(|| { let account = AccountId::from_str(ALICE).unwrap(); - let stake = 100_000; + let stake = 20_000 * UNIT; + + assert_ok!(pallet_balances::Pallet::::force_set_balance( + RuntimeOrigin::root(), + account, + stake + )); let call = RuntimeCall::ParachainStaking(pallet_parachain_staking::Call::join_candidates { @@ -209,10 +214,7 @@ mod tests { candidate_count: 32, }); - assert_err!( - call.dispatch(RuntimeOrigin::signed(account)), - frame_system::Error::::CallFiltered - ); + assert_ok!(call.dispatch(RuntimeOrigin::signed(account))); }); } From 12100a518933ca88434c00ebdca2777514d27358 Mon Sep 17 00:00:00 2001 From: luispdm <17044119+luispdm@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:52:39 +0200 Subject: [PATCH 07/10] remove comment --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f26676420..fd338f46d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,5 @@ name: Build -# Controls when the action will run. on: push: workflow_dispatch: From 32cc893ec904ea69c715cebb3da1a54baa34aca6 Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Thu, 18 Jul 2024 14:56:50 +0200 Subject: [PATCH 08/10] using Everything --- runtime/laos/src/configs/system.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/runtime/laos/src/configs/system.rs b/runtime/laos/src/configs/system.rs index eb8f8849d..20eaf063f 100644 --- a/runtime/laos/src/configs/system.rs +++ b/runtime/laos/src/configs/system.rs @@ -18,7 +18,7 @@ use crate::{ weights::RocksDbWeight, AccountId, Balance, Block, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, RuntimeVersion, VERSION, }; -use frame_support::{parameter_types, traits::Contains}; +use frame_support::{parameter_types, traits::Everything}; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; parameter_types! { @@ -61,7 +61,7 @@ impl frame_system::Config for Runtime { /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// The basic call filter to use in dispatchable. - type BaseCallFilter = BaseCallFilter; + type BaseCallFilter = Everything; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = (); /// Block & extrinsics weights: base values and limits. @@ -75,13 +75,6 @@ impl frame_system::Config for Runtime { type MaxConsumers = frame_support::traits::ConstU32<16>; } -pub struct BaseCallFilter; -impl Contains for BaseCallFilter { - fn contains(_: &RuntimeCall) -> bool { - true - } -} - // tests #[cfg(test)] mod tests { From 3fb0aa528f07bd4f1b4d7224f35d9dea25ec1dfc Mon Sep 17 00:00:00 2001 From: Alessandro Siniscalchi Date: Fri, 19 Jul 2024 10:15:32 +0200 Subject: [PATCH 09/10] fix commit hash fork documentation --- pallets/parachain-staking/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/parachain-staking/README.md b/pallets/parachain-staking/README.md index 0b495f955..499c9de3d 100644 --- a/pallets/parachain-staking/README.md +++ b/pallets/parachain-staking/README.md @@ -1,6 +1,6 @@ # DPoS Pallet for Parachain Staking -This pallet is forked from `moonbeam` to avoid dependency on it. The exact commit hash of the fork is tag [`v0.36.0`](https://github.com/moonbeam-foundation/moonbeam/tree/v0.36.0/pallets/parachain-staking); +This pallet is forked from [`moonbeam v0.36.0`](https://github.com/moonbeam-foundation/moonbeam/tree/v0.36.0/pallets/parachain-staking), commit hash `d1087f3091726ffbe14b44655d848d00a1f14201`. ## Formatting Rules From 6f6337faac221a0a19b2b1ef142ccee3490b06c0 Mon Sep 17 00:00:00 2001 From: luispdm <17044119+luispdm@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:11:49 +0200 Subject: [PATCH 10/10] restore e2e tests timeout --- e2e-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/package.json b/e2e-tests/package.json index 5ed69b781..5ca876b8c 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -7,7 +7,7 @@ "fmt-check": "prettier ./tests --check", "fmt": "prettier ./tests --write", "build": "cp -r ../pallets/laos-evolution/src/precompiles/evolution_collection_factory/contracts contracts && cp -r ../pallets/laos-evolution/src/precompiles/evolution_collection/contracts contracts && cp -r ../pallets/asset-metadata-extender/src/precompiles/asset_metadata_extender/contracts contracts && truffle compile && rm -rf contracts", - "test": "mocha -r ts-node/register 'tests/**/*.ts'", + "test": "mocha -r ts-node/register -t 270000 'tests/**/*.ts'", "test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'" }, "author": "",