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
+9 -36
View File
@@ -199,7 +199,6 @@ impl frame_system::Config for Runtime {
type Version = Version;
type AccountData = pallet_balances::AccountData<Balance>;
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
type ExtensionsWeightInfo = weights::frame_system_extensions::WeightInfo<Runtime>;
type SS58Prefix = SS58Prefix;
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
@@ -330,7 +329,6 @@ impl pallet_transaction_payment::Config for Runtime {
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
}
parameter_types! {
@@ -593,7 +591,7 @@ where
// so the actual block number is `n`.
.saturating_sub(1);
let tip = 0;
let tx_ext: TxExtension = (
let extra: SignedExtra = (
frame_system::CheckNonZeroSender::<Runtime>::new(),
frame_system::CheckSpecVersion::<Runtime>::new(),
frame_system::CheckTxVersion::<Runtime>::new(),
@@ -605,17 +603,16 @@ where
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
)
.into();
let raw_payload = SignedPayload::new(call, tx_ext)
);
let raw_payload = SignedPayload::new(call, extra)
.map_err(|e| {
log::warn!("Unable to create signed payload: {:?}", e);
})
.ok()?;
let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?;
let (call, tx_ext, _) = raw_payload.deconstruct();
let (call, extra, _) = raw_payload.deconstruct();
let address = <Runtime as frame_system::Config>::Lookup::unlookup(account);
Some((call, (address, signature, tx_ext)))
Some((call, (address, signature, extra)))
}
}
@@ -636,32 +633,12 @@ parameter_types! {
pub Prefix: &'static [u8] = b"Pay ROCs to the Rococo account:";
}
#[cfg(feature = "runtime-benchmarks")]
pub struct ClaimsHelper;
#[cfg(feature = "runtime-benchmarks")]
use frame_support::dispatch::DispatchInfo;
#[cfg(feature = "runtime-benchmarks")]
impl claims::BenchmarkHelperTrait<RuntimeCall, DispatchInfo> for ClaimsHelper {
fn default_call_and_info() -> (RuntimeCall, DispatchInfo) {
use frame_support::dispatch::GetDispatchInfo;
let call = RuntimeCall::Claims(claims::Call::attest {
statement: claims::StatementKind::Regular.to_text().to_vec(),
});
let info = call.get_dispatch_info();
(call, info)
}
}
impl claims::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting;
type Prefix = Prefix;
type MoveClaimOrigin = EnsureRoot<AccountId>;
type WeightInfo = weights::runtime_common_claims::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ClaimsHelper;
}
parameter_types! {
@@ -1470,8 +1447,8 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type SignedBlock = generic::SignedBlock<Block>;
/// `BlockId` type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;
/// The extension to the basic transaction logic.
pub type TxExtension = (
/// The `SignedExtension` to the basic transaction logic.
pub type SignedExtra = (
frame_system::CheckNonZeroSender<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
@@ -1484,7 +1461,7 @@ pub type TxExtension = (
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// All migrations that will run on the next runtime upgrade.
///
@@ -1698,7 +1675,7 @@ pub type Executive = frame_executive::Executive<
Migrations,
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, TxExtension>;
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
parameter_types! {
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
@@ -1769,9 +1746,7 @@ mod benches {
[pallet_scheduler, Scheduler]
[pallet_sudo, Sudo]
[frame_system, SystemBench::<Runtime>]
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_payment, TransactionPayment]
[pallet_treasury, Treasury]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
@@ -2265,7 +2240,6 @@ sp_api::impl_runtime_apis! {
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use frame_benchmarking::baseline::Pallet as Baseline;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
@@ -2286,7 +2260,6 @@ sp_api::impl_runtime_apis! {
use frame_support::traits::WhitelistedStorageKeys;
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use frame_benchmarking::baseline::Pallet as Baseline;
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
use sp_storage::TrackedStorageKey;