-
Notifications
You must be signed in to change notification settings - Fork 769
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
base: master
Are you sure you want to change the base?
Conversation
b059f67
to
4bc9edc
Compare
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( |
5c3ab3b
to
57585ac
Compare
50a8759
to
355615d
Compare
c3abd5b
to
e1a2699
Compare
4994d7e
to
47c9710
Compare
750f1bb
to
e0d4e7c
Compare
e0d4e7c
to
e37fe07
Compare
cumulus/parachains/runtimes/collectives/collectives-westend/src/fellowship/tracks.rs
Outdated
Show resolved
Hide resolved
cumulus/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/tracks.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plase check the CI output. It shows what is red, currently it does not seem to compile, so i cannot review if it is correct.
e37fe07
to
0fb1bb1
Compare
3083edb
to
ecbe227
Compare
use core::cmp::Ordering; | ||
// Adapted from Iterator::is_sorted implementation available in nightly | ||
// https://github.com/rust-lang/rust/issues/53485 | ||
let mut iter = Self::tracks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, we now have this twice...
pub trait IsSortedBy<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it's worth the duplication to not create some weird common dependency, let's hope it gets stabilized soon? 🤞🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay will let the next reviewer decide 😄
2e23b83
to
6a877dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Since the motivation for these changes is to provide an option for setting tracks within the storage, and as these changes are breaking changes, it would be nice to have such a setup as an example and proof of concept to ensure we're not missing anything. For example, you could try setting it up for the kitchensink-runtime
runtime with the parameters
pallet.
@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 |
@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.
ce4ec43
to
3503e9c
Compare
…anod/polkadot-sdk into olanod-referenda-owned-tracks
Returning an iterator in
TracksInfo::tracks()
instead of a static slice allows for more flexible implementations ofTracksInfo
that can use the chain storage without compromising a lot on the performance/memory penalty if we were to return an ownedVec
instead.