Fix tracking validator set in ImOnline (#3596)

* Use session::validators instead of staking::current_elected

* Basic test framework.

* Initialize validators, attempt to heartbeat.

* Use dummy crypto for im-online testing.

* Remove printlns.

* Finish test, make it invalid.

* Add reporting test.

* Finalize the test.

* Remove dumbness.

* Updates.

* Update AuRa

* Update srml/im-online/src/tests.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Derive Ord

* Add some more tests.

* Remove stray todo.

* Bump runtime version.

* Bump impl-trait-for-tuples.

* Enforce new version of trait-for-tuples.
This commit is contained in:
Tomasz Drwięga
2019-09-13 14:55:33 +02:00
committed by Gavin Wood
parent a7f35680b4
commit b7c6bc1ed5
26 changed files with 493 additions and 133 deletions
@@ -137,7 +137,6 @@ mod tests {
use sr_primitives::testing::{Header, UintAuthorityId};
use sr_primitives::traits::{ConvertInto, IdentityLookup, OpaqueKeys};
use sr_primitives::Perbill;
use sr_staking_primitives::CurrentElectedSet;
use support::{impl_outer_origin, parameter_types};
type AuthorityDiscovery = Module<Test>;
@@ -149,13 +148,6 @@ mod tests {
type AuthorityId = im_online::sr25519::AuthorityId;
pub struct DummyCurrentElectedSet<T>(std::marker::PhantomData<T>);
impl<T> CurrentElectedSet<T> for DummyCurrentElectedSet<T> {
fn current_elected_set() -> Vec<T> {
vec![]
}
}
pub struct TestOnSessionEnding;
impl session::OnSessionEnding<AuthorityId> for TestOnSessionEnding {
fn on_session_ending(_: SessionIndex, _: SessionIndex) -> Option<Vec<AuthorityId>> {
@@ -189,7 +181,6 @@ mod tests {
UncheckedExtrinsic<(), im_online::Call<Test>, (), ()>,
>;
type ReportUnresponsiveness = ();
type CurrentElectedSet = DummyCurrentElectedSet<AuthorityId>;
}
pub type BlockNumber = u64;