Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/vesting-preco…
Browse files Browse the repository at this point in the history
…mpile
  • Loading branch information
luispdm committed Jul 19, 2024
2 parents b71e41d + b303c48 commit 8881e1d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 103 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Build

# Controls when the action will run.
on:
push:
workflow_dispatch:
Expand Down Expand Up @@ -120,60 +119,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
23 changes: 4 additions & 19 deletions .github/workflows/qa.yml → .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Main

on:
push:
branches:
- 'main'

jobs:
e2e-tests:
uses: ./.github/workflows/e2e.yml
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"fmt-check": "prettier ./tests --check",
"fmt": "prettier ./tests --write",
"build": "./compile_contracts.sh",
"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 -t 270000 'tests/**/*.ts'",
"test-sql": "FRONTIER_BACKEND_TYPE='sql' mocha -r ts-node/register 'tests/**/*.ts'"
},
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-staking/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
33 changes: 11 additions & 22 deletions runtime/laos/src/configs/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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.
Expand All @@ -75,27 +75,13 @@ impl frame_system::Config for Runtime {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

pub struct BaseCallFilter;
impl Contains<RuntimeCall> 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 {
use super::*;
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};
Expand Down Expand Up @@ -204,21 +190,24 @@ 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::<Runtime>::force_set_balance(
RuntimeOrigin::root(),
account,
stake
));

let call =
RuntimeCall::ParachainStaking(pallet_parachain_staking::Call::join_candidates {
bond: stake,
candidate_count: 32,
});

assert_err!(
call.dispatch(RuntimeOrigin::signed(account)),
frame_system::Error::<Runtime>::CallFiltered
);
assert_ok!(call.dispatch(RuntimeOrigin::signed(account)));
});
}

Expand Down

0 comments on commit 8881e1d

Please sign in to comment.