-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
It looks like @athei signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
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.
on the right track, but we need to reduce boilerplate
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 realised something:
I don't think it actually makes sense for dispatchInfo to be generic at the moment. Maybe we can make it generic, but currently it isn't.
otherwise, it doesn't even make sense for it to be generic as it is since it is kinda hard-coded in frame-support::dispatch. Your weight annotation must return weight
+ pays_fee
+ class
and then they get bundled into this type DispatchInfo
.
Yes, you can use any type to compute these 3, but they are fixed themselves. From this PoV I think this work needs to be refactored again.
I recommend merging this PR leniently just to unblock weight refund and I can make a follow up asap and my goal would be actually to either rethink the whole process or make it un-generic, as it used to be.
An alternative approach would be that I pass the |
Yes, I think @athei is fully aware of that, but it making it a fixed type would require moving
I think this PR looks good and is a bit nicer than current approach, so I think we should merge it as is (especially that it unlocks stuff). We can further change it in the future if needed. |
|
Ugh, yes. So it's now generic, since weight is |
Yes |
* Move DispatchInfo Associated type to Dispatchable * Bound Call: Dispatchable * Pass PostDispatchInfo to post_dispatch * Pass DispatchInfo by reference to avoid clones
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
dabb4d3
to
211334a
Compare
That would be nice. I think I addressed all raised concerns now. Praying to CI gods. |
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
I added the Polkadot companion and tested it against this PR locally. |
…adot#986 (paritytech#982) * Companion PR to paritytech#5560 * Set priorities. * Update substrate. * Fix tests. * Update Substrate * Companion of SignedExtension refactor (paritytech#5540) Co-authored-by: Tomasz Drwięga <tomasz@parity.io> Co-authored-by: Alexander Theißen <alexander.theissen@parity.io>
polkadot companion: paritytech/polkadot#979
This PR refactors the trait
SignedExtension
. The following changes where applied:Move the
DispatchInfo
associated type toDispatchable::Info
This information logically belongs to the
Dispatchable
. Not having it there requires consuming types to duplicate this as an associated type (SignedExtension, Applyable
).Bound
Call: Dispatchable
This is a requirement for the first change. Because the
DispatchInfo
type is now an associated type onDispatchable
.Pass
Dispatchable::PostInfo
toSignedExtension::post_dispatch
This is a followup of #5458 that passes this new information to the
SignedExtension
where it can then be used to accomplish weight refund (in a followup PR).Pass
Dispatchable::Info
by referenceThere was no apparent reason (or is there one?) for having
DispatchInfo
to be cloned into everySignedExtension
.