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

Migrate pallet-transaction-payment to new pallet attribute macro #9087

Merged
9 commits merged into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl pallet_contracts::Config for Runtime {
type RentFraction = RentFraction;
type SurchargeReward = SurchargeReward;
type CallStack = [pallet_contracts::Frame<Self>; 31];
type WeightPrice = pallet_transaction_payment::Module<Self>;
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
type ChainExtension = ();
type DeletionQueueDepth = DeletionQueueDepth;
Expand Down
6 changes: 4 additions & 2 deletions frame/balances/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ macro_rules! decl_tests {
use crate::*;
use sp_runtime::{ArithmeticError, FixedPointNumber, traits::{SignedExtension, BadOrigin}};
use frame_support::{
assert_noop, assert_storage_noop, assert_ok, assert_err, StorageValue,
assert_noop, assert_storage_noop, assert_ok, assert_err,
traits::{
LockableCurrency, LockIdentifier, WithdrawReasons,
Currency, ReservableCurrency, ExistenceRequirement::AllowDeath
Expand Down Expand Up @@ -148,7 +148,9 @@ macro_rules! decl_tests {
.monied(true)
.build()
.execute_with(|| {
pallet_transaction_payment::NextFeeMultiplier::put(Multiplier::saturating_from_integer(1));
pallet_transaction_payment::NextFeeMultiplier::<$test>::put(
Multiplier::saturating_from_integer(1)
);
Balances::set_lock(ID_1, &1, 10, WithdrawReasons::RESERVE);
assert_noop!(
<Balances as Currency<_>>::transfer(&1, &2, 1, AllowDeath),
Expand Down
1 change: 1 addition & 0 deletions frame/balances/src/tests_composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ frame_support::construct_runtime!(
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
}
);

Expand Down
1 change: 1 addition & 0 deletions frame/balances/src/tests_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ frame_support::construct_runtime!(
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
}
);

Expand Down
3 changes: 2 additions & 1 deletion frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ mod tests {
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
Custom: custom::{Pallet, Call, ValidateUnsigned, Inherent},
}
);
Expand Down Expand Up @@ -835,7 +836,7 @@ mod tests {
header: Header {
parent_hash: [69u8; 32].into(),
number: 1,
state_root: hex!("ec6bb58b0e4bc7fdf0151a0f601eb825f529fbf90b5be5b2024deba30c5cbbcb").into(),
state_root: hex!("1039e1a4bd0cf5deefe65f313577e70169c41c7773d6acf31ca8d671397559f5").into(),
extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(),
digest: Digest { logs: vec![], },
},
Expand Down
18 changes: 10 additions & 8 deletions frame/transaction-payment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,31 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true }
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }
smallvec = "1.4.1"

sp-core = { version = "3.0.0", path = "../../primitives/core", default-features = false }
sp-io = { version = "3.0.0", path = "../../primitives/io", default-features = false }
sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }

frame-support = { version = "3.0.0", default-features = false, path = "../support" }
frame-system = { version = "3.0.0", default-features = false, path = "../system" }
smallvec = "1.4.1"
sp-io = { version = "3.0.0", path = "../../primitives/io", default-features = false }
sp-core = { version = "3.0.0", path = "../../primitives/core", default-features = false }

[dev-dependencies]
serde_json = "1.0.41"
pallet-balances = { version = "3.0.0", path = "../balances" }
sp-storage = { version = "3.0.0", path = "../../primitives/storage" }
pallet-balances = { version = "3.0.0", path = "../balances" }

[features]
default = ["std"]
std = [
"serde",
"codec/std",
"sp-std/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"frame-support/std",
"frame-system/std",
"sp-io/std",
"sp-core/std",
]
try-runtime = ["frame-support/try-runtime"]
8 changes: 4 additions & 4 deletions frame/transaction-payment/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Transaction Payment Module
# Transaction Payment Pallet

This module provides the basic logic needed to pay the absolute minimum amount needed for a
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 module allows one to configure:
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
License: Apache-2.0
7 changes: 4 additions & 3 deletions frame/transaction-payment/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"
description = "RPC interface for the transaction payment module."
description = "RPC interface for the transaction payment pallet."
readme = "README.md"

[package.metadata.docs.rs]
Expand All @@ -17,9 +17,10 @@ codec = { package = "parity-scale-codec", version = "2.0.0" }
jsonrpc-core = "15.1.0"
jsonrpc-core-client = "15.1.0"
jsonrpc-derive = "15.1.0"

sp-api = { version = "3.0.0", path = "../../../primitives/api" }
sp-blockchain = { version = "3.0.0", path = "../../../primitives/blockchain" }
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
sp-rpc = { version = "3.0.0", path = "../../../primitives/rpc" }
sp-runtime = { version = "3.0.0", path = "../../../primitives/runtime" }
sp-api = { version = "3.0.0", path = "../../../primitives/api" }
sp-blockchain = { version = "3.0.0", path = "../../../primitives/blockchain" }
pallet-transaction-payment-rpc-runtime-api = { version = "3.0.0", path = "./runtime-api" }
4 changes: 2 additions & 2 deletions frame/transaction-payment/rpc/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RPC interface for the transaction payment module.
RPC interface for the transaction payment pallet.

License: Apache-2.0
License: Apache-2.0
4 changes: 2 additions & 2 deletions frame/transaction-payment/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
sp-api = { version = "3.0.0", default-features = false, path = "../../../../primitives/api" }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
sp-api = { version = "3.0.0", default-features = false, path = "../../../../primitives/api" }
sp-runtime = { version = "3.0.0", default-features = false, path = "../../../../primitives/runtime" }
pallet-transaction-payment = { version = "3.0.0", default-features = false, path = "../../../transaction-payment" }

[features]
default = ["std"]
std = [
"sp-api/std",
"codec/std",
"sp-api/std",
"sp-runtime/std",
"pallet-transaction-payment/std",
]
4 changes: 2 additions & 2 deletions frame/transaction-payment/rpc/runtime-api/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Runtime API definition for transaction payment module.
Runtime API definition for transaction payment pallet.

License: Apache-2.0
License: Apache-2.0
2 changes: 1 addition & 1 deletion frame/transaction-payment/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Runtime API definition for transaction payment module.
//! Runtime API definition for transaction payment pallet.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
2 changes: 1 addition & 1 deletion frame/transaction-payment/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! RPC interface for the transaction payment module.
//! RPC interface for the transaction payment pallet.

use std::sync::Arc;
use std::convert::TryInto;
Expand Down
Loading