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

Commit df50122

Browse files
koushirogui1117KiChjang
authored
Migrate pallet-transaction-payment to new pallet attribute macro (#9087)
* Migrate pallet-transaciont-payment to new pallet attribute macro Signed-off-by: koushiro <[email protected]> * remove generic from genesis config * fix test * fix tests * fix deprecated * fix tests Signed-off-by: koushiro <[email protected]> Co-authored-by: thiolliere <[email protected]> Co-authored-by: Keith Yeung <[email protected]>
1 parent bab9dec commit df50122

File tree

16 files changed

+185
-128
lines changed

16 files changed

+185
-128
lines changed

bin/node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ impl pallet_contracts::Config for Runtime {
821821
type RentFraction = RentFraction;
822822
type SurchargeReward = SurchargeReward;
823823
type CallStack = [pallet_contracts::Frame<Self>; 31];
824-
type WeightPrice = pallet_transaction_payment::Module<Self>;
824+
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
825825
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
826826
type ChainExtension = ();
827827
type DeletionQueueDepth = DeletionQueueDepth;

frame/balances/src/tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ macro_rules! decl_tests {
2626
use crate::*;
2727
use sp_runtime::{ArithmeticError, FixedPointNumber, traits::{SignedExtension, BadOrigin}};
2828
use frame_support::{
29-
assert_noop, assert_storage_noop, assert_ok, assert_err, StorageValue,
29+
assert_noop, assert_storage_noop, assert_ok, assert_err,
3030
traits::{
3131
LockableCurrency, LockIdentifier, WithdrawReasons,
3232
Currency, ReservableCurrency, ExistenceRequirement::AllowDeath
@@ -148,7 +148,9 @@ macro_rules! decl_tests {
148148
.monied(true)
149149
.build()
150150
.execute_with(|| {
151-
pallet_transaction_payment::NextFeeMultiplier::put(Multiplier::saturating_from_integer(1));
151+
pallet_transaction_payment::NextFeeMultiplier::<$test>::put(
152+
Multiplier::saturating_from_integer(1)
153+
);
152154
Balances::set_lock(ID_1, &1, 10, WithdrawReasons::RESERVE);
153155
assert_noop!(
154156
<Balances as Currency<_>>::transfer(&1, &2, 1, AllowDeath),

frame/balances/src/tests_composite.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ frame_support::construct_runtime!(
4343
{
4444
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
4545
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
46+
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
4647
}
4748
);
4849

frame/balances/src/tests_local.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ frame_support::construct_runtime!(
4545
{
4646
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
4747
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
48+
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
4849
}
4950
);
5051

frame/executive/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ mod tests {
667667
{
668668
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
669669
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
670+
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
670671
Custom: custom::{Pallet, Call, ValidateUnsigned, Inherent},
671672
}
672673
);
@@ -835,7 +836,7 @@ mod tests {
835836
header: Header {
836837
parent_hash: [69u8; 32].into(),
837838
number: 1,
838-
state_root: hex!("ec6bb58b0e4bc7fdf0151a0f601eb825f529fbf90b5be5b2024deba30c5cbbcb").into(),
839+
state_root: hex!("1039e1a4bd0cf5deefe65f313577e70169c41c7773d6acf31ca8d671397559f5").into(),
839840
extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(),
840841
digest: Digest { logs: vec![], },
841842
},

frame/transaction-payment/Cargo.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,31 @@ targets = ["x86_64-unknown-linux-gnu"]
1515
[dependencies]
1616
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
1717
serde = { version = "1.0.101", optional = true }
18-
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }
18+
smallvec = "1.4.1"
19+
20+
sp-core = { version = "3.0.0", path = "../../primitives/core", default-features = false }
21+
sp-io = { version = "3.0.0", path = "../../primitives/io", default-features = false }
1922
sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" }
23+
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }
24+
2025
frame-support = { version = "3.0.0", default-features = false, path = "../support" }
2126
frame-system = { version = "3.0.0", default-features = false, path = "../system" }
22-
smallvec = "1.4.1"
23-
sp-io = { version = "3.0.0", path = "../../primitives/io", default-features = false }
24-
sp-core = { version = "3.0.0", path = "../../primitives/core", default-features = false }
2527

2628
[dev-dependencies]
2729
serde_json = "1.0.41"
28-
pallet-balances = { version = "3.0.0", path = "../balances" }
2930
sp-storage = { version = "3.0.0", path = "../../primitives/storage" }
31+
pallet-balances = { version = "3.0.0", path = "../balances" }
3032

3133
[features]
3234
default = ["std"]
3335
std = [
3436
"serde",
3537
"codec/std",
36-
"sp-std/std",
38+
"sp-core/std",
39+
"sp-io/std",
3740
"sp-runtime/std",
41+
"sp-std/std",
3842
"frame-support/std",
3943
"frame-system/std",
40-
"sp-io/std",
41-
"sp-core/std",
4244
]
4345
try-runtime = ["frame-support/try-runtime"]

frame/transaction-payment/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Transaction Payment Module
1+
# Transaction Payment Pallet
22

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

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

16-
License: Apache-2.0
16+
License: Apache-2.0

frame/transaction-payment/rpc/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
license = "Apache-2.0"
77
homepage = "https://substrate.dev"
88
repository = "https://github.com/paritytech/substrate/"
9-
description = "RPC interface for the transaction payment module."
9+
description = "RPC interface for the transaction payment pallet."
1010
readme = "README.md"
1111

1212
[package.metadata.docs.rs]
@@ -17,9 +17,10 @@ codec = { package = "parity-scale-codec", version = "2.0.0" }
1717
jsonrpc-core = "15.1.0"
1818
jsonrpc-core-client = "15.1.0"
1919
jsonrpc-derive = "15.1.0"
20+
21+
sp-api = { version = "3.0.0", path = "../../../primitives/api" }
22+
sp-blockchain = { version = "3.0.0", path = "../../../primitives/blockchain" }
2023
sp-core = { version = "3.0.0", path = "../../../primitives/core" }
2124
sp-rpc = { version = "3.0.0", path = "../../../primitives/rpc" }
2225
sp-runtime = { version = "3.0.0", path = "../../../primitives/runtime" }
23-
sp-api = { version = "3.0.0", path = "../../../primitives/api" }
24-
sp-blockchain = { version = "3.0.0", path = "../../../primitives/blockchain" }
2526
pallet-transaction-payment-rpc-runtime-api = { version = "3.0.0", path = "./runtime-api" }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
RPC interface for the transaction payment module.
1+
RPC interface for the transaction payment pallet.
22

3-
License: Apache-2.0
3+
License: Apache-2.0

frame/transaction-payment/rpc/runtime-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ readme = "README.md"
1313
targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[dependencies]
16-
sp-api = { version = "3.0.0", default-features = false, path = "../../../../primitives/api" }
1716
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
17+
sp-api = { version = "3.0.0", default-features = false, path = "../../../../primitives/api" }
1818
sp-runtime = { version = "3.0.0", default-features = false, path = "../../../../primitives/runtime" }
1919
pallet-transaction-payment = { version = "3.0.0", default-features = false, path = "../../../transaction-payment" }
2020

2121
[features]
2222
default = ["std"]
2323
std = [
24-
"sp-api/std",
2524
"codec/std",
25+
"sp-api/std",
2626
"sp-runtime/std",
2727
"pallet-transaction-payment/std",
2828
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Runtime API definition for transaction payment module.
1+
Runtime API definition for transaction payment pallet.
22

3-
License: Apache-2.0
3+
License: Apache-2.0

frame/transaction-payment/rpc/runtime-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
//! Runtime API definition for transaction payment module.
18+
//! Runtime API definition for transaction payment pallet.
1919
2020
#![cfg_attr(not(feature = "std"), no_std)]
2121

frame/transaction-payment/rpc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
//! RPC interface for the transaction payment module.
18+
//! RPC interface for the transaction payment pallet.
1919
2020
use std::sync::Arc;
2121
use std::convert::TryInto;

0 commit comments

Comments
 (0)