Skip to content

Commit d14b3b9

Browse files
gavofyorkgupnikgeorgepisaltuchevdorbkchr
authored
FRAME: Create TransactionExtension as a replacement for SignedExtension (paritytech#2280)
Closes paritytech#2160 First part of [Extrinsic Horizon](paritytech#2415) Introduces a new trait `TransactionExtension` to replace `SignedExtension`. Introduce the idea of transactions which obey the runtime's extensions and have according Extension data (né Extra data) yet do not have hard-coded signatures. Deprecate the terminology of "Unsigned" when used for transactions/extrinsics owing to there now being "proper" unsigned transactions which obey the extension framework and "old-style" unsigned which do not. Instead we have __*General*__ for the former and __*Bare*__ for the latter. (Ultimately, the latter will be phased out as a type of transaction, and Bare will only be used for Inherents.) Types of extrinsic are now therefore: - Bare (no hardcoded signature, no Extra data; used to be known as "Unsigned") - Bare transactions (deprecated): Gossiped, validated with `ValidateUnsigned` (deprecated) and the `_bare_compat` bits of `TransactionExtension` (deprecated). - Inherents: Not gossiped, validated with `ProvideInherent`. - Extended (Extra data): Gossiped, validated via `TransactionExtension`. - Signed transactions (with a hardcoded signature). - General transactions (without a hardcoded signature). `TransactionExtension` differs from `SignedExtension` because: - A signature on the underlying transaction may validly not be present. - It may alter the origin during validation. - `pre_dispatch` is renamed to `prepare` and need not contain the checks present in `validate`. - `validate` and `prepare` is passed an `Origin` rather than a `AccountId`. - `validate` may pass arbitrary information into `prepare` via a new user-specifiable type `Val`. - `AdditionalSigned`/`additional_signed` is renamed to `Implicit`/`implicit`. It is encoded *for the entire transaction* and passed in to each extension as a new argument to `validate`. This facilitates the ability of extensions to acts as underlying crypto. There is a new `DispatchTransaction` trait which contains only default function impls and is impl'ed for any `TransactionExtension` impler. It provides several utility functions which reduce some of the tedium from using `TransactionExtension` (indeed, none of its regular functions should now need to be called directly). Three transaction version discriminator ("versions") are now permissible: - 0b000000100: Bare (used to be called "Unsigned"): contains Signature or Extra (extension data). After bare transactions are no longer supported, this will strictly identify an Inherents only. - 0b100000100: Old-school "Signed" Transaction: contains Signature and Extra (extension data). - 0b010000100: New-school "General" Transaction: contains Extra (extension data), but no Signature. For the New-school General Transaction, it becomes trivial for authors to publish extensions to the mechanism for authorizing an Origin, e.g. through new kinds of key-signing schemes, ZK proofs, pallet state, mutations over pre-authenticated origins or any combination of the above. ## Code Migration ### NOW: Getting it to build Wrap your `SignedExtension`s in `AsTransactionExtension`. This should be accompanied by renaming your aggregate type in line with the new terminology. E.g. Before: ```rust /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( /* snip */ MySpecialSignedExtension, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>; ``` After: ```rust /// The extension to the basic transaction logic. pub type TxExtension = ( /* snip */ AsTransactionExtension<MySpecialSignedExtension>, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>; ``` You'll also need to alter any transaction building logic to add a `.into()` to make the conversion happen. E.g. Before: ```rust fn construct_extrinsic( /* snip */ ) -> UncheckedExtrinsic { let extra: SignedExtra = ( /* snip */ MySpecialSignedExtension::new(/* snip */), ); let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); let signature = payload.using_encoded(|e| sender.sign(e)); UncheckedExtrinsic::new_signed( /* snip */ Signature::Sr25519(signature), extra, ) } ``` After: ```rust fn construct_extrinsic( /* snip */ ) -> UncheckedExtrinsic { let tx_ext: TxExtension = ( /* snip */ MySpecialSignedExtension::new(/* snip */).into(), ); let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); let signature = payload.using_encoded(|e| sender.sign(e)); UncheckedExtrinsic::new_signed( /* snip */ Signature::Sr25519(signature), tx_ext, ) } ``` ### SOON: Migrating to `TransactionExtension` Most `SignedExtension`s can be trivially converted to become a `TransactionExtension`. There are a few things to know. - Instead of a single trait like `SignedExtension`, you should now implement two traits individually: `TransactionExtensionBase` and `TransactionExtension`. - Weights are now a thing and must be provided via the new function `fn weight`. #### `TransactionExtensionBase` This trait takes care of anything which is not dependent on types specific to your runtime, most notably `Call`. - `AdditionalSigned`/`additional_signed` is renamed to `Implicit`/`implicit`. - Weight must be returned by implementing the `weight` function. If your extension is associated with a pallet, you'll probably want to do this via the pallet's existing benchmarking infrastructure. #### `TransactionExtension` Generally: - `pre_dispatch` is now `prepare` and you *should not reexecute the `validate` functionality in there*! - You don't get an account ID any more; you get an origin instead. If you need to presume an account ID, then you can use the trait function `AsSystemOriginSigner::as_system_origin_signer`. - You get an additional ticket, similar to `Pre`, called `Val`. This defines data which is passed from `validate` into `prepare`. This is important since you should not be duplicating logic from `validate` to `prepare`, you need a way of passing your working from the former into the latter. This is it. - This trait takes two type parameters: `Call` and `Context`. `Call` is the runtime call type which used to be an associated type; you can just move it to become a type parameter for your trait impl. `Context` is not currently used and you can safely implement over it as an unbounded type. - There's no `AccountId` associated type any more. Just remove it. Regarding `validate`: - You get three new parameters in `validate`; all can be ignored when migrating from `SignedExtension`. - `validate` returns a tuple on success; the second item in the tuple is the new ticket type `Self::Val` which gets passed in to `prepare`. If you use any information extracted during `validate` (off-chain and on-chain, non-mutating) in `prepare` (on-chain, mutating) then you can pass it through with this. For the tuple's last item, just return the `origin` argument. Regarding `prepare`: - This is renamed from `pre_dispatch`, but there is one change: - FUNCTIONALITY TO VALIDATE THE TRANSACTION NEED NOT BE DUPLICATED FROM `validate`!! - (This is different to `SignedExtension` which was required to run the same checks in `pre_dispatch` as in `validate`.) Regarding `post_dispatch`: - Since there are no unsigned transactions handled by `TransactionExtension`, `Pre` is always defined, so the first parameter is `Self::Pre` rather than `Option<Self::Pre>`. If you make use of `SignedExtension::validate_unsigned` or `SignedExtension::pre_dispatch_unsigned`, then: - Just use the regular versions of these functions instead. - Have your logic execute in the case that the `origin` is `None`. - Ensure your transaction creation logic creates a General Transaction rather than a Bare Transaction; this means having to include all `TransactionExtension`s' data. - `ValidateUnsigned` can still be used (for now) if you need to be able to construct transactions which contain none of the extension data, however these will be phased out in stage 2 of the Transactions Horizon, so you should consider moving to an extension-centric design. ## TODO - [x] Introduce `CheckSignature` impl of `TransactionExtension` to ensure it's possible to have crypto be done wholly in a `TransactionExtension`. - [x] Deprecate `SignedExtension` and move all uses in codebase to `TransactionExtension`. - [x] `ChargeTransactionPayment` - [x] `DummyExtension` - [x] `ChargeAssetTxPayment` (asset-tx-payment) - [x] `ChargeAssetTxPayment` (asset-conversion-tx-payment) - [x] `CheckWeight` - [x] `CheckTxVersion` - [x] `CheckSpecVersion` - [x] `CheckNonce` - [x] `CheckNonZeroSender` - [x] `CheckMortality` - [x] `CheckGenesis` - [x] `CheckOnlySudoAccount` - [x] `WatchDummy` - [x] `PrevalidateAttests` - [x] `GenericSignedExtension` - [x] `SignedExtension` (chain-polkadot-bulletin) - [x] `RefundSignedExtensionAdapter` - [x] Implement `fn weight` across the board. - [ ] Go through all pre-existing extensions which assume an account signer and explicitly handle the possibility of another kind of origin. - [x] `CheckNonce` should probably succeed in the case of a non-account origin. - [x] `CheckNonZeroSender` should succeed in the case of a non-account origin. - [x] `ChargeTransactionPayment` and family should fail in the case of a non-account origin. - [ ] - [x] Fix any broken tests. --------- Signed-off-by: georgepisaltu <[email protected]> Signed-off-by: Alexandru Vasile <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> Signed-off-by: Alexandru Gheorghe <[email protected]> Signed-off-by: Andrei Sandu <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]> Co-authored-by: georgepisaltu <[email protected]> Co-authored-by: Chevdor <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Maciej <[email protected]> Co-authored-by: Javier Viola <[email protected]> Co-authored-by: Marcin S. <[email protected]> Co-authored-by: Tsvetomir Dimitrov <[email protected]> Co-authored-by: Javier Bullrich <[email protected]> Co-authored-by: Koute <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]> Co-authored-by: Vladimir Istyufeev <[email protected]> Co-authored-by: Ross Bulat <[email protected]> Co-authored-by: Gonçalo Pestana <[email protected]> Co-authored-by: Liam Aharon <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: André Silva <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: s0me0ne-unkn0wn <[email protected]> Co-authored-by: ordian <[email protected]> Co-authored-by: Sebastian Kunert <[email protected]> Co-authored-by: Aaro Altonen <[email protected]> Co-authored-by: Dmitry Markin <[email protected]> Co-authored-by: Alexandru Vasile <[email protected]> Co-authored-by: Alexander Samusev <[email protected]> Co-authored-by: Julian Eager <[email protected]> Co-authored-by: Michal Kucharczyk <[email protected]> Co-authored-by: Davide Galassi <[email protected]> Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: yjh <[email protected]> Co-authored-by: Tom Mi <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Will | Paradox | ParaNodes.io <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Joshy Orndorff <[email protected]> Co-authored-by: Joshy Orndorff <[email protected]> Co-authored-by: PG Herveou <[email protected]> Co-authored-by: Alexander Theißen <[email protected]> Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Juan Girini <[email protected]> Co-authored-by: bader y <[email protected]> Co-authored-by: James Wilson <[email protected]> Co-authored-by: joe petrowski <[email protected]> Co-authored-by: asynchronous rob <[email protected]> Co-authored-by: Parth <[email protected]> Co-authored-by: Andrew Jones <[email protected]> Co-authored-by: Jonathan Udd <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Egor_P <[email protected]> Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: Evgeny Snitko <[email protected]> Co-authored-by: Just van Stam <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: gupnik <[email protected]> Co-authored-by: dzmitry-lahoda <[email protected]> Co-authored-by: zhiqiangxu <[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Anwesh <[email protected]> Co-authored-by: cheme <[email protected]> Co-authored-by: Sam Johnson <[email protected]> Co-authored-by: kianenigma <[email protected]> Co-authored-by: Jegor Sidorenko <[email protected]> Co-authored-by: Muharem <[email protected]> Co-authored-by: joepetrowski <[email protected]> Co-authored-by: Alexandru Gheorghe <[email protected]> Co-authored-by: Gabriel Facco de Arruda <[email protected]> Co-authored-by: Squirrel <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Co-authored-by: georgepisaltu <[email protected]> Co-authored-by: command-bot <>
1 parent a73df4d commit d14b3b9

File tree

181 files changed

+16918
-12826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+16918
-12826
lines changed

substrate/.maintain/frame-weight-template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait WeightInfo {
3333

3434
/// Weights for `{{pallet}}` using the Substrate node and recommended hardware.
3535
pub struct SubstrateWeight<T>(PhantomData<T>);
36-
{{#if (eq pallet "frame_system")}}
36+
{{#if (or (eq pallet "frame_system") (eq pallet "frame_system_extensions"))}}
3737
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
3838
{{else}}
3939
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {

substrate/bin/minimal/runtime/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn native_version() -> NativeVersion {
5252
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
5353
}
5454

55-
type SignedExtra = (
55+
type TxExtension = (
5656
frame_system::CheckNonZeroSender<Runtime>,
5757
frame_system::CheckSpecVersion<Runtime>,
5858
frame_system::CheckTxVersion<Runtime>,
@@ -104,7 +104,7 @@ impl pallet_transaction_payment::Config for Runtime {
104104
type LengthToFee = FixedFee<1, <Self as pallet_balances::Config>::Balance>;
105105
}
106106

107-
type Block = frame::runtime::types_common::BlockOf<Runtime, SignedExtra>;
107+
type Block = frame::runtime::types_common::BlockOf<Runtime, TxExtension>;
108108
type Header = HeaderFor<Runtime>;
109109

110110
type RuntimeExecutive =

substrate/bin/node-template/node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ runtime-benchmarks = [
7878
"frame-benchmarking/runtime-benchmarks",
7979
"frame-system/runtime-benchmarks",
8080
"node-template-runtime/runtime-benchmarks",
81+
"pallet-transaction-payment/runtime-benchmarks",
8182
"sc-service/runtime-benchmarks",
8283
"sp-runtime/runtime-benchmarks",
8384
]

substrate/bin/node-template/node/src/benchmarking.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn create_benchmark_extrinsic(
109109
.checked_next_power_of_two()
110110
.map(|c| c / 2)
111111
.unwrap_or(2) as u64;
112-
let extra: runtime::SignedExtra = (
112+
let tx_ext: runtime::TxExtension = (
113113
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
114114
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
115115
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
@@ -121,11 +121,12 @@ pub fn create_benchmark_extrinsic(
121121
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
122122
frame_system::CheckWeight::<runtime::Runtime>::new(),
123123
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
124-
);
124+
)
125+
.into();
125126

126127
let raw_payload = runtime::SignedPayload::from_raw(
127128
call.clone(),
128-
extra.clone(),
129+
tx_ext.clone(),
129130
(
130131
(),
131132
runtime::VERSION.spec_version,
@@ -143,7 +144,7 @@ pub fn create_benchmark_extrinsic(
143144
call,
144145
sp_runtime::AccountId32::from(sender.public()).into(),
145146
runtime::Signature::Sr25519(signature),
146-
extra,
147+
tx_ext,
147148
)
148149
}
149150

substrate/bin/node-template/runtime/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ runtime-benchmarks = [
106106
"pallet-sudo/runtime-benchmarks",
107107
"pallet-template/runtime-benchmarks",
108108
"pallet-timestamp/runtime-benchmarks",
109+
"pallet-transaction-payment/runtime-benchmarks",
109110
"sp-runtime/runtime-benchmarks",
110111
]
111112
try-runtime = [

substrate/bin/node-template/runtime/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ impl pallet_transaction_payment::Config for Runtime {
241241
type WeightToFee = IdentityFee<Balance>;
242242
type LengthToFee = IdentityFee<Balance>;
243243
type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
244+
type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Runtime>;
244245
}
245246

246247
impl pallet_sudo::Config for Runtime {
@@ -276,8 +277,8 @@ pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
276277
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
277278
/// Block type as expected by this runtime.
278279
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
279-
/// The SignedExtension to the basic transaction logic.
280-
pub type SignedExtra = (
280+
/// The extension to the basic transaction logic.
281+
pub type TxExtension = (
281282
frame_system::CheckNonZeroSender<Runtime>,
282283
frame_system::CheckSpecVersion<Runtime>,
283284
frame_system::CheckTxVersion<Runtime>,
@@ -296,9 +297,9 @@ type Migrations = ();
296297

297298
/// Unchecked extrinsic type as expected by this runtime.
298299
pub type UncheckedExtrinsic =
299-
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
300+
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
300301
/// The payload being signed in transactions.
301-
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
302+
pub type SignedPayload = generic::SignedPayload<RuntimeCall, TxExtension>;
302303
/// Executive: handles dispatch to the various modules.
303304
pub type Executive = frame_executive::Executive<
304305
Runtime,
@@ -314,6 +315,7 @@ mod benches {
314315
frame_benchmarking::define_benchmarks!(
315316
[frame_benchmarking, BaselineBench::<Runtime>]
316317
[frame_system, SystemBench::<Runtime>]
318+
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
317319
[pallet_balances, Balances]
318320
[pallet_timestamp, Timestamp]
319321
[pallet_sudo, Sudo]
@@ -498,6 +500,7 @@ impl_runtime_apis! {
498500
use frame_benchmarking::{baseline, Benchmarking, BenchmarkList};
499501
use frame_support::traits::StorageInfoTrait;
500502
use frame_system_benchmarking::Pallet as SystemBench;
503+
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
501504
use baseline::Pallet as BaselineBench;
502505

503506
let mut list = Vec::<BenchmarkList>::new();
@@ -514,6 +517,7 @@ impl_runtime_apis! {
514517
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};
515518
use sp_storage::TrackedStorageKey;
516519
use frame_system_benchmarking::Pallet as SystemBench;
520+
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
517521
use baseline::Pallet as BaselineBench;
518522

519523
impl frame_system_benchmarking::Config for Runtime {}

substrate/bin/node/cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ runtime-benchmarks = [
196196
"frame-system/runtime-benchmarks",
197197
"kitchensink-runtime/runtime-benchmarks",
198198
"node-inspect?/runtime-benchmarks",
199+
"pallet-asset-conversion-tx-payment/runtime-benchmarks",
199200
"pallet-asset-tx-payment/runtime-benchmarks",
200201
"pallet-assets/runtime-benchmarks",
201202
"pallet-balances/runtime-benchmarks",
@@ -205,6 +206,7 @@ runtime-benchmarks = [
205206
"pallet-skip-feeless-payment/runtime-benchmarks",
206207
"pallet-sudo/runtime-benchmarks",
207208
"pallet-timestamp/runtime-benchmarks",
209+
"pallet-transaction-payment/runtime-benchmarks",
208210
"pallet-treasury/runtime-benchmarks",
209211
"sc-client-db/runtime-benchmarks",
210212
"sc-service/runtime-benchmarks",

substrate/bin/node/cli/benches/block_production.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
110110

111111
fn extrinsic_set_time(now: u64) -> OpaqueExtrinsic {
112112
kitchensink_runtime::UncheckedExtrinsic {
113-
signature: None,
113+
preamble: sp_runtime::generic::Preamble::Bare,
114114
function: kitchensink_runtime::RuntimeCall::Timestamp(pallet_timestamp::Call::set { now }),
115115
}
116116
.into()

substrate/bin/node/cli/benches/executor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use sp_core::{
2929
storage::well_known_keys,
3030
traits::{CallContext, CodeExecutor, RuntimeCode},
3131
};
32-
use sp_runtime::traits::BlakeTwo256;
32+
use sp_runtime::{generic::ExtrinsicFormat, traits::BlakeTwo256};
3333
use sp_state_machine::TestExternalities as CoreTestExternalities;
3434
use staging_node_cli::service::RuntimeExecutor;
3535

@@ -144,11 +144,11 @@ fn test_blocks(
144144
) -> Vec<(Vec<u8>, Hash)> {
145145
let mut test_ext = new_test_ext(genesis_config);
146146
let mut block1_extrinsics = vec![CheckedExtrinsic {
147-
signed: None,
147+
format: ExtrinsicFormat::Bare,
148148
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: 0 }),
149149
}];
150150
block1_extrinsics.extend((0..20).map(|i| CheckedExtrinsic {
151-
signed: Some((alice(), signed_extra(i, 0))),
151+
format: ExtrinsicFormat::Signed(alice(), tx_ext(i, 0)),
152152
function: RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death {
153153
dest: bob().into(),
154154
value: 1 * DOLLARS,

substrate/bin/node/cli/src/service.rs

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,21 @@ pub fn create_extrinsic(
107107
.map(|c| c / 2)
108108
.unwrap_or(2) as u64;
109109
let tip = 0;
110-
let extra: kitchensink_runtime::SignedExtra =
110+
let tx_ext: kitchensink_runtime::TxExtension =
111111
(
112-
frame_system::CheckNonZeroSender::<kitchensink_runtime::Runtime>::new(),
113-
frame_system::CheckSpecVersion::<kitchensink_runtime::Runtime>::new(),
114-
frame_system::CheckTxVersion::<kitchensink_runtime::Runtime>::new(),
115-
frame_system::CheckGenesis::<kitchensink_runtime::Runtime>::new(),
116-
frame_system::CheckEra::<kitchensink_runtime::Runtime>::from(generic::Era::mortal(
117-
period,
118-
best_block.saturated_into(),
119-
)),
120-
frame_system::CheckNonce::<kitchensink_runtime::Runtime>::from(nonce),
121-
frame_system::CheckWeight::<kitchensink_runtime::Runtime>::new(),
112+
(
113+
frame_system::CheckNonZeroSender::<kitchensink_runtime::Runtime>::new(),
114+
frame_system::CheckSpecVersion::<kitchensink_runtime::Runtime>::new(),
115+
frame_system::CheckTxVersion::<kitchensink_runtime::Runtime>::new(),
116+
frame_system::CheckGenesis::<kitchensink_runtime::Runtime>::new(),
117+
frame_system::CheckEra::<kitchensink_runtime::Runtime>::from(generic::Era::mortal(
118+
period,
119+
best_block.saturated_into(),
120+
)),
121+
frame_system::CheckNonce::<kitchensink_runtime::Runtime>::from(nonce),
122+
frame_system::CheckWeight::<kitchensink_runtime::Runtime>::new(),
123+
)
124+
.into(),
122125
pallet_skip_feeless_payment::SkipCheckIfFeeless::from(
123126
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::<
124127
kitchensink_runtime::Runtime,
@@ -128,15 +131,17 @@ pub fn create_extrinsic(
128131

129132
let raw_payload = kitchensink_runtime::SignedPayload::from_raw(
130133
function.clone(),
131-
extra.clone(),
134+
tx_ext.clone(),
132135
(
133-
(),
134-
kitchensink_runtime::VERSION.spec_version,
135-
kitchensink_runtime::VERSION.transaction_version,
136-
genesis_hash,
137-
best_hash,
138-
(),
139-
(),
136+
(
137+
(),
138+
kitchensink_runtime::VERSION.spec_version,
139+
kitchensink_runtime::VERSION.transaction_version,
140+
genesis_hash,
141+
best_hash,
142+
(),
143+
(),
144+
),
140145
(),
141146
),
142147
);
@@ -146,7 +151,7 @@ pub fn create_extrinsic(
146151
function,
147152
sp_runtime::AccountId32::from(sender.public()).into(),
148153
kitchensink_runtime::Signature::Sr25519(signature),
149-
extra,
154+
tx_ext,
150155
)
151156
}
152157

@@ -791,7 +796,7 @@ mod tests {
791796
use codec::Encode;
792797
use kitchensink_runtime::{
793798
constants::{currency::CENTS, time::SLOT_DURATION},
794-
Address, BalancesCall, RuntimeCall, UncheckedExtrinsic,
799+
Address, BalancesCall, RuntimeCall, TxExtension, UncheckedExtrinsic,
795800
};
796801
use node_primitives::{Block, DigestItem, Signature};
797802
use sc_client_api::BlockBackend;
@@ -993,25 +998,31 @@ mod tests {
993998
let tx_payment = pallet_skip_feeless_payment::SkipCheckIfFeeless::from(
994999
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment::from(0, None),
9951000
);
996-
let extra = (
997-
check_non_zero_sender,
998-
check_spec_version,
999-
check_tx_version,
1000-
check_genesis,
1001-
check_era,
1002-
check_nonce,
1003-
check_weight,
1001+
let tx_ext: TxExtension = (
1002+
(
1003+
check_non_zero_sender,
1004+
check_spec_version,
1005+
check_tx_version,
1006+
check_genesis,
1007+
check_era,
1008+
check_nonce,
1009+
check_weight,
1010+
)
1011+
.into(),
10041012
tx_payment,
10051013
);
10061014
let raw_payload = SignedPayload::from_raw(
10071015
function,
1008-
extra,
1009-
((), spec_version, transaction_version, genesis_hash, genesis_hash, (), (), ()),
1016+
tx_ext,
1017+
(
1018+
((), spec_version, transaction_version, genesis_hash, genesis_hash, (), ()),
1019+
(),
1020+
),
10101021
);
10111022
let signature = raw_payload.using_encoded(|payload| signer.sign(payload));
1012-
let (function, extra, _) = raw_payload.deconstruct();
1023+
let (function, tx_ext, _) = raw_payload.deconstruct();
10131024
index += 1;
1014-
UncheckedExtrinsic::new_signed(function, from.into(), signature.into(), extra)
1025+
UncheckedExtrinsic::new_signed(function, from.into(), signature.into(), tx_ext)
10151026
.into()
10161027
},
10171028
);

0 commit comments

Comments
 (0)