Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into A0-1525
  • Loading branch information
kostekIV committed Nov 22, 2022
commit 3c90908d74bd7b7978b1e9b1d02ab82010bb46b2
9 changes: 1 addition & 8 deletions .github/actions/run-e2e-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:
- name: Run consensus party
shell: bash
run: ./.github/scripts/run_consensus.sh -m ${{ inputs.min-validator-count }} -n ${{ inputs.node-count }}

- name: Sleep
shell: bash
run: sleep 60
Expand Down Expand Up @@ -90,10 +90,3 @@ runs:
if: inputs.follow-up-finalization-check == 'true'
shell: bash
run: ./.github/scripts/run_e2e_test.sh -t finalization -m "${{ inputs.min-validator-count }}"

- name: Print debug if failed
if: ${{ failure() }}
shell: bash
run: |
cd bin/cliain
cargo run -- --seed //Alice debug-storage
12 changes: 6 additions & 6 deletions .github/scripts/check_finalization.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

RPC_HOST=127.0.0.1
RPC_PORT=9933
RPC_HOST=${RPC_HOST:-127.0.0.1}
RPC_PORT=${RPC_PORT:-9933}
LAST_FINALIZED=""
VALIDATOR=damian
VALIDATOR=${VALIDATOR:-damian}

while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do
block_hash=$(docker run --network container:$VALIDATOR appropriate/curl:latest \
block_hash=$(docker run --rm --network container:$VALIDATOR appropriate/curl:latest \
-H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method": "chain_getFinalizedHead"}' http://$RPC_HOST:$RPC_PORT | jq '.result')
ret_val=$?
Expand All @@ -15,7 +15,7 @@ while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do
continue
fi

finalized_block=$(docker run --network container:$VALIDATOR appropriate/curl:latest \
finalized_block=$(docker run --rm --network container:$VALIDATOR appropriate/curl:latest \
-H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock", "params": ['$block_hash']}' http://$RPC_HOST:$RPC_PORT | jq '.result.block.header.number')

Expand All @@ -25,9 +25,9 @@ while [[ "$LAST_FINALIZED" =~ "0x0" ]] || [[ -z "$LAST_FINALIZED" ]]; do
continue
else
LAST_FINALIZED=$finalized_block
echo "Last finalized block number: $LAST_FINALIZED"
fi

done

echo "Last finalized block number: $LAST_FINALIZED"
exit $?
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
Node0:
environment:
- ONLY_LEGACY_PROTOCOL=true

Node1:
environment:
- ONLY_LEGACY_PROTOCOL=true
12 changes: 10 additions & 2 deletions .github/scripts/run_consensus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set -euo pipefail
# change when increasing the number of node containers
NODE_COUNT=5
MIN_VALIDATOR_COUNT=4
DOCKER_COMPOSE=${DOCKER_COMPOSE:-"docker/docker-compose.yml"}
OVERRIDE_DOCKER_COMPOSE=${OVERRIDE_DOCKER_COMPOSE:-""}

# default minimum validator count
MIN_VALIDATOR_COUNT=4
Expand Down Expand Up @@ -82,14 +84,20 @@ function generate_bootnode_peer_id {

function run_containers {
local authorities_count="$1"
local docker_compose_file="$2"
local override_file="$3"

echo "Running ${authorities_count} containers..."
docker-compose -f docker/docker-compose.yml up -d
if [[ -z ${override_file} ]]; then
docker-compose -f "${docker_compose_file}" up -d
else
docker-compose -f "${docker_compose_file}" -f "${override_file}" up -d
fi
}

authorities=$(generate_authorities ${NODE_COUNT})
generate_chainspec "${authorities[@]}" "${MIN_VALIDATOR_COUNT}"
generate_bootnode_peer_id ${authorities[0]}
run_containers ${NODE_COUNT}
run_containers ${NODE_COUNT} "${DOCKER_COMPOSE}" "${OVERRIDE_DOCKER_COMPOSE}"

exit $?
12 changes: 8 additions & 4 deletions .github/scripts/run_e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function set_randomized_test_params {

ARGS=(
--network "container:Node0"
-e NODE_URL="127.0.0.1:9943"
-e NODE_URL="ws://127.0.0.1:9943"
-e RUST_LOG=info
)

Expand Down Expand Up @@ -101,12 +101,16 @@ fi

if [[ -n "${UPGRADE_VERSION:-}" && -n "${UPGRADE_SESSION:-}" && -n "${UPGRADE_FINALIZATION_WAIT_SESSIONS:-}" ]]; then
ARGS+=(
-e "${UPGRADE_VERSION}"
-e "${UPGRADE_SESSION}"
-e "${UPGRADE_FINALIZATION_WAIT_SESSIONS}"
-e UPGRADE_VERSION
-e UPGRADE_SESSION
-e UPGRADE_FINALIZATION_WAIT_SESSIONS
)
fi

if [[ -n "${ONLY_LEGACY:-}" ]]; then
ARGS+=(-e ONLY_LEGACY)
fi

docker run -v $(pwd)/docker/data:/data "${ARGS[@]}" aleph-e2e-client:latest

exit $?
2 changes: 1 addition & 1 deletion .github/workflows/build-node-and-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
retention-days: 7

- name: Build test binary
run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals"
run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals only_legacy"

- name: Upload test binary
uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
DOCKERHUB_TESTNET_IMAGE: cardinalcryptography/aleph-zero:testnet-${{ steps.vars.outputs.branch }}
DOCKERHUB_TESTNET_LATEST_IMAGE: cardinalcryptography/aleph-zero:testnet-latest
run: |
echo "FROM ${{ env.DOCKERHUB_TESTNET_IMAGE }}" > Dockerfile.dockerhub
echo "FROM ${{ env.TESTNET_IMAGE }}" > Dockerfile.dockerhub
echo 'ENTRYPOINT ["/usr/local/bin/aleph-node"]' >> Dockerfile.dockerhub
docker build -t ${{ env.DOCKERHUB_TESTNET_IMAGE }} -f Dockerfile.dockerhub .
docker tag ${{ env.DOCKERHUB_TESTNET_IMAGE }} ${{ env.DOCKERHUB_TESTNET_LATEST_IMAGE }}
Expand Down
160 changes: 149 additions & 11 deletions .github/workflows/e2e-tests-main-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,45 @@ jobs:
retention-days: 7


build-cliain-image:
name: Build docker image for cliain
runs-on: ubuntu-20.04
steps:
- name: GIT | Checkout source code
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Restore cache
uses: ./.github/actions/restore-cache
with:
target-key: cliain
cache-version: v2
cargo-targets: bin/cliain/target/

- name: Cargo | Build release binary
run: |
cd bin/cliain && cargo build --release

- name: Build docker image
run: |
cd bin/cliain
docker build --tag cliain:latest -f ./Dockerfile .
docker save -o cliain.tar cliain:latest

- name: Upload test docker image
uses: actions/upload-artifact@v2
with:
name: cliain-docker
path: ./bin/cliain/cliain.tar
if-no-files-found: error
retention-days: 7

- name: Cleanup cache
uses: ./.github/actions/post-cache


check-determinism:
needs: [build-new-node]
name: Verify runtime build determinism
Expand Down Expand Up @@ -279,6 +318,7 @@ jobs:
test-case: fee_calculation
timeout-minutes: 2


run-e2e-validators-rotate:
needs: [build-test-docker, build-test-client]
name: Run validators rotation test
Expand Down Expand Up @@ -399,7 +439,7 @@ jobs:
node-count: 6
reserved-seats: 3
non-reserved-seats: 3
follow-up-finalization-check: true
follow-up-finalization-check: false
timeout-minutes: 15

run-e2e-ban-automatic:
Expand All @@ -417,6 +457,21 @@ jobs:
follow-up-finalization-check: true
timeout-minutes: 15

run-e2e-ban-manual:
needs: [build-test-docker, build-test-client]
name: Run ban manual test
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Run e2e test
uses: ./.github/actions/run-e2e-test
with:
test-case: ban_manual
follow-up-finalization-check: true
timeout-minutes: 15

run-e2e-ban-counter-clearing:
needs: [build-test-docker, build-test-client]
name: Run ban counter clearing test
Expand All @@ -432,8 +487,23 @@ jobs:
follow-up-finalization-check: true
timeout-minutes: 15

run-e2e-permissionless-ban:
run-e2e-ban-threshold:
needs: [build-test-docker, build-test-client]
name: Run ban threshold test
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Run e2e test
uses: ./.github/actions/run-e2e-test
with:
test-case: ban_threshold
follow-up-finalization-check: true
timeout-minutes: 15

run-e2e-permissionless-ban:
needs: [ build-test-docker, build-test-client ]
name: Run permissionless ban test
runs-on: ubuntu-20.04
steps:
Expand All @@ -460,14 +530,14 @@ jobs:
with:
test-case: version_upgrade
env:
UPGRADE_VERSION: 1,
UPGRADE_SESSION: 3,
UPGRADE_FINALIZATION_WAIT_SESSIONS: 2,
UPGRADE_VERSION: 1
UPGRADE_SESSION: 3
UPGRADE_FINALIZATION_WAIT_SESSIONS: 2
timeout-minutes: 10

run-e2e-ban-manual:
run-e2e-failing-version-upgrade:
needs: [build-test-docker, build-test-client]
name: Run ban manual test
name: Run basic (failing) version-upgrade test
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
Expand All @@ -476,9 +546,74 @@ jobs:
- name: Run e2e test
uses: ./.github/actions/run-e2e-test
with:
test-case: ban_manual
follow-up-finalization-check: true
timeout-minutes: 15
test-case: doomed_version_upgrade
env:
OVERRIDE_DOCKER_COMPOSE: ./.github/scripts/docker-compose.no_quorum_without_old.override.yml
UPGRADE_VERSION: 1
UPGRADE_SESSION: 3
UPGRADE_FINALIZATION_WAIT_SESSIONS: 2
ONLY_LEGACY: true
timeout-minutes: 10

run-e2e-version-upgrade-catchup:
needs: [build-test-docker, build-cliain-image]
name: Run series of tests where some of the nodes need to do version-upgrade during catch-up
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- nodes: "Node1"
ports: "9934"
ext_status: "finalized"
upgrade_before_disable: "true"

- nodes: "Node1"
ports: "9934"
ext_status: "finalized"
upgrade_before_disable: "false"

- nodes: "Node1:Node2"
ports: "9934:9935"
ext_status: "in-block"
upgrade_before_disable: "true"

- nodes: "Node1:Node2"
ports: "9934:9935"
ext_status: "in-block"
upgrade_before_disable: "false"
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Download artifact with docker image for aleph-node
uses: actions/download-artifact@v2
with:
name: aleph-test-docker

- name: Load node docker image
shell: bash
run: docker load -i aleph-node.tar

- name: Download artifact with docker image for cliain
uses: actions/download-artifact@v2
with:
name: cliain-docker

- name: Load cliain docker image
shell: bash
run: docker load -i cliain.tar

- name: Call catchup_test.sh
env:
UPGRADE_BLOCK: 31
NODES: ${{ matrix.nodes }}
PORTS: ${{ matrix.ports }}
EXT_STATUS: ${{ matrix.ext_status }}
UPGRADE_BEFORE_DISABLE: ${{ matrix.upgrade_before_disable }}
DOCKER_COMPOSE: docker/docker-compose.bridged.yml

run: |
./scripts/catchup_version_upgrade_test.sh

check-e2e-test-suite-completion:
needs: [
Expand All @@ -501,9 +636,12 @@ jobs:
run-e2e-rewards-points-basic,
run-e2e-authorities-are-staking,
run-e2e-ban-automatic,
run-e2e-ban-counter-clearing,
run-e2e-ban-manual,
run-e2e-ban-counter-clearing,
run-e2e-ban-threshold,
run-e2e-version-upgrade,
run-e2e-failing-version-upgrade,
run-e2e-version-upgrade-catchup,
run-e2e-permissionless-ban,
]
name: Check e2e test suite completion
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.