Skip to content

Apply transaction-pool patch.#2019

Merged
sam0x17 merged 1 commit intodevnet-readyfrom
transaction-pool-patch
Sep 4, 2025
Merged

Apply transaction-pool patch.#2019
sam0x17 merged 1 commit intodevnet-readyfrom
transaction-pool-patch

Conversation

@shamil-gadelshin
Copy link
Collaborator

Description

This PR removes the effect of the transaction longevity on its priority.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run cargo fmt and cargo clippy to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

The transaction pool change: shamil-gadelshin/transaction-pool@5cc8837

Typescript code to verify with block explorer
import { ApiPromise, WsProvider } from '@polkadot/api';
import { Keyring } from '@polkadot/keyring';

const WS = process.env.WS || 'ws://127.0.0.1:9935';
const AMOUNT = BigInt(process.env.AMOUNT || 10_000_000n); // base units
const AMOUNT2 = BigInt(process.env.AMOUNT || 1_000_000n); // base units
const PERIOD = Number(process.env.ERA_PERIOD || 16);        

async function shortEraForBob(api: ApiPromise) {
  const head = await api.rpc.chain.getFinalizedHead();
  const header = await api.rpc.chain.getHeader(head);
  const current = header.number.toNumber();
  const era = api.registry.createType('ExtrinsicEra', { current, period: PERIOD });
  return { era, blockHash: head };
}

async function main() {
  const api = await ApiPromise.create({ provider: new WsProvider(WS) });
  const keyring = new Keyring({ type: 'sr25519' });
  const ALICE = keyring.addFromUri('//Alice');
  const BOB   = keyring.addFromUri('//Bob');

  console.log(`Connected to ${WS}. Submitting two transfers (no wait).`);

  // 1) ALICE → BOB (default mortality — no custom era)
  {
    const tx = api.tx.balances.transferAllowDeath(BOB.address, AMOUNT);
    await tx.signAsync(ALICE);              // default era & blockHash
    const hash = await tx.send();           // submit only; returns extrinsic hash
    console.log(`ALICE → BOB submitted: ${hash.toHex()}`);
  }

  // 2) BOB → ALICE (custom SHORT mortal era)
  {
    const { era, blockHash } = await shortEraForBob(api);
    const nonce = await api.rpc.system.accountNextIndex(BOB.address);

    const tx = api.tx.balances.transferAllowDeath(ALICE.address, AMOUNT2);
    await tx.signAsync(BOB, { era, blockHash, nonce }); // custom short era only here
 //   await tx.signAsync(BOB);
    const hash = await tx.send();                       // submit only; returns extrinsic hash
    console.log(`BOB → ALICE (short era=${PERIOD}) submitted: ${hash.toHex()}`);
  }

  await api.disconnect();
  console.log('Done.');
}

main().catch((e) => {
  console.error(e);
  process.exit(1);
});

@sam0x17 sam0x17 merged commit a7904e0 into devnet-ready Sep 4, 2025
56 of 57 checks passed
@sam0x17 sam0x17 mentioned this pull request Sep 4, 2025
@shamil-gadelshin shamil-gadelshin self-assigned this Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants