diff --git a/prdoc/pr_4871.prdoc b/prdoc/pr_4871.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..6ff36f59d70085f3dfff23678b9d64946d4f75de --- /dev/null +++ b/prdoc/pr_4871.prdoc @@ -0,0 +1,14 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Removed `pallet::getter` usage from the pallet-tips + +doc: + - audience: Runtime Dev + description: | + This PR removed `pallet::getter`s from `pallet-tips`s storage items. + When accessed inside the pallet, use the syntax `StorageItem::<T, I>::get()`. + +crates: + - name: pallet-tips + bump: minor diff --git a/substrate/frame/tips/src/lib.rs b/substrate/frame/tips/src/lib.rs index e16ee041fcdf8b9692b9b9c9d9570fd7c38d715f..a75aed89d0b44866aee5453743f8865894660dc3 100644 --- a/substrate/frame/tips/src/lib.rs +++ b/substrate/frame/tips/src/lib.rs @@ -180,7 +180,6 @@ pub mod pallet { /// This has the insecure enumerable hash function since the key itself is already /// guaranteed to be a secure hash. #[pallet::storage] - #[pallet::getter(fn tips)] pub type Tips<T: Config<I>, I: 'static = ()> = StorageMap< _, Twox64Concat, @@ -192,7 +191,6 @@ pub mod pallet { /// Simple preimage lookup from the reason's hash to the original data. Again, has an /// insecure enumerable hash since the key is guaranteed to be the result of a secure hash. #[pallet::storage] - #[pallet::getter(fn reasons)] pub type Reasons<T: Config<I>, I: 'static = ()> = StorageMap<_, Identity, T::Hash, Vec<u8>, OptionQuery>; @@ -492,6 +490,18 @@ pub mod pallet { impl<T: Config<I>, I: 'static> Pallet<T, I> { // Add public immutables and private mutables. + /// Access tips storage from outside + pub fn tips( + hash: T::Hash, + ) -> Option<OpenTip<T::AccountId, BalanceOf<T, I>, BlockNumberFor<T>, T::Hash>> { + Tips::<T, I>::get(hash) + } + + /// Access reasons storage from outside + pub fn reasons(hash: T::Hash) -> Option<Vec<u8>> { + Reasons::<T, I>::get(hash) + } + /// The account ID of the treasury pot. /// /// This actually does computation. If you need to keep using it, then make sure you cache the