Documentation
¶
Index ¶
- Variables
- func GetAccountCount() int
- type Account
- type BlobMultiTestConfig
- type BlobSingleTestConfig
- type BlobTestConfig
- type CommonTestConfig
- type Config
- func (c *Config) GetAccountss() []Account
- func (c *Config) GetLogPath() string
- func (c *Config) GetNodeCount() int
- func (c *Config) GetNodeName(index int) string
- func (c *Config) GetOutputPath() string
- func (c *Config) GetServerAddress() string
- func (c *Config) GetTestMode() string
- func (c *Config) GetTxFuzzingConfig() TxFuzzingConfig
- func (c *Config) IsFuzzingEnabled() bool
- func (c *Config) IsMonitoringEnabled() bool
- func (c *Config) IsTxFuzzingEnabled() bool
- func (c *Config) PrintConfig()
- type FuzzingConfig
- type GetPooledTxsTestConfig
- type LargeTransactionsTestConfig
- type LogConfig
- type MonitoringConfig
- type MultiNodeTestConfig
- type OneTransactionTestConfig
- type OutputConfig
- type P2PConfig
- type PathsConfig
- type ServerConfig
- type SingleNodeTestConfig
- type SoftLimitReportModeConfig
- type SoftLimitSingleModeConfig
- type SoftLimitTestModeConfig
- type TestConfig
- type TxFuzzerConfig
- type TxFuzzingConfig
Constants ¶
This section is empty.
Variables ¶
var PredefinedAccounts = []Account{
{Address: "0x8943545177806ED17B9F23F0a21ee5948eCaa776", PrivateKey: "bcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31"},
{Address: "0xE25583099BA105D9ec0A67f5Ae86D90e50036425", PrivateKey: "39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d"},
{Address: "0x614561D2d143621E126e87831AEF287678B442b8", PrivateKey: "53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710"},
{Address: "0xf93Ee4Cf8c6c40b329b0c0626F28333c132CF241", PrivateKey: "ab63b23eb7941c1251757e24b3d2350d2bc05c3c388d06f8fe6feafefb1e8c70"},
{Address: "0x802dCbE1B1A97554B4F50DB5119E37E8e7336417", PrivateKey: "5d2344259f42259f82d2c140aa66102ba89b57b4883ee441a8b312622bd42491"},
{Address: "0xAe95d8DA9244C37CaC0a3e16BA966a8e852Bb6D6", PrivateKey: "27515f805127bebad2fb9b183508bdacb8c763da16f54e0678b16e8f28ef3fff"},
{Address: "0x2c57d1CFC6d5f8E4182a56b4cf75421472eBAEa4", PrivateKey: "7ff1a4c1d57e5e784d327c4c7651e952350bc271f156afb3d00d20f5ef924856"},
{Address: "0x741bFE4802cE1C4b5b00F9Df2F5f179A1C89171A", PrivateKey: "3a91003acaf4c21b3953d94fa4a6db694fa69e5242b2e37be05dd82761058899"},
{Address: "0xc3913d4D8bAb4914328651C2EAE817C8b78E1f4c", PrivateKey: "bb1d0f125b4fb2bb173c318cdead45468474ca71474e2247776b2b4c0fa2d3f5"},
{Address: "0x65D08a056c17Ae13370565B04cF77D2AfA1cB9FA", PrivateKey: "850643a0224065ecce3882673c21f56bcf6eef86274cc21cadff15930b59fc8c"},
{Address: "0x3e95dFbBaF6B348396E6674C7871546dCC568e56", PrivateKey: "94eb3102993b41ec55c241060f47daa0f6372e2e3ad7e91612ae36c364042e44"},
{Address: "0x5918b2e647464d4743601a865753e64C8059Dc4F", PrivateKey: "daf15504c22a352648a71ef2926334fe040ac1d5005019e09f6c979808024dc7"},
{Address: "0x589A698b7b7dA0Bec545177D3963A2741105C7C9", PrivateKey: "eaba42282ad33c8ef2524f07277c03a776d98ae19f581990ce75becb7cfa1c23"},
{Address: "0x4d1CB4eB7969f8806E2CaAc0cbbB71f88C8ec413", PrivateKey: "3fd98b5187bf6526734efaa644ffbb4e3670d66f5d0268ce0323ec09124bff61"},
{Address: "0xF5504cE2BcC52614F121aff9b93b2001d92715CA", PrivateKey: "5288e2f440c7f0cb61a9be8afdeb4295f786383f96f5e35eb0c94ef103996b64"},
{Address: "0xF61E98E7D47aB884C244E39E031978E33162ff4b", PrivateKey: "f296c7802555da2a5a662be70e078cbd38b44f96f8615ae529da41122ce8db05"},
{Address: "0xf1424826861ffbbD25405F5145B5E50d0F1bFc90", PrivateKey: "bf3beef3bd999ba9f2451e06936f0423cd62b815c9233dd3bc90f7e02a1e8673"},
{Address: "0xfDCe42116f541fc8f7b0776e2B30832bD5621C85", PrivateKey: "6ecadc396415970e91293726c3f5775225440ea0844ae5616135fd10d66b5954"},
{Address: "0xD9211042f35968820A3407ac3d80C725f8F75c14", PrivateKey: "a492823c3e193d6c595f37a18e3c06650cf4c74558cc818b16130b293716106f"},
{Address: "0xD8F3183DEF51A987222D845be228e0Bbb932C222", PrivateKey: "c5114526e042343c6d1899cad05e1c00ba588314de9b96929914ee0df18d46b2"},
{Address: "0xafF0CA253b97e54440965855cec0A8a2E2399896", PrivateKey: "04b9f63ecf84210c5366c66d68fa1f5da1fa4f634fad6dfc86178e4d79ff9e59"},
}
PredefinedAccounts are the accounts available when using ethereum-package to create a local test environment
Functions ¶
func GetAccountCount ¶
func GetAccountCount() int
GetAccountCount returns the total number of predefined accounts
Types ¶
type Account ¶
type Account struct {
Address string `yaml:"address"` // 公钥地址
PrivateKey string `yaml:"private_key"` // 私钥(不含0x前缀)
}
func GetAccount ¶
GetAccount returns a specific account by index
func GetPredefinedAccounts ¶
func GetPredefinedAccounts() []Account
GetPredefinedAccounts returns the predefined accounts
type BlobMultiTestConfig ¶
type BlobMultiTestConfig struct {
NodeIndices []int `yaml:"node_indices"`
Nonces []string `yaml:"nonces"`
BlobCount int `yaml:"blob_count"`
BlobDataSize int `yaml:"blob_data_size"`
MaxFeePerBlobGas string `yaml:"max_fee_per_blob_gas"`
GeneratorType string `yaml:"generator_type"`
TotalTransactions int `yaml:"total_transactions"`
SendIntervalMS int `yaml:"send_interval_ms"`
ParallelExecution bool `yaml:"parallel_execution"`
VerifyTransactions bool `yaml:"verify_transactions"`
SaveHashes bool `yaml:"save_hashes"`
}
BlobMultiTestConfig configures blob multi-node test
type BlobSingleTestConfig ¶
type BlobSingleTestConfig struct {
NodeIndex int `yaml:"node_index"`
Nonce string `yaml:"nonce"`
BlobCount int `yaml:"blob_count"`
BlobDataSize int `yaml:"blob_data_size"`
MaxFeePerBlobGas string `yaml:"max_fee_per_blob_gas"`
GeneratorType string `yaml:"generator_type"` // random, pattern, zero, l2-data
TotalTransactions int `yaml:"total_transactions"`
SendIntervalMS int `yaml:"send_interval_ms"`
VerifyTransactions bool `yaml:"verify_transactions"`
SaveHashes bool `yaml:"save_hashes"`
FromAccountIndex int `yaml:"from_account_index"` // Index of sender account in accounts array (default: 0)
ToAccountIndex int `yaml:"to_account_index"` // Index of receiver account in accounts array (default: 1)
}
BlobSingleTestConfig configures blob single-node test
type BlobTestConfig ¶
type BlobTestConfig struct {
// Basic configuration
BlobCount int `yaml:"blob_count"` // Number of blobs per transaction (1-6)
BlobDataSize int `yaml:"blob_data_size"` // Size of blob data in bytes
MaxFeePerBlobGas string `yaml:"max_fee_per_blob_gas"` // Max fee per blob gas (in wei)
// Test scenarios
Scenarios []string `yaml:"scenarios"` // random, pattern, zero, l2-data
// Node configuration
SingleNodeIndex int `yaml:"single_node_index"` // Node index for single-node tests
MultiNodeIndices []int `yaml:"multi_node_indices"` // Node indices for multi-node tests
// Nonce configuration for blob tests
SingleNodeNonce string `yaml:"single_node_nonce"` // "auto" or numeric string
MultiNodeNonces []string `yaml:"multi_node_nonces"` // Array of "auto" or numeric strings
// Account configuration
FromAccountIndex int `yaml:"from_account_index"` // Index of sender account (default: 0)
ToAccountIndex int `yaml:"to_account_index"` // Index of receiver account (default: 1)
// Verification configuration
VerifyBeaconAPI bool `yaml:"verify_beacon_api"` // Whether to verify via Beacon API
BeaconEndpoint string `yaml:"beacon_endpoint"` // Beacon node endpoint
VerifyAfterBlocks int `yaml:"verify_after_blocks"` // Wait N blocks before verification
// Batch test configuration
BatchSize int `yaml:"batch_size"` // Number of transactions per batch
TotalBlobTxs int `yaml:"total_blob_txs"` // Total number of blob transactions to send
SendInterval int `yaml:"send_interval_ms"` // Interval between sends in milliseconds
// Stress test configuration
StressTestDuration int `yaml:"stress_test_duration_sec"` // Duration for stress test in seconds
MaxConcurrent int `yaml:"max_concurrent"` // Max concurrent blob txs
FillBlobs bool `yaml:"fill_blobs"` // Fill all 6 blobs per tx
}
BlobTestConfig holds blob transaction test configuration
type CommonTestConfig ¶
type CommonTestConfig struct {
TimeoutSeconds int `yaml:"timeout_seconds"`
RetryCount int `yaml:"retry_count"`
DelayBetweenRequestsMS int `yaml:"delay_between_requests_ms"`
DefaultGasLimit uint64 `yaml:"default_gas_limit"`
DefaultGasTipCap string `yaml:"default_gas_tip_cap"`
DefaultGasFeeCap string `yaml:"default_gas_fee_cap"`
}
CommonTestConfig holds defaults and common knobs
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Mode string `yaml:"mode"`
P2P P2PConfig `yaml:"p2p"`
Fuzzing FuzzingConfig `yaml:"fuzzing"`
TxFuzzing TxFuzzingConfig `yaml:"tx_fuzz"`
Monitoring MonitoringConfig `yaml:"monitoring"`
Output OutputConfig `yaml:"output"`
Log LogConfig `yaml:"log"`
Paths PathsConfig `yaml:"paths"`
Test TestConfig `yaml:"test"`
Accounts []Account `yaml:"accounts"`
// Transaction defaults - can be configured or use defaults
ChainIDValue int64 `yaml:"chain_id"`
DefaultGasTipCapValue string `yaml:"default_gas_tip_cap"` // in wei, e.g. "3000000000"
DefaultGasFeeCapValue string `yaml:"default_gas_fee_cap"` // in wei, e.g. "30000000000"
// Computed fields (initialized from above values)
ChainID *big.Int
DefaultGasTipCap *big.Int
DefaultGasFeeCap *big.Int
}
Config represents the main configuration structure
func LoadConfig ¶
LoadConfig loads configuration from the specified YAML file
func (*Config) GetAccountss ¶
func (*Config) GetLogPath ¶
GetLogPath returns the full log directory path
func (*Config) GetNodeCount ¶
GetNodeCount returns the number of configured nodes
func (*Config) GetNodeName ¶
GetNodeName returns the node name by index
func (*Config) GetOutputPath ¶
GetOutputPath returns the full output directory path
func (*Config) GetServerAddress ¶
GetServerAddress returns the full server address
func (*Config) GetTestMode ¶
GetTestMode returns the test mode
func (*Config) GetTxFuzzingConfig ¶
func (c *Config) GetTxFuzzingConfig() TxFuzzingConfig
GetTxFuzzingConfig returns the transaction fuzzing configuration
func (*Config) IsFuzzingEnabled ¶
IsFuzzingEnabled returns whether fuzzing is enabled
func (*Config) IsMonitoringEnabled ¶
IsMonitoringEnabled returns whether monitoring is enabled
func (*Config) IsTxFuzzingEnabled ¶
IsTxFuzzingEnabled returns true if transaction fuzzing is enabled
func (*Config) PrintConfig ¶
func (c *Config) PrintConfig()
PrintConfig prints the current configuration (for debugging)
type FuzzingConfig ¶
type FuzzingConfig struct {
Enabled bool `yaml:"enabled"`
MaxIterations int `yaml:"max_iterations"`
MutationRate float64 `yaml:"mutation_rate"`
Seed int64 `yaml:"seed"`
Protocols []string `yaml:"protocols"`
}
FuzzingConfig holds fuzzing-related configuration
type GetPooledTxsTestConfig ¶
type GetPooledTxsTestConfig struct {
NodeIndex int `yaml:"node_index"`
HashFilePath string `yaml:"hash_file_path"`
FallbackPath string `yaml:"fallback_file_path"`
VerifyHashes bool `yaml:"verify_hashes"`
PrintResults bool `yaml:"print_results"`
}
GetPooledTxsTestConfig configures pooled tx query test
type LargeTransactionsTestConfig ¶
type LargeTransactionsTestConfig struct {
NodeIndex int `yaml:"node_index"`
TransactionCount int `yaml:"transaction_count"`
NonceStart string `yaml:"nonce_start"` // number or max_uint64
FromAccountIndex int `yaml:"from_account_index"`
ToAccountIndex int `yaml:"to_account_index"`
ValueWei string `yaml:"value"`
SaveHashes bool `yaml:"save_hashes"`
BatchSend bool `yaml:"batch_send"`
}
LargeTransactionsTestConfig configures large batch tx test
type LogConfig ¶
type LogConfig struct {
Directory string `yaml:"directory"`
Template string `yaml:"template"`
AutoGenerate bool `yaml:"auto_generate"`
IncludeDetails bool `yaml:"include_details"`
}
LogConfig holds log configuration
type MonitoringConfig ¶
type MonitoringConfig struct {
Enabled bool `yaml:"enabled"`
LogLevel string `yaml:"log_level"`
MetricsPort int `yaml:"metrics_port"`
ReportInterval int `yaml:"report_interval"`
}
MonitoringConfig holds monitoring configuration
type MultiNodeTestConfig ¶
type MultiNodeTestConfig struct {
BatchSize int `yaml:"batch_size"`
Nonces []string `yaml:"nonces"`
AccountStrategy string `yaml:"account_strategy"`
VerifyTransactions bool `yaml:"verify_transactions"`
SaveHashes bool `yaml:"save_hashes"`
ParallelExecution bool `yaml:"parallel_execution"`
}
MultiNodeTestConfig contains multi-node test overrides
type OneTransactionTestConfig ¶
type OneTransactionTestConfig struct {
NodeIndex int `yaml:"node_index"`
Nonce string `yaml:"nonce"`
FromAccountIndex int `yaml:"from_account_index"`
ToAccountIndex int `yaml:"to_account_index"`
ValueWei string `yaml:"value"`
VerifyInPool bool `yaml:"verify_in_pool"`
PrintTx bool `yaml:"print_transaction"`
}
OneTransactionTestConfig configures single tx test
type OutputConfig ¶
type OutputConfig struct {
Directory string `yaml:"directory"`
Format string `yaml:"format"`
Compress bool `yaml:"compress"`
}
OutputConfig holds output configuration
type P2PConfig ¶
type P2PConfig struct {
MaxPeers int `yaml:"max_peers"`
ListenPort int `yaml:"listen_port"`
BootstrapNodes []string `yaml:"bootstrap_nodes"`
JWTSecret string `yaml:"jwt_secret"`
NodeNames []string `yaml:"node_names"`
}
P2PConfig holds P2P network configuration
type PathsConfig ¶
type PathsConfig struct {
TxHashes string `yaml:"tx_hashes"`
TxHashesExt string `yaml:"tx_hashes_ext"`
}
PathsConfig holds file paths configuration
type ServerConfig ¶
type ServerConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Timeout int `yaml:"timeout"`
}
ServerConfig holds server-related configuration
type SingleNodeTestConfig ¶
type SingleNodeTestConfig struct {
NodeIndex int `yaml:"node_index"`
Nonce string `yaml:"nonce"`
BatchSize int `yaml:"batch_size"`
AccountStrategy string `yaml:"account_strategy"` // predefined, random, custom
FromAccountIndex int `yaml:"from_account_index"`
ToAccountIndex int `yaml:"to_account_index"`
VerifyTransactions bool `yaml:"verify_transactions"`
SaveHashes bool `yaml:"save_hashes"`
}
SingleNodeTestConfig contains single-node test overrides
type SoftLimitReportModeConfig ¶
type SoftLimitReportModeConfig struct {
IncludeDetails bool `yaml:"include_details"`
}
SoftLimitReportModeConfig for report generation
type SoftLimitSingleModeConfig ¶
type SoftLimitSingleModeConfig struct {
NodeIndex int `yaml:"node_index"`
HashCount int `yaml:"hash_count"`
Nonce string `yaml:"nonce"`
TimeoutSeconds int `yaml:"timeout_seconds"`
VerifyResponse bool `yaml:"verify_response"`
}
SoftLimitSingleModeConfig for single client soft limit
type SoftLimitTestModeConfig ¶
type SoftLimitTestModeConfig struct {
Scenarios []int `yaml:"scenarios"`
TimeoutMultiplier int `yaml:"timeout_multiplier"`
MinTimeoutSeconds int `yaml:"min_timeout_seconds"`
MaxTimeoutSeconds int `yaml:"max_timeout_seconds"`
TestAllNodes bool `yaml:"test_all_nodes"`
ReportFormat string `yaml:"report_format"` // detailed, summary, json
}
SoftLimitTestModeConfig configures soft limit (all clients) test
type TestConfig ¶
type TestConfig struct {
Mode string `yaml:"mode"`
SingleNodeIndex int `yaml:"single_node_index"`
SingleNodeNonce string `yaml:"single_node_nonce"` // "auto" or numeric string
SingleNodeBatchSize int `yaml:"single_node_batch_size"`
MultiNodeBatchSize int `yaml:"multi_node_batch_size"`
MultiNodeNonces []string `yaml:"multi_node_nonces"` // Array of "auto" or numeric strings
SoftLimitScenarios []int `yaml:"soft_limit_scenarios"`
DefaultTimeoutSeconds int `yaml:"default_timeout_seconds"`
GetPooledTxsNodeIndex int `yaml:"get_pooled_txs_node_index"`
BlobTest BlobTestConfig `yaml:"blob_test"`
// New per-mode sections (backward compatible): if set in YAML, tests will prefer these
Common CommonTestConfig `yaml:"common"`
SingleNode SingleNodeTestConfig `yaml:"single_node"`
MultiNode MultiNodeTestConfig `yaml:"multi_node"`
SoftLimit SoftLimitTestModeConfig `yaml:"soft_limit"`
SoftLimitSingle SoftLimitSingleModeConfig `yaml:"soft_limit_single"`
SoftLimitReport SoftLimitReportModeConfig `yaml:"soft_limit_report"`
GetPooledTxs GetPooledTxsTestConfig `yaml:"get_pooled_txs"`
OneTransaction OneTransactionTestConfig `yaml:"one_transaction"`
LargeTxs LargeTransactionsTestConfig `yaml:"large_transactions"`
BlobSingle BlobSingleTestConfig `yaml:"blob_single"`
BlobMulti BlobMultiTestConfig `yaml:"blob_multi"`
}
TestConfig holds test-related configuration
type TxFuzzerConfig ¶
type TxFuzzerConfig struct {
TxPerSecond int `yaml:"tx_per_second"`
FuzzDurationSec int `yaml:"fuzz_duration_sec"`
RPCEndpoints []string `yaml:"rpc_endpoints"`
// Error handling and retry configuration
MaxRetries int `yaml:"max_retries" json:"maxRetries"` // Maximum retry attempts
RetryDelay time.Duration `yaml:"retry_delay" json:"retryDelay"` // Delay between retries
CircuitBreaker bool `yaml:"circuit_breaker" json:"circuitBreaker"` // Enable circuit breaker
FailureThreshold int `yaml:"failure_threshold" json:"failureThreshold"` // Circuit breaker failure threshold
}
TxFuzzerConfig holds transaction fuzzer configuration
type TxFuzzingConfig ¶
type TxFuzzingConfig struct {
Enabled bool `yaml:"enabled"`
RPCEndpoint string `yaml:"rpc_endpoint"`
ChainID int64 `yaml:"chain_id"`
MaxGasPrice int64 `yaml:"max_gas_price"` // in wei
MaxGasLimit uint64 `yaml:"max_gas_limit"`
TxPerSecond int `yaml:"tx_per_second"`
FuzzDurationSec int `yaml:"fuzz_duration_sec"`
Seed int64 `yaml:"seed"`
UseAccounts bool `yaml:"use_accounts"` // whether to use predefined accounts
}
TxFuzzingConfig holds transaction fuzzing configuration