-
Notifications
You must be signed in to change notification settings - Fork 835
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
Include submitting origin in PollStatus #4961
base: master
Are you sure you want to change the base?
Include submitting origin in PollStatus #4961
Conversation
3a90bfd
to
8e23940
Compare
@@ -59,9 +59,12 @@ impl pallet_balances::Config for Test { | |||
type AccountStore = System; | |||
} | |||
|
|||
#[derive(Clone, Debug, PartialEq, Eq)] | |||
pub struct Who; |
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.
Why not make the type generic over AccountId
? This can later be T::AccountId
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.
The "who" is not relevant for conviction voting so in this tests I just added a simple struct as placeholder, this struct is not used in the actual implementation of Polling
in pallet referenda where it's set as the runtime origin. Perhaps I don't get your point on why Who
would need to accept a generic field or is it in the TestPollState
where you suggest the generic parameter? anyway let me know to clarify :)
None, | ||
Ongoing(Tally, Class), | ||
Ongoing(Tally, Class, Who), |
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 would call this origin
.
@@ -85,6 +85,7 @@ pub trait Polling<Tally> { | |||
type Index: Parameter + Member + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen; | |||
type Votes: Parameter + Member + Ord + PartialOrd + Copy + HasCompact + MaxEncodedLen; | |||
type Class: Parameter + Member + Ord + PartialOrd + MaxEncodedLen; | |||
type Who; |
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.
Same.
Also while there is not yet docs, we should start :D Maybe add a doc explaining this.
The CI pipeline was cancelled due to failure one of the required jobs. |
@olanod are you still interested in this or can we close it? |
4750e01
to
f6b26e4
Compare
f6b26e4
to
9a7c812
Compare
Sorry I forgot about the who->origin suggestion. It's still relevant! even more now that it seems iterable tracks will be merged and we won't need our own fork of the sdk :) |
9a7c812
to
f50beaa
Compare
Completed(Moment, bool), | ||
} | ||
|
||
impl<Tally, Moment, Class> PollStatus<Tally, Moment, Class> { | ||
pub fn ensure_ongoing(self) -> Option<(Tally, Class)> { | ||
impl<Tally, Moment, Class, Origin> PollStatus<Tally, Moment, Class, Origin> { |
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.
Actually thinking about this again, maybe we should introduce some DispatchablePollStatus: PollStatus
that only gives you the origin.
There can be polls that are not dispatchables and then you would not have an Origin
.
Adding a
Who
parameter to thePollStatus::Ongoing
variant is a simple change that provides more context to "pollsters" who might be interested in knowing what origin is going to execute a given call.