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

Change pallet referenda TracksInfo::tracks to return an iterator #2072

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

Conversation

olanod
Copy link
Contributor

@olanod olanod commented Oct 28, 2023

Returning an iterator in TracksInfo::tracks() instead of a static slice allows for more flexible implementations of TracksInfo that can use the chain storage without compromising a lot on the performance/memory penalty if we were to return an owned Vec instead.

@olanod olanod requested review from a team October 28, 2023 14:35
substrate/frame/referenda/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/referenda/src/types.rs Outdated Show resolved Hide resolved
@paritytech-ci paritytech-ci requested a review from a team October 28, 2023 17:01
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch from b059f67 to 4bc9edc Compare October 30, 2023 09:49
@olanod
Copy link
Contributor Author

olanod commented Oct 30, 2023

NOTE: I realized that return_position_impl_trait_in_trait was recently stabilized, I think it's worth using it in this feature as it makes usage of the trait much simpler. Please consider updating the rust toolchain :)

EDIT: As the policy is to keep things working with stable Rust, I reverted the usage of the nightly feature(fn tracks() -> impl Iterator<_>).

@olanod olanod force-pushed the olanod-referenda-owned-tracks branch from 5c3ab3b to 57585ac Compare November 9, 2023 10:11
@paritytech-review-bot paritytech-review-bot bot requested a review from a team November 9, 2023 10:12
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch 3 times, most recently from 50a8759 to 355615d Compare November 9, 2023 13:48
@olanod olanod requested a review from bkchr November 9, 2023 13:50
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch 3 times, most recently from c3abd5b to e1a2699 Compare November 10, 2023 17:23
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch 4 times, most recently from 4994d7e to 47c9710 Compare November 15, 2023 19:05
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch 2 times, most recently from 750f1bb to e0d4e7c Compare November 20, 2023 08:39
@olanod olanod force-pushed the olanod-referenda-owned-tracks branch from e0d4e7c to e37fe07 Compare February 20, 2024 15:58
@olanod olanod requested a review from a team as a code owner February 20, 2024 15:58
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Mar 26, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Mar 27, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
serban300 added a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
bkchr pushed a commit that referenced this pull request Apr 10, 2024
@olanod
Copy link
Contributor Author

olanod commented Apr 12, 2024

@muharem the feature is working, this week we released pallet-communities in Kreivo which allows DAOs to make use of the pallet-referenda infrastructure and set-up/configure their own tracks dynamically with pallet-referenda-tracks implemented by @pandres95

@muharem
Copy link
Contributor

muharem commented Apr 18, 2024

@olanod to have a setup example would be still good

Using an iterator instead of a static slice allows for more flexible
implementations of `TracksInfo` that can use the chain storage without
compromising a lot on the performance/memory penalty if we were to return
an owned `Vec` instead.
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.

5 participants