0 == unlimited
This commit is contained in:
parent
10c0d50ded
commit
bbe9f45805
@ -10,8 +10,8 @@
|
||||
gasFeeCap = "1000000007" # gasFeeCap to use for the deployment txs - env: $ETH_DEPLOYMENT_GAS_FEE_CAP
|
||||
|
||||
[contractSpammer]
|
||||
frequency = 0 # how often to send a transaction (in milliseconds) - env: $ETH_CALL_FREQ
|
||||
totalNumber = 500000 # total number of transactions to send (per sender) - env: $ETH_CALL_TOTAL_NUMBER
|
||||
frequency = 0 # how often to send a transaction (in milliseconds, 0 for no delay) - env: $ETH_CALL_FREQ
|
||||
totalNumber = 0 # total number of transactions to send (per sender, 0 for unlimited) - env: $ETH_CALL_TOTAL_NUMBER
|
||||
abiPath = "sol/build/Test.abi" # path to the abi file for the contract we are calling - env: $ETH_CALL_ABI_PATH
|
||||
# NOTE: we expect to be calling a method such as Put(address addr, uint256 val) where the first argument is an
|
||||
# integer than we can increment to store values at new locations in the contract trie (to grow it) and
|
||||
@ -22,8 +22,8 @@
|
||||
gasFeeCap = "1000000007" # gasFeeCap to use for the eth call txs - env: $ETH_CALL_GAS_FEE_CAP
|
||||
|
||||
[sendSpammer]
|
||||
frequency = 0 # how often to send a transaction (in milliseconds) - env: $ETH_SEND_FREQ
|
||||
totalNumber = 100000 # total number of transactions to send (per sender) - env: $ETH_SEND_TOTAL_NUMBER
|
||||
frequency = 0 # how often to send a transaction (in milliseconds, 0 for no delay) - env: $ETH_SEND_FREQ
|
||||
totalNumber = 0 # total number of transactions to send (per sender, 0 for unlimited) - env: $ETH_SEND_TOTAL_NUMBER
|
||||
amount = "10000" # amount of wei (1x10^-18 ETH) to send in each tx (be mindful of the genesis allocations) - env: $ETH_SEND_AMOUNT
|
||||
gasLimit = 21000 # gasLimit to use for the eth transfer txs - env: $ETH_SEND_GAS_LIMIT
|
||||
gasTipCap = "1000000000" # gasTipCap to use for the eth transfer txs - env: $ETH_SEND_GAS_TIP_CAP
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"math/big"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -235,6 +236,11 @@ func NewCallConfig(chainID *big.Int) (*CallConfig, error) {
|
||||
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
||||
}
|
||||
|
||||
totalNumber := viper.GetInt(ethCallTotalNumber)
|
||||
if totalNumber <= 0 {
|
||||
totalNumber = math.MaxInt
|
||||
}
|
||||
|
||||
return &CallConfig{
|
||||
ChainID: chainID,
|
||||
GasLimit: viper.GetUint64(ethCallGasLimit),
|
||||
@ -243,7 +249,7 @@ func NewCallConfig(chainID *big.Int) (*CallConfig, error) {
|
||||
MethodName: methodName,
|
||||
ABI: parsedABI,
|
||||
Frequency: frequency,
|
||||
TotalNumber: viper.GetInt(ethCallTotalNumber),
|
||||
TotalNumber: totalNumber,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -263,6 +269,11 @@ func NewSendConfig(chainID *big.Int) (*SendConfig, error) {
|
||||
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
||||
}
|
||||
|
||||
totalNumber := viper.GetInt(ethSendTotalNumber)
|
||||
if totalNumber <= 0 {
|
||||
totalNumber = math.MaxInt
|
||||
}
|
||||
|
||||
return &SendConfig{
|
||||
ChainID: chainID,
|
||||
Frequency: frequency,
|
||||
@ -270,6 +281,6 @@ func NewSendConfig(chainID *big.Int) (*SendConfig, error) {
|
||||
GasLimit: viper.GetUint64(ethSendGasLimit),
|
||||
GasFeeCap: big.NewInt(viper.GetInt64(ethSendGasFeeCap)),
|
||||
GasTipCap: big.NewInt(viper.GetInt64(ethSendGasTipCap)),
|
||||
TotalNumber: viper.GetInt(ethSendTotalNumber),
|
||||
TotalNumber: totalNumber,
|
||||
}, nil
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func (gen *TxGenerator) genCalls(wg *sync.WaitGroup, txChan chan<- *types.Transa
|
||||
case <-ticker.C:
|
||||
contractAddr := callConfig.ContractAddrs[rand.Intn(len(callConfig.ContractAddrs))]
|
||||
log.Debugf("Generating call from %s to %s.", senderAddr.Hex(), contractAddr.Hex())
|
||||
data, err := callConfig.ABI.Pack(callConfig.MethodName, contractAddr, big.NewInt(time.Now().UnixNano()))
|
||||
data, err := callConfig.ABI.Pack(callConfig.MethodName, contractAddr, big.NewInt(int64(i)))
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
continue
|
||||
|
@ -18,7 +18,7 @@ type TxWatcher struct {
|
||||
|
||||
func NewTxWatcher(ethClient *ethclient.Client) *TxWatcher {
|
||||
return &TxWatcher{
|
||||
PendingTxCh: make(chan *types.Transaction, 1000),
|
||||
PendingTxCh: make(chan *types.Transaction, 2500),
|
||||
ethClient: ethClient,
|
||||
quitCh: make(chan bool),
|
||||
}
|
||||
@ -32,7 +32,7 @@ func (tw *TxWatcher) Start() {
|
||||
select {
|
||||
case tx := <-tw.PendingTxCh:
|
||||
tw.counter += 1
|
||||
if 0 == tw.counter%10 {
|
||||
if 0 == tw.counter%50 {
|
||||
logrus.Debugf("TxW: checking on TX %s (%d in channel)", tx.Hash().Hex(), len(tw.PendingTxCh))
|
||||
var receipt *types.Receipt = nil
|
||||
sleep := time.Millisecond
|
||||
|
Loading…
Reference in New Issue
Block a user