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 8, 2024
1 parent 745c02c commit 9d2dc54
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .gitlab/pipeline/zombienet/substrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ zombienet-substrate-0003-block-building-warp-sync:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/0003-block-building-warp-sync"
--test="test-block-building-warp-sync.zndsl"

zombienet-substrate-0004-basic-beefy-warp-sync:
extends:
- .zombienet-substrate-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
4 changes: 2 additions & 2 deletions substrate/bin/node/runtime/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub mod time {
/// `SLOT_DURATION` should have the same value.
///
/// <https://research.web3.foundation/en/latest/polkadot/block-production/Babe.html#-6.-practical-results>
pub const MILLISECS_PER_BLOCK: Moment = 3000;
pub const MILLISECS_PER_BLOCK: Moment = 2000;
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
Expand All @@ -63,7 +63,7 @@ pub mod time {

// NOTE: Currently it is not possible to change the epoch duration after the chain has started.
// Attempting to do so will brick block production.
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 5 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: u64 = {
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64;

Expand Down
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
222 changes: 222 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/paritypr/substrate:latest"
default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/substrate-node"

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

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

[[relaychain.nodes]]
name = "bob"
validator = true
36 changes: 36 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,36 @@
[settings]
enable_tracing = false

#[relaychain]
#default_command = "/home/serban/workplace/sources/polkadot-sdk/target/release/substrate-node"
#
#chain = "local"
#chain_spec_path = "/home/serban/workplace/snapshots/db-test-gen/local.json"

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
default_command = "substrate-node"

chain = "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 46742 within 60 seconds
bob: reports block height is at least 46742 within 60 seconds
charlie: reports block height is at least 46742 within 60 seconds

dave: reports block height is at least 1 within 60 seconds
dave: reports block height is at least 46741 within 60 seconds
dave: reports block height is at least 46742 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 #46616" 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 9d2dc54

Please sign in to comment.