Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

PaysFee for DispatchInfo #4165

Merged
merged 10 commits into from
Nov 25, 2019
Merged

Conversation

xlc
Copy link
Contributor

@xlc xlc commented Nov 21, 2019

This allow more flexible fee logic such as adjust fee based on DispatchClass.

I want to have operational transactions have weight but no fees.

@kianenigma kianenigma self-requested a review November 21, 2019 09:16
@kianenigma
Copy link
Contributor

I want to have operational transactions have weight but no fees.

Fair and indeed a problem right now that we should fix.

I will think a bit about this and maybe and see if I can come up with a more general way of expressing fee logic in #[weight] without making it too complicated. Ideally, I want to get rid of a horrible function pay_len_fee() which is total crap as well. But this PR also seems like a good start. Thanks :)

@kianenigma kianenigma added the A0-please_review Pull request needs code review. label Nov 21, 2019
@kianenigma
Copy link
Contributor

Needs further test fixing as well.

@kianenigma
Copy link
Contributor

@xlc how about this:

  • get rid of pay_length_fee().
  • A third trait that all weight representatives must implement named Trait PaysFee { fn pays_fee() -> bool { true; } } + a blanket impl for all structs that have the other two traits (WeighData, ClassifyDispatch).
  • new filed in DispatchInfo named pays_fee: bool which is being set by dispatch.rs.

Then, whoever calls get_dispatch_info() know this and it can be expressed in the #[weight] tag. SimpleDispatchInfo does not show it atm but we can readily make it possible.

@xlc xlc force-pushed the convert-weight branch 2 times, most recently from afbcc1b to 04c4386 Compare November 22, 2019 10:14
@xlc xlc changed the title Pass DispatchInfo to WeightToFee PaysFee for DispatchInfo Nov 22, 2019
xlc and others added 2 commits November 23, 2019 00:05
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
@gavofyork gavofyork requested a review from kianenigma November 22, 2019 12:34
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a minor not here and there and then good to go. As mentioned, it won't be the end of the deal and I want to retire SimpleDispatchInfo soon, which will happen in follow ups.

The only logical difference of this PR is that a weighted operational transaction (we don't have that many of these actually, most FreeOperational) now pay the length fee as well.

@kianenigma kianenigma added A7-looksgoodtestsfail and removed A0-please_review Pull request needs code review. labels Nov 22, 2019
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
@kianenigma kianenigma merged commit 1078691 into paritytech:master Nov 25, 2019
@xlc xlc deleted the convert-weight branch November 25, 2019 07:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants