Skip to content
Snippets Groups Projects

Add end2end test for offences

Merged Benjamin Gallois requested to merge bgallois/duniter-v2s:114-offences-testing into master
@@ -21,6 +21,7 @@ use frame_support::assert_ok;
use frame_support::traits::ValidatorSet;
use frame_support::traits::ValidatorSetWithIdentification;
use gdev_runtime::*;
use pallet_im_online as im_online;
use pallet_im_online::UnresponsivenessOffence;
use pallet_session::historical::IdentificationTuple;
use sp_runtime::traits::Convert;
@@ -31,14 +32,13 @@ fn test_imonline_offence() {
ExtBuilder::new(1, 3, 4).build().execute_with(|| {
run_to_block(1);
let session_index = Session::current_index();
let current_validators = <Runtime as pallet_im_online::Config>::ValidatorSet::validators();
let current_validators = <Runtime as im_online::Config>::ValidatorSet::validators();
// Construct an offence where all validators (member: 1) are offenders
type ImOnline = pallet_im_online::Config;
let offenders = current_validatorc
let offenders = current_validators
.into_iter()
.enumerate()
.filter_map(|(_, id)| {
<<Runtime as ImOnline>::ValidatorSet as ValidatorSetWithIdentification<
<<Runtime as im_online::Config>::ValidatorSet as ValidatorSetWithIdentification<
sp_runtime::AccountId32,
>>::IdentificationOf::convert(id.clone())
.map(|full_id| (id, full_id))
Loading