Offences report system rework (#13425)

* Experiments with common equivocation trait

* Improved equivocation trait

* Fix grandpa equivocation implementation

* Remove some cruft

* Remove some more cruft

* More generic naming

* Simplification of offences manipilation

* More refactory

* Some prograss with the encapsulation of offence report system

* Finally unit type works as a universal null report system

* Align substrate node code

* Further simplification

* Fix test utils

* Remove not required associated type

* Fix benches

* Rollback to prev field name

* Box big params

* Fix typo

* Remove new tag computation

* Remove default implementations

* Better docs

* Return 'Result' instead of bool

* Change offence report system return types

* Some renaming and documentation

* Improve documentation

* More abstract offence report system

* Rename 'consume_evidence' to 'process_evidence'

* Further docs refinements

* Doc for dummy offence report

* Fix rustdoc

* Fix after master merge

* Apply code review suggestions

* Improve docs
This commit is contained in:
Davide Galassi
2023-03-07 21:25:55 +01:00
committed by GitHub
parent e16f15119f
commit 9dd10d131d
18 changed files with 499 additions and 741 deletions
+4 -15
View File
@@ -28,7 +28,7 @@ use scale_info::TypeInfo;
use sp_std::{marker::PhantomData, prelude::*};
use sp_application_crypto::{ecdsa, ed25519, sr25519, RuntimeAppPublic};
use sp_core::{offchain::KeyTypeId, OpaqueMetadata, RuntimeDebug};
use sp_core::{OpaqueMetadata, RuntimeDebug};
use sp_trie::{
trie_types::{TrieDBBuilder, TrieDBMutBuilderV1},
PrefixedMemoryDB, StorageProof,
@@ -39,7 +39,7 @@ use cfg_if::cfg_if;
use frame_support::{
dispatch::RawOrigin,
parameter_types,
traits::{CallerTrait, ConstU32, ConstU64, CrateVersion, KeyOwnerProofSystem},
traits::{CallerTrait, ConstU32, ConstU64, CrateVersion},
weights::{RuntimeDbWeight, Weight},
};
use frame_system::limits::{BlockLength, BlockWeights};
@@ -659,21 +659,10 @@ impl pallet_babe::Config for Runtime {
// pallet_babe::SameAuthoritiesForever.
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = ();
type KeyOwnerProofSystem = ();
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, AuthorityId)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
type WeightInfo = ();
type MaxAuthorities = ConstU32<10>;
type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
}
/// Adds one to the given input and returns the final result.