Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
update BEEFY equivocation report interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Lederstrumpf committed Aug 17, 2023
1 parent 75953f2 commit 0bb3678
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
6 changes: 3 additions & 3 deletions node/service/src/fake_runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -251,8 +251,8 @@ sp_api::impl_runtime_apis! {
unimplemented!()
}

fn submit_report_invalid_fork_unsigned_extrinsic(
_: beefy_primitives::InvalidForkCommitmentProof<BlockNumber, BeefyId, BeefySignature>,
fn submit_report_fork_equivocation_unsigned_extrinsic(
_: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, <Block as BlockT>::Header>,
_: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
unimplemented!()
Expand Down
8 changes: 4 additions & 4 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -1839,8 +1839,8 @@ sp_api::impl_runtime_apis! {
None
}

fn submit_report_invalid_fork_unsigned_extrinsic(
_invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof<BlockNumber, BeefyId, BeefySignature>,
fn submit_report_fork_equivocation_unsigned_extrinsic(
_fork_equivocation_proof: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, Header>,
_key_owner_proofs: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
// dummy implementation due to lack of BEEFY pallet.
Expand Down
8 changes: 4 additions & 4 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -1820,8 +1820,8 @@ sp_api::impl_runtime_apis! {
None
}

fn submit_report_invalid_fork_unsigned_extrinsic(
_invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof<BlockNumber, BeefyId, BeefySignature>,
fn submit_report_fork_equivocation_unsigned_extrinsic(
_fork_equivocation_proof: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, Header>,
_key_owner_proofs: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
// dummy implementation due to lack of BEEFY pallet.
Expand Down
18 changes: 8 additions & 10 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,6 @@ impl pallet_beefy::Config for Runtime {
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, BeefyId)>>::Proof;
type EquivocationReportSystem =
pallet_beefy::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
type InvalidForkReportSystem =
pallet_beefy::InvalidForkReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// MMR helper types.
Expand Down Expand Up @@ -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,
Expand All @@ -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<BlockNumber, BeefyId, BeefySignature>,
fn submit_report_fork_equivocation_unsigned_extrinsic(
fork_equivocation_proof: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, Header>,
key_owner_proofs: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
let key_owner_proofs = key_owner_proofs.iter().cloned().map(|p| p.decode()).collect::<Option<Vec<_>>>()?;

Beefy::submit_unsigned_invalid_fork_report(
invalid_fork_proof,
Beefy::submit_unsigned_fork_equivocation_report(
fork_equivocation_proof,
key_owner_proofs,
)
}
Expand Down
11 changes: 9 additions & 2 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -966,6 +966,13 @@ sp_api::impl_runtime_apis! {
None
}

fn submit_report_fork_equivocation_unsigned_extrinsic(
_fork_equivocation_proof: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, Header>,
_key_owner_proofs: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
None
}

fn generate_key_ownership_proof(
_set_id: beefy_primitives::ValidatorSetId,
_authority_id: BeefyId,
Expand Down
8 changes: 4 additions & 4 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -1574,8 +1574,8 @@ sp_api::impl_runtime_apis! {
None
}

fn submit_report_invalid_fork_unsigned_extrinsic(
_invalid_fork_proof: beefy_primitives::InvalidForkCommitmentProof<BlockNumber, BeefyId, BeefySignature>,
fn submit_report_fork_equivocation_unsigned_extrinsic(
_fork_equivocation_proof: beefy_primitives::ForkEquivocationProof<BlockNumber, BeefyId, BeefySignature, Header>,
_key_owner_proofs: Vec<beefy_primitives::OpaqueKeyOwnershipProof>,
) -> Option<()> {
None
Expand Down

0 comments on commit 0bb3678

Please sign in to comment.