This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Guide updates for disputes. #3401
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2e331f3
Guide updates for disputes.
eskimor 95ced57
Working availability recovery flood protection.
eskimor 39db282
More fixes.
eskimor 9c6cce7
Formatting.
eskimor 38f2ac0
Fix.
eskimor 91cc2d7
Update roadmap/implementers-guide/src/node/disputes/dispute-participa…
eskimor 4b4c9b6
Review remarks.
eskimor bcea331
Merge branch 'rk-disputes-guide' of github.com:paritytech/polkadot in…
eskimor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,13 @@ struct State { | |
} | ||
``` | ||
|
||
### On startup | ||
|
||
Check DB for recorded votes for non concluded disputes we have not yet | ||
recorded a local statement for. | ||
For all of those send `DisputeParticipationMessage::Participate` message to | ||
dispute participation subsystem. | ||
|
||
### On `OverseerSignal::ActiveLeavesUpdate` | ||
|
||
For each leaf in the leaves update: | ||
|
@@ -80,18 +87,39 @@ Do nothing. | |
|
||
### On `DisputeCoordinatorMessage::ImportStatement` | ||
|
||
* Deconstruct into parts `{ candidate_hash, candidate_receipt, session, statements }`. | ||
* If the session is earlier than `state.highest_session - DISPUTE_WINDOW`, return. | ||
* Load from underlying DB by querying `("candidate-votes", session, candidate_hash). If that does not exist, create fresh with the given candidate receipt. | ||
* If candidate votes is empty and the statements only contain dispute-specific votes, return. | ||
* Otherwise, if there is already an entry from the validator in the respective `valid` or `invalid` field of the `CandidateVotes`, return. | ||
* Add an entry to the respective `valid` or `invalid` list of the `CandidateVotes` for each statement in `statements`. | ||
* Write the `CandidateVotes` to the underyling DB. | ||
* If the both `valid` and `invalid` lists now have non-zero length where previously one or both had zero length, the candidate is now freshly disputed. | ||
* If freshly disputed, load `"active-disputes"` and add the candidate hash and session index. Also issue a [`DisputeParticipationMessage::Participate`][DisputeParticipationMessage]. | ||
* If the dispute now has supermajority votes in the "valid" direction, according to the `SessionInfo` of the dispute candidate's session, remove from `"active-disputes"`. | ||
* If the dispute now has supermajority votes in the "invalid" direction, there is no need to do anything explicitly. The actual rollback will be handled during the active leaves update by observing digests from the runtime. | ||
* Write `"active-disputes"` | ||
1. Deconstruct into parts `{ candidate_hash, candidate_receipt, session, statements }`. | ||
2. If the session is earlier than `state.highest_session - DISPUTE_WINDOW`, | ||
respond with `ImportStatementsResult::InvalidImport` and return. | ||
3. Load from underlying DB by querying `("candidate-votes", session, | ||
candidate_hash)`. If that does not exist, create fresh with the given | ||
candidate receipt. | ||
4. If candidate votes is empty and the statements only contain dispute-specific | ||
votes, respond with `ImportStatementsResult::InvalidImport` and return. | ||
5. Otherwise, if there is already an entry from the validator in the respective | ||
`valid` or `invalid` field of the `CandidateVotes`, respond with | ||
`ImportStatementsResult::ValidImport` and return. | ||
6. Add an entry to the respective `valid` or `invalid` list of the | ||
`CandidateVotes` for each statement in `statements`. | ||
7. If the both `valid` and `invalid` lists now became non-zero length where | ||
previously one or both had zero length, the candidate is now freshly | ||
disputed. | ||
8. If the candidate is not freshly disputed as determined by 7, continue with | ||
10. If it is freshly disputed now, load `"active-disputes"` and add the | ||
candidate hash and session index. Then, if we have local statements with | ||
regards to that candidate, also continue with 10. Otherwise proceed with 9. | ||
9. Issue a | ||
[`DisputeParticipationMessage::Participate`][DisputeParticipationMessage]. | ||
Wait for response on the `report_availability` oneshot. If available, continue | ||
with 10. If not send back `ImportStatementsResult::InvalidImport` and return. | ||
10. Write the `CandidateVotes` to the underyling DB. | ||
11. Send back `ImportStatementsResult::ValidImport`. | ||
12. If the dispute now has supermajority votes in the "valid" direction, | ||
according to the `SessionInfo` of the dispute candidate's session, remove | ||
from `"active-disputes"`. | ||
13. If the dispute now has supermajority votes in the "invalid" direction, there | ||
is no need to do anything explicitly. The actual rollback will be handled | ||
during the active leaves update by observing digests from the runtime. | ||
Comment on lines
+119
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This diff contains changes to 'active-disputes' so we make a distinction between "recent" (everything in DISPUTE_WINDOW, concluded or not) and "active" (subset of recent which is either not concluded or was concluded within some small amount of time) Due to this, we actually never prune anything from The motivation of the change in #3348 is to make sure the provisioner can still provide votes that are submitted shortly after conclusion to the on-chain logic. Those votes will be rewarded less than earlier ones. |
||
14. Write `"active-disputes"` | ||
|
||
### On `DisputeCoordinatorMessage::ActiveDisputes` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍