Skip to content
Snippets Groups Projects
Unverified Commit 60849232 authored by Deepak Chaudhary's avatar Deepak Chaudhary Committed by GitHub
Browse files

Remove pallet::getter usage from all pallet-tips (#4871)


### ISSUE
Link to the issue:
https://github.com/paritytech/polkadot-sdk/issues/3326
cc @muraca 

Deliverables
 - [Deprecation] remove pallet::getter usage from all pallet-tips
 

### Test Outcomes
___
Successful tests by running `cargo test -p pallet-tips --features
runtime-benchmarks`



running 26 tests
test tests::__construct_runtime_integrity_test::runtime_integrity_tests
... ok
test benchmarking::bench_retract_tip ... ok
test tests::equal_entries_invariant ... ok
test benchmarking::bench_tip ... ok
test tests::finders_fee_invariant ... ok
test tests::genesis_config_works ... ok
test tests::genesis_funding_works ... ok
test benchmarking::bench_slash_tip ... ok
test tests::reasons_invariant ... ok
test benchmarking::bench_report_awesome ... ok
test tests::close_tip_works ... ok
test tests::report_awesome_from_beneficiary_and_tip_works ... ok
test tests::test_genesis_config_builds ... ok
test tests::test_last_reward_migration ... ok
test benchmarking::bench_tip_new ... ok
test benchmarking::bench_close_tip ... ok
test tests::test_migration_v4 ... ok
test tests::slash_tip_works ... ok
test tests::report_awesome_and_tip_works_second_instance ... ok
test tests::report_awesome_and_tip_works ... ok
test tests::tip_changing_works ... ok
test tests::zero_base_deposit_prohibited - should panic ... ok
test tests::tip_median_calculation_works ... ok
test tests::tip_new_cannot_be_used_twice ... ok
test tests::tip_large_should_fail ... ok
test tests::retract_tip_works ... ok

test result: ok. 26 passed; 0 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.02s

   Doc-tests pallet_tips

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.00s

---

Polkadot Address: 16htXkeVhfroBhL6nuqiwknfXKcT6WadJPZqEi2jRf9z4XPY

---------

Co-authored-by: default avatarBastian Köcher <git@kchr.de>
parent 282eaaa5
No related merge requests found
Pipeline #483818 waiting for manual action with stages
in 20 minutes and 9 seconds
# 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
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment