Revert "FRAME: Create TransactionExtension as a replacement for SignedExtension (#2280)" (#3665)

This PR reverts #2280 which introduced `TransactionExtension` to replace
`SignedExtension`.

As a result of the discussion
[here](https://github.com/paritytech/polkadot-sdk/pull/3623#issuecomment-1986789700),
the changes will be reverted for now with plans to reintroduce the
concept in the future.

---------

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
This commit is contained in:
georgepisaltu
2024-03-13 16:10:59 +02:00
committed by GitHub
parent 60ac5a723c
commit bbd51ce867
350 changed files with 15826 additions and 24304 deletions
@@ -477,7 +477,7 @@ note: required because it appears within the type `RuntimeCall`
| ||_- in this macro invocation
... |
note: required by a bound in `frame_support::sp_runtime::traits::Dispatchable::Config`
--> $WORKSPACE/substrate/primitives/runtime/src/traits/mod.rs
--> $WORKSPACE/substrate/primitives/runtime/src/traits.rs
|
| type Config;
| ^^^^^^^^^^^^ required by this bound in `Dispatchable::Config`
@@ -510,7 +510,7 @@ note: required because it appears within the type `RuntimeCall`
| ||_- in this macro invocation
... |
note: required by a bound in `frame_support::pallet_prelude::ValidateUnsigned::Call`
--> $WORKSPACE/substrate/primitives/runtime/src/traits/mod.rs
--> $WORKSPACE/substrate/primitives/runtime/src/traits.rs
|
| type Call;
| ^^^^^^^^^^ required by this bound in `ValidateUnsigned::Call`
+63 -80
View File
@@ -743,40 +743,10 @@ impl pallet5::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
}
#[derive(Clone, Debug, codec::Encode, codec::Decode, PartialEq, Eq, scale_info::TypeInfo)]
pub struct AccountU64(u64);
impl sp_runtime::traits::IdentifyAccount for AccountU64 {
type AccountId = u64;
fn into_account(self) -> u64 {
self.0
}
}
impl sp_runtime::traits::Verify for AccountU64 {
type Signer = AccountU64;
fn verify<L: sp_runtime::traits::Lazy<[u8]>>(
&self,
_msg: L,
_signer: &<Self::Signer as sp_runtime::traits::IdentifyAccount>::AccountId,
) -> bool {
true
}
}
impl From<u64> for AccountU64 {
fn from(value: u64) -> Self {
Self(value)
}
}
pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<
u64,
RuntimeCall,
AccountU64,
frame_system::CheckNonZeroSender<Runtime>,
>;
pub type UncheckedExtrinsic =
sp_runtime::testing::TestXt<RuntimeCall, frame_system::CheckNonZeroSender<Runtime>>;
frame_support::construct_runtime!(
pub struct Runtime {
@@ -926,8 +896,10 @@ fn inherent_expand() {
let inherents = InherentData::new().create_extrinsics();
let expected =
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {}))];
let expected = vec![UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: None,
}];
assert_eq!(expected, inherents);
let block = Block::new(
@@ -939,11 +911,14 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
foo: 1,
bar: 0,
})),
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
signature: None,
},
],
);
@@ -958,11 +933,14 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
foo: 0,
bar: 0,
})),
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 0, bar: 0 }),
signature: None,
},
],
);
@@ -976,9 +954,10 @@ fn inherent_expand() {
BlakeTwo256::hash(b"test"),
Digest::default(),
),
vec![UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
foo: 0,
}))],
vec![UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
signature: None,
}],
);
let mut inherent = InherentData::new();
@@ -993,12 +972,10 @@ fn inherent_expand() {
BlakeTwo256::hash(b"test"),
Digest::default(),
),
vec![UncheckedExtrinsic::new_signed(
RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
1,
1.into(),
Default::default(),
)],
vec![UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: Some((1, Default::default())),
}],
);
let mut inherent = InherentData::new();
@@ -1014,13 +991,14 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
foo: 1,
bar: 1,
})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
foo: 0,
})),
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
signature: None,
},
],
);
@@ -1035,14 +1013,18 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
foo: 1,
bar: 1,
})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_storage_layer {
foo: 0,
})),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_storage_layer { foo: 0 }),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: None,
},
],
);
@@ -1057,17 +1039,18 @@ fn inherent_expand() {
Digest::default(),
),
vec![
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo {
foo: 1,
bar: 1,
})),
UncheckedExtrinsic::new_signed(
RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
1,
1.into(),
Default::default(),
),
UncheckedExtrinsic::new_bare(RuntimeCall::Example(pallet::Call::foo_no_post_info {})),
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 1 }),
signature: None,
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo { foo: 1, bar: 0 }),
signature: Some((1, Default::default())),
},
UncheckedExtrinsic {
call: RuntimeCall::Example(pallet::Call::foo_no_post_info {}),
signature: None,
},
],
);
@@ -1950,7 +1933,7 @@ fn extrinsic_metadata_ir_types() {
>(),
ir.signature_ty
);
assert_eq!(meta_type::<AccountU64>(), ir.signature_ty);
assert_eq!(meta_type::<()>(), ir.signature_ty);
assert_eq!(meta_type::<<<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload as SignaturePayloadT>::SignatureExtra>(), ir.extra_ty);
assert_eq!(meta_type::<frame_system::CheckNonZeroSender<Runtime>>(), ir.extra_ty);
@@ -943,7 +943,7 @@ fn metadata() {
ty: scale_info::meta_type::<UncheckedExtrinsic>(),
version: 4,
signed_extensions: vec![SignedExtensionMetadata {
identifier: "UnitTransactionExtension",
identifier: "UnitSignedExtension",
ty: scale_info::meta_type::<()>(),
additional_signed: scale_info::meta_type::<()>(),
}],
@@ -895,7 +895,7 @@ fn test_metadata() {
ty: meta_type::<UncheckedExtrinsic>(),
version: 4,
signed_extensions: vec![SignedExtensionMetadata {
identifier: "UnitTransactionExtension",
identifier: "UnitSignedExtension",
ty: meta_type::<()>(),
additional_signed: meta_type::<()>(),
}],
@@ -752,7 +752,7 @@ fn test_metadata() {
name: "Version",
ty: meta_type::<RuntimeVersion>(),
value: RuntimeVersion::default().encode(),
docs: maybe_docs(vec![ " Get the chain's current version."]),
docs: maybe_docs(vec![ " Get the chain's in-code version."]),
},
PalletConstantMetadata {
name: "SS58Prefix",
@@ -895,7 +895,7 @@ fn test_metadata() {
ty: meta_type::<UncheckedExtrinsic>(),
version: 4,
signed_extensions: vec![SignedExtensionMetadata {
identifier: "UnitTransactionExtension",
identifier: "UnitSignedExtension",
ty: meta_type::<()>(),
additional_signed: meta_type::<()>(),
}],