Zombienet tests - disputes on finalized blocks (#2184)

**Overview:**
Adding an extra malus variant focusing on disputing finalized blocks. It
will:
- wrap around approval-voting
- listen to `OverseerSignal::BlockFinalized` and when encountered start
a dispute for the `dispute_offset`th ancestor
- simply pass through all other messages and signals

Add zombienet tests testing various edgecases:
- disputing freshly finalized blocks
- disputing stale finalized blocks
- disputing eagerly pruned finalized blocks (might be separate PR)

**TODO:**
- [x] Register new malus variant
- [x] Simple pass through wrapper (approval-voting)
- [x] Simple network definition
- [x] Listen to block finalizations
- [x] Fetch ancestor hash
- [x] Fetch session index
- [x] Fetch candidate
- [x] Construct and send dispute message
- [x] zndsl test 1 checking that disputes on fresh finalizations resolve
valid Closes #1365
- [x] zndsl test 2 checking that disputes for too old finalized blocks
are not possible Closes #1364
- [ ] zndsl test 3 checking that disputes for candidates with eagerly
pruned relay parent state are handled correctly #1359 (deferred to a
separate PR)
- [x] Unit tests for new malus variant (testing cli etc)
- [x] Clean/streamline error handling
- [ ] ~~Ensure it tests properly on session boundaries~~

---------

Co-authored-by: Javier Viola <javier@parity.io>
Co-authored-by: Marcin S. <marcin@realemail.net>
Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
This commit is contained in:
Maciej
2023-11-27 09:30:13 +00:00
committed by GitHub
parent 4f8048b9c7
commit dc69dbba72
10 changed files with 462 additions and 3 deletions
@@ -0,0 +1,29 @@
Description: Test if disputes triggered on finalized blocks within scope always end as valid.
Network: ./0007-dispute-freshly-finalized.toml
Creds: config
# Check authority status and peers.
malus: reports node_roles is 4
honest: reports node_roles is 4
# Ensure parachains are registered.
honest: parachain 2000 is registered within 30 seconds
# Ensure parachains made progress.
honest: parachain 2000 block height is at least 10 within 200 seconds
# Ensure that malus is already attempting to dispute
malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds
# Check if disputes are initiated and concluded.
honest: reports polkadot_parachain_candidate_disputes_total is at least 2 within 100 seconds
honest: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is at least 2 within 100 seconds
honest: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is 0 within 100 seconds
# Check lag - approval
honest: reports polkadot_parachain_approval_checking_finality_lag is 0
# Check lag - dispute conclusion
honest: reports polkadot_parachain_disputes_finality_lag is 0