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

pallet_transaction_payment's TransactionByteFee is completely inflexible #10784

Closed
notlesh opened this issue Feb 2, 2022 · 4 comments
Closed
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@notlesh
Copy link
Contributor

notlesh commented Feb 2, 2022

pallet_transaction_payment provides only one input for scaling length fees, namely type TransactionByteFee: Get<BalanceOf<Self>>. In fee calculation, this value is used strictly as a multiplier on a transaction's length in bytes. The result is basically a compile-time constant modifier.

I believe this lacks the flexibility needed to create a fee structure that is both reasonably cheap for most txns and also expensive enough to prevent txn spam with large transactions (e.g. runtime upgrades).

In addition, this does not provide any mechanism for the cost of such a fee to respond to market pricing/demand, although this is potentially a distinct problem.

There are many ways this problem could be approached. I have introduced a small PR (#10785 ) which uses the same Vec<WeightToFeeCoefficient> mechanism used by the pallet's weight fee system. I include this mostly because I was able to solve the small-vs-large txn dilemma above using it, but I'm more interested in feedback about the issue.

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Feb 2, 2022
@ggwpez
Copy link
Member

ggwpez commented Feb 3, 2022

I generally like the idea of making it more flexible.
Having a polynomial here would introduce some additional arithmetic operations for each Extrinsic, which we would need to account for when calculating the weight.
What do you think? @shawntabrizi

@notlesh
Copy link
Contributor Author

notlesh commented Feb 3, 2022

...would introduce some additional arithmetic operations for each Extrinsic...

Yes, this approach would probably raise the inclusion fee slightly.

Another approach would be to create a callback for the runtime to do the entire calculation, passing the length and requiring an adjusted fee to be returned. This would be even more flexible and could be reduced to a cheap operation when needed.

@shawntabrizi
Copy link
Member

@notlesh in general your PR looks fine to me.

I think an even more generic callback function could be okay, but note that this also risks users implementing something too complex, where fee calculation must really be super simple logic, as to not take too much resources.

If someone starts to implement storage lookups, this can be really damaging for the chain. In those cases, I think we are better off gatekeeping the API, unless otherwise needed.

@notlesh
Copy link
Contributor Author

notlesh commented Aug 29, 2022

Closing this as #10785 was merged some time ago.

@notlesh notlesh closed this as completed Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
Development

No branches or pull requests

3 participants