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
|
gasFeeCap = "1000000007" # gasFeeCap to use for the deployment txs - env: $ETH_DEPLOYMENT_GAS_FEE_CAP
|
||||||
|
|
||||||
[contractSpammer]
|
[contractSpammer]
|
||||||
frequency = 0 # how often to send a transaction (in milliseconds) - env: $ETH_CALL_FREQ
|
frequency = 0 # how often to send a transaction (in milliseconds, 0 for no delay) - env: $ETH_CALL_FREQ
|
||||||
totalNumber = 500000 # total number of transactions to send (per sender) - env: $ETH_CALL_TOTAL_NUMBER
|
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
|
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
|
# 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
|
# 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
|
gasFeeCap = "1000000007" # gasFeeCap to use for the eth call txs - env: $ETH_CALL_GAS_FEE_CAP
|
||||||
|
|
||||||
[sendSpammer]
|
[sendSpammer]
|
||||||
frequency = 0 # how often to send a transaction (in milliseconds) - env: $ETH_SEND_FREQ
|
frequency = 0 # how often to send a transaction (in milliseconds, 0 for no delay) - env: $ETH_SEND_FREQ
|
||||||
totalNumber = 100000 # total number of transactions to send (per sender) - env: $ETH_SEND_TOTAL_NUMBER
|
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
|
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
|
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
|
gasTipCap = "1000000000" # gasTipCap to use for the eth transfer txs - env: $ETH_SEND_GAS_TIP_CAP
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -235,6 +236,11 @@ func NewCallConfig(chainID *big.Int) (*CallConfig, error) {
|
|||||||
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalNumber := viper.GetInt(ethCallTotalNumber)
|
||||||
|
if totalNumber <= 0 {
|
||||||
|
totalNumber = math.MaxInt
|
||||||
|
}
|
||||||
|
|
||||||
return &CallConfig{
|
return &CallConfig{
|
||||||
ChainID: chainID,
|
ChainID: chainID,
|
||||||
GasLimit: viper.GetUint64(ethCallGasLimit),
|
GasLimit: viper.GetUint64(ethCallGasLimit),
|
||||||
@ -243,7 +249,7 @@ func NewCallConfig(chainID *big.Int) (*CallConfig, error) {
|
|||||||
MethodName: methodName,
|
MethodName: methodName,
|
||||||
ABI: parsedABI,
|
ABI: parsedABI,
|
||||||
Frequency: frequency,
|
Frequency: frequency,
|
||||||
TotalNumber: viper.GetInt(ethCallTotalNumber),
|
TotalNumber: totalNumber,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,6 +269,11 @@ func NewSendConfig(chainID *big.Int) (*SendConfig, error) {
|
|||||||
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
frequency = viper.GetDuration(ethCallFrequency) * time.Millisecond
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalNumber := viper.GetInt(ethSendTotalNumber)
|
||||||
|
if totalNumber <= 0 {
|
||||||
|
totalNumber = math.MaxInt
|
||||||
|
}
|
||||||
|
|
||||||
return &SendConfig{
|
return &SendConfig{
|
||||||
ChainID: chainID,
|
ChainID: chainID,
|
||||||
Frequency: frequency,
|
Frequency: frequency,
|
||||||
@ -270,6 +281,6 @@ func NewSendConfig(chainID *big.Int) (*SendConfig, error) {
|
|||||||
GasLimit: viper.GetUint64(ethSendGasLimit),
|
GasLimit: viper.GetUint64(ethSendGasLimit),
|
||||||
GasFeeCap: big.NewInt(viper.GetInt64(ethSendGasFeeCap)),
|
GasFeeCap: big.NewInt(viper.GetInt64(ethSendGasFeeCap)),
|
||||||
GasTipCap: big.NewInt(viper.GetInt64(ethSendGasTipCap)),
|
GasTipCap: big.NewInt(viper.GetInt64(ethSendGasTipCap)),
|
||||||
TotalNumber: viper.GetInt(ethSendTotalNumber),
|
TotalNumber: totalNumber,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ func (gen *TxGenerator) genCalls(wg *sync.WaitGroup, txChan chan<- *types.Transa
|
|||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
contractAddr := callConfig.ContractAddrs[rand.Intn(len(callConfig.ContractAddrs))]
|
contractAddr := callConfig.ContractAddrs[rand.Intn(len(callConfig.ContractAddrs))]
|
||||||
log.Debugf("Generating call from %s to %s.", senderAddr.Hex(), contractAddr.Hex())
|
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 {
|
if err != nil {
|
||||||
errChan <- err
|
errChan <- err
|
||||||
continue
|
continue
|
||||||
|
@ -18,7 +18,7 @@ type TxWatcher struct {
|
|||||||
|
|
||||||
func NewTxWatcher(ethClient *ethclient.Client) *TxWatcher {
|
func NewTxWatcher(ethClient *ethclient.Client) *TxWatcher {
|
||||||
return &TxWatcher{
|
return &TxWatcher{
|
||||||
PendingTxCh: make(chan *types.Transaction, 1000),
|
PendingTxCh: make(chan *types.Transaction, 2500),
|
||||||
ethClient: ethClient,
|
ethClient: ethClient,
|
||||||
quitCh: make(chan bool),
|
quitCh: make(chan bool),
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ func (tw *TxWatcher) Start() {
|
|||||||
select {
|
select {
|
||||||
case tx := <-tw.PendingTxCh:
|
case tx := <-tw.PendingTxCh:
|
||||||
tw.counter += 1
|
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))
|
logrus.Debugf("TxW: checking on TX %s (%d in channel)", tx.Hash().Hex(), len(tw.PendingTxCh))
|
||||||
var receipt *types.Receipt = nil
|
var receipt *types.Receipt = nil
|
||||||
sleep := time.Millisecond
|
sleep := time.Millisecond
|
||||||
|
Loading…
Reference in New Issue
Block a user