-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Revert chain if at least f+1 validators voted against a candidate #7151
Revert chain if at least f+1 validators voted against a candidate #7151
Conversation
8490501
to
344bbcb
Compare
I'm not too familiar with the code, but can you please explain why https://github.com/paritytech/polkadot/blob/32b9138042/runtime/parachains/src/disputes.rs#L573-L583 and https://github.com/paritytech/polkadot/blob/32b9138042/node/core/dispute-coordinator/src/import.rs#L198-L208 don't need to change? Other than that, I think it looks good. |
This is a very good question. The way I understand the issue is that we don't want to change the disputes protocol altogether. We are just doing an implementation optimization. From the implementor's gude:
For this reason we don't touch About So based on the above I think we shouldn't change the way disputes are handled altogether and hence - we shouldn't change the code you have mentioned. But, if we have got |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually envisioned this to happen in the runtime - f+f invalid votes -> revert log -> done. Anyhow, node side is probably even better. As long as we do it both ways, it would probably make sense to keep them in sync - the very least to avoid confusion.
Self::get_own_invalid_votes(self.old_state()); | ||
|
||
old_invalid_votes as usize <= byzantine_threshold && | ||
imported_invalid_votes as usize > byzantine_threshold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we only check for newly imported invalid votes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want has_fresh_byzantine_threshold_against()
to return true
only once - when byzantine_threshold
is reached. So I check if the invalid votes before import were below (or equal) the byzantine_threshold
and at the same time they are above it after the import.
But you probably are asking something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I understand that you want to trigger the message once the threshold is passed and not on every import, but you are comparing newly imported votes to the byzantine threshold - so any previously known votes are not taken into account. This would only trigger if we imported f+1 invalid votes all at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, self.imported_invalid_votes()
returns the votes from the last import, not all votes. This is totally messed up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed now, but I have to add more tests. The current ones didn't catch that error.
Agree, we should also have this logic in the runtime. |
Done: #7225 |
bot merge |
* master: (60 commits) Ensure all `StorageVersion`s on Rococo/Westend are correct and migration hooks pass (#7251) Try-runtime proper return types (#7146) Have OCW mined election once a week on Westend (#7248) Bump enumn from 0.1.5 to 0.1.8 (#7226) Companion to #14183: FRAME: Allow message ID to be mutated in `ProcessMessage` (#7262) Remove TODO comment (#7260) Fix build (#7261) Update syn (#7258) Use Message Queue pallet for UMP dispatch (#6271) Freeze chain if there are byzantine threshold + 1 invalid votes against a local candidate (#7225) Revert chain if at least f+1 validators voted against a candidate (#7151) Ensure all `StorageVersion`s on Polkadot/Kusama are correct (#7199) Forgotten pub reexport for `GlobalConsensusParachainConvertsFor` (#7238) PVF: Vote invalid on panics in execution thread (after a retry) (#7155) PVF: Remove `rayon` and some uses of `tokio` (#7153) [xcm] Foreign global consensus parachain LocationToAccountId converter (#7016) Update docs (#7230) Bump parity-db to 0.4.8 (#7231) Merge branch 'master' of https://github.com/paritytech/polkadot (#7224) Relax the watermark rule in the runtime (#7188) ...
…slashing-client * ao-past-session-slashing-runtime: (61 commits) Ensure all `StorageVersion`s on Rococo/Westend are correct and migration hooks pass (#7251) Try-runtime proper return types (#7146) Have OCW mined election once a week on Westend (#7248) Bump enumn from 0.1.5 to 0.1.8 (#7226) Companion to #14183: FRAME: Allow message ID to be mutated in `ProcessMessage` (#7262) Remove TODO comment (#7260) Fix build (#7261) Update syn (#7258) Use Message Queue pallet for UMP dispatch (#6271) Freeze chain if there are byzantine threshold + 1 invalid votes against a local candidate (#7225) Revert chain if at least f+1 validators voted against a candidate (#7151) Ensure all `StorageVersion`s on Polkadot/Kusama are correct (#7199) Forgotten pub reexport for `GlobalConsensusParachainConvertsFor` (#7238) PVF: Vote invalid on panics in execution thread (after a retry) (#7155) PVF: Remove `rayon` and some uses of `tokio` (#7153) [xcm] Foreign global consensus parachain LocationToAccountId converter (#7016) Update docs (#7230) Bump parity-db to 0.4.8 (#7231) Merge branch 'master' of https://github.com/paritytech/polkadot (#7224) Relax the watermark rule in the runtime (#7188) ...
Once we see
byzantine threshold + 1
invalid votes for a dispute we can revert the chain to avoid building new blocks on top of it. Check #6950 for detailsAddresses #6950