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
@@ -25,7 +25,7 @@ use codec::Encode;
use frame_system::{CheckNonce, CheckWeight};
use sp_core::crypto::Pair as TraitPair;
use sp_keyring::AccountKeyring;
use sp_runtime::{generic::Preamble, transaction_validity::TransactionPriority, Perbill};
use sp_runtime::{transaction_validity::TransactionPriority, Perbill};
use sp_std::prelude::*;
/// Transfer used in test substrate pallet. Extrinsic is created and signed using this data.
@@ -66,11 +66,11 @@ impl TryFrom<&Extrinsic> for TransferData {
match uxt {
Extrinsic {
function: RuntimeCall::Balances(BalancesCall::transfer_allow_death { dest, value }),
preamble: Preamble::Signed(from, _, ((CheckNonce(nonce), ..), ..)),
signature: Some((from, _, (CheckNonce(nonce), ..))),
} => Ok(TransferData { from: *from, to: *dest, amount: *value, nonce: *nonce }),
Extrinsic {
function: RuntimeCall::SubstrateTest(PalletCall::bench_call { transfer }),
preamble: Preamble::Bare,
signature: None,
} => Ok(transfer.clone()),
_ => Err(()),
}
@@ -190,17 +190,18 @@ impl ExtrinsicBuilder {
/// Build `Extrinsic` using embedded parameters
pub fn build(self) -> Extrinsic {
if let Some(signer) = self.signer {
let tx_ext = (
(CheckNonce::from(self.nonce.unwrap_or(0)), CheckWeight::new()),
let extra = (
CheckNonce::from(self.nonce.unwrap_or(0)),
CheckWeight::new(),
CheckSubstrateCall {},
);
let raw_payload =
SignedPayload::from_raw(self.function.clone(), tx_ext.clone(), (((), ()), ()));
SignedPayload::from_raw(self.function.clone(), extra.clone(), ((), (), ()));
let signature = raw_payload.using_encoded(|e| signer.sign(e));
Extrinsic::new_signed(self.function, signer.public(), signature, tx_ext)
Extrinsic::new_signed(self.function, signer.public(), signature, extra)
} else {
Extrinsic::new_bare(self.function)
Extrinsic::new_unsigned(self.function)
}
}
}