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
@@ -73,9 +73,11 @@ pub fn expand_outer_inherent(
#(
#pallet_attrs
if let Some(inherent) = #pallet_names::create_inherent(self) {
let inherent = <#unchecked_extrinsic as #scrate::sp_runtime::traits::Extrinsic>::new_inherent(
let inherent = <#unchecked_extrinsic as #scrate::sp_runtime::traits::Extrinsic>::new(
inherent.into(),
);
None,
).expect("Runtime UncheckedExtrinsic is not Opaque, so it has to return \
`Some`; qed");
inherents.push(inherent);
}
@@ -121,7 +123,7 @@ pub fn expand_outer_inherent(
for xt in block.extrinsics() {
// Inherents are before any other extrinsics.
// And signed extrinsics are not inherents.
if !(#scrate::sp_runtime::traits::Extrinsic::is_bare(xt)) {
if #scrate::sp_runtime::traits::Extrinsic::is_signed(xt).unwrap_or(false) {
break
}
@@ -159,9 +161,10 @@ pub fn expand_outer_inherent(
match #pallet_names::is_inherent_required(self) {
Ok(Some(e)) => {
let found = block.extrinsics().iter().any(|xt| {
let is_bare = #scrate::sp_runtime::traits::Extrinsic::is_bare(xt);
let is_signed = #scrate::sp_runtime::traits::Extrinsic::is_signed(xt)
.unwrap_or(false);
if is_bare {
if !is_signed {
let call = <
#unchecked_extrinsic as ExtrinsicCall
>::call(xt);
@@ -206,9 +209,8 @@ pub fn expand_outer_inherent(
use #scrate::inherent::ProvideInherent;
use #scrate::traits::{IsSubType, ExtrinsicCall};
let is_bare = #scrate::sp_runtime::traits::Extrinsic::is_bare(ext);
if !is_bare {
// Signed extrinsics are not inherents.
if #scrate::sp_runtime::traits::Extrinsic::is_signed(ext).unwrap_or(false) {
// Signed extrinsics are never inherents.
return false
}
@@ -119,13 +119,13 @@ pub fn expand_runtime_metadata(
call_ty,
signature_ty,
extra_ty,
extensions: <
signed_extensions: <
<
#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata
>::Extra as #scrate::sp_runtime::traits::TransactionExtensionBase
>::SignedExtensions as #scrate::sp_runtime::traits::SignedExtension
>::metadata()
.into_iter()
.map(|meta| #scrate::__private::metadata_ir::TransactionExtensionMetadataIR {
.map(|meta| #scrate::__private::metadata_ir::SignedExtensionMetadataIR {
identifier: meta.identifier,
ty: meta.ty,
additional_signed: meta.additional_signed,
@@ -153,10 +153,6 @@ pub fn expand_outer_origin(
self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(filter));
}
fn set_caller(&mut self, caller: OriginCaller) {
self.caller = caller;
}
fn set_caller_from(&mut self, other: impl Into<Self>) {
self.caller = other.into().caller;
}
@@ -305,16 +301,6 @@ pub fn expand_outer_origin(
}
}
impl #scrate::__private::AsSystemOriginSigner<<#runtime as #system_path::Config>::AccountId> for RuntimeOrigin {
fn as_system_origin_signer(&self) -> Option<&<#runtime as #system_path::Config>::AccountId> {
if let OriginCaller::system(#system_path::Origin::<#runtime>::Signed(ref signed)) = &self.caller {
Some(signed)
} else {
None
}
}
}
#pallet_conversions
})
}