Warp sync zombienet tests: add basic BEEFY checks (#2854)

Part of https://github.com/paritytech/polkadot-sdk/issues/2787

This is an initial PR that adds some basic BEEFY checks to the warp sync
zombienet tests. To be more specific, it does the following:
- Changes the snapshot used by the warp sync zombienet tests to one
built from an updated version of the kitchensink runtime, that supports
BEEFY
- Adds some basic BEEFY checks to the warp sync zombienet tests
- Deduplicates some params of the warp sync zombienet tests, making them
easier to extend
This commit is contained in:
Serban Iorga
2024-01-11 11:39:33 +01:00
committed by GitHub
parent c8112e2c6f
commit 578960f3ea
12 changed files with 176 additions and 509 deletions
+19 -3
View File
@@ -40,6 +40,16 @@
tags: tags:
- zombienet-polkadot-integration-test - zombienet-polkadot-integration-test
.zombienet-substrate-warp-sync-common:
extends:
- .zombienet-substrate-common
variables:
# DB generated from commit: https://github.com/paritytech/polkadot-sdk/commit/2e4b8996c4924fc39f85198019039cf0987f89ec
# TODO: As a workaround for https://github.com/paritytech/polkadot-sdk/issues/2568 the DB was generated in archive mode.
# After the issue is fixed, we should replace it with a pruned version of the DB.
DB_SNAPSHOT: "https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-510ac1c891afe26bad6fcd6d74185917b3fb1b4f.tgz"
DB_BLOCK_HEIGHT: 47222
zombienet-substrate-0000-block-building: zombienet-substrate-0000-block-building:
extends: extends:
- .zombienet-substrate-common - .zombienet-substrate-common
@@ -50,7 +60,7 @@ zombienet-substrate-0000-block-building:
zombienet-substrate-0001-basic-warp-sync: zombienet-substrate-0001-basic-warp-sync:
extends: extends:
- .zombienet-substrate-common - .zombienet-substrate-warp-sync-common
script: script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0001-basic-warp-sync" --local-dir="${LOCAL_DIR}/0001-basic-warp-sync"
@@ -58,7 +68,10 @@ zombienet-substrate-0001-basic-warp-sync:
zombienet-substrate-0002-validators-warp-sync: zombienet-substrate-0002-validators-warp-sync:
extends: extends:
- .zombienet-substrate-common - .zombienet-substrate-warp-sync-common
before_script:
- !reference [.zombienet-substrate-warp-sync-common, before_script]
- cp --remove-destination ${LOCAL_DIR}/0001-basic-warp-sync/chain-spec.json ${LOCAL_DIR}/0002-validators-warp-sync
script: script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0002-validators-warp-sync" --local-dir="${LOCAL_DIR}/0002-validators-warp-sync"
@@ -66,7 +79,10 @@ zombienet-substrate-0002-validators-warp-sync:
zombienet-substrate-0003-block-building-warp-sync: zombienet-substrate-0003-block-building-warp-sync:
extends: extends:
- .zombienet-substrate-common - .zombienet-substrate-warp-sync-common
before_script:
- !reference [.zombienet-substrate-warp-sync-common, before_script]
- cp --remove-destination ${LOCAL_DIR}/0001-basic-warp-sync/chain-spec.json ${LOCAL_DIR}/0003-block-building-warp-sync
script: script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0003-block-building-warp-sync" --local-dir="${LOCAL_DIR}/0003-block-building-warp-sync"
@@ -10,10 +10,10 @@ The `dave` node executed with `--sync warp` syncs database with the rest of the
Database was prepared using the following zombienet file (`generate-warp-sync-database.toml`): Database was prepared using the following zombienet file (`generate-warp-sync-database.toml`):
``` ```
[relaychain] [relaychain]
default_image = "docker.io/parity/substrate:master" default_image = "docker.io/paritypr/substrate:master"
default_command = "substrate" default_command = "substrate"
chain = "gen-db" chain = "local"
chain_spec_path = "chain-spec.json" chain_spec_path = "chain-spec.json"
@@ -32,32 +32,31 @@ The zombienet shall be executed with the following command, and run for some per
``` ```
Once the zombienet is stopped, the database snapshot Once the zombienet is stopped, the database snapshot
(`{alice,bob}/data/chains/local_testnet/db/` dirs) was created using the following (`alice/data/chains/local_testnet/db/` dir) was created using the following
commands: commands:
```bash ```bash
mkdir -p db-snapshot/{alice,bob}/data/chains/local_testnet/db/ mkdir -p db-snapshot/alice/data/chains/local_testnet/db/
cp -r db-test-gen/alice/data/chains/local_testnet/db/full db-snapshot/alice/data/chains/local_testnet/db/ cp -r db-test-gen/alice/data/chains/local_testnet/db/full db-snapshot/alice/data/chains/local_testnet/db/
cp -r db-test-gen/bob/data/chains/local_testnet/db/full db-snapshot/bob/data/chains/local_testnet/db/ ```
Sample command to prepare archive:
```
tar -C db-snapshot/alice/ -czf chains.tgz ./
``` ```
The file format should be `tar.gz`. File shall contain `local_testnet` folder and its subfolders, e.g.: The file format should be `tar.gz`. File shall contain `local_testnet` folder and its subfolders, e.g.:
``` ```
$ tar tzf chains.tgz | head $ tar tzf chains.tgz | head
local_testnet/ data/chains/local_testnet/
local_testnet/db/ data/chains/local_testnet/db/
local_testnet/db/full/ data/chains/local_testnet/db/full/
... ...
local_testnet/db/full/000469.log data/chains/local_testnet/db/full/000469.log
```
Sample command to prepare archive:
```
tar -C db-snapshot/alice/data/chains/ -czf chains.tgz local_testnet
``` ```
Also refer to: [zombienet#578](https://github.com/paritytech/zombienet/issues/578) Also refer to: [zombienet#578](https://github.com/paritytech/zombienet/issues/578)
The `raw` chain-spec shall also be saved: `db-test-gen/gen-db-raw.json`. The `raw` chain-spec shall also be saved: `db-test-gen/local.json`.
# Where to upload database # Where to upload database
The access to this [bucket](https://console.cloud.google.com/storage/browser/zombienet-db-snaps/) is required. The access to this [bucket](https://console.cloud.google.com/storage/browser/zombienet-db-snaps/) is required.
@@ -81,8 +80,6 @@ Test can be run with the following command:
zombienet-linux test --dir db-snapshot --provider native test-warp-sync.zndsl zombienet-linux test --dir db-snapshot --provider native test-warp-sync.zndsl
``` ```
*NOTE*: currently blocked by: [zombienet#578](https://github.com/paritytech/zombienet/issues/578)
# Save some time hack # Save some time hack
Substrate can be patched to reduce the grandpa session period. Substrate can be patched to reduce the grandpa session period.
File diff suppressed because one or more lines are too long
@@ -1,16 +1,19 @@
# this file is not intended to be executed in CI stage # this file is not intended to be executed in CI stage
[relaychain] [relaychain]
default_image = "docker.io/parity/substrate:latest" default_image = "docker.io/paritypr/substrate:latest"
default_command = "substrate" default_command = "substrate"
# refer to ./README.md for more details on how to create snapshot and spec # refer to ./README.md for more details on how to create snapshot and spec
chain = "gen-db" chain = "local"
chain_spec_path = "chain-spec.json" chain_spec_path = "chain-spec.json"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "alice" name = "alice"
validator = true validator = true
# TODO: Workaround for https://github.com/paritytech/polkadot-sdk/issues/2568
# After the issue is fixed, we can remove this.
args = ["--state-pruning archive --blocks-pruning archive"]
[[relaychain.nodes]] [[relaychain.nodes]]
name = "bob" name = "bob"
@@ -5,24 +5,24 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate" default_command = "substrate"
chain = "gen-db" chain = "local"
chain_spec_path = "chain-spec.json" chain_spec_path = "chain-spec.json"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "alice" name = "alice"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "bob" name = "bob"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
#we need at least 3 nodes for warp sync #we need at least 3 nodes for warp sync
[[relaychain.nodes]] [[relaychain.nodes]]
name = "charlie" name = "charlie"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "dave" name = "dave"
@@ -13,18 +13,16 @@ charlie: reports peers count is at least 3 within 60 seconds
dave: reports peers count is at least 3 within 60 seconds dave: reports peers count is at least 3 within 60 seconds
# db snapshot has 12133 blocks # db snapshot has {{DB_BLOCK_HEIGHT}} blocks
dave: reports block height is at least 1 within 60 seconds alice: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 12132 within 60 seconds bob: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 12133 within 60 seconds charlie: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
alice: reports block height is at least 12133 within 60 seconds dave: reports block height is at least 1 within 60 seconds
bob: reports block height is at least 12133 within 60 seconds dave: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
charlie: reports block height is at least 12133 within 60 seconds
dave: log line matches "Warp sync is complete" within 60 seconds dave: log line matches "Warp sync is complete" within 60 seconds
# workaround for: https://github.com/paritytech/zombienet/issues/580 dave: log line matches "Block history download is complete" within 10 seconds
dave: count of log lines containing "Block history download is complete" is 1 within 10 seconds
dave: count of log lines containing "error" is 0 within 10 seconds dave: count of log lines containing "error" is 0 within 10 seconds
dave: count of log lines containing "verification failed" is 0 within 10 seconds dave: count of log lines containing "verification failed" is 0 within 10 seconds
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
../0001-basic-warp-sync/chain-spec.json
@@ -5,7 +5,7 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate" default_command = "substrate"
chain = "gen-db" chain = "local"
chain_spec_path = "chain-spec.json" chain_spec_path = "chain-spec.json"
[[relaychain.nodes]] [[relaychain.nodes]]
@@ -18,18 +18,18 @@ chain_spec_path = "chain-spec.json"
validator = true validator = true
args = ["--sync warp"] args = ["--sync warp"]
#we need at least 3 nodes for warp sync # we need at least 3 nodes for warp sync
[[relaychain.nodes]] [[relaychain.nodes]]
name = "charlie" name = "charlie"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "dave" name = "dave"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "eve" name = "eve"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
@@ -14,24 +14,23 @@ charlie: reports peers count is at least 4 within 60 seconds
dave: reports peers count is at least 4 within 60 seconds dave: reports peers count is at least 4 within 60 seconds
eve: reports peers count is at least 4 within 60 seconds eve: reports peers count is at least 4 within 60 seconds
# db snapshot has 12133 blocks # db snapshot has {{DB_BLOCK_HEIGHT}} blocks
charlie: reports block height is at least 12133 within 60 seconds charlie: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 12133 within 60 seconds dave: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
eve: reports block height is at least 12133 within 60 seconds eve: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
alice: log line matches "Warp sync is complete" within 60 seconds alice: log line matches "Warp sync is complete" within 60 seconds
bob: log line matches "Warp sync is complete" within 60 seconds bob: log line matches "Warp sync is complete" within 60 seconds
# workaround for: https://github.com/paritytech/zombienet/issues/580 alice: log line matches "Block history download is complete" within 120 seconds
alice: count of log lines containing "Block history download is complete" is 1 within 60 seconds bob: log line matches "Block history download is complete" within 120 seconds
bob: count of log lines containing "Block history download is complete" is 1 within 60 seconds
alice: reports block height is at least 12133 within 10 seconds alice: reports block height is at least {{DB_BLOCK_HEIGHT}} within 10 seconds
bob: reports block height is at least 12133 within 10 seconds bob: reports block height is at least {{DB_BLOCK_HEIGHT}} within 10 seconds
alice: count of log lines containing "error" is 0 within 10 seconds alice: count of log lines containing "error" is 0 within 10 seconds
bob: count of log lines containing "verification failed" is 0 within 10 seconds bob: count of log lines containing "verification failed" is 0 within 10 seconds
# new block were built # new blocks were built
alice: reports block height is at least 12136 within 90 seconds alice: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 90 seconds
bob: reports block height is at least 12136 within 90 seconds bob: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 90 seconds
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
../0001-basic-warp-sync/chain-spec.json
@@ -5,24 +5,24 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate" default_command = "substrate"
chain = "gen-db" chain = "local"
chain_spec_path = "chain-spec.json" chain_spec_path = "chain-spec.json"
#we need at least 3 nodes for warp sync #we need at least 3 nodes for warp sync
[[relaychain.nodes]] [[relaychain.nodes]]
name = "alice" name = "alice"
validator = true validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "bob" name = "bob"
validator = true validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "charlie" name = "charlie"
validator = false validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz" db_snapshot="{{DB_SNAPSHOT}}"
[[relaychain.nodes]] [[relaychain.nodes]]
name = "dave" name = "dave"
@@ -13,18 +13,24 @@ charlie: reports peers count is at least 3 within 60 seconds
dave: reports peers count is at least 3 within 60 seconds dave: reports peers count is at least 3 within 60 seconds
# db snapshot has 12133 blocks # db snapshot has {{DB_BLOCK_HEIGHT}} blocks
dave: reports block height is at least 1 within 60 seconds alice: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 12132 within 60 seconds bob: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 12133 within 60 seconds charlie: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
alice: reports block height is at least 12133 within 60 seconds alice: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds
bob: reports block height is at least 12133 within 60 seconds bob: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds
charlie: reports block height is at least 12133 within 60 seconds charlie: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: log line matches "Warp sync is complete" within 60 seconds dave: log line matches "Warp sync is complete" within 60 seconds
# workaround for: https://github.com/paritytech/zombienet/issues/580 dave: log line matches "Block history download is complete" within 10 seconds
dave: count of log lines containing "Block history download is complete" is 1 within 10 seconds
dave: reports substrate_beefy_best_block is at least {{DB_BLOCK_HEIGHT}} within 180 seconds
dave: reports substrate_beefy_best_block is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: count of log lines containing "error" is 0 within 10 seconds dave: count of log lines containing "error" is 0 within 10 seconds
dave: count of log lines containing "verification failed" is 0 within 10 seconds dave: count of log lines containing "verification failed" is 0 within 10 seconds