-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabled validators runtime API #1257
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
800d8e5
Add `disabled_validators` in staging runtime api
tdimitrov 936216d
Cumulus changes
tdimitrov eaca5ed
Merge branch 'master' into tsv-disabling-node-side
tdimitrov e4dee17
Fix compilation errors
tdimitrov 0d0129c
Merge branch 'master' into tsv-disabling-node-side
tdimitrov 5e7655f
Merge branch 'master' into tsv-disabling-node-side
tdimitrov 6fb4b7f
merge master and resolve conflicts (v8)
ordian 70dc6b6
implement disabled_validators correctly
ordian bca3c83
add a CAVEAT comment
ordian f717d0b
cargo fmt
ordian 2a5af89
Clarify docs
ordian 2c53894
Merge branch 'master' into tsv-disabling-node-side
tdimitrov a3bcb2f
Merge branch 'master' into tsv-disabling-node-side
ordian 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ pub(crate) struct RequestResultCache { | |
unapplied_slashes: LruMap<Hash, Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>>, | ||
key_ownership_proof: LruMap<(Hash, ValidatorId), Option<slashing::OpaqueKeyOwnershipProof>>, | ||
minimum_backing_votes: LruMap<SessionIndex, u32>, | ||
disabled_validators: LruMap<Hash, Vec<ValidatorIndex>>, | ||
para_backing_state: LruMap<(Hash, ParaId), Option<async_backing::BackingState>>, | ||
async_backing_params: LruMap<Hash, async_backing::AsyncBackingParams>, | ||
} | ||
|
@@ -96,6 +97,7 @@ impl Default for RequestResultCache { | |
unapplied_slashes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
key_ownership_proof: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
minimum_backing_votes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
disabled_validators: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
para_backing_state: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
async_backing_params: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)), | ||
} | ||
|
@@ -444,6 +446,21 @@ impl RequestResultCache { | |
self.minimum_backing_votes.insert(session_index, minimum_backing_votes); | ||
} | ||
|
||
pub(crate) fn disabled_validators( | ||
&mut self, | ||
relay_parent: &Hash, | ||
) -> Option<&Vec<ValidatorIndex>> { | ||
self.disabled_validators.get(relay_parent).map(|v| &*v) | ||
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. Out of curiosity, what that 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. It converts &mut to & |
||
} | ||
|
||
pub(crate) fn cache_disabled_validators( | ||
&mut self, | ||
relay_parent: Hash, | ||
disabled_validators: Vec<ValidatorIndex>, | ||
) { | ||
self.disabled_validators.insert(relay_parent, disabled_validators); | ||
} | ||
|
||
pub(crate) fn para_backing_state( | ||
&mut self, | ||
key: (Hash, ParaId), | ||
|
@@ -520,6 +537,7 @@ pub(crate) enum RequestResult { | |
slashing::OpaqueKeyOwnershipProof, | ||
Option<()>, | ||
), | ||
DisabledValidators(Hash, Vec<ValidatorIndex>), | ||
ParaBackingState(Hash, ParaId, Option<async_backing::BackingState>), | ||
AsyncBackingParams(Hash, async_backing::AsyncBackingParams), | ||
} |
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
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
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.
Still not sure why we need to expose everything via RPC. I personally would limit the public facing APIs as much as possible. Anything that is exposed, we need to assume we can not change it without breaking things.
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.
The very least we should communicate clearly that these RPC calls are an unstable feature, which might change anytime.
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.
paritytech/cumulus#2160 (comment)
Well, I agree we should limit the scope for collators. But this is out of scope (hehe) of this PR.