Skip to content

Commit

Permalink
Add BEEFY warp zombienet test
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Jan 4, 2024
1 parent 5b9e69d commit 3ae3245
Show file tree
Hide file tree
Showing 11 changed files with 509 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,11 @@ zombienet-polkadot-malus-0001-dispute-valid:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/integrationtests"
--test="0001-dispute-valid-block.zndsl"

zombienet-polkadot-0004-basic-beefy-warp-sync:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0004-basic-beefy-warp-sync"
--test="test-warp-sync.zndsl"
4 changes: 2 additions & 2 deletions polkadot/runtime/rococo/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ pub mod time {
use runtime_common::prod_or_fast;

use primitives::{BlockNumber, Moment};
pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const MILLISECS_PER_BLOCK: Moment = 4000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;

frame_support::parameter_types! {
pub EpochDurationInBlocks: BlockNumber =
prod_or_fast!(1 * HOURS, 1 * MINUTES, "ROCOCO_EPOCH_DURATION");
prod_or_fast!(1 * HOURS, 1 * MINUTES * 30, "ROCOCO_EPOCH_DURATION");
}

// These time units are defined in number of blocks.
Expand Down
165 changes: 165 additions & 0 deletions polkadot/zombienet_tests/0004-basic-beefy-warp-sync/chain-spec.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# this file is not intended to be executed in CI stage
[relaychain]
default_image = "docker.io/parity/polkadot:latest"
default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot"

# refer to ./README.md for more details on how to create snapshot and spec
chain = "rococo-local"
chain_spec_path = "/home/serban/workplace/snapshots/db-test-gen-main/rococo-local.json"

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

[[relaychain.nodes]]
name = "bob"
validator = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[settings]
enable_tracing = false

#[relaychain]
##default_image = "docker.io/parity/polkadot:latest"
##default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot"
#
#chain = "rococo-local"
#chain_spec_path = "/home/serban/workplace/snapshots/db-test-gen-main/rococo-local.json"

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "polkadot"

chain = "rococo-local"
chain_spec_path = "chain-spec.json"

[[relaychain.nodes]]
name = "alice"
validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0004-basic-beefy-warp-sync/chains.tgz"

[[relaychain.nodes]]
name = "bob"
validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0004-basic-beefy-warp-sync/chains.tgz"

#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/0004-basic-beefy-warp-sync/chains.tgz"

[[relaychain.nodes]]
name = "dave"
validator = false
args = ["--sync warp"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Description: Warp sync
Network: ./test-warp-sync.toml
Creds: config

alice: reports node_roles is 4
bob: reports node_roles is 4
charlie: reports node_roles is 1
dave: reports node_roles is 1

alice: reports peers count is at least 3 within 60 seconds
bob: reports peers count is at least 3 within 60 seconds
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 #17751 blocks
alice: reports block height is at least 17751 within 60 seconds
bob: reports block height is at least 17751 within 60 seconds
charlie: reports block height is at least 17751 within 60 seconds

dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least 17750 within 60 seconds
dave: reports block height is at least 17751 within 60 seconds

dave: log line matches "Warp sync is complete" within 60 seconds
dave: log line matches "Block history download is complete" within 60 seconds
dave: log line matches "🥩 Concluded mandatory round #17715" 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
2 changes: 1 addition & 1 deletion substrate/client/network/sync/src/chain_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const STATE_SYNC_FINALITY_THRESHOLD: u32 = 8;
const MAJOR_SYNC_BLOCKS: u8 = 5;

/// Number of peers that need to be connected before warp sync is started.
const MIN_PEERS_TO_START_WARP_SYNC: usize = 3;
const MIN_PEERS_TO_START_WARP_SYNC: usize = 2;

mod rep {
use sc_network::ReputationChange as Rep;
Expand Down
165 changes: 165 additions & 0 deletions substrate/zombienet/0004-basic-beefy-warp-sync/chain-spec.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# this file is not intended to be executed in CI stage
[relaychain]
default_image = "docker.io/parity/polkadot:latest"
default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot"

# refer to ./README.md for more details on how to create snapshot and spec
chain = "rococo-local"
chain_spec_path = "/home/serban/workplace/snapshots/db-test-gen-main/rococo-local.json"

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

[[relaychain.nodes]]
name = "bob"
validator = true
37 changes: 37 additions & 0 deletions substrate/zombienet/0004-basic-beefy-warp-sync/test-warp-sync.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[settings]
enable_tracing = false

#[relaychain]
##default_image = "docker.io/parity/polkadot:latest"
##default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/polkadot"
#
#chain = "rococo-local"
#chain_spec_path = "/home/serban/workplace/snapshots/db-test-gen-main/rococo-local.json"

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "polkadot"

chain = "rococo-local"
chain_spec_path = "chain-spec.json"

[[relaychain.nodes]]
name = "alice"
validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0004-basic-beefy-warp-sync/chains.tgz"

[[relaychain.nodes]]
name = "bob"
validator = true
db_snapshot="https://storage.googleapis.com/zombienet-db-snaps/substrate/0004-basic-beefy-warp-sync/chains.tgz"

#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/0004-basic-beefy-warp-sync/chains.tgz"

[[relaychain.nodes]]
name = "dave"
validator = false
args = ["--sync warp"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Description: Warp sync
Network: ./test-warp-sync.toml
Creds: config

alice: reports node_roles is 4
bob: reports node_roles is 4
charlie: reports node_roles is 1
dave: reports node_roles is 1

alice: reports peers count is at least 3 within 60 seconds
bob: reports peers count is at least 3 within 60 seconds
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 #17751 blocks
alice: reports block height is at least 17751 within 60 seconds
bob: reports block height is at least 17751 within 60 seconds
charlie: reports block height is at least 17751 within 60 seconds

dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least 17750 within 60 seconds
dave: reports block height is at least 17751 within 60 seconds

dave: log line matches "Warp sync is complete" within 60 seconds
dave: log line matches "Block history download is complete" within 60 seconds
dave: log line matches "🥩 Concluded mandatory round #17715" 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

0 comments on commit 3ae3245

Please sign in to comment.