Skip to content

Commit

Permalink
feat(tx-payment): move transaction payment pallets off our substrate …
Browse files Browse the repository at this point in the history
…fork
  • Loading branch information
hussein-aitlahcen committed Jan 18, 2023
1 parent 69f1293 commit 7bcf4b9
Show file tree
Hide file tree
Showing 32 changed files with 4,159 additions and 65 deletions.
101 changes: 74 additions & 27 deletions code/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions code/integration-tests/local-integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ session = { package = "pallet-session", git = "https://github.com/paritytech/sub
smallvec = "1.6.1"
sudo = { package = "pallet-sudo", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
transaction-payment = { package = "pallet-transaction-payment", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
treasury = { package = "pallet-treasury", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
utility = { package = "pallet-utility", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }

Expand All @@ -72,11 +71,11 @@ liquidations = { package = "pallet-liquidations", path = "../../parachain/frame/
oracle = { package = "pallet-oracle", path = "../../parachain/frame/oracle", default-features = false }
primitives = { path = "../../parachain/runtime/primitives", default-features = false }
vault = { package = "pallet-vault", path = "../../parachain/frame/vault", default-features = false }

transaction-payment = { package = "pallet-transaction-payment", path = "../../parachain/frame/transaction-payment", default-features = false }

# Used for the node template's RPCs
system-rpc-runtime-api = { package = "frame-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
transaction-payment-rpc-runtime-api = { package = "pallet-transaction-payment-rpc-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" }
transaction-payment-rpc-runtime-api = { package = "pallet-transaction-payment-rpc-runtime-api", path = "../../parachain/frame/transaction-payment", default-features = false }

# Used for runtime benchmarking
benchmarking = { package = "frame-benchmarking", git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.30" }
Expand Down
52 changes: 52 additions & 0 deletions code/parachain/frame/transaction-payment/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[package]
name = "pallet-transaction-payment"
version = "4.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>", "Composable Developers"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "FRAME pallet to manage transaction payments"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
scale-info = { default-features = false, version = "2.1.1", features = [
"derive",
] }
serde = { version = "1.0.136", optional = true }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

[dev-dependencies]
serde_json = "1.0.85"
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

[features]
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"serde",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
]
try-runtime = ["frame-support/try-runtime"]

runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
16 changes: 16 additions & 0 deletions code/parachain/frame/transaction-payment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Transaction Payment Pallet

This pallet provides the basic logic needed to pay the absolute minimum amount needed for a
transaction to be included. This includes:
- _weight fee_: A fee proportional to amount of weight a transaction consumes.
- _length fee_: A fee proportional to the encoded length of the transaction.
- _tip_: An optional tip. Tip increases the priority of the transaction, giving it a higher
chance to be included by the transaction queue.

Additionally, this pallet allows one to configure:
- The mapping between one unit of weight to one unit of fee via [`Config::WeightToFee`].
- A means of updating the fee for the next block, via defining a multiplier, based on the
final state of the chain at the end of the previous block. This can be configured via
[`Config::FeeMultiplierUpdate`]

License: Apache-2.0
Loading

0 comments on commit 7bcf4b9

Please sign in to comment.