Skip to content

Commit 79a2cdd

Browse files
committed
Integrate BeefyMmrApi
1 parent 14a4b90 commit 79a2cdd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

demo/runtime/src/lib.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ impl pallet_beefy::Config for Runtime {
659659
type MaxAuthorities = MaxValidators;
660660
type MaxNominators = ConstU32<0>;
661661
type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
662-
type OnNewValidatorSet = MmrLeaf;
663-
type AncestryHelper = MmrLeaf;
662+
type OnNewValidatorSet = BeefyMmrLeaf;
663+
type AncestryHelper = BeefyMmrLeaf;
664664
type WeightInfo = ();
665665
type KeyOwnerProof = sp_session::MembershipProof;
666666
// TODO: disabled equivocations, they require additional modules like Offences and full Session pallet
@@ -734,7 +734,7 @@ construct_runtime!(
734734
Mmr: pallet_mmr,
735735
// MMR leaf construction must be after session in order to have a leaf's next_auth_set
736736
// refer to block<N>. See issue polkadot-fellows/runtimes#160 for details.
737-
MmrLeaf: pallet_beefy_mmr,
737+
BeefyMmrLeaf: pallet_beefy_mmr,
738738
TestHelperPallet: crate::test_helper_pallet,
739739
}
740740
);
@@ -1048,7 +1048,7 @@ impl_runtime_apis! {
10481048
) -> Option<sp_runtime::OpaqueValue> {
10491049
use sp_consensus_beefy::AncestryHelper;
10501050

1051-
MmrLeaf::generate_proof(prev_block_number, best_known_block_number)
1051+
BeefyMmrLeaf::generate_proof(prev_block_number, best_known_block_number)
10521052
.map(|p| p.encode())
10531053
.map(sp_runtime::OpaqueValue::new)
10541054
}
@@ -1104,6 +1104,16 @@ impl_runtime_apis! {
11041104
}
11051105
}
11061106

1107+
impl pallet_beefy_mmr::BeefyMmrApi<Block, Hash> for RuntimeApi {
1108+
fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet<Hash> {
1109+
BeefyMmrLeaf::authority_set_proof()
1110+
}
1111+
1112+
fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet<Hash> {
1113+
BeefyMmrLeaf::next_authority_set_proof()
1114+
}
1115+
}
1116+
11071117
#[cfg(feature = "runtime-benchmarks")]
11081118
impl frame_benchmarking::Benchmark<Block> for Runtime {
11091119
fn benchmark_metadata(extra: bool) -> (

0 commit comments

Comments
 (0)