mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Approval Checking Improvements Omnibus (#2480)
* add tracing to approval voting * notify if session info is not working * add dispute period to chain specs * propagate genesis session to parachains runtime * use `on_genesis_session` * protect against zero cores in computation * tweak voting rule to be based off of best and add logs * genesis configuration should use VRF slots only * swallow more keystore errors * add some docs * make validation-worker args non-optional and update clap * better tracing for bitfield signing and provisioner * pass amount of bits in bitfields to inclusion instead of recomputing * debug -> warn for some logs * better tracing for availability recovery * a little av-store tracing * bridge: forward availability recovery messages * add missing try_from impl * some more tracing * improve approval distribution tracing * guide: hold onto pending approval messages until NewBlocks * Hold onto pending approval messages until NewBlocks * guide: adjust comment * process all actions for one wakeup at a time * vec * fix network bridge test * replace randomness-collective-flip with Babe * remove PairNotFound
This commit is contained in:
committed by
GitHub
parent
3c4ed7b234
commit
3300b53306
@@ -229,11 +229,17 @@ impl<T: Config> Module<T> {
|
||||
validators.clone()
|
||||
};
|
||||
|
||||
BufferedSessionChanges::mutate(|v| v.push(BufferedSessionChange {
|
||||
validators,
|
||||
queued,
|
||||
session_index,
|
||||
}));
|
||||
if session_index == 0 {
|
||||
// Genesis session should be immediately enacted.
|
||||
Self::apply_new_session(0, validators, queued);
|
||||
} else {
|
||||
BufferedSessionChanges::mutate(|v| v.push(BufferedSessionChange {
|
||||
validators,
|
||||
queued,
|
||||
session_index,
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,10 +250,10 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
|
||||
impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Module<T> {
|
||||
type Key = ValidatorId;
|
||||
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I)
|
||||
fn on_genesis_session<'a, I: 'a>(validators: I)
|
||||
where I: Iterator<Item=(&'a T::AccountId, Self::Key)>
|
||||
{
|
||||
|
||||
<Module<T>>::on_new_session(false, 0, validators, None);
|
||||
}
|
||||
|
||||
fn on_new_session<'a, I: 'a>(changed: bool, validators: I, queued: I)
|
||||
@@ -266,7 +272,7 @@ mod tests {
|
||||
use primitives::v1::{Id as ParaId};
|
||||
use crate::mock::{
|
||||
new_test_ext,
|
||||
Initializer, System, Dmp, Paras, Configuration, MockGenesisConfig,
|
||||
Initializer, System, Dmp, Paras, Configuration, SessionInfo, MockGenesisConfig,
|
||||
};
|
||||
|
||||
use frame_support::{
|
||||
@@ -274,6 +280,24 @@ mod tests {
|
||||
traits::{OnFinalize, OnInitialize},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn session_0_is_instantly_applied() {
|
||||
new_test_ext(Default::default()).execute_with(|| {
|
||||
Initializer::on_new_session(
|
||||
false,
|
||||
0,
|
||||
Vec::new().into_iter(),
|
||||
Some(Vec::new().into_iter()),
|
||||
);
|
||||
|
||||
let v = <BufferedSessionChanges>::get();
|
||||
assert!(v.is_empty());
|
||||
|
||||
assert_eq!(SessionInfo::earliest_stored_session(), 0);
|
||||
assert!(SessionInfo::session_info(0).is_some());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn session_change_before_initialize_is_still_buffered_after() {
|
||||
new_test_ext(Default::default()).execute_with(|| {
|
||||
|
||||
Reference in New Issue
Block a user