diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml index 1506137961..24d8ff0dbe 100644 --- a/polkadot/.gitlab-ci.yml +++ b/polkadot/.gitlab-ci.yml @@ -738,6 +738,36 @@ zombienet-tests-parachains-disputes: tags: - zombienet-polkadot-integration-test +zombienet-tests-parachains-disputes-garbage-candidate: + stage: stage3 + image: "${ZOMBIENET_IMAGE}" + <<: *kubernetes-env + <<: *zombienet-refs + needs: + - job: publish-polkadot-debug-image + - job: publish-test-collators-image + - job: publish-malus-image + variables: + GH_DIR: "https://github.com/paritytech/polkadot/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests/functional" + before_script: + - echo "Zombie-net Tests Config" + - echo "${ZOMBIENET_IMAGE_NAME}" + - echo "${PARACHAINS_IMAGE_NAME} ${PARACHAINS_IMAGE_TAG}" + - echo "${MALUS_IMAGE_NAME} ${MALUS_IMAGE_TAG}" + - echo "${GH_DIR}" + - export DEBUG=zombie,zombie::network-node + - export ZOMBIENET_INTEGRATION_TEST_IMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG} + - export MALUS_IMAGE=${MALUS_IMAGE_NAME}:${MALUS_IMAGE_TAG} + - export COL_IMAGE=${COLLATOR_IMAGE_NAME}:${COLLATOR_IMAGE_TAG} + script: + - /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh + --github-remote-dir="${GH_DIR}" + --test="0003-parachains-garbage-candidate.feature" + allow_failure: false + retry: 2 + tags: + - zombienet-polkadot-integration-test + zombienet-test-parachains-upgrade-smoke-test: stage: stage3 image: "${ZOMBIENET_IMAGE}" diff --git a/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.feature b/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.feature new file mode 100644 index 0000000000..24be749f13 --- /dev/null +++ b/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.feature @@ -0,0 +1,41 @@ +Description: Test dispute finality lag when 1/3 of parachain validators always attempt to include an invalid block +Network: ./0003-parachains-garbage-candidate.toml +Creds: config + +honest-validator-0: is up +honest-validator-1: is up +honest-validator-2: is up +malus-validator-0: is up + +# Check authority status. +honest-validator-0: reports node_roles is 4 +honest-validator-1: reports node_roles is 4 +honest-validator-2: reports node_roles is 4 +malus-validator-0: reports node_roles is 4 + +# Parachains should be making progress even if we have up to 1/3 malicious validators. +honest-validator-0: parachain 2000 block height is at least 2 within 180 seconds +honest-validator-1: parachain 2001 block height is at least 2 within 180 seconds +honest-validator-2: parachain 2002 block height is at least 2 within 180 seconds + +# Check for chain reversion after dispute conclusion. +honest-validator-0: log line contains "reverted due to a bad parachain block" within 180 seconds +honest-validator-1: log line contains "reverted due to a bad parachain block" within 180 seconds +honest-validator-2: log line contains "reverted due to a bad parachain block" within 180 seconds + +# Check if disputes are concluded in less than 2 blocks. +honest-validator-0: reports polkadot_parachain_disputes_finality_lag is lower than 2 +honest-validator-1: reports polkadot_parachain_disputes_finality_lag is lower than 2 +honest-validator-2: reports polkadot_parachain_disputes_finality_lag is lower than 2 + +# Allow more time for malicious validator activity. +sleep 30 seconds + +# Check that garbage parachain blocks included by malicious validators are being disputed. +honest-validator-0: reports parachain_candidate_disputes_total is at least 2 within 15 seconds +honest-validator-1: reports parachain_candidate_disputes_total is at least 2 within 15 seconds +honest-validator-2: reports parachain_candidate_disputes_total is at least 2 within 15 seconds + +# Disputes should always end as "invalid" +honest-validator-0: reports parachain_candidate_dispute_concluded{validity="invalid"} is at least 2 within 15 seconds +honest-validator-1: reports parachain_candidate_dispute_concluded{validity="valid"} is 0 within 15 seconds diff --git a/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.toml b/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.toml new file mode 100644 index 0000000000..8f82d30e2a --- /dev/null +++ b/polkadot/zombienet_tests/functional/0003-parachains-garbage-candidate.toml @@ -0,0 +1,46 @@ +[settings] +timeout = 1000 +bootnode = true + +[relaychain.genesis.runtime.runtime_genesis_config.configuration.config] + max_validators_per_core = 1 + needed_approvals = 2 + +[relaychain] +default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" +chain = "rococo-local" +chain_spec_command = "polkadot build-spec --chain rococo-local --disable-default-bootnode" +default_command = "polkadot" + +[relaychain.default_resources] +limits = { memory = "4G", cpu = "2" } +requests = { memory = "2G", cpu = "1" } + + [[relaychain.node_groups]] + name = "honest-validator" + count = 3 + args = ["-lparachain=debug,runtime=debug"] + + [[relaychain.node_groups]] + image = "{{MALUS_IMAGE}}" + name = "malus-validator" + command = "malus suggest-garbage-candidate" + args = ["-lparachain=debug,MALUS=trace"] + count = 1 + +{% for id in range(2000,2003) %} +[[parachains]] +id = {{id}} +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size={{10000*(id-1999)}} --pvf-complexity={{id - 1999}}" + [parachains.collator] + image = "{{COL_IMAGE}}" + name = "collator" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size={{10000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] +{% endfor %} + +[types.Header] +number = "u64" +parent_hash = "Hash" +post_state = "Hash"