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

bring back fees module #2910

@peektism

Description

@peektism

There once was a fees module, but it was removed -- see #1993 for more details. I agree with the Gav's comment in which he mentioned that, because Substrate is not a fixed-function state-transition, transaction fees are not so clearly defined:

Substrate is not designed to provide fees to the block author and in some consensus methods, there may not even be a singular identifiable "block author". Some chains may choose to burn fees, others may pass them to one or more entities involved in block authorship, others (like Polkadot) may do a combination. Some more complex modules in Substrate may reserve "fees" and return them (or not) in the same block or some number of blocks later. None of this fits trivially and absolutely into a traditional definition of "transaction fees". src

I understand that #2048 introduces new types to handle situations in which currency must be minted or burned, but I don't think this renders a fees module completely useless. For Kusama, we have been using a Weight type to calculate transaction fees according to this research. If we really want Substrate to be generic, we ought to consider creating a separate module for managing fees instead of coding the Polkadot preferences as defaults into node/runtime and sr-primitives/weights.rs.

Not sure exactly how to do this yet, but we might consider the following:

  • Transaction Weight and something to convert between weight and fees => see Transaction Fee Multiplier #2854
  • include the types that depend on the Imbalance type (TransactionPayment, TransferPayment, DustRemoval) to fix this hack
  • OnFeeCharged for defining default behavior that occurs after a fee is charged (but first see here)
  • worth checking out the old fees module, git reset --hard 45824913c980bb1ba3963f9bba67775a507d8624 works for that purpose and git reset --hard HEAD gets you back to head of master
  • maybe include a collateral management system like Balance

cc @kianenigma @xlc @joepetrowski

Metadata

Metadata

Assignees

No one assigned

    Labels

    I7-refactorCode needs refactoring.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions