Removed pallet::getter usage from Beefy and MMR pallets (#3740)

Part of #3326 

cc @kianenigma @ggwpez @liamaharon 

polkadot address: 12poSUQPtcF1HUPQGY3zZu2P8emuW9YnsPduA4XG3oCEfJVp

---------

Signed-off-by: Matteo Muraca <mmuraca247@gmail.com>
This commit is contained in:
Matteo Muraca
2024-03-19 14:55:23 +01:00
committed by GitHub
parent abd3f0c49a
commit 817870e3b2
12 changed files with 81 additions and 72 deletions
+4 -6
View File
@@ -68,7 +68,7 @@ where
<T as pallet_beefy::Config>::BeefyId,
>::MmrRoot(*root)),
);
<frame_system::Pallet<T>>::deposit_log(digest);
frame_system::Pallet::<T>::deposit_log(digest);
}
}
@@ -126,7 +126,6 @@ pub mod pallet {
/// Details of current BEEFY authority set.
#[pallet::storage]
#[pallet::getter(fn beefy_authorities)]
pub type BeefyAuthorities<T: Config> =
StorageValue<_, BeefyAuthoritySet<MerkleRootOf<T>>, ValueQuery>;
@@ -134,7 +133,6 @@ pub mod pallet {
///
/// This storage entry is used as cache for calls to `update_beefy_next_authority_set`.
#[pallet::storage]
#[pallet::getter(fn beefy_next_authorities)]
pub type BeefyNextAuthorities<T: Config> =
StorageValue<_, BeefyNextAuthoritySet<MerkleRootOf<T>>, ValueQuery>;
}
@@ -152,7 +150,7 @@ impl<T: Config> LeafDataProvider for Pallet<T> {
version: T::LeafVersion::get(),
parent_number_and_hash: ParentNumberAndHash::<T>::leaf_data(),
leaf_extra: T::BeefyDataProvider::extra_data(),
beefy_next_authority_set: Pallet::<T>::beefy_next_authorities(),
beefy_next_authority_set: BeefyNextAuthorities::<T>::get(),
}
}
}
@@ -177,12 +175,12 @@ where
impl<T: Config> Pallet<T> {
/// Return the currently active BEEFY authority set proof.
pub fn authority_set_proof() -> BeefyAuthoritySet<MerkleRootOf<T>> {
Pallet::<T>::beefy_authorities()
BeefyAuthorities::<T>::get()
}
/// Return the next/queued BEEFY authority set proof.
pub fn next_authority_set_proof() -> BeefyNextAuthoritySet<MerkleRootOf<T>> {
Pallet::<T>::beefy_next_authorities()
BeefyNextAuthorities::<T>::get()
}
/// Returns details of a BEEFY authority set.
+2 -2
View File
@@ -107,7 +107,7 @@ fn should_contain_valid_leaf_data() {
let mut ext = new_test_ext(vec![1, 2, 3, 4]);
let parent_hash = ext.execute_with(|| {
init_block(1);
<frame_system::Pallet<Test>>::parent_hash()
frame_system::Pallet::<Test>::parent_hash()
});
let mmr_leaf = read_mmr_leaf(&mut ext, node_offchain_key(0, parent_hash));
@@ -132,7 +132,7 @@ fn should_contain_valid_leaf_data() {
// build second block on top
let parent_hash = ext.execute_with(|| {
init_block(2);
<frame_system::Pallet<Test>>::parent_hash()
frame_system::Pallet::<Test>::parent_hash()
});
let mmr_leaf = read_mmr_leaf(&mut ext, node_offchain_key(1, parent_hash));