runtime: update grandpa equivocation reporting api (#1407)

* runtime: update grandpa equivocation reporting api

* Bump

Co-authored-by: Gav Wood <gavin@parity.io>
This commit is contained in:
André Silva
2020-07-17 12:01:02 +01:00
committed by GitHub
parent 63a655afb0
commit 0a049e81de
5 changed files with 159 additions and 172 deletions
+146 -138
View File
File diff suppressed because it is too large Load Diff
+4 -11
View File
@@ -560,12 +560,7 @@ impl grandpa::Trait for Runtime {
GrandpaId, GrandpaId,
)>>::IdentificationTuple; )>>::IdentificationTuple;
type HandleEquivocation = grandpa::EquivocationHandler< type HandleEquivocation = grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
Self::KeyOwnerIdentification,
primitives::v0::fisherman::FishermanAppCrypto,
Runtime,
Offences,
>;
} }
parameter_types! { parameter_types! {
@@ -653,7 +648,6 @@ impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime
transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip), transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
registrar::LimitParathreadCommits::<Runtime>::new(), registrar::LimitParathreadCommits::<Runtime>::new(),
parachains::ValidateDoubleVoteReports::<Runtime>::new(), parachains::ValidateDoubleVoteReports::<Runtime>::new(),
grandpa::ValidateEquivocationReport::<Runtime>::new(),
); );
let raw_payload = SignedPayload::new(call, extra).map_err(|e| { let raw_payload = SignedPayload::new(call, extra).map_err(|e| {
debug::warn!("Unable to create signed payload: {:?}", e); debug::warn!("Unable to create signed payload: {:?}", e);
@@ -963,7 +957,7 @@ construct_runtime! {
Historical: session_historical::{Module}, Historical: session_historical::{Module},
Session: session::{Module, Call, Storage, Event, Config<T>}, Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent}, FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event}, Grandpa: grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>}, ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config}, AuthorityDiscovery: authority_discovery::{Module, Call, Config},
@@ -1032,7 +1026,6 @@ pub type SignedExtra = (
transaction_payment::ChargeTransactionPayment<Runtime>, transaction_payment::ChargeTransactionPayment<Runtime>,
registrar::LimitParathreadCommits<Runtime>, registrar::LimitParathreadCommits<Runtime>,
parachains::ValidateDoubleVoteReports<Runtime>, parachains::ValidateDoubleVoteReports<Runtime>,
grandpa::ValidateEquivocationReport<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
@@ -1159,7 +1152,7 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities() Grandpa::grandpa_authorities()
} }
fn submit_report_equivocation_extrinsic( fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof< equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash, <Block as BlockT>::Hash,
sp_runtime::traits::NumberFor<Block>, sp_runtime::traits::NumberFor<Block>,
@@ -1168,7 +1161,7 @@ sp_api::impl_runtime_apis! {
) -> Option<()> { ) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?; let key_owner_proof = key_owner_proof.decode()?;
Grandpa::submit_report_equivocation_extrinsic( Grandpa::submit_unsigned_equivocation_report(
equivocation_proof, equivocation_proof,
key_owner_proof, key_owner_proof,
) )
+4 -11
View File
@@ -626,12 +626,7 @@ impl grandpa::Trait for Runtime {
type KeyOwnerProofSystem = Historical; type KeyOwnerProofSystem = Historical;
type HandleEquivocation = grandpa::EquivocationHandler< type HandleEquivocation = grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
Self::KeyOwnerIdentification,
primitives::v0::fisherman::FishermanAppCrypto,
Runtime,
Offences,
>;
} }
parameter_types! { parameter_types! {
@@ -720,7 +715,6 @@ impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime
transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip), transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
registrar::LimitParathreadCommits::<Runtime>::new(), registrar::LimitParathreadCommits::<Runtime>::new(),
parachains::ValidateDoubleVoteReports::<Runtime>::new(), parachains::ValidateDoubleVoteReports::<Runtime>::new(),
grandpa::ValidateEquivocationReport::<Runtime>::new(),
claims::PrevalidateAttests::<Runtime>::new(), claims::PrevalidateAttests::<Runtime>::new(),
); );
let raw_payload = SignedPayload::new(call, extra).map_err(|e| { let raw_payload = SignedPayload::new(call, extra).map_err(|e| {
@@ -976,7 +970,7 @@ construct_runtime! {
Historical: session_historical::{Module}, Historical: session_historical::{Module},
Session: session::{Module, Call, Storage, Event, Config<T>}, Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent}, FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event}, Grandpa: grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>}, ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config}, AuthorityDiscovery: authority_discovery::{Module, Call, Config},
@@ -1042,7 +1036,6 @@ pub type SignedExtra = (
transaction_payment::ChargeTransactionPayment<Runtime>, transaction_payment::ChargeTransactionPayment<Runtime>,
registrar::LimitParathreadCommits<Runtime>, registrar::LimitParathreadCommits<Runtime>,
parachains::ValidateDoubleVoteReports<Runtime>, parachains::ValidateDoubleVoteReports<Runtime>,
grandpa::ValidateEquivocationReport<Runtime>,
claims::PrevalidateAttests<Runtime>, claims::PrevalidateAttests<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
@@ -1170,7 +1163,7 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities() Grandpa::grandpa_authorities()
} }
fn submit_report_equivocation_extrinsic( fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof< equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash, <Block as BlockT>::Hash,
sp_runtime::traits::NumberFor<Block>, sp_runtime::traits::NumberFor<Block>,
@@ -1179,7 +1172,7 @@ sp_api::impl_runtime_apis! {
) -> Option<()> { ) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?; let key_owner_proof = key_owner_proof.decode()?;
Grandpa::submit_report_equivocation_extrinsic( Grandpa::submit_unsigned_equivocation_report(
equivocation_proof, equivocation_proof,
key_owner_proof, key_owner_proof,
) )
+1 -1
View File
@@ -713,7 +713,7 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities() Grandpa::grandpa_authorities()
} }
fn submit_report_equivocation_extrinsic( fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: fg_primitives::EquivocationProof< _equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash, <Block as BlockT>::Hash,
sp_runtime::traits::NumberFor<Block>, sp_runtime::traits::NumberFor<Block>,
+4 -11
View File
@@ -384,12 +384,7 @@ impl grandpa::Trait for Runtime {
GrandpaId, GrandpaId,
)>>::IdentificationTuple; )>>::IdentificationTuple;
type HandleEquivocation = grandpa::EquivocationHandler< type HandleEquivocation = grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
Self::KeyOwnerIdentification,
primitives::v0::fisherman::FishermanAppCrypto,
Runtime,
Offences,
>;
} }
parameter_types! { parameter_types! {
@@ -477,7 +472,6 @@ impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime
transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip), transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
registrar::LimitParathreadCommits::<Runtime>::new(), registrar::LimitParathreadCommits::<Runtime>::new(),
parachains::ValidateDoubleVoteReports::<Runtime>::new(), parachains::ValidateDoubleVoteReports::<Runtime>::new(),
grandpa::ValidateEquivocationReport::<Runtime>::new(),
); );
let raw_payload = SignedPayload::new(call, extra).map_err(|e| { let raw_payload = SignedPayload::new(call, extra).map_err(|e| {
debug::warn!("Unable to create signed payload: {:?}", e); debug::warn!("Unable to create signed payload: {:?}", e);
@@ -721,7 +715,7 @@ construct_runtime! {
Historical: session_historical::{Module}, Historical: session_historical::{Module},
Session: session::{Module, Call, Storage, Event, Config<T>}, Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent}, FinalityTracker: finality_tracker::{Module, Call, Storage, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event}, Grandpa: grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>}, ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config}, AuthorityDiscovery: authority_discovery::{Module, Call, Config},
@@ -778,7 +772,6 @@ pub type SignedExtra = (
transaction_payment::ChargeTransactionPayment<Runtime>, transaction_payment::ChargeTransactionPayment<Runtime>,
registrar::LimitParathreadCommits<Runtime>, registrar::LimitParathreadCommits<Runtime>,
parachains::ValidateDoubleVoteReports<Runtime>, parachains::ValidateDoubleVoteReports<Runtime>,
grandpa::ValidateEquivocationReport<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
@@ -898,7 +891,7 @@ sp_api::impl_runtime_apis! {
Grandpa::grandpa_authorities() Grandpa::grandpa_authorities()
} }
fn submit_report_equivocation_extrinsic( fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: fg_primitives::EquivocationProof< equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash, <Block as BlockT>::Hash,
sp_runtime::traits::NumberFor<Block>, sp_runtime::traits::NumberFor<Block>,
@@ -907,7 +900,7 @@ sp_api::impl_runtime_apis! {
) -> Option<()> { ) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?; let key_owner_proof = key_owner_proof.decode()?;
Grandpa::submit_report_equivocation_extrinsic( Grandpa::submit_unsigned_equivocation_report(
equivocation_proof, equivocation_proof,
key_owner_proof, key_owner_proof,
) )