mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-21 23:47:56 +00:00
30930edda5
* Add zombienet config to release (#158) * Cleanup docs for the release (#160) * Updated documentation to version 1.7.0 * Updated broken links * updated docs to v1.10 (#166) * updated dependencies to v1.10.0 (#165) * Fixed weights for non-XCM related pallets (#149) * add remove proxies to filter (#146) * Fix weights for XCM and Message Queue. (#153) * Fix for PriceForSiblingDelivery (#156) * Fix the FeeManager setting (#159) * better explanation for constants (#167) * better explanation for constants * Removed polkadot launch (#169) * Removed warnings about experimental code. (#170) * Attached audit. * toml sort * changelog and version bump (#174) * changelog and version bump * cargo fmt fix --------- Co-authored-by: Nikita Khateev <nikita.khateev@openzeppelin.com> Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
57 lines
3.1 KiB
Plaintext
57 lines
3.1 KiB
Plaintext
:source-highlighter: highlight.js
|
|
:highlightjs-languages: rust
|
|
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
|
|
|
|
= pallet_transaction_payment
|
|
|
|
Branch/Release: `release-polkadot-v1.10.0`
|
|
|
|
== Source Code link:https://github.com/paritytech/polkadot-sdk/blob/release-polkadot-v1.10.0/substrate/frame/transaction-payment/src/lib.rs[{github-icon},role=heading-link]
|
|
|
|
== Purpose
|
|
|
|
`pallet-transaction-payment` implements transaction fee logic.
|
|
|
|
In substrate, every transaction has an associated `call`, and each `call` has its own xref:glossary.adoc#weight[weight] function. The weight function estimates the time it takes to execute the `call`.
|
|
|
|
`Config::WeightToFee` is a mapping between the smallest unit of compute (*Weight*) and smallest unit of fee.
|
|
|
|
This pallet also exposes
|
|
- how to update fees for the next block based on past fees (`Config::FeeMultiplierUpdate`)
|
|
- how fees are paid (`Config::OnChargeTransaction`)
|
|
|
|
The base fee and adjusted xref:glossary.adoc#weight_fee[weight] and xref:glossary.adoc#length_fee[length] fees constitute the _inclusion fee_, which is the minimum fee for a transaction to be included in a block. The formula of final fee:
|
|
```rust, ignore
|
|
inclusion_fee = base_fee + length_fee + [fee_multiplier_update * weight_fee];
|
|
final_fee = inclusion_fee + tip;
|
|
```
|
|
The inputs are defined below in the glossary and config sections.
|
|
|
|
== Config
|
|
|
|
* Pallet-specific handlers:
|
|
** `OnChargeTransaction` -- Handler for withdrawing, refunding and depositing the transaction fee. Type must implement the trait `OnChargeTransaction<Self>`.
|
|
** `FeeMultiplierUpdate` -- Handler to define how base fees change over time (over blocks). Type must implement the trait `MultiplierUpdate`. Possible assignments include `ConstantFee`, `SlowAdjustingFee`, and `FastAdjustingFee`.
|
|
* Pallet-specific converters:
|
|
** `WeightToFee` -- Mapping between the smallest unit of weight and smallest unit of fee. Type must implement the trait `WeightToFee<Balance = BalanceOf<Self>>`.
|
|
** `LengthToFee` -- Convert a length value into a deductible fee based on the currency type. Type must implement the trait `WeightToFee<Balance = BalanceOf<Self>>`.
|
|
* Pallet-specific constants:
|
|
** `OperationalFeeMultiplier` -- A fee mulitiplier for `Operational` extrinsics to compute "virtual tip" to boost their `priority`. Type must implement the trait `Get<u32>`.
|
|
* Common configs:
|
|
** `RuntimeEvent`
|
|
|
|
== Dispatchables
|
|
|
|
There are no dispatchables (and no errors) in this pallet. This pallet is only intended to configure the transaction fee logic for a chain.
|
|
|
|
**Events:**
|
|
|
|
* `TransactionFeePaid(who, actual_fee, tip)` -- a transaction fee was paid by account `who` with total amount of `actual_fee + tip`.
|
|
|
|
== More Reading
|
|
|
|
** https://www.shawntabrizi.com/blog/substrate/substrate-weight-and-fees/[Substrate Weight & Fees] by Shawn Tabrizi
|
|
* https://docs.substrate.io/build/tx-weights-fees/[Substrate Docs: Transaction Weight & Fees]
|
|
** https://docs.substrate.io/reference/how-to-guides/weights/calculate-fees/#:~:text=Weight%20fee%20%2D%20A%20fee%20calculated,change%20as%20the%20chain%20progresses[Substrate Docs: How to Calculate Fees]
|
|
|