-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remove declare synced #1134
Remove declare synced #1134
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,7 +272,7 @@ benchmarks! { | |
let block_number = 1; | ||
let nonce = NULL_ARR; | ||
let x25519_public_key = NULL_ARR; | ||
let endpoint = b"http://localhost:3001".to_vec(); | ||
let endpoint = vec![]; | ||
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. Why did this change? 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. so there are two ways to run benches compile then run them (like in our scripts) this is the more closer to production way the first uses the runtime config sets the second uses the mocks So this would pass the first not the second, now it passes both 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. @JesseAbram I thought I bumped the max length to account for this, no? If not, can you bump it to like 25 bytes, it helps makes the test more readable. 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. mmm pretty sure that would effect other tests 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. also wtv, changed 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. Ah sorry, I did change this but in #1123 which is still a draft PR 😅 |
||
let validate_also = false; | ||
|
||
prep_bond_and_validate::<T>( | ||
|
@@ -336,16 +336,6 @@ benchmarks! { | |
); | ||
} | ||
|
||
declare_synced { | ||
let caller: T::AccountId = whitelisted_caller(); | ||
let validator_id_res = <T as pallet_session::Config>::ValidatorId::try_from(caller.clone()).or(Err(Error::<T>::InvalidValidatorId)).unwrap(); | ||
ThresholdToStash::<T>::insert(caller.clone(), validator_id_res.clone()); | ||
|
||
}: _(RawOrigin::Signed(caller.clone()), true) | ||
verify { | ||
assert_last_event::<T>(Event::<T>::ValidatorSyncStatus(validator_id_res, true).into()); | ||
} | ||
|
||
confirm_key_reshare_confirmed { | ||
let c in 0 .. MAX_SIGNERS as u32; | ||
// leave a space for two as not to rotate and only confirm rotation | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,17 +172,6 @@ pub mod pallet { | |
pub type ThresholdToStash<T: Config> = | ||
StorageMap<_, Blake2_128Concat, T::AccountId, T::ValidatorId, OptionQuery>; | ||
|
||
/// Tracks wether the validator's kvdb is synced using a stash key as an identifier | ||
#[pallet::storage] | ||
#[pallet::getter(fn is_validator_synced)] | ||
pub type IsValidatorSynced<T: Config> = StorageMap< | ||
_, | ||
Blake2_128Concat, | ||
<T as pallet_session::Config>::ValidatorId, | ||
bool, | ||
ValueQuery, | ||
>; | ||
|
||
#[derive( | ||
Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen, Default, | ||
)] | ||
|
@@ -278,7 +267,6 @@ pub mod pallet { | |
|
||
ThresholdServers::<T>::insert(validator_stash, server_info.clone()); | ||
ThresholdToStash::<T>::insert(&server_info.tss_account, validator_stash); | ||
IsValidatorSynced::<T>::insert(validator_stash, true); | ||
} | ||
|
||
let refresh_info = RefreshInfo { | ||
|
@@ -485,7 +473,6 @@ pub mod pallet { | |
let server_info = | ||
ThresholdServers::<T>::take(&validator_id).ok_or(Error::<T>::NoThresholdKey)?; | ||
ThresholdToStash::<T>::remove(&server_info.tss_account); | ||
IsValidatorSynced::<T>::remove(&validator_id); | ||
Self::deposit_event(Event::NodeInfoRemoved(controller)); | ||
} | ||
Ok(Some(<T as Config>::WeightInfo::withdraw_unbonded( | ||
|
@@ -559,18 +546,6 @@ pub mod pallet { | |
Ok(()) | ||
} | ||
|
||
/// Let a validator declare if their kvdb is synced or not synced | ||
/// `synced`: State of validator's kvdb | ||
#[pallet::call_index(6)] | ||
#[pallet::weight(<T as Config>::WeightInfo::declare_synced())] | ||
pub fn declare_synced(origin: OriginFor<T>, synced: bool) -> DispatchResult { | ||
let who = ensure_signed(origin.clone())?; | ||
let stash = Self::threshold_to_stash(who).ok_or(Error::<T>::NoThresholdKey)?; | ||
IsValidatorSynced::<T>::insert(&stash, synced); | ||
Self::deposit_event(Event::ValidatorSyncStatus(stash, synced)); | ||
Ok(()) | ||
} | ||
|
||
#[pallet::call_index(7)] | ||
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. We might as well bite the bullet here and make it a |
||
#[pallet::weight(({ | ||
<T as Config>::WeightInfo::confirm_key_reshare_confirmed(MAX_SIGNERS as u32) | ||
|
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.
Can we rename this then to just
add_validators
?