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

Some late short-term fixes for dispute slashing #6249

Merged
merged 49 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
80020b3
disputes/slashing: slash only backers for ForInvalid
ordian Oct 24, 2022
ed428b1
add an assertion in mock impl
ordian Nov 7, 2022
8228728
fix tests
ordian Nov 7, 2022
656ab84
do not slash backers on onconcluded disputes
ordian Nov 7, 2022
e3d7ba6
slash an intersection of backers and losers
ordian Nov 9, 2022
78c1cda
Merge branch 'master' into ao-5535-followup
ordian Nov 9, 2022
59b9c0d
zombienet/disputes: check for offence only for invalid disputes
ordian Nov 10, 2022
9ee1e3b
add backing votes to disputes bench builder
ordian Nov 11, 2022
0606aab
Merge branch 'master' into ao-5535-followup
ordian Nov 11, 2022
cabbee2
Update runtime/parachains/src/builder.rs
ordian Nov 11, 2022
d7bd141
Brad implementers guide revisions 2 (#6239)
BradleyOlson64 Nov 11, 2022
adcd81e
Update disputes prioritisation in `dispute-coordinator` (#6130)
tdimitrov Nov 11, 2022
254fbc4
approval-voting: remove redundant validation check (#6266)
ordian Nov 12, 2022
b900d2a
remove fill_block (#6200)
Szegoo Nov 12, 2022
5b60a5b
fix a compilation warning (#6279)
ordian Nov 13, 2022
8d3ff43
Only report concluded if there is an actual dispute. (#6270)
eskimor Nov 14, 2022
71b5aac
[ci] fix buildah image (#6281)
alvicsam Nov 14, 2022
ed143f2
Revert special casing of Kusama for grandpa rounds. (#6217)
eskimor Nov 15, 2022
17b7567
Fixes "for loop over an `Option`" warnings (#6291)
mrcnski Nov 15, 2022
5d607f6
companion for #12599 (#6290)
niklasad1 Nov 15, 2022
a5bff0c
remove the runtime check and test
ordian Nov 15, 2022
b2b1a0d
Merge branch 'master' into ao-5535-followup
ordian Nov 15, 2022
89b03f6
Merge branch 'master' into ao-5535-followup
ordian Nov 15, 2022
c96630c
Merge branch 'master' into ao-5535-followup
ordian Nov 24, 2022
8fba9e0
append keys on past-session slashing
ordian Nov 24, 2022
9e81fa9
Merge branch 'master' into ao-5535-followup
ordian Nov 25, 2022
77e777c
runtime/disputes: allow importing backing votes after explicit for
ordian Nov 25, 2022
cf90b17
explicit MaliciousBacker error and a test
ordian Nov 26, 2022
7c4c3f5
update an outdated comment
ordian Nov 26, 2022
b47dc15
Revert "update an outdated comment"
ordian Nov 30, 2022
4e36bed
Revert "remove the runtime check and test"
ordian Nov 30, 2022
d9f337f
Merge branch 'master' into ao-5535-followup
ordian Nov 30, 2022
01386f2
incremental punishment post conclusion + test
ordian Nov 30, 2022
a08af12
punish backers post FOR vote
ordian Dec 1, 2022
b83279b
remove unnecessary lifetime annotation
ordian Dec 6, 2022
37b1d59
add a comment to zombinet test
ordian Dec 6, 2022
5f1758f
Merge branch 'master' into ao-5535-followup
ordian Dec 6, 2022
a489310
typo
ordian Dec 12, 2022
0fb61ff
Merge branch 'master' into ao-5535-followup
ordian Jan 2, 2023
6358cb1
Merge branch 'ao-5535-followup' of github.com:paritytech/polkadot int…
ordian Jan 2, 2023
b2f82ca
Merge branch 'master' into ao-5535-followup
ordian Jan 5, 2023
a1ee63a
Merge 'master' and resolve conflicts
ordian Jan 7, 2023
142d852
fmt
ordian Jan 7, 2023
8632334
post merge test fixes
ordian Jan 7, 2023
4d63258
another day, another master merge
ordian Jan 10, 2023
9d81c26
fix test after changes in master
ordian Jan 10, 2023
9d3fb1c
Merge branch 'master' into ao-5535-followup
ordian Jan 16, 2023
b8de8d6
address review nits
ordian Jan 16, 2023
036b09e
Merge branch 'master' into ao-5535-followup
ordian Feb 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Brad implementers guide revisions 2 (#6239)
* Add disputes subsystems fix

* Updated dispute approval vote import reasoning

* Improved wording of my changes

* Resolving issues brought up in comments
  • Loading branch information
BradleyOlson64 authored and ordian committed Nov 15, 2022
commit d7bd141cb64f27c9c6ac6502e54779613410c329
2 changes: 1 addition & 1 deletion roadmap/implementers-guide/src/node/disputes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This section is for the node-side subsystems that lead to participation in dispu
* Participation. Participate in active disputes. When a node becomes aware of a dispute, it should recover the data for the disputed block, check the validity of the parablock, and issue a statement regarding the validity of the parablock.
* Distribution. Validators should notify each other of active disputes and relevant statements over the network.
* Submission. When authoring a block, a validator should inspect the state of the parent block and provide any information about disputes that the chain needs as part of the `ParaInherent`. This should initialize new disputes on-chain as necessary.
* Fork-choice and Finality. When observing a block issuing a `DisputeRollback` digest in the header, that branch of the relay chain should be abandoned all the way back to the indicated block. When voting on chains in GRANDPA, no chains that contain blocks that are or have been disputed should be voted on.
* Fork-choice and Finality. When observing a block issuing a `DisputeRollback` digest in the header, that branch of the relay chain should be abandoned all the way back to the indicated block. When voting on chains in GRANDPA, no chains that contain blocks with active disputes or disputes that concluded invalid should be voted on.

## Components

Expand Down
60 changes: 32 additions & 28 deletions roadmap/implementers-guide/src/node/disputes/dispute-coordinator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ In particular the dispute-coordinator is responsible for:

- Ensuring that the node is able to raise a dispute in case an invalid candidate
is found during approval checking.
- Ensuring malicious approval votes will be recorded, so nodes can get slashed
properly.
- Ensuring lazy approval votes (votes given without running the parachain
validation function) will be recorded, so lazy nodes can get slashed properly.
- Coordinating actual participation in a dispute, ensuring that the node
participates in any justified dispute in a way that ensures resolution of
disputes on the network even in the case of many disputes raised (flood/DoS
Expand Down Expand Up @@ -76,24 +76,27 @@ inefficient process. (Quadratic complexity adds up, with 35 votes in total per c
Approval votes are very relevant nonetheless as we are going to see in the next
section.

## Ensuring Malicious Approval Votes Will Be Recorded
## Ensuring Lazy Approval Votes Will Be Recorded

### Ensuring Recording

While there is no need to record approval votes in the dispute coordinator
preemptively, we do need to make sure they are recorded when a dispute
actually happens. This is because only votes recorded by the dispute
coordinator will be considered for slashing. While the backing group always gets
slashed, a serious attack attempt will likely also consist of malicious approval
checkers which will cast approval votes, although the candidate is invalid. If
we did not import those votes, those nodes would likely cast an `invalid` explicit
vote as part of the dispute in addition to their approval vote and thus avoid a
slash. With the 2/3rd honest assumption it seems unrealistic that malicious
actors will keep sending approval votes once they became aware of a raised
dispute. Hence the most crucial approval votes to import are the early ones
(tranche 0), to take into account network latencies and such we still want to
import approval votes at a later point in time as well (in particular we need to
make sure the dispute can conclude, but more on that later).
coordinator will be considered for slashing. It is sufficient for our
threat model that malicious backers are slashed as opposed to both backers and
approval checkers. However, we still must import approval votes from the approvals
process into the disputes process to ensure that lazy approval checkers
actually run the parachain validation function. Slashing lazy approval checkers is necessary, else we risk a useless approvals process where every approval
checker blindly votes valid for every candidate. If we did not import approval
votes, lazy nodes would likely cast a properly checked explicit vote as part
of the dispute in addition to their blind approval vote and thus avoid a slash.
With the 2/3rd honest assumption it seems unrealistic that lazy approval voters
will keep sending unchecked approval votes once they became aware of a raised
dispute. Hence the most crucial approval votes to import are the early ones
(tranche 0), to take into account network latencies and such we still want to
import approval votes at a later point in time as well (in particular we need
to make sure the dispute can conclude, but more on that later).

As mentioned already previously, importing votes is most efficient when batched.
At the same time approval voting and disputes are running concurrently so
Expand Down Expand Up @@ -173,7 +176,7 @@ There are two potential caveats with this though:
voting. By distributing our own approval vote we make sure the dispute can
conclude regardless how the race ended (we either participate explicitly
anyway or we sent our already present approval vote). By importing all
approval votes we make it possible to slash malicious approval voters, even
approval votes we make it possible to slash lazy approval voters, even
if they also cast an invalid explicit vote.

Conclusion: As long as we make sure, if our own approval vote gets imported
Expand All @@ -199,11 +202,12 @@ time participation is faster than approval, a node would do double work.
### Ensuring Chain Import

While in the previous section we discussed means for nodes to ensure relevant
votes are recorded so attackers get slashed properly, it is crucial to also
discuss the actual chain import. Only if we guarantee that recorded votes will
also get imported on chain (on all potential chains really) we will succeed in
executing slashes. Again approval votes prove to be our weak spot here, but also
backing votes might get missed.
votes are recorded so lazy approval checkers get slashed properly, it is crucial
to also discuss the actual chain import. Only if we guarantee that recorded votes
will also get imported on chain (on all potential chains really) we will succeed
in executing slashes. Particularly we need to make sure backing votes end up on
chain consistantly. In contrast recording and slashing lazy approval voters only
needs to be likely, not certain.

Dispute distribution will make sure all explicit dispute votes get distributed
among nodes which includes current block producers (current authority set) which
Expand All @@ -223,14 +227,14 @@ production in the current set - they might only exist on an already abandoned
fork. This means a block producer that just joined the set, might not have seen
any of them.

For approvals it is even more tricky: Approval voting together with finalization
is a completely off-chain process therefore those protocols don't care about
block production at all. Approval votes only have a guarantee of being
propagated between the nodes that are responsible for finalizing the concerned
blocks. This implies that on an era change the current authority set, will not
necessarily get informed about any approval votes for the previous era. Hence
even if all validators of the previous era successfully recorded all approval
votes in the dispute coordinator, they won't get a chance to put them on chain,
For approvals it is even more tricky and less necessary: Approval voting together
with finalization is a completely off-chain process therefore those protocols
don't care about block production at all. Approval votes only have a guarantee of
being propagated between the nodes that are responsible for finalizing the
concerned blocks. This implies that on an era change the current authority set,
will not necessarily get informed about any approval votes for the previous era.
Hence even if all validators of the previous era successfully recorded all approval
votes in the dispute coordinator, they won't get a chance to put them on chain,
hence they won't be considered for slashing.

It is important to note, that the essential properties of the system still hold:
Expand Down