txs

package
v0.5.2-call-depth-metrics Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: GPL-3.0, LGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent[T any] interface {
	Execute(ctx context.Context) error
}

Execute the work of the given agent.

func NewIssueNAgent

func NewIssueNAgent[T any](sequence TxSequence[T], worker Worker[T], n uint64) Agent[T]

NewIssueNAgent creates a new issueNAgent

type CreateTx

type CreateTx func(key *ecdsa.PrivateKey, nonce uint64) (*types.Transaction, error)

type TxSequence

type TxSequence[T any] interface {
	Chan() <-chan T
}

TxSequence provides an interface to return a channel of transactions. The sequence is responsible for closing the channel when there are no further transactions.

func ConvertTxSliceToSequence

func ConvertTxSliceToSequence(txs []*types.Transaction) TxSequence[*types.Transaction]

func GenerateTxSequence

func GenerateTxSequence(ctx context.Context, generator CreateTx, client ethclient.Client, key *ecdsa.PrivateKey, numTxs uint64) (TxSequence[*types.Transaction], error)

GenerateTxSequence fetches the current nonce of key and calls [generator] [numTxs] times sequentially to generate a sequence of transactions.

func GenerateTxSequences

func GenerateTxSequences(ctx context.Context, generator CreateTx, client ethclient.Client, keys []*ecdsa.PrivateKey, txsPerKey uint64) ([]TxSequence[*types.Transaction], error)

type Worker

type Worker[T any] interface {
	IssueTx(ctx context.Context, tx T) error
	ConfirmTx(ctx context.Context, tx T) error
	Close(ctx context.Context) error
}

Worker defines the interface for issuance and confirmation of transactions. The caller is responsible for calling Close to cleanup resources used by the worker at the end of the simulation.

Jump to

Keyboard shortcuts

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