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

Revert chain if at least f+1 validators voted against a candidate #6950

Closed
eskimor opened this issue Mar 24, 2023 · 5 comments
Closed

Revert chain if at least f+1 validators voted against a candidate #6950

eskimor opened this issue Mar 24, 2023 · 5 comments
Assignees
Labels
T5-parachains_protocol This PR/Issue is related to Parachains features and protocol changes.

Comments

@eskimor
Copy link
Member

eskimor commented Mar 24, 2023

For maximum security and minimizing effects on the network we should probably revert a chain as soon as f+1 validators voted against a candidate. This should mostly be irrelevant, except if under attack and an attacker manages to prolong full dispute resolution. By reverting as early as possible (f+1 against) we:

  1. Make it even harder to get a bad candidate finalized via DoS attacks and thus strengthen the security of the network*).
  2. Also improve liveness: By reverting earlier, we have less wasted effort/thrown away blocks.

*) This is defense in depth, this should not be possible even without this change, but if it was because of some bug for example, it would certainly get harder this way.

@mrcnski
Copy link
Contributor

mrcnski commented Mar 24, 2023

What is f?

@mrcnski
Copy link
Contributor

mrcnski commented Mar 24, 2023

I guess the byzantine threshold? Looking at the code it looks like we already set relevant flags once we hit the thresholds, but I suppose this does not trigger reversion? Where does that happen?

Edit: I see now in the code above that the "against" vote is actually triggered by a supermajority and not f + 1. This would need to change.

@sandreim
Copy link
Contributor

sandreim commented Mar 24, 2023

If I understand correctly, right now it is triggered by dispute coordinator concluding a dispute against a candidate, which means it needs supermajority. Chain selection subsystem is responsible of doing the reversion.

I think it is a good idea, it for sure would save additional work if disputes are concluding slow and we revert with 1/2 of votes against.

@mrcnski
Copy link
Contributor

mrcnski commented Mar 24, 2023

Cool, so I think this also would need to be changed. (Looks like there is some duplication with the runtime code linked above which maybe can be extracted out, to keep the logic in sync.)

https://github.com/paritytech/polkadot/blob/32b9138042/node/core/dispute-coordinator/src/import.rs#L198-L208

@eskimor
Copy link
Member Author

eskimor commented Mar 24, 2023

@sandreim raised a good point. For spam resilience we only take into account participation for either confirmed disputes or for ones where we have seen candidates included/backed on the non-finalized chain and a few blocks behind finality.

The dispute for the candidate which reached f+1 votes should conclude eventually in all cases, since the dispute is confirmed. Hence we should be able to get that 100% slash through. In case there are more invalid candidates on the reverted chain, then the risk of not being able to slash those offenders is slightly increased as the fork is abandoned and can fall behind finality. In case participations have not been queued, validators will no longer participate once that fork fell behind finality by 10 blocks.

Mitigation:

  1. Assuming we get at least one 100% slash through, even when heavily loaded, then the gambler's ruin property should be maintained - also queuing participations is fast.
  2. We could evaluate increasing DISPUTE_CANDIDATE_LIFETIME_AFTER_FINALIZATION more. This needs to be balanced with spam considerations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T5-parachains_protocol This PR/Issue is related to Parachains features and protocol changes.
Projects
No open projects
Development

No branches or pull requests

4 participants