Skip to content

Commit 7125f65

Browse files
author
ordian
authored
less flaky dispute slashing test (#1218)
1 parent c58db69 commit 7125f65

File tree

2 files changed

+42
-25
lines changed

2 files changed

+42
-25
lines changed

polkadot/zombienet_tests/functional/0004-parachains-disputes-past-session.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ bootnode = true
44

55
[relaychain.genesis.runtime.configuration.config]
66
max_validators_per_core = 1
7-
needed_approvals = 3
8-
group_rotation_frequency = 4
7+
needed_approvals = 2
8+
group_rotation_frequency = 3
99

1010
[relaychain]
1111
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
@@ -16,15 +16,16 @@ default_command = "polkadot"
1616
limits = { memory = "4G", cpu = "2" }
1717
requests = { memory = "2G", cpu = "1" }
1818

19-
[[relaychain.nodes]]
20-
name = "alice"
19+
[[relaychain.node_groups]]
20+
name = "honest-flaky-validator"
2121
invulnerable = true # it will go offline, we don't want to disable it
22-
args = ["-lparachain=debug,runtime=debug"]
22+
count = 2
23+
args = ["-lparachain=debug"]
2324

2425
[[relaychain.node_groups]]
2526
name = "honest-validator"
26-
count = 2
27-
args = ["-lruntime=debug,sync=trace"]
27+
count = 1
28+
args = ["-lparachain=debug"]
2829

2930
[[relaychain.node_groups]]
3031
image = "{{MALUS_IMAGE}}"

polkadot/zombienet_tests/functional/0004-parachains-disputes-past-session.zndsl

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,52 @@ Description: Past-session dispute slashing
22
Network: ./0004-parachains-disputes-past-session.toml
33
Creds: config
44

5-
alice: reports node_roles is 4
5+
# Ensure nodes are up and running
6+
honest-flaky-validator: reports node_roles is 4
67

7-
# pause alice so that disputes don't conclude
8-
alice: pause
8+
# Stop issuing disputes for now
9+
malus-validator: pause
910

10-
# Ensure parachain is registered.
11-
honest-validator-0: parachain 1000 is registered within 100 seconds
11+
# Ensure parachain is registered
12+
honest-validator: parachain 1000 is registered within 100 seconds
1213

13-
# Ensure parachain made progress.
14-
honest-validator-0: parachain 1000 block height is at least 1 within 300 seconds
14+
# Ensure parachain made progress
15+
honest-validator: parachain 1000 block height is at least 1 within 300 seconds
1516

16-
# There should be disputes initiated
17-
honest-validator-0: reports polkadot_parachain_candidate_disputes_total is at least 2 within 200 seconds
17+
# Start issuing disputes
18+
malus-validator: resume
1819

19-
# Stop issuing disputes
20-
malus-validator-0: pause
20+
# Wait for malus to back garbage candidate
21+
malus-validator: log line matches "Suggesting malicious candidate" within 200 seconds
22+
23+
# Pause first flaky node
24+
# Availability and finality will continue with 3/4 nodes online (incl. malus)
25+
honest-flaky-validator-0: pause
26+
27+
# Wait for the dispute
28+
honest-flaky-validator-1: reports parachain_candidate_disputes_total is at least 1 within 40 seconds
29+
30+
# Pause second flaky node so that we do not revert blocks due to f+1 invalid votes
31+
# Availability and finality will stop
32+
honest-flaky-validator-1: pause
2133

22-
# wait for the next session
34+
# Wait for 1 full session to pass after the last unconcluded dispute.
2335
sleep 120 seconds
2436

25-
# But should not resolve
26-
honest-validator-0: reports block height minus finalised block is at least 10 within 100 seconds
37+
# Now resume flaky validators
38+
honest-flaky-validator: resume
2739

28-
# Now resume alice
29-
alice: resume
40+
# Stop issuing disputes
41+
malus-validator: pause
3042

3143
# Disputes should start concluding now
32-
honest-validator-0: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is at least 1 within 200 seconds
44+
honest-validator: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is at least 1 within 200 seconds
45+
3346
# Disputes should always end as "invalid"
34-
honest-validator-0: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is 0
47+
honest-validator: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is 0
3548

3649
# Check an unsigned extrinsic is submitted
3750
honest-validator: log line contains "Successfully reported pending slash" within 180 seconds
51+
52+
# Finality should not lag after dispute resolution
53+
honest-validator: reports block height minus finalised block is lower than 8 within 100 seconds

0 commit comments

Comments
 (0)