Skip to content

Commit 7324223

Browse files
author
Grigoriy Simonov
committed
remove deprecated SignedExtension
1 parent 0481c11 commit 7324223

11 files changed

Lines changed: 48 additions & 80 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/rpc/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ sc-network-sync = { workspace = true }
3737
sc-rpc = { workspace = true }
3838
sc-rpc-server = { workspace = true }
3939
sc-service = { workspace = true }
40-
sc-transaction-pool = { workspace = true }
4140
sc-transaction-pool-api = { workspace = true }
4241
sc-utils = { workspace = true }
4342
sp-api = { workspace = true, features = ["default"] }

frame/ethereum/src/lib.rs

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ use frame_support::{
5252
};
5353
use frame_system::{pallet_prelude::OriginFor, CheckWeight, WeightInfo};
5454
use sp_runtime::{
55-
generic::DigestItem,
56-
traits::{DispatchInfoOf, Dispatchable, One, Saturating, UniqueSaturatedInto, Zero},
57-
transaction_validity::{
55+
generic::DigestItem, impl_tx_ext_default, traits::{DispatchInfoOf, Dispatchable, One, Saturating, UniqueSaturatedInto, Zero}, transaction_validity::{
5856
InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
59-
},
60-
RuntimeDebug, SaturatedConversion,
57+
}, RuntimeDebug, SaturatedConversion
6158
};
6259
// Frontier
6360
use fp_consensus::{PostLog, PreLog, FRONTIER_ENGINE_ID};
@@ -1126,41 +1123,16 @@ impl From<TransactionValidationError> for InvalidTransactionWrapper {
11261123
#[derive(TypeInfo, PartialEq, Eq, Clone, Debug, Encode, Decode)]
11271124
pub struct FakeTransactionFinalizer<T>(PhantomData<T>);
11281125

1129-
impl<T: Config + TypeInfo + core::fmt::Debug + Send + Sync> sp_runtime::traits::SignedExtension
1126+
impl<T: Config + TypeInfo + core::fmt::Debug + Send + Sync + Dispatchable> sp_runtime::traits::TransactionExtension<T::RuntimeCall>
11301127
for FakeTransactionFinalizer<T>
11311128
{
11321129
const IDENTIFIER: &'static str = "FakeTransactionFinalizer";
11331130

1134-
type AccountId = T::AccountId;
1135-
1136-
type Call = T::RuntimeCall;
1137-
1138-
type AdditionalSigned = ();
1131+
type Implicit = ();
11391132

11401133
type Pre = ();
11411134

1142-
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
1143-
Ok(())
1144-
}
1145-
1146-
fn pre_dispatch(
1147-
self,
1148-
_who: &Self::AccountId,
1149-
_call: &Self::Call,
1150-
_info: &DispatchInfoOf<Self::Call>,
1151-
_len: usize,
1152-
) -> Result<Self::Pre, TransactionValidityError> {
1153-
Ok(())
1154-
}
1155-
1156-
fn post_dispatch(
1157-
_pre: Option<Self::Pre>,
1158-
_info: &DispatchInfoOf<Self::Call>,
1159-
_post_info: &sp_runtime::traits::PostDispatchInfoOf<Self::Call>,
1160-
_len: usize,
1161-
_result: &sp_runtime::DispatchResult,
1162-
) -> Result<(), TransactionValidityError> {
1163-
<Pallet<T>>::flush_injected_transaction();
1164-
Ok(())
1165-
}
1135+
type Val = ();
1136+
1137+
impl_tx_ext_default!(T::RuntimeCall; validate prepare weight);
11661138
}

frame/ethereum/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use pallet_evm::BackwardsAddressMapping;
3939
use super::*;
4040
use crate::IntermediateStateRoot;
4141

42-
pub type SignedExtra = (frame_system::CheckSpecVersion<Test>,);
42+
pub type TxExtension = (frame_system::CheckSpecVersion<Test>,);
4343

4444
frame_support::construct_runtime! {
4545
pub enum Test {

frame/ethereum/src/tests/eip1559.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn transaction_with_max_extrinsic_gas_limit_should_success_pre_dispatch() {
6565

6666
let call = crate::Call::<Test>::transact { transaction };
6767
let source = call.check_self_contained().unwrap().unwrap();
68-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, _> {
68+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, _> {
6969
format: fp_self_contained::CheckedFormat::SelfContained(source),
7070
function: RuntimeCall::Ethereum(call.clone()),
7171
};
@@ -104,7 +104,7 @@ fn transaction_with_gas_limit_greater_than_max_extrinsic_should_fail_pre_dispatc
104104

105105
let call = crate::Call::<Test>::transact { transaction };
106106
let source = call.check_self_contained().unwrap().unwrap();
107-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, _> {
107+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, _> {
108108
format: fp_self_contained::CheckedFormat::SelfContained(source),
109109
function: RuntimeCall::Ethereum(call.clone()),
110110
};
@@ -142,7 +142,7 @@ fn transaction_without_enough_gas_should_not_work() {
142142

143143
let call = crate::Call::<Test>::transact { transaction };
144144
let source = call.check_self_contained().unwrap().unwrap();
145-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, _> {
145+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, _> {
146146
format: fp_self_contained::CheckedFormat::SelfContained(source),
147147
function: RuntimeCall::Ethereum(call.clone()),
148148
};
@@ -169,7 +169,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
169169
transaction: signed,
170170
};
171171
let source = call.check_self_contained().unwrap().unwrap();
172-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, H160> {
172+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, H160> {
173173
format: fp_self_contained::CheckedFormat::SelfContained(source),
174174
function: RuntimeCall::Ethereum(call.clone()),
175175
};
@@ -196,7 +196,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
196196
transaction: signed2,
197197
};
198198
let source2 = call2.check_self_contained().unwrap().unwrap();
199-
let extrinsic2 = CheckedExtrinsic::<u64, _, SignedExtra, _> {
199+
let extrinsic2 = CheckedExtrinsic::<u64, _, TxExtension, _> {
200200
format: fp_self_contained::CheckedFormat::SelfContained(source),
201201
function: RuntimeCall::Ethereum(call2.clone()),
202202
};
@@ -224,7 +224,7 @@ fn transaction_with_to_hight_nonce_should_fail_in_block() {
224224
transaction: signed,
225225
};
226226
let source = call.check_self_contained().unwrap().unwrap();
227-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
227+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
228228
format: fp_self_contained::CheckedFormat::SelfContained(source),
229229
function: RuntimeCall::Ethereum(call),
230230
};
@@ -247,7 +247,7 @@ fn transaction_with_invalid_chain_id_should_fail_in_block() {
247247

248248
let call = crate::Call::<Test>::transact { transaction };
249249
let source = call.check_self_contained().unwrap().unwrap();
250-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
250+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
251251
format: fp_self_contained::CheckedFormat::SelfContained(source),
252252
function: RuntimeCall::Ethereum(call),
253253
};

frame/ethereum/src/tests/eip2930.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn transaction_without_enough_gas_should_not_work() {
7171

7272
let call = crate::Call::<Test>::transact { transaction };
7373
let source = call.check_self_contained().unwrap().unwrap();
74-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, _> {
74+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, _> {
7575
format: fp_self_contained::CheckedFormat::SelfContained(source),
7676
function: RuntimeCall::Ethereum(call.clone()),
7777
};
@@ -100,7 +100,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
100100
transaction: signed,
101101
};
102102
let source = call.check_self_contained().unwrap().unwrap();
103-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, H160> {
103+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, H160> {
104104
format: fp_self_contained::CheckedFormat::SelfContained(source),
105105
function: RuntimeCall::Ethereum(call.clone()),
106106
};
@@ -128,7 +128,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
128128
transaction: signed2,
129129
};
130130
let source2 = call2.check_self_contained().unwrap().unwrap();
131-
let extrinsic2 = CheckedExtrinsic::<u64, _, SignedExtra, _> {
131+
let extrinsic2 = CheckedExtrinsic::<u64, _, TxExtension, _> {
132132
format: fp_self_contained::CheckedFormat::SelfContained(source),
133133
function: RuntimeCall::Ethereum(call2.clone()),
134134
};
@@ -156,7 +156,7 @@ fn transaction_with_to_hight_nonce_should_fail_in_block() {
156156
transaction: signed,
157157
};
158158
let source = call.check_self_contained().unwrap().unwrap();
159-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
159+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
160160
format: fp_self_contained::CheckedFormat::SelfContained(source),
161161
function: RuntimeCall::Ethereum(call),
162162
};
@@ -179,7 +179,7 @@ fn transaction_with_invalid_chain_id_should_fail_in_block() {
179179

180180
let call = crate::Call::<Test>::transact { transaction };
181181
let source = call.check_self_contained().unwrap().unwrap();
182-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
182+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
183183
format: fp_self_contained::CheckedFormat::SelfContained(source),
184184
function: RuntimeCall::Ethereum(call),
185185
};

frame/ethereum/src/tests/legacy.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn transaction_without_enough_gas_should_not_work() {
7171

7272
let call = crate::Call::<Test>::transact { transaction };
7373
let source = call.check_self_contained().unwrap().unwrap();
74-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, _> {
74+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, _> {
7575
format: fp_self_contained::CheckedFormat::SelfContained(source),
7676
function: RuntimeCall::Ethereum(call.clone()),
7777
};
@@ -100,7 +100,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
100100
transaction: signed,
101101
};
102102
let source = call.check_self_contained().unwrap().unwrap();
103-
let extrinsic = CheckedExtrinsic::<u64, _, SignedExtra, H160> {
103+
let extrinsic = CheckedExtrinsic::<u64, _, TxExtension, H160> {
104104
format: fp_self_contained::CheckedFormat::SelfContained(source),
105105
function: RuntimeCall::Ethereum(call.clone()),
106106
};
@@ -128,7 +128,7 @@ fn transaction_with_to_low_nonce_should_not_work() {
128128
transaction: signed2,
129129
};
130130
let source2 = call2.check_self_contained().unwrap().unwrap();
131-
let extrinsic2 = CheckedExtrinsic::<u64, _, SignedExtra, _> {
131+
let extrinsic2 = CheckedExtrinsic::<u64, _, TxExtension, _> {
132132
format: fp_self_contained::CheckedFormat::SelfContained(source),
133133
function: RuntimeCall::Ethereum(call2.clone()),
134134
};
@@ -156,7 +156,7 @@ fn transaction_with_to_hight_nonce_should_fail_in_block() {
156156
transaction: signed,
157157
};
158158
let source = call.check_self_contained().unwrap().unwrap();
159-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
159+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
160160
format: fp_self_contained::CheckedFormat::SelfContained(source),
161161
function: RuntimeCall::Ethereum(call),
162162
};
@@ -179,7 +179,7 @@ fn transaction_with_invalid_chain_id_should_fail_in_block() {
179179

180180
let call = crate::Call::<Test>::transact { transaction };
181181
let source = call.check_self_contained().unwrap().unwrap();
182-
let extrinsic = CheckedExtrinsic::<_, _, SignedExtra, _> {
182+
let extrinsic = CheckedExtrinsic::<_, _, TxExtension, _> {
183183
format: fp_self_contained::CheckedFormat::SelfContained(source),
184184
function: RuntimeCall::Ethereum(call),
185185
};

frame/evm/src/runner/stack.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ where
8282
reason: WithdrawReason,
8383
config: &'config evm::Config,
8484
is_transactional: bool,
85-
precompiles: &'precompiles T::PrecompilesType,
85+
precompiles: &'precompiles PrecompileSetWithMethods<T>,
8686
weight_limit: Option<Weight>,
8787
proof_size_base_cost: Option<u64>,
8888
f: F,
@@ -93,7 +93,7 @@ where
9393
'config,
9494
'precompiles,
9595
SubstrateStackState<'_, 'config, T>,
96-
T::PrecompilesType,
96+
PrecompileSetWithMethods<T>,
9797
>,
9898
) -> (ExitReason, R),
9999
R: Default,
@@ -145,7 +145,7 @@ where
145145
mut max_priority_fee_per_gas: Option<U256>,
146146
reason: WithdrawReason,
147147
config: &'config evm::Config,
148-
precompiles: &'precompiles T::PrecompilesType,
148+
precompiles: &'precompiles PrecompileSetWithMethods<T>,
149149
is_transactional: bool,
150150
f: F,
151151
mut base_fee: U256,
@@ -159,7 +159,7 @@ where
159159
'config,
160160
'precompiles,
161161
SubstrateStackState<'_, 'config, T>,
162-
T::PrecompilesType,
162+
PrecompileSetWithMethods<T>,
163163
>,
164164
) -> (ExitReason, R),
165165
R: Default,
@@ -502,8 +502,8 @@ where
502502
}
503503
/* Unique:
504504
*/
505-
let precompiles = T::PrecompilesValue::get();
506-
//let precompiles = <PrecompileSetWithMethods<T>>::get();
505+
//let precompiles = T::PrecompilesValue::get();
506+
let precompiles = <PrecompileSetWithMethods<T>>::get();
507507
Self::execute(
508508
&source,
509509
value,
@@ -567,8 +567,8 @@ where
567567
}
568568
/* Unique:
569569
*/
570-
let precompiles = T::PrecompilesValue::get();
571-
//let precompiles = <PrecompileSetWithMethods<T>>::get();
570+
//let precompiles = T::PrecompilesValue::get();
571+
let precompiles = <PrecompileSetWithMethods<T>>::get();
572572
Self::execute(
573573
&source,
574574
value,
@@ -632,8 +632,8 @@ where
632632
}
633633
/* Unique:
634634
*/
635-
let precompiles = T::PrecompilesValue::get();
636-
//let precompiles = <PrecompileSetWithMethods<T>>::get();
635+
//let precompiles = T::PrecompilesValue::get();
636+
let precompiles = <PrecompileSetWithMethods<T>>::get();
637637
let code_hash = H256::from(sp_io::hashing::keccak_256(&init));
638638
Self::execute(
639639
&source,
@@ -1379,7 +1379,7 @@ mod tests {
13791379
WithdrawReason::Create,
13801380
&config,
13811381
false,
1382-
&MockPrecompileSet,
1382+
&PrecompileSetWithMethods(MockPrecompileSet),
13831383
None,
13841384
None,
13851385
|_| {
@@ -1392,7 +1392,7 @@ mod tests {
13921392
WithdrawReason::Create,
13931393
&config,
13941394
false,
1395-
&MockPrecompileSet,
1395+
&PrecompileSetWithMethods(MockPrecompileSet),
13961396
None,
13971397
None,
13981398
|_| (ExitReason::Succeed(ExitSucceed::Stopped), ()),
@@ -1425,7 +1425,7 @@ mod tests {
14251425
WithdrawReason::Create,
14261426
&config,
14271427
false,
1428-
&MockPrecompileSet,
1428+
&PrecompileSetWithMethods(MockPrecompileSet),
14291429
None,
14301430
None,
14311431
|_| (ExitReason::Succeed(ExitSucceed::Stopped), ()),

primitives/self-contained/src/checked_extrinsic.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use frame_support::dispatch::{DispatchInfo, GetDispatchInfo};
1919
use scale_codec::Encode;
2020
use sp_runtime::{
2121
traits::{
22-
self, AsTransactionAuthorizedOrigin, DispatchInfoOf, DispatchTransaction, Dispatchable, MaybeDisplay, Member, PostDispatchInfoOf, SignedExtension, TransactionExtension, ValidateUnsigned
22+
self, AsTransactionAuthorizedOrigin, DispatchInfoOf, DispatchTransaction, Dispatchable, MaybeDisplay, Member, PostDispatchInfoOf, TransactionExtension, ValidateUnsigned
2323
},
2424
transaction_validity::{
2525
InvalidTransaction, TransactionSource, TransactionValidity, TransactionValidityError,
@@ -74,8 +74,6 @@ where
7474

7575
fn validate<I: ValidateUnsigned<Call = Self::Call>>(
7676
&self,
77-
// TODO [#5006;ToDr] should source be passed to `SignedExtension`s?
78-
// Perhaps a change for 2.0 to avoid breaking too much APIs?
7977
source: TransactionSource,
8078
info: &DispatchInfoOf<Self::Call>,
8179
len: usize,

template/node/src/benchmarking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn create_benchmark_extrinsic(
121121
.checked_next_power_of_two()
122122
.map(|c| c / 2)
123123
.unwrap_or(2) as u64;
124-
let extra: runtime::SignedExtra = (
124+
let extra: runtime::TxExtension = (
125125
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
126126
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
127127
frame_system::CheckTxVersion::<runtime::Runtime>::new(),

0 commit comments

Comments
 (0)