Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Zombienet: test disputes with malus garbage candidates (#5857)
Browse files Browse the repository at this point in the history
* 1/3 validators suggest garbage candidates,
but paras should make progress

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* scale down test a bit

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Use docker paths and more paras

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* dispute finality lag < 2

* scale down

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* scale down more

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* attempt fix

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* one malus node

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Update zombienet_tests/functional/0003-parachains-garbage-candidate.toml

Co-authored-by: Andronik <write@reusable.software>

* Update zombienet_tests/functional/0003-parachains-garbage-candidate.toml

Co-authored-by: Andronik <write@reusable.software>

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Co-authored-by: Andronik <write@reusable.software>
  • Loading branch information
sandreim and ordian authored Aug 11, 2022
1 parent 107456b commit c4f271c
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions zombienet_tests/functional/0003-parachains-garbage-candidate.toml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit c4f271c

Please sign in to comment.