config

package
v0.1.102 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyRequiresERC20

func AnyRequiresERC20(m []Mode) bool

AnyRequiresERC20 returns true if any mode requires an ERC20 contract.

func AnyRequiresERC721

func AnyRequiresERC721(m []Mode) bool

AnyRequiresERC721 returns true if any mode requires an ERC721 contract.

func AnyRequiresLoadTestContract

func AnyRequiresLoadTestContract(m []Mode) bool

AnyRequiresLoadTestContract returns true if any mode requires the LoadTester contract.

func HasMode

func HasMode(mode Mode, m []Mode) bool

HasMode returns true if the given mode is in the slice.

func HasUniqueModes

func HasUniqueModes(m []Mode) bool

HasUniqueModes returns true if all modes in the slice are unique.

func RequiresERC20

func RequiresERC20(m Mode) bool

RequiresERC20 returns true if the mode requires an ERC20 contract.

func RequiresERC721

func RequiresERC721(m Mode) bool

RequiresERC721 returns true if the mode requires an ERC721 contract.

func RequiresLoadTestContract

func RequiresLoadTestContract(m Mode) bool

RequiresLoadTestContract returns true if the mode requires the LoadTester contract.

Types

type Config

type Config struct {
	// Network connection
	RPCURL  string
	ChainID uint64
	Proxy   string

	// Test parameters
	Requests    int64
	Concurrency int64
	BatchSize   uint64
	TimeLimit   int64
	Seed        int64

	// Transaction options
	PrivateKey         string
	ToAddress          string
	EthAmountInWei     uint64
	RandomRecipients   bool
	LegacyTxMode       bool
	FireAndForget      bool
	WaitForReceipt     bool
	ReceiptRetryMax    uint
	ReceiptRetryDelay  uint // initial delay in milliseconds
	OutputRawTxOnly    bool
	StartNonce         uint64
	GasPriceMultiplier float64

	// Gas options
	ForceGasLimit         uint64
	ForceGasPrice         uint64
	ForcePriorityGasPrice uint64
	MaxBaseFeeWei         uint64

	// Rate limiting
	RateLimit                  float64
	AdaptiveRateLimit          bool
	AdaptiveTargetSize         uint64
	AdaptiveRateLimitIncrement uint64
	AdaptiveCycleDuration      uint64
	AdaptiveBackoffFactor      float64

	// Mode configuration
	Modes []string

	// Call-only options
	EthCallOnly            bool
	EthCallOnlyLatestBlock bool

	// Contract addresses
	LoadTestContractAddress string
	ERC20Address            string
	ERC721Address           string

	// Mode-specific options
	StoreDataSize       uint64
	RecallLength        uint64
	BlockBatchSize      uint64
	ContractAddress     string
	ContractCallData    string
	ContractCallPayable bool
	BlobFeeCap          uint64

	// Account pool options
	SendingAccountsCount      uint64
	AccountFundingAmount      *big.Int
	PreFundSendingAccounts    bool
	RefundRemainingFunds      bool
	SendingAccountsFile       string
	CheckBalanceBeforeFunding bool

	// Summary output
	ShouldProduceSummary bool
	SummaryOutputMode    string

	// UniswapV3-specific config (set by uniswapv3 subcommand)
	UniswapV3 *UniswapV3Config

	// Computed fields (populated during initialization)
	CurrentGasPrice       *big.Int
	CurrentGasTipCap      *big.Int
	CurrentNonce          *uint64
	ECDSAPrivateKey       *ecdsa.PrivateKey
	FromETHAddress        *common.Address
	ToETHAddress          *common.Address
	ContractETHAddress    *common.Address
	SendAmount            *big.Int
	ChainSupportBaseFee   bool
	ParsedModes           []Mode
	MultiMode             bool
	BigGasPriceMultiplier *big.Float
}

Config holds all load test parameters.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the Config and returns an error if any validation fails.

type Mode

type Mode int

Mode represents the type of load test to perform.

const (
	ModeERC20 Mode = iota
	ModeERC721
	ModeBlob
	ModeContractCall
	ModeDeploy
	ModeIncrement
	ModeRandom
	ModeRecall
	ModeRPC
	ModeStore
	ModeTransaction
	ModeUniswapV3
)

Mode constants. If you add a new constant, run: make gen-load-test-modes

func ParseMode

func ParseMode(modeStr string) (Mode, error)

ParseMode converts a mode string to a Mode enum. Note: "R" (capital) is the alias for recall mode, while "r" is for random mode.

func (Mode) String

func (i Mode) String() string

type UniswapV3Config

type UniswapV3Config struct {
	// Pre-deployed contract addresses (as hex strings).
	FactoryV3                          string
	Multicall                          string
	ProxyAdmin                         string
	TickLens                           string
	NFTDescriptorLib                   string
	NonfungibleTokenPositionDescriptor string
	TransparentUpgradeableProxy        string
	NonfungiblePositionManager         string
	Migrator                           string
	Staker                             string
	QuoterV2                           string
	SwapRouter                         string
	WETH9                              string
	PoolToken0                         string
	PoolToken1                         string

	// Pool and swap parameters.
	PoolFees        float64
	SwapAmountInput uint64
}

UniswapV3Config holds UniswapV3-specific configuration.

func (*UniswapV3Config) Validate

func (c *UniswapV3Config) Validate() error

Validate validates the UniswapV3Config and returns an error if any validation fails.

Jump to

Keyboard shortcuts

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