e2e: use more simple strings for generated transactions (#7513)

This commit is contained in:
Sam Kleinman
2022-01-05 12:17:23 -05:00
committed by GitHub
parent 4137c16d3f
commit 8564c5079f
5 changed files with 14 additions and 13 deletions

View File

@@ -113,7 +113,7 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
KeyType: keyType.Choose(r).(string),
Evidence: evidence.Choose(r).(int),
QueueType: opt["queueType"].(string),
TxSize: int64(txSize.Choose(r).(int)),
TxSize: txSize.Choose(r).(int),
}
var numSeeds, numValidators, numFulls, numLightClients int

View File

@@ -64,7 +64,7 @@ type Manifest struct {
QueueType string `toml:"queue_type"`
// Number of bytes per tx. Default is 1kb (1024)
TxSize int64
TxSize int
// ABCIProtocol specifies the protocol used to communicate with the ABCI
// application: "unix", "tcp", "grpc", or "builtin". Defaults to builtin.

View File

@@ -70,7 +70,7 @@ type Testnet struct {
KeyType string
Evidence int
LogLevel string
TxSize int64
TxSize int
ABCIProtocol string
}

View File

@@ -7,6 +7,7 @@ import (
"math/rand"
"time"
tmrand "github.com/tendermint/tendermint/libs/rand"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
"github.com/tendermint/tendermint/types"
@@ -85,7 +86,7 @@ func Load(ctx context.Context, r *rand.Rand, testnet *e2e.Testnet) error {
// generation is primarily the result of backpressure from the
// broadcast transaction, though there is still some timer-based
// limiting.
func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSize int64, networkSize int) {
func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSize int, networkSize int) {
timer := time.NewTimer(0)
defer timer.Stop()
defer close(chTx)
@@ -101,12 +102,7 @@ func loadGenerate(ctx context.Context, r *rand.Rand, chTx chan<- types.Tx, txSiz
// space, while reduce the size of the data in the app.
id := r.Int63n(100)
bz := make([]byte, txSize)
_, err := r.Read(bz)
if err != nil {
panic(fmt.Errorf("failed to read random bytes: %w", err))
}
tx := types.Tx(fmt.Sprintf("load-%X=%x", id, bz))
tx := types.Tx(fmt.Sprintf("load-%X=%s", id, tmrand.StrFromSource(r, txSize)))
select {
case <-ctx.Done():