mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-03 10:32:05 +00:00
* ci: Fix linter complaint (#9645)
Fixes a very silly linter complaint that makes absolutely no sense and is blocking the merging of several PRs.
---
#### PR checklist
- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
(cherry picked from commit 83b7f4ad5b)
# Conflicts:
# .github/workflows/lint.yml
# .golangci.yml
# cmd/tendermint/commands/debug/util.go
* Resolve conflicts
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* ci: Sync golangci-lint config with main
Minus the spelling configuration that restricts spelling to US English
only.
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* make format
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove usage of deprecated io/ioutil package
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove unused mockBlockStore
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* blockchain/v2: Remove unused method
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Bulk fix lints
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* lint: Ignore auto-generated query PEG
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
74 lines
1.9 KiB
Go
74 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/informalsystems/tm-load-test/pkg/loadtest"
|
|
|
|
"github.com/tendermint/tendermint/test/loadtime/payload"
|
|
)
|
|
|
|
// Ensure all of the interfaces are correctly satisfied.
|
|
var (
|
|
_ loadtest.ClientFactory = (*ClientFactory)(nil)
|
|
_ loadtest.Client = (*TxGenerator)(nil)
|
|
)
|
|
|
|
// ClientFactory implements the loadtest.ClientFactory interface.
|
|
type ClientFactory struct {
|
|
ID []byte
|
|
}
|
|
|
|
// TxGenerator is responsible for generating transactions.
|
|
// TxGenerator holds the set of information that will be used to generate
|
|
// each transaction.
|
|
type TxGenerator struct {
|
|
id []byte
|
|
conns uint64
|
|
rate uint64
|
|
size uint64
|
|
}
|
|
|
|
func main() {
|
|
u := [16]byte(uuid.New()) // generate run ID on startup
|
|
if err := loadtest.RegisterClientFactory("loadtime-client", &ClientFactory{ID: u[:]}); err != nil {
|
|
panic(err)
|
|
}
|
|
loadtest.Run(&loadtest.CLIConfig{
|
|
AppName: "loadtime",
|
|
AppShortDesc: "Generate timestamped transaction load.",
|
|
AppLongDesc: "loadtime generates transaction load for the purpose of measuring the end-to-end latency of a transaction from submission to execution in a Tendermint network.", //nolint:lll
|
|
DefaultClientFactory: "loadtime-client",
|
|
})
|
|
}
|
|
|
|
func (f *ClientFactory) ValidateConfig(cfg loadtest.Config) error {
|
|
psb, err := payload.MaxUnpaddedSize()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if psb > cfg.Size {
|
|
return fmt.Errorf("payload size exceeds configured size")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (f *ClientFactory) NewClient(cfg loadtest.Config) (loadtest.Client, error) {
|
|
return &TxGenerator{
|
|
id: f.ID,
|
|
conns: uint64(cfg.Connections),
|
|
rate: uint64(cfg.Rate),
|
|
size: uint64(cfg.Size),
|
|
}, nil
|
|
}
|
|
|
|
func (c *TxGenerator) GenerateTx() ([]byte, error) {
|
|
return payload.NewBytes(&payload.Payload{
|
|
Connections: c.conns,
|
|
Rate: c.rate,
|
|
Size: c.size,
|
|
Id: c.id,
|
|
})
|
|
}
|