Documentation
¶
Index ¶
- func GetAll() map[string]Runner
- func GetRandomAddress(deps *Dependencies) *common.Address
- func NewHexwordReader(deps *Dependencies) io.Reader
- func OutputRawBytes(rawTx []byte) error
- func OutputRawTransaction(tx *types.Transaction) error
- func Register(mode Runner)
- func TransactOptsToCallMsg(cfg *config.Config, gasLimit uint64) ethereum.CallMsg
- func TxToCallMsg(cfg *config.Config, tx *types.Transaction) ethereum.CallMsg
- type Dependencies
- type HexwordReader
- type IndexedActivity
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRandomAddress ¶
func GetRandomAddress(deps *Dependencies) *common.Address
GetRandomAddress generates a random Ethereum address using the given random source.
func NewHexwordReader ¶
func NewHexwordReader(deps *Dependencies) io.Reader
NewHexwordReader creates a new hexword reader with the given random source.
func OutputRawBytes ¶
OutputRawBytes outputs raw bytes as a 0x-prefixed hex string to stdout.
func OutputRawTransaction ¶
func OutputRawTransaction(tx *types.Transaction) error
OutputRawTransaction outputs a raw signed transaction as hex.
func TransactOptsToCallMsg ¶
TransactOptsToCallMsg converts bind.TransactOpts to an ethereum.CallMsg.
func TxToCallMsg ¶
TxToCallMsg converts a transaction to an ethereum.CallMsg.
Types ¶
type Dependencies ¶
type Dependencies struct {
// Ethereum clients
Client *ethclient.Client
RPCClient *ethrpc.Client
// Contract instances
LoadTesterContract *tester.LoadTester
LoadTesterAddress common.Address
ERC20Contract *tokens.ERC20
ERC20Address common.Address
ERC721Contract *tokens.ERC721
ERC721Address common.Address
// Mode-specific data
RecallTransactions []rpctypes.PolyTransaction
IndexedActivity *IndexedActivity
// Random source for deterministic randomness
RandSource *rand.Rand
RandSourceMu sync.Mutex
// UniswapV3 configuration (populated when uniswapv3 mode is used)
UniswapV3Config *uniswap.UniswapV3Config
UniswapV3PoolConfig *uniswap.PoolConfig
UniswapV3Pool *uniswapv3.IUniswapV3Pool
}
Dependencies holds shared resources needed by mode implementations.
func (*Dependencies) RandIntn ¶
func (d *Dependencies) RandIntn(n int) int
RandIntn returns a deterministic random int while guarding concurrent access.
type HexwordReader ¶
type HexwordReader struct {
// contains filtered or unexported fields
}
HexwordReader provides a reader that generates hex-word patterns.
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 holds indexed blockchain activity data for RPC testing.
type Runner ¶
type Runner interface {
// Name returns the canonical name of the mode.
Name() string
// Aliases returns alternative names/shortcuts for this mode.
Aliases() []string
// RequiresContract returns true if this mode needs the LoadTester contract.
RequiresContract() bool
// RequiresERC20 returns true if this mode needs an ERC20 contract.
RequiresERC20() bool
// RequiresERC721 returns true if this mode needs an ERC721 contract.
RequiresERC721() bool
// Init sets up any mode-specific state before execution.
Init(ctx context.Context, cfg *config.Config, deps *Dependencies) error
// Execute performs a single load test operation.
// Returns start time, end time, transaction hash, and any error.
Execute(ctx context.Context, cfg *config.Config, deps *Dependencies, opts *bind.TransactOpts) (start, end time.Time, txHash common.Hash, err error)
}
Runner defines the interface that all load test modes must implement.