This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zombienet: test disputes with malus garbage candidates (#5857)
* 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
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
zombienet_tests/functional/0003-parachains-garbage-candidate.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
46
zombienet_tests/functional/0003-parachains-garbage-candidate.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |