Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
dd7216af
Commit
dd7216af
authored
4 years ago
by
joe petrowski
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
clarify docs on query_info and partial_fee (#6090)
parent
6ae0de57
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs
+3
-3
3 additions, 3 deletions
...rate/frame/transaction-payment/rpc/runtime-api/src/lib.rs
substrate/frame/transaction-payment/src/lib.rs
+19
-11
19 additions, 11 deletions
substrate/frame/transaction-payment/src/lib.rs
with
22 additions
and
14 deletions
substrate/frame/transaction-payment/rpc/runtime-api/src/lib.rs
+
3
−
3
View file @
dd7216af
...
...
@@ -26,7 +26,7 @@ use codec::{Encode, Codec, Decode};
use
serde
::{
Serialize
,
Deserialize
,
Serializer
,
Deserializer
};
use
sp_runtime
::
traits
::{
MaybeDisplay
,
MaybeFromStr
};
///
Some i
nformation related to a dispatchable that can be queried from the runtime.
///
I
nformation related to a dispatchable
's class, weight, and fee
that can be queried from the runtime.
#[derive(Eq,
PartialEq,
Encode,
Decode,
Default)]
#[cfg_attr(feature
=
"std"
,
derive(Debug,
Serialize,
Deserialize))]
#[cfg_attr(feature
=
"std"
,
serde(rename_all
=
"camelCase"
))]
...
...
@@ -35,8 +35,8 @@ pub struct RuntimeDispatchInfo<Balance> {
pub
weight
:
Weight
,
/// Class of this dispatch.
pub
class
:
DispatchClass
,
/// The
partial
inclusion fee of this dispatch. This does not include tip or anything else
which
///
is
depend
ent
on the signature (
aka
. depends on a `SignedExtension`).
/// The inclusion fee of this dispatch. This does not include
a
tip or anything else
that
/// depend
s
on the signature (
i.e
. depends on a `SignedExtension`).
#[cfg_attr(feature
=
"std"
,
serde(bound(serialize
=
"Balance: std::fmt::Display"
)))]
#[cfg_attr(feature
=
"std"
,
serde(serialize_with
=
"serialize_as_string"
))]
#[cfg_attr(feature
=
"std"
,
serde(bound(deserialize
=
"Balance: std::str::FromStr"
)))]
...
...
This diff is collapsed.
Click to expand it.
substrate/frame/transaction-payment/src/lib.rs
+
19
−
11
View file @
dd7216af
...
...
@@ -107,8 +107,9 @@ decl_module! {
impl
<
T
:
Trait
>
Module
<
T
>
{
/// Query the data that we know about the fee of a given `call`.
///
/// As this module is not and cannot be aware of the internals of a signed extension, it only
/// interprets them as some encoded value and takes their length into account.
/// This module is not and cannot be aware of the internals of a signed extension, for example
/// a tip. It only interprets the extrinsic as some encoded value and accounts for its weight
/// and length, the runtime's extrinsic base weight, and the current fee multiplier.
///
/// All dispatchables must be annotated with weight and will have some fee info. This function
/// always returns.
...
...
@@ -137,17 +138,24 @@ impl<T: Trait> Module<T> {
/// Compute the final fee value for a particular transaction.
///
/// The final fee is composed of:
/// - _base_fee_: This is the minimum amount a user pays for a transaction.
/// - _len_fee_: This is the amount paid merely to pay for size of the transaction.
/// - _weight_fee_: This amount is computed based on the weight of the transaction. Unlike
/// size-fee, this is not input dependent and reflects the _complexity_ of the execution
/// and the time it consumes.
/// - _targeted_fee_adjustment_: This is a multiplier that can tune the final fee based on
/// - `base_fee`: This is the minimum amount a user pays for a transaction. It is declared
/// as a base _weight_ in the runtime and converted to a fee using `WeightToFee`.
/// - `len_fee`: The length fee, the amount paid for the encoded length (in bytes) of the
/// transaction.
/// - `weight_fee`: This amount is computed based on the weight of the transaction. Weight
/// accounts for the execution time of a transaction.
/// - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on
/// the congestion of the network.
/// - (
o
ptional)
_
tip
_
:
i
f included in the transaction,
i
t will be added on top. Only
signed
/// transactions can have a tip.
/// - (
O
ptional)
`
tip
`
:
I
f included in the transaction, t
he tip
will be added on top. Only
///
signed
transactions can have a tip.
///
/// final_fee = base_fee + targeted_fee_adjustment(len_fee + weight_fee) + tip;
/// The base fee and adjusted weight and length fees constitute the _inclusion fee,_ which is
/// the minimum fee for a transaction to be included in a block.
///
/// ```ignore
/// inclusion_fee = base_fee + targeted_fee_adjustment * (len_fee + weight_fee);
/// final_fee = inclusion_fee + tip;
/// ```
pub
fn
compute_fee
(
len
:
u32
,
info
:
&
DispatchInfoOf
<
T
::
Call
>
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment