-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
I prefer making it simple, so something like |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Yep updated it to use |
Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b4. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
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.
This looks good to me, just a few nits / comments
Co-authored-by: Sam Johnson <sam@durosoft.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
bot rebase |
Rebased |
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
bot merge |
* First approach on pallet::call_weight Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use attr on pallet::call instead Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ui tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename to weight(prefix = ...)) Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify to #[pallet::call(weight(T))] Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add stray token error Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Try to add some docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Migrate remaining pallets" Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b4. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Renames Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Co-authored-by: Sam Johnson <sam@durosoft.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update UI tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/pallet/parse/mod.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Remove old code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
* First approach on pallet::call_weight Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use attr on pallet::call instead Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ui tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename to weight(prefix = ...)) Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify to #[pallet::call(weight(T))] Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add stray token error Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Try to add some docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Migrate remaining pallets" Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b4. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Renames Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Co-authored-by: Sam Johnson <sam@durosoft.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update UI tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/pallet/parse/mod.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Remove old code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
There was a request to create a less repetitive syntax in the case that calls use the
WeightInfo
trait to calculate their weight.This MR adds an attribute to the
#[pallet::call]
macro in the form of#[pallet::call(weight($type))]
.$type
will then be prepended to the call name to generate a#[pallet::weight]
attribute for each call that does not explicitly annotate one. Alternatively a=
token can be used like#[pallet::call(weight = …)]
.It is not restricted to use
<T as Config>::WeightInfo
and could use other types as well (although not advised).The pallets
Alliance
,Assets
,Balances
andexample-basic
are updated to demonstrate the effect.Old Syntax
With the
pallet::weight
annotation above each call.New Syntax
Intended usage together with a
WeightInfo
trait. AConfig<I>
can be used for instanced pallets.It is possible to override the inherited value per call:
... or using something else entirely (for whatever reason):
Dev Mode
The inherited weight has precedence over the default weight (=zero).
Follow-ups
TODOs