DocsReference@proto-kit/sequencerClassesDefaultMempoolSorting

@proto-kit/sequencerDocs


Documentation / @proto-kit/sequencer / DefaultMempoolSorting

Class: DefaultMempoolSorting

Lifecycle of a SequencerModule

start(): Executed to execute any logic required to start the module

Extends

Implements

Constructors

new DefaultMempoolSorting()

new DefaultMempoolSorting(): DefaultMempoolSorting

Returns

DefaultMempoolSorting

Inherited from

SequencerModule.constructor

Properties

currentConfig

protected currentConfig: undefined | NoConfig

Store the config separately, so that we can apply additional checks when retrieving it via the getter

Inherited from

SequencerModule.currentConfig

Defined in

packages/common/dist/config/ConfigurableModule.d.ts:17


presets

static presets: Presets<unknown> = {}

Inherited from

SequencerModule.presets

Defined in

packages/sequencer/src/sequencer/builder/SequencerModule.ts:20

Accessors

config

Get Signature

get config(): Config

Returns

Config

Set Signature

set config(config): void

Parameters

config: Config

Returns

void

Inherited from

SequencerModule.config

Defined in

packages/common/dist/config/ConfigurableModule.d.ts:18

Methods

create()

create(childContainerProvider): void

Parameters

childContainerProvider: ChildContainerProvider

Returns

void

Inherited from

SequencerModule.create

Defined in

packages/common/dist/config/ConfigurableModule.d.ts:20


enablePostSorting()

enablePostSorting(): boolean

Indicate whether to do pre-sorting (as it’s expensive depending on your block size)

Returns

boolean

Implementation of

MempoolSorting.enablePostSorting

Defined in

packages/sequencer/src/mempool/sorting/DefaultMempoolSorting.ts:20


postSorting()

postSorting(transactions): PendingTransaction[]

Postsorting happens on the sequencer-side. It’s less fast but can take in any two transactions and directly compare them based on arbitrary logic

Parameters

transactions: PendingTransaction[]

Returns

PendingTransaction[]

Implementation of

MempoolSorting.postSorting

Defined in

packages/sequencer/src/mempool/sorting/DefaultMempoolSorting.ts:24


presortingPriority()

presortingPriority(tx): number

Presorting happens on the backend (i.e. the DB), before the data travels to the sequencer. It’s very fast, but limited to only integer sorting. The value returned here has to be static per transaction, since it will be sorted and compared on the DB-side.

Parameters

tx: PendingTransaction

Returns

number

Priority of the transaction - larger is better (therefore will be put in the block first)

Implementation of

MempoolSorting.presortingPriority

Defined in

packages/sequencer/src/mempool/sorting/DefaultMempoolSorting.ts:28


start()

start(): Promise<void>

Start the module and all it’s functionality. The returned Promise has to resolve after initialization, since it will block in the sequencer init. That means that you mustn’t await server.start() for example.

Returns

Promise<void>

Overrides

SequencerModule.start

Defined in

packages/sequencer/src/mempool/sorting/DefaultMempoolSorting.ts:16