Skip to content

Commit a6b817f

Browse files
Klapeyronladamesny
authored andcommitted
Integrate BeefyMmrApi
1 parent 62b1511 commit a6b817f

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
@@ -709,8 +709,8 @@ impl pallet_beefy::Config for Runtime {
709709
type MaxAuthorities = MaxValidators;
710710
type MaxNominators = ConstU32<0>;
711711
type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
712-
type OnNewValidatorSet = MmrLeaf;
713-
type AncestryHelper = MmrLeaf;
712+
type OnNewValidatorSet = BeefyMmrLeaf;
713+
type AncestryHelper = BeefyMmrLeaf;
714714
type WeightInfo = ();
715715
type KeyOwnerProof = sp_session::MembershipProof;
716716
// TODO: disabled equivocations, they require additional modules like Offences and full Session pallet
@@ -784,7 +784,7 @@ construct_runtime!(
784784
Mmr: pallet_mmr,
785785
// MMR leaf construction must be after session in order to have a leaf's next_auth_set
786786
// refer to block<N>. See issue polkadot-fellows/runtimes#160 for details.
787-
MmrLeaf: pallet_beefy_mmr,
787+
BeefyMmrLeaf: pallet_beefy_mmr,
788788
TestHelperPallet: crate::test_helper_pallet,
789789
}
790790
);
@@ -1099,7 +1099,7 @@ impl_runtime_apis! {
10991099
) -> Option<sp_runtime::OpaqueValue> {
11001100
use sp_consensus_beefy::AncestryHelper;
11011101

1102-
MmrLeaf::generate_proof(prev_block_number, best_known_block_number)
1102+
BeefyMmrLeaf::generate_proof(prev_block_number, best_known_block_number)
11031103
.map(|p| p.encode())
11041104
.map(sp_runtime::OpaqueValue::new)
11051105
}
@@ -1155,6 +1155,16 @@ impl_runtime_apis! {
11551155
}
11561156
}
11571157

1158+
impl pallet_beefy_mmr::BeefyMmrApi<Block, Hash> for RuntimeApi {
1159+
fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet<Hash> {
1160+
BeefyMmrLeaf::authority_set_proof()
1161+
}
1162+
1163+
fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet<Hash> {
1164+
BeefyMmrLeaf::next_authority_set_proof()
1165+
}
1166+
}
1167+
11581168
#[cfg(feature = "runtime-benchmarks")]
11591169
impl frame_benchmarking::Benchmark<Block> for Runtime {
11601170
fn benchmark_metadata(extra: bool) -> (

0 commit comments

Comments
 (0)