Millau, Rialto: accept equivocation reports (#2614) (#2617)

This commit is contained in:
Serban Iorga
2023-10-12 10:08:35 +03:00
committed by Bastian Köcher
parent d4952b2e2e
commit 08f1580658
6 changed files with 88 additions and 10 deletions
+34 -3
View File
@@ -45,7 +45,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, Block as BlockT, Keccak256, NumberFor, OpaqueKeys},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedPointNumber, Perquintill,
ApplyExtrinsicResult, FixedPointNumber, KeyTypeId, Perquintill,
};
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
#[cfg(feature = "std")]
@@ -219,6 +219,7 @@ pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
parameter_types! {
pub const EpochDuration: u64 = bp_rialto::EPOCH_DURATION_IN_SLOTS as u64;
pub const ExpectedBlockTime: bp_rialto::Moment = bp_rialto::time_units::MILLISECS_PER_BLOCK;
pub ReportLongevity: u64 = EpochDuration::get() * 10;
}
impl pallet_babe::Config for Runtime {
@@ -257,8 +258,9 @@ impl pallet_grandpa::Config for Runtime {
type WeightInfo = ();
type MaxAuthorities = ConstU32<10>;
type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
type MaxNominators = ConstU32<256>;
}
@@ -383,6 +385,29 @@ impl pallet_session::Config for Runtime {
type WeightInfo = ();
}
impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type EventHandler = ();
}
pub struct FullIdentificationOf;
impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOf {
fn convert(_: AccountId) -> Option<()> {
Some(())
}
}
impl pallet_session::historical::Config for Runtime {
type FullIdentification = ();
type FullIdentificationOf = FullIdentificationOf;
}
impl pallet_offences::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = ();
}
impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = ConstU32<10>;
}
@@ -469,6 +494,12 @@ construct_runtime!(
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
// for im-online.
Authorship: pallet_authorship::{Pallet, Storage},
Offences: pallet_offences::{Pallet, Storage, Event},
Historical: pallet_session::historical::{Pallet},
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event},