Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warp sync zombienet tests: add basic BEEFY checks #2854

Merged
merged 12 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
19 changes: 16 additions & 3 deletions .gitlab/pipeline/zombienet/substrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
tags:
- zombienet-polkadot-integration-test

.zombienet-substrate-warp-sync-common:
extends:
- .zombienet-substrate-common
variables:
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:
extends:
- .zombienet-substrate-common
Expand All @@ -50,23 +57,29 @@ zombienet-substrate-0000-block-building:

zombienet-substrate-0001-basic-warp-sync:
extends:
- .zombienet-substrate-common
- .zombienet-substrate-warp-sync-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0001-basic-warp-sync"
--test="test-warp-sync.zndsl"

zombienet-substrate-0002-validators-warp-sync:
extends:
- .zombienet-substrate-common
- .zombienet-substrate-warp-sync-common
before_script:
- !reference [.zombienet-substrate-warp-sync-common, before_script]
- cp ${LOCAL_DIR}/0001-basic-warp-sync/chain-spec.json ${LOCAL_DIR}/0002-validators-warp-sync
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0002-validators-warp-sync"
--test="test-validators-warp-sync.zndsl"

zombienet-substrate-0003-block-building-warp-sync:
extends:
- .zombienet-substrate-common
- .zombienet-substrate-warp-sync-common
before_script:
- !reference [.zombienet-substrate-warp-sync-common, before_script]
- cp ${LOCAL_DIR}/0001-basic-warp-sync/chain-spec.json ${LOCAL_DIR}/0003-block-building-warp-sync
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0003-block-building-warp-sync"
Expand Down
33 changes: 15 additions & 18 deletions substrate/zombienet/0001-basic-warp-sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ 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`):
```
[relaychain]
default_image = "docker.io/parity/substrate:master"
default_image = "docker.io/paritypr/substrate:master"
default_command = "substrate"

chain = "gen-db"
chain = "local"

chain_spec_path = "chain-spec.json"

[[relaychain.nodes]]
name = "alice"
validator = true

serban300 marked this conversation as resolved.
Show resolved Hide resolved
[[relaychain.nodes]]
name = "bob"
validator = true
Expand All @@ -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
(`{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:
```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/bob/data/chains/local_testnet/db/full db-snapshot/bob/data/chains/local_testnet/db/
```

The file format should be `tar.gz`. File shall contain `local_testnet` folder and its subfolders, e.g.:
Sample command to prepare archive:
```
$ tar tzf chains.tgz | head
local_testnet/
local_testnet/db/
local_testnet/db/full/
...
local_testnet/db/full/000469.log
tar -C db-snapshot/alice/ -czf chains.tgz ./
```

Sample command to prepare archive:
The file format should be `tar.gz`. File shall contain `local_testnet` folder and its subfolders, e.g.:
```
tar -C db-snapshot/alice/data/chains/ -czf chains.tgz local_testnet
$ tar tzf chains.tgz | head
data/chains/local_testnet/
data/chains/local_testnet/db/
data/chains/local_testnet/db/full/
...
data/chains/local_testnet/db/full/000469.log
```

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`.
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
The `raw` chain-spec shall also be saved: `db-test-gen/local.json`.

# Where to upload database
The access to this [bucket](https://console.cloud.google.com/storage/browser/zombienet-db-snaps/) is required.
Expand All @@ -81,8 +80,6 @@ Test can be run with the following command:
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
Substrate can be patched to reduce the grandpa session period.
Expand Down
150 changes: 90 additions & 60 deletions substrate/zombienet/0001-basic-warp-sync/chain-spec.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# this file is not intended to be executed in CI stage
[relaychain]
default_image = "docker.io/parity/substrate:latest"
default_image = "docker.io/paritypr/substrate:latest"
default_command = "substrate"

# 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"


[[relaychain.nodes]]
name = "alice"
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"]
serban300 marked this conversation as resolved.
Show resolved Hide resolved

[[relaychain.nodes]]
name = "bob"
Expand Down
8 changes: 4 additions & 4 deletions substrate/zombienet/0001-basic-warp-sync/test-warp-sync.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate"

chain = "gen-db"
chain = "local"
chain_spec_path = "chain-spec.json"

[[relaychain.nodes]]
name = "alice"
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]]
name = "bob"
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
[[relaychain.nodes]]
name = "charlie"
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]]
name = "dave"
Expand Down
16 changes: 7 additions & 9 deletions substrate/zombienet/0001-basic-warp-sync/test-warp-sync.zndsl
Original file line number Diff line number Diff line change
Expand Up @@ -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


# db snapshot has 12133 blocks
dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least 12132 within 60 seconds
dave: reports block height is at least 12133 within 60 seconds
# db snapshot has {{DB_BLOCK_HEIGHT}} blocks
alice: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
bob: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
charlie: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved

alice: reports block height is at least 12133 within 60 seconds
bob: reports block height is at least 12133 within 60 seconds
charlie: reports block height is at least 12133 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: log line matches "Warp sync is complete" within 60 seconds
# workaround for: https://github.com/paritytech/zombienet/issues/580
dave: count of log lines containing "Block history download is complete" is 1 within 10 seconds
dave: log line matches "Block history download is complete" 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
192 changes: 0 additions & 192 deletions substrate/zombienet/0002-validators-warp-sync/chain-spec.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate"

chain = "gen-db"
chain = "local"
chain_spec_path = "chain-spec.json"

[[relaychain.nodes]]
Expand All @@ -18,18 +18,18 @@ chain_spec_path = "chain-spec.json"
validator = true
args = ["--sync warp"]

#we need at least 3 nodes for warp sync
# we need at least 3 nodes for warp sync
[[relaychain.nodes]]
name = "charlie"
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]]
name = "dave"
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]]
name = "eve"
validator = false
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0001-basic-warp-sync/chains-a233bbacff650aac6bcb56b4e4ef7db7dc143cfb.tgz"
db_snapshot="{{DB_SNAPSHOT}}"
Original file line number Diff line number Diff line change
Expand Up @@ -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
eve: reports peers count is at least 4 within 60 seconds

# db snapshot has 12133 blocks
charlie: reports block height is at least 12133 within 60 seconds
dave: reports block height is at least 12133 within 60 seconds
eve: reports block height is at least 12133 within 60 seconds
# db snapshot has {{DB_BLOCK_HEIGHT}} blocks
charlie: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
dave: reports block height is at least {{DB_BLOCK_HEIGHT}} 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
bob: log line matches "Warp sync is complete" within 60 seconds

# workaround for: https://github.com/paritytech/zombienet/issues/580
alice: count of log lines containing "Block history download is complete" is 1 within 60 seconds
bob: count of log lines containing "Block history download is complete" is 1 within 60 seconds
alice: log line matches "Block history download is complete" within 120 seconds
bob: log line matches "Block history download is complete" within 120 seconds

alice: reports block height is at least 12133 within 10 seconds
bob: 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 {{DB_BLOCK_HEIGHT}} 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

# new block were built
alice: reports block height is at least 12136 within 90 seconds
bob: reports block height is at least 12136 within 90 seconds
# new blocks were built
alice: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 90 seconds
bob: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 90 seconds
192 changes: 0 additions & 192 deletions substrate/zombienet/0003-block-building-warp-sync/chain-spec.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ enable_tracing = false
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate"

chain = "gen-db"
chain = "local"
chain_spec_path = "chain-spec.json"

#we need at least 3 nodes for warp sync
[[relaychain.nodes]]
name = "alice"
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]]
name = "bob"
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]]
name = "charlie"
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]]
name = "dave"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ charlie: 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
dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least 12132 within 60 seconds
dave: reports block height is at least 12133 within 60 seconds
# db snapshot has {{DB_BLOCK_HEIGHT}} blocks
alice: reports block height is at least {{DB_BLOCK_HEIGHT}} within 60 seconds
bob: reports block height is at least {{DB_BLOCK_HEIGHT}} 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
bob: reports block height is at least 12133 within 60 seconds
charlie: reports block height is at least 12133 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
michalkucharczyk marked this conversation as resolved.
Show resolved Hide resolved
serban300 marked this conversation as resolved.
Show resolved Hide resolved
dave: reports block height is greater than {{DB_BLOCK_HEIGHT}} within 60 seconds

dave: log line matches "Warp sync is complete" within 60 seconds
# workaround for: https://github.com/paritytech/zombienet/issues/580
dave: count of log lines containing "Block history download is complete" is 1 within 10 seconds
dave: log line matches "Block history download is complete" 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 "verification failed" is 0 within 10 seconds