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

Pallet AURA: remove pallet::getter macro and write the corresponding code #3350

Conversation

k-gunjan
Copy link
Contributor

@k-gunjan k-gunjan commented Feb 16, 2024

Removed the pallet::getter macro call from storage type definitions and added the corresponding implementations directly.
fixes #3330

polkadot address: 14JzTPPUd8x8phKi8qLxHgNTnTMg6DUukCLXoWprejkaHXPz

@k-gunjan k-gunjan requested a review from a team as a code owner February 16, 2024 07:35
@cla-bot-2021
Copy link

cla-bot-2021 bot commented Feb 16, 2024

User @k-gunjan, please sign the CLA here.

///
/// This function will be deprecated in future releases. It is recommended not to use it in new
/// developments.
pub fn authorities() -> BoundedVec<T::AuthorityId, T::MaxAuthorities> {
Copy link
Contributor

Choose a reason for hiding this comment

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

where are these functions used? do they even need to exist?

Copy link
Contributor Author

@k-gunjan k-gunjan Feb 16, 2024

Choose a reason for hiding this comment

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

Thank you for your review and the points raised. I appreciate the opportunity to clarify the usage and implications of the proposed changes.

I've noted that the this function is utilized not only within this pallet like here but also across other crates within the SDK like here. This widespread use underscores its current necessity and potential impact on existing implementations.

In my understanding, the primary aim of this PR is to streamline the codebase by removing unnecessary macro complexity, thereby improving readability and maintainability without altering the existing functionality or interfaces. Given this scope, maintaining these function calls as-is ensures compatibility and stability across the SDK during this transitional phase. Please suggest .

If recommended I can go ahead and replace the uses here with Authorities::<T>::get() in a future iteration.

Let me know if you recommend proceeding with these adjustments now, or if we should consider them as part of a subsequent phase of optimization.

Copy link
Member

Choose a reason for hiding this comment

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

If recommended I can go ahead and replace the uses here with Authorities::::get() in a future iteration.

In my opinion we should do this. No need for another function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your valuable feedback. I've implemented the suggested changes in the latest commit (e81e6c4). You can view the changes here.

Please take a look at the updated code when you have a moment. I'm open to any further suggestions or discussions if there's more to refine.

Copy link
Contributor

Choose a reason for hiding this comment

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

@k-gunjan I think Oliver meant that you should not introduce these new methods in this PR.
Instead, you should go around the other crates that call the getter functions you removed, and replace them with pallet_aura::Authorities::<T>::get().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Muraca ! I'll remove definition from here and replace uses in other pallets.

@davxy davxy changed the title remove pallet::getter macro and write the corresponding code Pallet AURA: remove pallet::getter macro and write the corresponding code Feb 16, 2024
@franciscoaguirre franciscoaguirre added the R0-silent Changes should not be mentioned in any release notes label Feb 19, 2024
///
/// This function will be deprecated in future releases. It is recommended not to use it in new
/// developments.
pub fn authorities() -> BoundedVec<T::AuthorityId, T::MaxAuthorities> {
Copy link
Contributor

Choose a reason for hiding this comment

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

@k-gunjan I think Oliver meant that you should not introduce these new methods in this PR.
Instead, you should go around the other crates that call the getter functions you removed, and replace them with pallet_aura::Authorities::<T>::get().

Copy link
Contributor

@s0me0ne-unkn0wn s0me0ne-unkn0wn left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@k-gunjan k-gunjan force-pushed the gunjan-remove-getter-macro-pallet-aura-issue-3330 branch 3 times, most recently from 005d91f to 05ab1ae Compare March 6, 2024 04:12
@k-gunjan k-gunjan force-pushed the gunjan-remove-getter-macro-pallet-aura-issue-3330 branch from 9c1a94c to 9b59665 Compare March 6, 2024 10:15
@muraca
Copy link
Contributor

muraca commented Mar 8, 2024

As a breaking change, this requires the removal of the R0 label and a prdoc

substrate/frame/aura/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/aura/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/aura/src/lib.rs Outdated Show resolved Hide resolved
@bkchr bkchr enabled auto-merge March 18, 2024 10:04
@bkchr bkchr added this pull request to the merge queue Mar 18, 2024
Merged via the queue into paritytech:master with commit 816c072 Mar 18, 2024
130 of 132 checks passed
@k-gunjan k-gunjan deleted the gunjan-remove-getter-macro-pallet-aura-issue-3330 branch March 18, 2024 10:55
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Mar 24, 2024
…code (paritytech#3350)

Removed the `pallet::getter` macro call from storage type definitions
and added the corresponding implementations directly.
fixes paritytech#3330  

polkadot address: 14JzTPPUd8x8phKi8qLxHgNTnTMg6DUukCLXoWprejkaHXPz

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
@Morganamilo Morganamilo mentioned this pull request Apr 4, 2024
12 tasks
@k-gunjan
Copy link
Contributor Author

tip?

enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
- Update weights to reflect the new version.

Notable Changes:
- [System Callbacks](paritytech/polkadot-sdk#1781)
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1922
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
- Upgrade Polkadot-sdk to v.1.10.0.
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1928
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
- Upgrade Polkadot-sdk to v.1.10.0.
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1928
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 30, 2024
- Upgrade Polkadot-sdk to v.1.10.0.
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1928
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Jul 31, 2024
- Upgrade Polkadot-sdk to v.1.10.0.
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1928
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Aug 1, 2024
- Upgrade Polkadot-sdk to v.1.10.0.
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macr](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

issue-1928
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Aug 1, 2024
- Upgrade Polkadot-sdk 1.9.0 to 1.10.0
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter macro](paritytech/polkadot-sdk#3350)
- [Refactor APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)
- [Refactor Unified Host Functions](paritytech/polkadot-sdk#3854)
- [StorageWeightReclaim SignedExtension](https://github.com/paritytech/polkadot-sdk/pull/3002/files)

For more details, please refer to:

[Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)
enddynayn added a commit to frequency-chain/frequency that referenced this pull request Aug 1, 2024
- Upgrade Polkadot-sdk 1.9.0 to 1.10.0
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental
flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter
macro](paritytech/polkadot-sdk#3350)
- [Refactor
APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)
- [Refactor Unified Host
Functions](paritytech/polkadot-sdk#3854)
- [StorageWeightReclaim
SignedExtension](https://github.com/paritytech/polkadot-sdk/pull/3002/files)

For more details, please refer to:

[Release
Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

#1928

---------

Co-authored-by: enddynayn <enddynayn@users.noreply.github.com>
rustadot pushed a commit to rustadot/recurrency that referenced this pull request Sep 5, 2024
- Upgrade Polkadot-sdk 1.9.0 to 1.10.0
- Update weights to reflect the new version.

Notable Changes:
- [Remove experimental
flag](https://github.com/paritytech/polkadot-sdk/pull/3654/files)
- [Remove pallet::getter
macro](paritytech/polkadot-sdk#3350)
- [Refactor
APIs](https://github.com/paritytech/polkadot-sdk/pull/3817/files#diff-b02373af4015a8ebdf3a3f5be9ea0ce555b6e45331872e0465fd2f488177d383)
- [Refactor Unified Host
Functions](paritytech/polkadot-sdk#3854)
- [StorageWeightReclaim
SignedExtension](https://github.com/paritytech/polkadot-sdk/pull/3002/files)

For more details, please refer to:

[Release
Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.10.0)

#1928

---------

Co-authored-by: enddynayn <enddynayn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove pallet::getter usage from pallet-aura
7 participants