Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove pallet::getter from pallet-offences #6027

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Zebedeusz
Copy link

Description

Part of #3326
Removes pallet::getter from pallet-offences from type Reports.
Adds a test to verify that retrieval of Reports still works with storage::getter.

@Zebedeusz Zebedeusz added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 11, 2024
@Zebedeusz Zebedeusz requested a review from a team as a code owner October 11, 2024 12:45
@Zebedeusz Zebedeusz force-pushed the zebedeusz/remove_getter_pallet_offences branch from 6d121c6 to b74ddc3 Compare October 11, 2024 12:48

crates:
- name: pallet-offences
bump: patch
Copy link
Contributor

@seadanda seadanda Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the getter is a breaking (major) change unless you add a function with the same signature. I'd go with adding the new function but marking it as deprecated to avoid the breakage but letting people know that it is deprecated and that they should use Reports::<T>::get(id) instead.

Comment on lines +43 to +46
// when
let stored_offence_details = Reports::<Runtime>::get(report_id);

// then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// when
let stored_offence_details = Reports::<Runtime>::get(report_id);
// then
#[allow(deprecated)]
let stored_offence_details = Offences::reports(report_id);
assert_eq!(stored_offence_details, Some(offence_details.clone()));
let stored_offence_details = Reports::<Runtime>::get(report_id);

This new part of the test should pass to avoid a breaking change

@shawntabrizi
Copy link
Member

Yeah, we need you to create a new public function which does the same thing as the getter here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants