From 0bb36785062f238b2c8510888cdd56d2bc640655 Mon Sep 17 00:00:00 2001 From: Robert Hambrock Date: Thu, 17 Aug 2023 11:25:41 +0200 Subject: [PATCH] update BEEFY equivocation report interface --- node/service/src/fake_runtime_api.rs | 6 +++--- runtime/kusama/src/lib.rs | 8 ++++---- runtime/polkadot/src/lib.rs | 8 ++++---- runtime/rococo/src/lib.rs | 18 ++++++++---------- runtime/test-runtime/src/lib.rs | 11 +++++++++-- runtime/westend/src/lib.rs | 8 ++++---- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/node/service/src/fake_runtime_api.rs b/node/service/src/fake_runtime_api.rs index 6cc7181c5da7..418217997385 100644 --- a/node/service/src/fake_runtime_api.rs +++ b/node/service/src/fake_runtime_api.rs @@ -240,7 +240,7 @@ sp_api::impl_runtime_apis! { unimplemented!() } - fn submit_report_equivocation_unsigned_extrinsic( + fn submit_report_vote_equivocation_unsigned_extrinsic( _: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, @@ -251,8 +251,8 @@ sp_api::impl_runtime_apis! { unimplemented!() } - fn submit_report_invalid_fork_unsigned_extrinsic( - _: beefy_primitives::InvalidForkCommitmentProof, + fn submit_report_fork_equivocation_unsigned_extrinsic( + _: beefy_primitives::ForkEquivocationProof::Header>, _: Vec, ) -> Option<()> { unimplemented!() diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 1d77ad85b6b4..94ab803949c5 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1827,8 +1827,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: beefy_primitives::VoteEquivocationProof< + fn submit_report_vote_equivocation_unsigned_extrinsic( + _vote_equivocation_proof: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, BeefySignature, @@ -1839,8 +1839,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_invalid_fork_unsigned_extrinsic( - _invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof, + fn submit_report_fork_equivocation_unsigned_extrinsic( + _fork_equivocation_proof: beefy_primitives::ForkEquivocationProof, _key_owner_proofs: Vec, ) -> Option<()> { // dummy implementation due to lack of BEEFY pallet. diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index c3258b77345c..fabde9f914a6 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1808,8 +1808,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: beefy_primitives::VoteEquivocationProof< + fn submit_report_vote_equivocation_unsigned_extrinsic( + _vote_equivocation_proof: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, BeefySignature, @@ -1820,8 +1820,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_invalid_fork_unsigned_extrinsic( - _invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof, + fn submit_report_fork_equivocation_unsigned_extrinsic( + _fork_equivocation_proof: beefy_primitives::ForkEquivocationProof, _key_owner_proofs: Vec, ) -> Option<()> { // dummy implementation due to lack of BEEFY pallet. diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 86dbea9067b4..073cb6ba3e0a 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -1270,8 +1270,6 @@ impl pallet_beefy::Config for Runtime { type KeyOwnerProof = >::Proof; type EquivocationReportSystem = pallet_beefy::EquivocationReportSystem; - type InvalidForkReportSystem = - pallet_beefy::InvalidForkReportSystem; } /// MMR helper types. @@ -1830,8 +1828,8 @@ sp_api::impl_runtime_apis! { Beefy::validator_set() } - fn submit_report_equivocation_unsigned_extrinsic( - equivocation_proof: beefy_primitives::VoteEquivocationProof< + fn submit_report_vote_equivocation_unsigned_extrinsic( + vote_equivocation_proof: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, BeefySignature, @@ -1840,20 +1838,20 @@ sp_api::impl_runtime_apis! { ) -> Option<()> { let key_owner_proof = key_owner_proof.decode()?; - Beefy::submit_unsigned_equivocation_report( - equivocation_proof, + Beefy::submit_unsigned_vote_equivocation_report( + vote_equivocation_proof, key_owner_proof, ) } - fn submit_report_invalid_fork_unsigned_extrinsic( - invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof, + fn submit_report_fork_equivocation_unsigned_extrinsic( + fork_equivocation_proof: beefy_primitives::ForkEquivocationProof, key_owner_proofs: Vec, ) -> Option<()> { let key_owner_proofs = key_owner_proofs.iter().cloned().map(|p| p.decode()).collect::>>()?; - Beefy::submit_unsigned_invalid_fork_report( - invalid_fork_proof, + Beefy::submit_unsigned_fork_equivocation_report( + fork_equivocation_proof, key_owner_proofs, ) } diff --git a/runtime/test-runtime/src/lib.rs b/runtime/test-runtime/src/lib.rs index bb478d3865a3..03eac628182a 100644 --- a/runtime/test-runtime/src/lib.rs +++ b/runtime/test-runtime/src/lib.rs @@ -955,8 +955,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: beefy_primitives::VoteEquivocationProof< + fn submit_report_vote_equivocation_unsigned_extrinsic( + _vote_equivocation_proof: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, BeefySignature, @@ -966,6 +966,13 @@ sp_api::impl_runtime_apis! { None } + fn submit_report_fork_equivocation_unsigned_extrinsic( + _fork_equivocation_proof: beefy_primitives::ForkEquivocationProof, + _key_owner_proofs: Vec, + ) -> Option<()> { + None + } + fn generate_key_ownership_proof( _set_id: beefy_primitives::ValidatorSetId, _authority_id: BeefyId, diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index c481975dae80..bfa8ed29b56d 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1563,8 +1563,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_equivocation_unsigned_extrinsic( - _equivocation_proof: beefy_primitives::VoteEquivocationProof< + fn submit_report_vote_equivocation_unsigned_extrinsic( + _vote_equivocation_proof: beefy_primitives::VoteEquivocationProof< BlockNumber, BeefyId, BeefySignature, @@ -1574,8 +1574,8 @@ sp_api::impl_runtime_apis! { None } - fn submit_report_invalid_fork_unsigned_extrinsic( - _invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof, + fn submit_report_fork_equivocation_unsigned_extrinsic( + _fork_equivocation_proof: beefy_primitives::ForkEquivocationProof, _key_owner_proofs: Vec, ) -> Option<()> { None