-
Notifications
You must be signed in to change notification settings - Fork 68
A0-1845: Authorities api #870
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ed2448d
simplify and unificate authorities api
kostekIV c126a6d
lint
kostekIV a07fc4f
bump aleph-client
kostekIV 140a729
Merge branch 'main' into queued-validators
kostekIV 1a085b4
fix tests
kostekIV 9fe00c1
Merge branch 'queued-validators' of github.com:Cardinal-Cryptography/…
kostekIV 7891ba0
lint
kostekIV ea4aff4
hide docs
kostekIV b5afbcb
adjust check
kostekIV 8b775ea
adjust check 2
kostekIV 1b24429
default
kostekIV c4d92d1
lint
kostekIV 5dcf752
Merge branch 'main' into queued-validators
kostekIV 9d367e1
logs instead of panics
kostekIV 9b5522d
fix doc
kostekIV 60bf353
add version
kostekIV 7bd4bfe
add versions
kostekIV df86a12
revert
kostekIV 26b5c24
fix tests
kostekIV 58ffda3
Merge branch 'main' into queued-validators
kostekIV 2a922d0
regenrate
kostekIV 954d7af
Merge branch 'queued-validators' of github.com:Cardinal-Cryptography/…
kostekIV a21d560
Merge remote-tracking branch 'origin/main' into queued-validators
kostekIV f2f824e
Updated runtimte file
Marcin-Radecki 1c45215
Disable runtime check
Marcin-Radecki 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,15 +1,45 @@ | ||
| use primitives::SessionIndex; | ||
| use frame_support::{ | ||
| log, | ||
| sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic}, | ||
| }; | ||
| use primitives::{AuthorityId, SessionIndex}; | ||
| use sp_std::prelude::*; | ||
|
|
||
| use crate::Config; | ||
|
|
||
| /// Information provider from `pallet_session`. Loose pallet coupling via traits. | ||
| pub trait SessionInfoProvider<T: frame_system::Config> { | ||
| pub trait SessionInfoProvider { | ||
| fn current_session() -> SessionIndex; | ||
| } | ||
|
|
||
| impl<T> SessionInfoProvider<T> for pallet_session::Pallet<T> | ||
| /// Authorities provider, used only as default value in case of missing this information in our pallet. This can | ||
| /// happen for the session after runtime upgraded. | ||
| pub trait NextSessionAuthorityProvider<T: Config> { | ||
| fn next_authorities() -> Vec<T::AuthorityId>; | ||
| } | ||
|
|
||
| impl<T> SessionInfoProvider for pallet_session::Pallet<T> | ||
| where | ||
| T: pallet_session::Config, | ||
| { | ||
| fn current_session() -> SessionIndex { | ||
| pallet_session::CurrentIndex::<T>::get() | ||
| } | ||
| } | ||
|
|
||
| impl<T> NextSessionAuthorityProvider<T> for pallet_session::Pallet<T> | ||
| where | ||
| T: Config + pallet_session::Config, | ||
| { | ||
| fn next_authorities() -> Vec<T::AuthorityId> { | ||
| let next: Option<Vec<_>> = pallet_session::Pallet::<T>::queued_keys() | ||
| .iter() | ||
| .map(|(_, key)| key.get(AuthorityId::ID)) | ||
| .collect(); | ||
|
|
||
| next.unwrap_or_else(|| { | ||
| log::error!(target: "pallet_aleph", "Missing next session keys"); | ||
| vec![] | ||
| }) | ||
| } | ||
| } |
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.