-
Notifications
You must be signed in to change notification settings - Fork 2
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
Partition proactive refresh #504
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f321b02
partition proactive refresh
JesseAbram 688c344
finished partitioning algorithim
JesseAbram 8c02b70
refactor
JesseAbram f450b40
fmt
JesseAbram f10877c
document
JesseAbram 5ffbfa6
add logger to test
JesseAbram 579d092
refactor
JesseAbram 5cbaa11
Change `REFRESHES_PER_SESSION` from `u128` to `u32` (#513)
HCastano eab1851
move refreshes done to ocw message
JesseAbram 6612dc2
lint
JesseAbram dd9a3ef
fix propogation test
JesseAbram 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
Binary file not shown.
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
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -86,6 +86,12 @@ pub mod pallet { | |||
pub x25519_public_key: X25519PublicKey, | ||||
pub endpoint: TssServerURL, | ||||
} | ||||
/// Info that is requiered to do a proactive refresh | ||||
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, Default)] | ||||
pub struct RefreshInfo { | ||||
pub validators_info: Vec<ValidatorInfo>, | ||||
pub refreshes_done: u32, | ||||
} | ||||
|
||||
#[pallet::pallet] | ||||
#[pallet::without_storage_info] | ||||
|
@@ -140,9 +146,10 @@ pub mod pallet { | |||
ValueQuery, | ||||
>; | ||||
|
||||
/// A trigger for the proactive refresh OCW | ||||
#[pallet::storage] | ||||
#[pallet::getter(fn proactive_refresh)] | ||||
pub type ProactiveRefresh<T: Config> = StorageValue<_, Vec<ValidatorInfo>, ValueQuery>; | ||||
pub type ProactiveRefresh<T: Config> = StorageValue<_, RefreshInfo, ValueQuery>; | ||||
|
||||
#[pallet::genesis_config] | ||||
#[derive(DefaultNoBound)] | ||||
|
@@ -175,8 +182,11 @@ pub mod pallet { | |||
IsValidatorSynced::<T>::insert(validator_id, true); | ||||
} | ||||
} | ||||
|
||||
ProactiveRefresh::<T>::put(self.proactive_refresh_validators.clone()); | ||||
let refresh_info = RefreshInfo { | ||||
validators_info: self.proactive_refresh_validators.clone(), | ||||
refreshes_done: 0, | ||||
}; | ||||
ProactiveRefresh::<T>::put(refresh_info); | ||||
} | ||||
} | ||||
// Errors inform users that something went wrong. | ||||
|
@@ -350,6 +360,7 @@ pub mod pallet { | |||
pub fn new_session_handler( | ||||
validators: &[<T as pallet_session::Config>::ValidatorId], | ||||
) -> Result<(), DispatchError> { | ||||
// TODO add back in refresh trigger and refreshed counter https://github.com/entropyxyz/entropy-core/issues/511 | ||||
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. Don't think we need this
Suggested change
|
||||
// Init a 2D Vec where indices and values represent subgroups and validators, | ||||
// respectively. | ||||
let mut new_validators_set: Vec<Vec<<T as pallet_session::Config>::ValidatorId>> = | ||||
|
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.
This struct is very similar to
OcwMessageProactiveRefresh
. Im guessing the reason you didn't use the same type is because of compilation issues with using theRuntimeDebug
andTypeInfo
traits inentropy-shared
. Possibly we could get that to work by fiddling around with feature flags, but i think this is fine as it is.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.
yes lol this is exactly what happened