Skip to content

Commit 03fcd95

Browse files
committed
Merge branch 'master' of github.com:AstarNetwork/Astar into feat/improve-collator-selection
2 parents 99aa51f + eea4653 commit 03fcd95

File tree

9 files changed

+156
-36
lines changed

9 files changed

+156
-36
lines changed

.devcontainer/devcontainer.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Rust",
3+
"image": "mcr.microsoft.com/devcontainers/rust:latest",
4+
"runArgs": ["--platform=linux/amd64"]
5+
}

.github/workflows/release.yml

+34-2
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ jobs:
536536
asset_name: evm-tracing-artifacts-${{ github.ref_name }}.tar.gz
537537
asset_content_type: application/gzip
538538

539-
chain-sync:
539+
chain-sync-smoke:
540540
needs: native-linux
541541
runs-on: ubuntu-latest
542542
strategy:
@@ -556,4 +556,36 @@ jobs:
556556
- name: Sync chain ${{ matrix.chain }}
557557
run: |
558558
chmod +x target/release/astar-collator
559-
./scripts/sync.sh ${{ matrix.chain }}
559+
./scripts/sync-smoke.sh ${{ matrix.chain }}
560+
561+
zombienet-smoke:
562+
needs: native-linux
563+
runs-on: ubuntu-latest
564+
strategy:
565+
matrix:
566+
chain: [ "astar-dev", "shiden-dev", "shibuya-dev" ]
567+
568+
steps:
569+
- name: Checkout the source code
570+
uses: actions/checkout@v4
571+
572+
- name: Download pre-built collator binary
573+
uses: actions/download-artifact@v3
574+
with:
575+
name: astar-ubuntu-latest-x86_64
576+
path: target/release
577+
578+
- name: Setup
579+
run: |
580+
chmod +x target/release/astar-collator
581+
mv target/release/astar-collator third-party/zombienet
582+
583+
- name: Setup zombienet
584+
working-directory: third-party/zombienet
585+
run: ./setup.sh
586+
587+
- name: ${{ matrix.chain }} build blocks
588+
working-directory: third-party/zombienet
589+
env:
590+
CHAIN: ${{ matrix.chain }}
591+
run: zombienet -p native test smoke.zndsl

.github/workflows/static-analysis.yml

+23-25
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: Static Analysis
2-
on: [push, workflow_dispatch]
2+
on: [ push, workflow_dispatch ]
33
concurrency:
44
group: ${{ github.workflow }}-${{ github.ref }}
55
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
66

77
jobs:
88
fmt:
99
if: github.event.pull_request.draft == false
10-
runs-on: [self-hosted, Linux, X64]
10+
runs-on: [ self-hosted, Linux, X64 ]
1111
steps:
1212
- name: Checkout the source code
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: Install deps
1616
run: sudo apt -y install protobuf-compiler
@@ -35,39 +35,37 @@ jobs:
3535
3636
clippy:
3737
if: github.event.pull_request.draft == false
38-
runs-on: [self-hosted, Linux, X64]
38+
runs-on: [ self-hosted, Linux, X64 ]
3939
steps:
40-
- name: Checkout the source code
41-
uses: actions/checkout@v3
40+
- name: Checkout the source code
41+
uses: actions/checkout@v4
4242

43-
- name: Install deps
44-
run: sudo apt -y install protobuf-compiler
43+
- name: Install deps
44+
run: sudo apt -y install protobuf-compiler
4545

46-
- name: free disk space
47-
run: |
48-
sudo swapoff -a
49-
sudo rm -f /swapfile
50-
sudo apt clean
46+
- name: free disk space
47+
run: |
48+
sudo swapoff -a
49+
sudo rm -f /swapfile
50+
sudo apt clean
5151
52-
- name: Install & display rust toolchain
53-
run: rustup show
52+
- name: Install & display rust toolchain
53+
run: rustup show
5454

55-
- name: Check targets are installed correctly
56-
run: rustup target list --installed
55+
- name: Check targets are installed correctly
56+
run: rustup target list --installed
5757

58-
- uses: actions-rs/clippy-check@v1
59-
env:
60-
SKIP_WASM_BUILD: 1
61-
with:
62-
token: ${{ secrets.GITHUB_TOKEN }}
63-
args: --features try-runtime,runtime-benchmarks -- -D warnings
58+
- name: Clippy
59+
env:
60+
SKIP_WASM_BUILD: 1
61+
run: cargo clippy --features evm-tracing,try-runtime,runtime-benchmarks -- -D warnings
6462

6563
check-license:
6664
if: github.event.pull_request.draft == false
67-
runs-on: [self-hosted, Linux, X64]
65+
runs-on: [ self-hosted, Linux, X64 ]
6866
steps:
6967
- name: Checkout the source code
70-
uses: actions/checkout@v3
68+
uses: actions/checkout@v4
7169

7270
- name: Check license
7371
uses: viperproject/check-license-header@v2

bin/collator/res/shibuya.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"bootNodes": [
66
"/ip4/65.108.46.114/tcp/38333/ws/p2p/12D3KooWLBLYreWVnWUvV5xvTgbhr5zSPn33LQhexGW28zj83GjH",
77
"/ip4/103.243.173.186/tcp/30333/ws/p2p/12D3KooWDuAQkahaTsN8XHg4k7qe8rttoXrTW5jpJke275S2YA1a",
8-
"/ip4/134.209.98.231/tcp/30333/ws/p2p/12D3KooWHuBMCcRqAChQ1fGBJ76QKF2u1yZPs6ZX93Qgn24jDq3Q",
8+
"/ip4/134.209.98.231/tcp/30333/ws/p2p/12D3KooWNfADqVKZFtiTDvR4CYF6pro5KVXeBEKYBHh5ohLAHrqk",
99
"/dns/bootnode-01.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWLBLYreWVnWUvV5xvTgbhr5zSPn33LQhexGW28zj83GjH",
1010
"/dns/bootnode-02.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWDuAQkahaTsN8XHg4k7qe8rttoXrTW5jpJke275S2YA1a",
11-
"/dns/bootnode-03.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWHuBMCcRqAChQ1fGBJ76QKF2u1yZPs6ZX93Qgn24jDq3Q"
11+
"/dns/bootnode-03.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWNfADqVKZFtiTDvR4CYF6pro5KVXeBEKYBHh5ohLAHrqk"
1212
],
1313
"telemetryEndpoints": null,
1414
"protocolId": "shibuya",

bin/collator/res/shibuya.raw.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"bootNodes": [
66
"/ip4/65.108.46.114/tcp/38333/ws/p2p/12D3KooWLBLYreWVnWUvV5xvTgbhr5zSPn33LQhexGW28zj83GjH",
77
"/ip4/103.243.173.186/tcp/30333/ws/p2p/12D3KooWDuAQkahaTsN8XHg4k7qe8rttoXrTW5jpJke275S2YA1a",
8-
"/ip4/134.209.98.231/tcp/30333/ws/p2p/12D3KooWHuBMCcRqAChQ1fGBJ76QKF2u1yZPs6ZX93Qgn24jDq3Q",
8+
"/ip4/134.209.98.231/tcp/30333/ws/p2p/12D3KooWNfADqVKZFtiTDvR4CYF6pro5KVXeBEKYBHh5ohLAHrqk",
99
"/dns/bootnode-01.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWLBLYreWVnWUvV5xvTgbhr5zSPn33LQhexGW28zj83GjH",
1010
"/dns/bootnode-02.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWDuAQkahaTsN8XHg4k7qe8rttoXrTW5jpJke275S2YA1a",
11-
"/dns/bootnode-03.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWHuBMCcRqAChQ1fGBJ76QKF2u1yZPs6ZX93Qgn24jDq3Q"
11+
"/dns/bootnode-03.shibuya.astar.network/tcp/443/wss/p2p/12D3KooWNfADqVKZFtiTDvR4CYF6pro5KVXeBEKYBHh5ohLAHrqk"
1212
],
1313
"telemetryEndpoints": null,
1414
"protocolId": "shibuya",

scripts/sync.sh scripts/sync-smoke.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ chain="$@"
88
# run node
99
./target/release/astar-collator --chain $chain --no-telemetry --no-prometheus --tmp -- --no-telemetry --no-prometheus & CHAIN_PID=$!
1010

11-
printf "Waiting for RPC to be ready"
11+
trap "kill $CHAIN_PID" EXIT
12+
13+
echo "Waiting for RPC to be ready"
1214
attempts=12 # 1 minutes
1315
until nc -z localhost 9944; do
1416
attempts=$((attempts - 1))
@@ -19,10 +21,11 @@ until nc -z localhost 9944; do
1921
sleep 5
2022
done
2123

22-
printf "Waiting for 30 seconds to sync at least 1000 blocks"
24+
echo "Waiting for 30 seconds to sync at least 1000 blocks"
2325
sleep 30
2426

25-
number=$(curl --location http://localhost:9944 \
27+
number=$(curl --silent \
28+
--location http://localhost:9944 \
2629
--header 'Content-Type: application/json' \
2730
--data '{
2831
"jsonrpc": "2.0",
@@ -35,5 +38,3 @@ if [ "$number" -lt 1000 ]; then
3538
echo "ERROR: Chain failed to sync 1000 blocks in 30 seconds"
3639
exit 1
3740
fi
38-
39-
kill $CHAIN_PID

third-party/zombienet/setup.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ $(arch) != "x86_64" ]
6+
then
7+
echo "Runs only on x86_64 architecture"
8+
exit 1
9+
fi
10+
11+
if ! command -v ./astar-collator &> /dev/null
12+
then
13+
echo "No executable astar-collator binary in zombienet directory"
14+
exit 1
15+
fi
16+
17+
ZOMBINET_VERSION=v1.3.106
18+
19+
if ! command -v zombienet &> /dev/null
20+
then
21+
echo "Install zombienet $ZOMBINET_VERSION"
22+
mkdir -p $HOME/.local/bin
23+
wget -q -O $HOME/.local/bin/zombienet https://github.com/paritytech/zombienet/releases/download/$ZOMBINET_VERSION/zombienet-linux-x64
24+
chmod a+x $HOME/.local/bin/zombienet
25+
PATH=$HOME/.local/bin:$PATH
26+
zombienet version
27+
fi
28+
29+
echo "Pull polkadot binaries"
30+
zombienet setup polkadot -y & SETUP_PID=$!
31+
while ps $SETUP_PID > /dev/null ; do
32+
sleep 1
33+
done
34+
chmod +x polkadot polkadot-execute-worker polkadot-prepare-worker

third-party/zombienet/smoke.toml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[settings]
2+
timeout = 1000
3+
4+
# Used to start 4 validator nodes and 2 collator nodes for a single parachain.
5+
6+
[relaychain]
7+
default_command = "./polkadot"
8+
chain = "rococo-local"
9+
10+
[[relaychain.nodes]]
11+
name = "alice"
12+
validator = true
13+
14+
[[relaychain.nodes]]
15+
name = "bob"
16+
validator = true
17+
18+
[[relaychain.nodes]]
19+
name = "charlie"
20+
validator = true
21+
22+
[[relaychain.nodes]]
23+
name = "dave"
24+
validator = true
25+
26+
[[parachains]]
27+
# Right now this has to be 2000 but soon we might be able to use arbitrary para-id
28+
id = 2000
29+
chain = "{{CHAIN}}"
30+
cumulus_based = true
31+
32+
[[parachains.collators]]
33+
name = "collator1"
34+
command = "./astar-collator"
35+
ws_port=9944
36+
37+
[[parachains.collators]]
38+
name = "collator2"
39+
command = "./astar-collator"

third-party/zombienet/smoke.zndsl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Description: Parachain build blocks
2+
Network: ./smoke.toml
3+
Creds: config
4+
5+
alice: is up
6+
collator1: is up
7+
collator2: is up
8+
9+
## test the block height
10+
collator1: reports block height is greater than 5 within 200 seconds
11+
collator2: reports block height is greater than 5 within 200 seconds

0 commit comments

Comments
 (0)