grandpa: report equivocations on all runtimes (#1000)

* grandpa: report equivocations on all runtimes

* runtime: fix test-runtime compilation

* runtime: enable historical session manager on all runtimes

* runtime: fix indentation

* runtime: use strong key types in KeyOwnerProofSystem definitions

* update substrate

* bump spec_version of runtimes
This commit is contained in:
André Silva
2020-05-06 19:27:28 +01:00
committed by GitHub
parent 117fffb0cb
commit 41699f5d6e
12 changed files with 387 additions and 185 deletions
+4 -15
View File
@@ -19,7 +19,6 @@
use sp_std::prelude::*;
use sp_std::result;
use codec::{Decode, Encode};
use sp_core::sr25519;
use sp_runtime::{
KeyTypeId, Perbill, RuntimeDebug,
traits::{
@@ -41,13 +40,12 @@ use frame_support::{
use primitives::{
Balance,
BlockNumber,
Signature,
parachain::{
Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement, ParachainDispatchOrigin,
UpwardMessage, ValidatorId, ActiveParas, CollatorId, Retriable, OmittedValidationData,
CandidateReceipt, GlobalValidationSchedule, AbridgedCandidateReceipt,
LocalValidationData, Scheduling, ValidityAttestation, NEW_HEADS_IDENTIFIER, PARACHAIN_KEY_TYPE_ID,
ValidatorSignature, SigningContext, HeadData, ValidationCode, FishermanId,
ValidatorSignature, SigningContext, HeadData, ValidationCode,
},
};
use frame_support::{
@@ -56,7 +54,6 @@ use frame_support::{
};
use sp_runtime::{
transaction_validity::InvalidTransaction,
traits::Verify,
};
use inherents::{ProvideInherent, InherentData, MakeFatalError, InherentIdentifier};
@@ -68,14 +65,6 @@ use system::{
use crate::attestations::{self, IncludedBlocks};
use crate::registrar::Registrar;
// An `AppCrypto` type to facilitate submitting signed transactions.
pub struct FishermanAuthorityId;
impl system::offchain::AppCrypto<<Signature as Verify>::Signer, Signature> for FishermanAuthorityId {
type RuntimeAppPublic = FishermanId;
type GenericSignature = sr25519::Signature;
type GenericPublic = sp_core::sr25519::Public;
}
// ranges for iteration of general block number don't work, so this
// is a utility to get around that.
struct BlockNumberRange<N> {
@@ -221,12 +210,12 @@ impl<T: session::Trait> Get<Vec<T::ValidatorId>> for ValidatorIdentities<T> {
}
}
/// A trait to get a session number the `Proof` belongs to.
/// A trait to get a session number the `MembershipProof` belongs to.
pub trait GetSessionNumber {
fn session(&self) -> SessionIndex;
}
impl GetSessionNumber for session::historical::Proof {
impl GetSessionNumber for sp_session::MembershipProof {
fn session(&self) -> SessionIndex {
self.session()
}
@@ -1996,7 +1985,7 @@ mod tests {
}
fn report_double_vote(
report: DoubleVoteReport<session::historical::Proof>,
report: DoubleVoteReport<sp_session::MembershipProof>,
) -> Result<ParachainsCall<Test>, TransactionValidityError> {
let inner = ParachainsCall::report_double_vote(report);
let call = Call::Parachains(inner.clone());