difftreelog
style(Scheduler) removed unlikely to be used commented chunks of code
in: master
3 files changed
pallets/scheduler/src/lib.rsdiffbeforeafterboth159/// The location of a scheduled task that can be used to remove it.159/// The location of a scheduled task that can be used to remove it.160pub type TaskAddress<BlockNumber> = (BlockNumber, u32);160pub type TaskAddress<BlockNumber> = (BlockNumber, u32);161162/*#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))] todo remove completely?163#[derive(Clone, RuntimeDebug, Encode, Decode)]164struct ScheduledV1<Call, BlockNumber> {165 maybe_id: Option<Vec<u8>>,166 priority: schedule::Priority,167 call: Call,168 maybe_periodic: Option<schedule::Period<BlockNumber>>,169}*/170161171/// Information regarding an item to be executed in the future.162/// Information regarding an item to be executed in the future.172#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]163#[cfg_attr(any(feature = "std", test), derive(PartialEq, Eq))]187 _phantom: PhantomData<AccountId>,178 _phantom: PhantomData<AccountId>,188}179}189190/// The current version of Scheduled struct.191/*pub type Scheduled<Call, BlockNumber, PalletsOrigin, AccountId, PreDispatch> =192 ScheduledV2<Call, BlockNumber, PalletsOrigin, AccountId, PreDispatch>;*/193194// A value placed in storage that represents the current version of the Scheduler storage.195// This value is used by the `on_runtime_upgrade` logic to determine whether we run196// storage migration logic.197/*#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] todo remove completely?198enum Releases {199 V1,200 V2,201}202203impl Default for Releases {204 fn default() -> Self {205 Releases::V1206 }207}*/208180209#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]181#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]210pub struct CallSpec {182pub struct CallSpec {224 <<T as Config>::CallExecutor as DispatchCall<T, H160>>::Pre196 <<T as Config>::CallExecutor as DispatchCall<T, H160>>::Pre225 >>>;197 >>>;226198 227 /*pub SpecAgenda: map hasher(twox_64_concat) T::BlockNumber todo remove completely?228 => Vec<Option<CallSpec>>;*/229230 /// Lookup from identity to the block number and index of the task.199 /// Lookup from identity to the block number and index of the task.231 Lookup: map hasher(twox_64_concat) Vec<u8> => Option<TaskAddress<T::BlockNumber>>;200 Lookup: map hasher(twox_64_concat) Vec<u8> => Option<TaskAddress<T::BlockNumber>>;232233 // / Storage version of the pallet.234 // /235 // / New networks start with last version.236 //StorageVersion build(|_| Releases::V2): Releases; todo remove completely?237 }201 }238}202}239203runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -811,19 +811,6 @@
type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;
-/*fn get_signed_extra(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtra {
- (
- frame_system::CheckSpecVersion::<Runtime>::new(),
- frame_system::CheckGenesis::<Runtime>::new(),
- frame_system::CheckEra::<Runtime>::from(Era::Immortal),
- frame_system::CheckNonce::<Runtime>::from(frame_system::Pallet::<Runtime>::account_nonce(
- from,
- )),
- frame_system::CheckWeight::<Runtime>::new(),
- ChargeTransactionPayment::new(0),
- )
-}*/
-
#[derive(Default, Encode, Decode, Clone, TypeInfo)]
pub struct SchedulerPreDispatch {
tip: Balance,
@@ -849,29 +836,12 @@
type Pre = SchedulerPreDispatch;
fn dispatch_call(
- //signer: <T as frame_system::Config>::AccountId,
pre_dispatch: Self::Pre,
call: <T as pallet_unq_scheduler::Config>::Call,
) -> Result<
Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
TransactionValidityError,
> {
- /*let dispatch_info = call.get_dispatch_info();
-
- let extrinsic = fp_self_contained::CheckedExtrinsic::<
- AccountId,
- Call,
- SignedExtra,
- SelfContainedSignedInfo,
- > {
- signed: CheckedSignature::<AccountId, SignedExtra, SelfContainedSignedInfo>::Signed(
- signer.clone().into(),
- get_signed_extra(signer.clone().into()),
- ),
- function: call.clone().into(),
- };
-
- extrinsic.apply::<Runtime>(&dispatch_info, 0)*/
let dispatch_info = call.get_dispatch_info();
let pre = (
pre_dispatch.tip,
tests/src/scheduler.test.tsdiffbeforeafterboth--- a/tests/src/scheduler.test.ts
+++ b/tests/src/scheduler.test.ts
@@ -3,7 +3,7 @@
// file 'LICENSE', which is part of this source code package.
//
-import chai, { expect } from 'chai';
+import chai, {expect} from 'chai';
import chaiAsPromised from 'chai-as-promised';
import privateKey from './substrate/privateKey';
import {
@@ -27,8 +27,6 @@
getTokenOwner,
getGenericResult,
scheduleTransferFundsPeriodicExpectSuccess,
- setCollectionLimitsExpectSuccess,
- getDetailedCollectionInfo,
getFreeBalance,
confirmSponsorshipByKeyExpectSuccess,
} from './util/helpers';
@@ -142,51 +140,6 @@
expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));
});
});
-
- /*it.skip('Going bankrupt after sponsoring a scheduled transaction does not nullify the transaction', async () => {
- await usingApi(async (api) => {
- // Find two empty, unused accounts
- const zeroBalance = await findUnusedAddress(api);
- const zeroBalanceSponsor = await findUnusedAddress(api);
-
- const collectionId = await createCollectionExpectSuccess();
-
- // Grace these with money, enough to cover future transactions
- const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
- await submitTransactionAsync(alice, balanceTx);
-
- // Grace these with money, enough to cover future transactions
- const balanceSponsorTx = api.tx.balances.transfer(zeroBalanceSponsor.address, 1n * UNIQUE);
- await submitTransactionAsync(alice, balanceSponsorTx);
-
- // Set a collection sponsor
- await setCollectionSponsorExpectSuccess(collectionId, zeroBalanceSponsor.address);
- await confirmSponsorshipExpectSuccess(collectionId);
-
- // Add zeroBalance address to allow list
- await enablePublicMintingExpectSuccess(alice, collectionId);
- await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
-
- // Mint a fresh NFT
- const tokenId = await createItemExpectSuccess(zeroBalance, collectionId, 'NFT');
-
- // Schedule transfer of the NFT a few blocks ahead
- // const waitForBlocks = 4;
- await scheduleTransferExpectSuccess(collectionId, tokenId, zeroBalance, alice, 1, 4);
- //await waitAfterScheduleExpectSuccess(collectionId, tokenId, alice, 3);
-
- // Get rid of the account's funds before the scheduled transaction takes place
- const emptyBalanceSponsorTx = api.tx.balances.setBalance(zeroBalanceSponsor.address, 0, 0);
- const sudoTx = api.tx.sudo.sudo(emptyBalanceSponsorTx as any);
- const events = await submitTransactionAsync(alice, sudoTx);
- expect(getGenericResult(events).success).to.be.true;
-
- // Wait for a certain number of blocks, save for the ones that already happened while accepting the late transactions
- await waitNewBlocks(4);
-
- expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));
- });
- });*/
it('Sponsor going bankrupt does not impact a scheduled transaction', async () => {
const collectionId = await createCollectionExpectSuccess();