loadtest

package
v0.1.99 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadtestCmd = &cobra.Command{
	Use:   "loadtest",
	Short: "Run a generic load test against an Eth/EVM style JSON-RPC endpoint.",
	Long:  loadTestUsage,
	Args:  cobra.NoArgs,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		rpcUrl := flag_loader.GetRpcUrlFlagValue(cmd)
		privateKey := flag_loader.GetPrivateKeyFlagValue(cmd)
		if rpcUrl != nil {
			inputLoadTestParams.RPCUrl = *rpcUrl
		}
		if privateKey != nil {
			inputLoadTestParams.PrivateKey = *privateKey
		}
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		zerolog.DurationFieldUnit = time.Second
		zerolog.DurationFieldInteger = true

		return checkLoadtestFlags()
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		return runLoadTest(cmd.Context())
	},
}

LoadtestCmd represents the loadtest command

Functions

This section is empty.

Types

type Account added in v0.1.80

type Account struct {
	// contains filtered or unexported fields
}

Structure used by the account pool to control the current state of an account

func (*Account) Address added in v0.1.80

func (a *Account) Address(ctx context.Context) common.Address

Returns the address of the account

func (*Account) Nonce added in v0.1.80

func (a *Account) Nonce(ctx context.Context) uint64

Returns the nonce of the account

func (*Account) PrivateKey added in v0.1.80

func (a *Account) PrivateKey(ctx context.Context) *ecdsa.PrivateKey

Returns the private key of the account

type AccountPool added in v0.1.80

type AccountPool struct {
	// contains filtered or unexported fields
}

Structure to control accounts used by the tests

func NewAccountPool added in v0.1.80

func NewAccountPool(ctx context.Context, client *ethclient.Client, fundingPrivateKey *ecdsa.PrivateKey, fundingAmount *big.Int, rateLimit float64) (*AccountPool, error)

Creates a new account pool with the given funding private key. The funding private key is used to fund the accounts in the pool. The funding amount is the amount of ether to send to each account. The client is used to interact with the network to get account information and also to send transactions to fund accounts.

func (*AccountPool) Add added in v0.1.80

func (ap *AccountPool) Add(ctx context.Context, privateKey *ecdsa.PrivateKey, startNonce *uint64) error

Adds an account to the pool with the given private key

func (*AccountPool) AddN added in v0.1.80

func (ap *AccountPool) AddN(ctx context.Context, privateKeys ...*ecdsa.PrivateKey) error

Adds multiple accounts to the pool with the given private keys

func (*AccountPool) AddRandom added in v0.1.80

func (ap *AccountPool) AddRandom(ctx context.Context) error

Adds a random account to the pool

func (*AccountPool) AddRandomN added in v0.1.80

func (ap *AccountPool) AddRandomN(ctx context.Context, n uint64) error

Adds N random accounts to the pool

func (*AccountPool) AddReusableNonce added in v0.1.80

func (ap *AccountPool) AddReusableNonce(ctx context.Context, address common.Address, nonce uint64) error

Adds a reusable nonce to the account with the given address

func (*AccountPool) AllAccountsReady added in v0.1.90

func (ap *AccountPool) AllAccountsReady() (bool, int, int)

func (*AccountPool) FundAccounts added in v0.1.80

func (ap *AccountPool) FundAccounts(ctx context.Context) error

Funds all accounts in the pool

func (*AccountPool) Next added in v0.1.80

func (ap *AccountPool) Next(ctx context.Context) (Account, error)

Returns the next account in the pool

func (*AccountPool) Nonces added in v0.1.80

func (ap *AccountPool) Nonces(ctx context.Context, onlyUsed bool) *sync.Map

Returns the nonces of all accounts in the pool

func (*AccountPool) NoncesOf added in v0.1.80

func (ap *AccountPool) NoncesOf(address common.Address) (startNonce, nonce uint64)

func (*AccountPool) NumberOfPendingTxs added in v0.1.80

func (ap *AccountPool) NumberOfPendingTxs(ctx context.Context) (uint64, error)

NumberOfPendingTxs returns the difference between the internal nonce and the network pending nonce for all accounts in the pool. It uses caching to avoid making too many requests to the network.

func (*AccountPool) RefreshNonce added in v0.1.80

func (ap *AccountPool) RefreshNonce(ctx context.Context, address common.Address) error

Refreshes the nonce for the given address

func (*AccountPool) ReturnFunds added in v0.1.80

func (ap *AccountPool) ReturnFunds(ctx context.Context) error

type BlobCommitment

type BlobCommitment struct {
	Blob          kzg4844.Blob
	Commitment    kzg4844.Commitment
	Proof         kzg4844.Proof
	VersionedHash common.Hash
}

type IndexedActivity

type IndexedActivity struct {
	BlockNumbers    []string
	TransactionIDs  []string
	BlockIDs        []string
	Addresses       []string
	ERC20Addresses  []string
	ERC721Addresses []string
	Contracts       []string
	BlockNumber     uint64
	Transactions    []rpctypes.PolyTransaction
}

IndexedActivity is used to hold a bunch of values for testing an RPC

type Latency

type Latency struct {
	Min    float64
	Median float64
	Max    float64
}

type Summary

type Summary struct {
	BlockNumber uint64
	Time        time.Time
	GasLimit    uint64
	GasUsed     uint64
	NumTx       int
	Utilization float64
	Latencies   Latency
}

type SummaryOutput

type SummaryOutput struct {
	Summaries          []Summary
	SuccessfulTx       int64
	TotalTx            int64
	TotalMiningTime    time.Duration
	TotalGasUsed       uint64
	TransactionsPerSec float64
	GasPerSecond       float64
	Latencies          Latency
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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