diff --git a/prdoc/pr_4871.prdoc b/prdoc/pr_4871.prdoc new file mode 100644 index 000000000000..6ff36f59d700 --- /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::::get()`. + +crates: + - name: pallet-tips + bump: minor diff --git a/substrate/frame/tips/src/lib.rs b/substrate/frame/tips/src/lib.rs index e16ee041fcdf..a75aed89d0b4 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, 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, I: 'static = ()> = StorageMap<_, Identity, T::Hash, Vec, OptionQuery>; @@ -492,6 +490,18 @@ pub mod pallet { impl, I: 'static> Pallet { // Add public immutables and private mutables. + /// Access tips storage from outside + pub fn tips( + hash: T::Hash, + ) -> Option, BlockNumberFor, T::Hash>> { + Tips::::get(hash) + } + + /// Access reasons storage from outside + pub fn reasons(hash: T::Hash) -> Option> { + Reasons::::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