Documentation
¶
Index ¶
- func GetRandomAddress(randSrc *rand.Rand) *common.Address
- func LightSummary(results []Sample, startTime, endTime time.Time, rl *rate.Limiter)
- func NewHexwordReader(randSrc *rand.Rand) io.Reader
- func OutputRawBytes(rawTx []byte) error
- func OutputRawTransaction(tx *ethtypes.Transaction) error
- func Run(ctx context.Context, cfg *config.Config) error
- func SummarizeResults(ctx context.Context, c *ethclient.Client, rpc *ethrpc.Client, ...) error
- type Account
- type AccountPool
- func (ap *AccountPool) Add(ctx context.Context, privateKey *ecdsa.PrivateKey, startNonce *uint64) error
- func (ap *AccountPool) AddN(ctx context.Context, privateKeys ...*ecdsa.PrivateKey) error
- func (ap *AccountPool) AddRandom(ctx context.Context) error
- func (ap *AccountPool) AddRandomN(ctx context.Context, n uint64) error
- func (ap *AccountPool) AddReusableNonce(ctx context.Context, address common.Address, nonce uint64) error
- func (ap *AccountPool) AllAccountsReady() (bool, int, int)
- func (ap *AccountPool) FundAccounts(ctx context.Context) error
- func (ap *AccountPool) Next(ctx context.Context) (Account, error)
- func (ap *AccountPool) Nonces(ctx context.Context, onlyUsed bool) *sync.Map
- func (ap *AccountPool) NoncesOf(address common.Address) (startNonce, nonce uint64)
- func (ap *AccountPool) NumberOfPendingTxs(ctx context.Context) (uint64, error)
- func (ap *AccountPool) RefreshNonce(ctx context.Context, address common.Address) error
- func (ap *AccountPool) ReturnFunds(ctx context.Context) error
- func (ap *AccountPool) SetFundingAmount(amount *big.Int)
- type AccountPoolConfig
- type BlobCommitment
- type BlockSummary
- type Latency
- type Runner
- func (r *Runner) Close()
- func (r *Runner) GetAccountPool() *AccountPool
- func (r *Runner) GetClient() *ethclient.Client
- func (r *Runner) GetConfig() *config.Config
- func (r *Runner) GetDependencies() *mode.Dependencies
- func (r *Runner) GetResults() []Sample
- func (r *Runner) Init(ctx context.Context) error
- func (r *Runner) RecordSample(goRoutineID, requestID int64, err error, start, end time.Time, nonce uint64)
- func (r *Runner) Run(ctx context.Context) error
- func (r *Runner) SetModes(m []mode.Runner)
- type Sample
- type Summary
- type SummaryOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRandomAddress ¶
GetRandomAddress generates a random Ethereum address.
func LightSummary ¶
LightSummary prints a quick summary of load test results.
func NewHexwordReader ¶
NewHexwordReader creates a new hexword reader with the given random source.
func OutputRawBytes ¶
OutputRawBytes outputs raw bytes as a 0x-prefixed hex string.
func OutputRawTransaction ¶
func OutputRawTransaction(tx *ethtypes.Transaction) error
OutputRawTransaction outputs a raw signed transaction as hex.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account represents a single account used by the load test.
func (*Account) PrivateKey ¶
func (a *Account) PrivateKey() *ecdsa.PrivateKey
PrivateKey returns the private key of the account.
type AccountPool ¶
type AccountPool struct {
// contains filtered or unexported fields
}
AccountPool manages a pool of accounts used for sending transactions.
func NewAccountPool ¶
func NewAccountPool(ctx context.Context, client *ethclient.Client, cfg *AccountPoolConfig) (*AccountPool, error)
NewAccountPool creates a new account pool with the given configuration.
func (*AccountPool) Add ¶
func (ap *AccountPool) Add(ctx context.Context, privateKey *ecdsa.PrivateKey, startNonce *uint64) error
Add adds an account to the pool with the given private key.
func (*AccountPool) AddN ¶
func (ap *AccountPool) AddN(ctx context.Context, privateKeys ...*ecdsa.PrivateKey) error
AddN adds multiple accounts to the pool with the given private keys.
func (*AccountPool) AddRandom ¶
func (ap *AccountPool) AddRandom(ctx context.Context) error
AddRandom adds a random account to the pool.
func (*AccountPool) AddRandomN ¶
func (ap *AccountPool) AddRandomN(ctx context.Context, n uint64) error
AddRandomN adds N random accounts to the pool.
func (*AccountPool) AddReusableNonce ¶
func (ap *AccountPool) AddReusableNonce(ctx context.Context, address common.Address, nonce uint64) error
AddReusableNonce adds a reusable nonce to the account with the given address.
func (*AccountPool) AllAccountsReady ¶
func (ap *AccountPool) AllAccountsReady() (bool, int, int)
AllAccountsReady returns whether all accounts are ready for use.
func (*AccountPool) FundAccounts ¶
func (ap *AccountPool) FundAccounts(ctx context.Context) error
FundAccounts funds all accounts in the pool.
func (*AccountPool) Next ¶
func (ap *AccountPool) Next(ctx context.Context) (Account, error)
Next returns the next account in the pool.
func (*AccountPool) NoncesOf ¶
func (ap *AccountPool) NoncesOf(address common.Address) (startNonce, nonce uint64)
NoncesOf returns the start nonce and current nonce for a given address.
func (*AccountPool) NumberOfPendingTxs ¶
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.
func (*AccountPool) RefreshNonce ¶
RefreshNonce refreshes the nonce for the given address.
func (*AccountPool) ReturnFunds ¶
func (ap *AccountPool) ReturnFunds(ctx context.Context) error
ReturnFunds returns funds from all accounts back to the funding account.
func (*AccountPool) SetFundingAmount ¶
func (ap *AccountPool) SetFundingAmount(amount *big.Int)
SetFundingAmount updates the funding amount for the pool.
type AccountPoolConfig ¶
type AccountPoolConfig struct {
FundingPrivateKey *ecdsa.PrivateKey
FundingAmount *big.Int
RateLimit float64
EthCallOnly bool
RefundRemainingFunds bool
CheckBalanceBeforeFunding bool
LegacyTxMode bool
// Gas override settings
ForceGasPrice uint64
ForcePriorityGasPrice uint64
GasPriceMultiplier *big.Float
ChainSupportBaseFee bool
}
AccountPoolConfig holds configuration for the account pool.
type BlobCommitment ¶
type BlobCommitment struct {
Blob [131072]byte // kzg4844.Blob size
Commitment [48]byte // kzg4844.Commitment size
Proof [48]byte // kzg4844.Proof size
VersionedHash common.Hash
}
BlobCommitment holds blob transaction commitment data.
type BlockSummary ¶
type BlockSummary struct {
Block *rpctypes.RawBlockResponse
Receipts map[common.Hash]rpctypes.RawTxReceipt
Latencies map[uint64]time.Duration
}
BlockSummary holds data about a single block's transactions.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner handles the execution of a load test.
func (*Runner) GetAccountPool ¶
func (r *Runner) GetAccountPool() *AccountPool
GetAccountPool returns the account pool.
func (*Runner) GetDependencies ¶
func (r *Runner) GetDependencies() *mode.Dependencies
GetDependencies returns the mode dependencies.
func (*Runner) GetResults ¶
GetResults returns all recorded samples.
type Sample ¶
type Sample struct {
GoRoutineID int64
RequestID int64
RequestTime time.Time
WaitTime time.Duration
Receipt string
IsError bool
Nonce uint64
}
Sample represents a single load test request/response.