formbatchesint

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncludeBatchCreation

func IncludeBatchCreation(
	m dsl.Module,
	mc common.ModuleConfig,
	params *common.ModuleParams,
	commonState *common.State,
	logger logging.Logger,
)

IncludeBatchCreation registers event handlers for processing NewRequests and RequestBatch events.

Types

type State

type State struct {
	*common.State

	// The current epoch.
	// If a batch requests from a higher epoch is received, it needs to be buffered until its epoch is reached.
	Epoch tt.EpochNr

	// Progress made by all clients so far.
	// This data structure is used to avoid storing transactions that have already been delivered.
	ClientProgress *clientprogress.ClientProgress

	// Combined total payload size of all the transactions in the mempool.
	TotalPayloadSize int

	// The cummulative number of payload bytes of transactions that have not been output in batches in this epoch.
	// At the beginning of each epoch, this value is reset to TotalPayloadSize.
	UnproposedPayloadSize int

	// Number of transactions that have not yet been output in batches in the current epoch.
	// At the beginning of each epoch, this value is reset to Transactions.Len().
	NumUnproposed int

	// Iterator over the list transactions in the mempool.
	// At the start of each epoch, the iterator is reset to the start of the list.
	// This is necessary for re-emitting transactions that already have been emitted in the previous epoch
	// But failed to be agreed upon.
	Iterator *indexedlist.Iterator[tt.TxID, *trantorpbtypes.Transaction]

	// EarlyBatchRequests stores batch requests with a higher epoch number than the current epoch.
	// In Trantor, this can happen in a corner case
	// when advancing to a new epoch is delayed by the processing of the batch fetcher.
	// Note that these are different from PendingBatchRequests,
	// which are this epoch's batch requests waiting for a batch to fill (or a timeout)
	EarlyBatchRequests map[tt.EpochNr][]*mppbtypes.RequestBatchOrigin

	// Pending batch requests, i.e., this epoch's batch requests that have not yet been satisfied.
	// They are indexed by order of arrival.
	// Note that this only concerns batch requests from the current epoch.
	// Requests from future epochs are buffered separately.
	PendingBatchRequests map[int]*mppbtypes.RequestBatchOrigin

	// Index of the oldest pending batch request.
	FirstPendingBatchReqID int

	// Index to assign to the next new pending batch request.
	NextPendingBatchReqID int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL