-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conversation
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.
Yup, this is a good addition to refund weight.
Actually I think there is a bit more handling needed here.
We probably should not be doing a weight refund returning an |
Why? In case of Do you also agree with the other change (crediting the |
My only thought is that we don't support refunds when extrinsics error, and generally that provides an even larger negative incentive for people to submit any transactions which may potentially error. You can think of the larger the potential fee, the more someone will be careful about sending a message which succeeds. Ideally, the blockchain is only consistent of successful transactions, but instead, we must store bad ones too since we need to charge a fee for that. Anyway, practically speaking, you are right though, the weight returned here should be safe. |
* Make `pallet_xcm::execute` supply the proper weight credit * Use weight correction Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
The
max_weight
argument is listed in the weight annotation and therefore the weight is already paid by including the extrinsic due to weight fee collection. Therefore we should credit it here.We should also use weight correction here. I only use it in case we actually do the xcm execution. One could also use it in case we error out before reaching this point. This would add more complexity to the function. Not sure if worth.
I would need to add some additional tests if we consider merging this. Just wanted to make sure that my assumptions about this functions are correct before investing more work.