Fix linter errors thrown by lll (#3970)

* Fix long line errors in abci, crypto, and libs packages

* Fix long lines in p2p and rpc packages

* Fix long lines in abci, state, and tools packages

* Fix long lines in behaviour and blockchain packages

* Fix long lines in cmd and config packages

* Begin fixing long lines in consensus package

* Finish fixing long lines in consensus package

* Add lll exclusion for lines containing URLs

* Fix long lines in crypto package

* Fix long lines in evidence package

* Fix long lines in mempool and node packages

* Fix long lines in libs package

* Fix long lines in lite package

* Fix new long line in node package

* Fix long lines in p2p package

* Ignore gocritic warning

* Fix long lines in privval package

* Fix long lines in rpc package

* Fix long lines in scripts package

* Fix long lines in state package

* Fix long lines in tools package

* Fix long lines in types package

* Enable lll linter
This commit is contained in:
Phil Salant
2019-10-17 04:42:28 -04:00
committed by Marko
parent 8ba159834f
commit bc572217c0
112 changed files with 1673 additions and 358 deletions

View File

@@ -22,6 +22,8 @@ func main() {
var durationInt, txsRate, connections, txSize int
var verbose bool
var outputFormat, broadcastTxMethod string
var usage = "tm-bench [-c 1] [-T 10] [-r 1000] [-s 250]" +
" [endpoints] [-output-format <plain|json> [-broadcast-tx-method <async|sync|commit>]]"
flagSet := flag.NewFlagSet("tm-bench", flag.ExitOnError)
flagSet.IntVar(&connections, "c", 1, "Connections to keep open per endpoint")
@@ -29,14 +31,20 @@ func main() {
flagSet.IntVar(&txsRate, "r", 1000, "Txs per second to send in a connection")
flagSet.IntVar(&txSize, "s", 250, "The size of a transaction in bytes, must be greater than or equal to 40.")
flagSet.StringVar(&outputFormat, "output-format", "plain", "Output format: plain or json")
flagSet.StringVar(&broadcastTxMethod, "broadcast-tx-method", "async", "Broadcast method: async (no guarantees; fastest), sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest)")
flagSet.StringVar(
&broadcastTxMethod,
"broadcast-tx-method",
"async",
"Broadcast method: async (no guarantees; fastest),"+
" sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest)",
)
flagSet.BoolVar(&verbose, "v", false, "Verbose output")
flagSet.Usage = func() {
fmt.Println(`Tendermint blockchain benchmarking tool.
Usage:
tm-bench [-c 1] [-T 10] [-r 1000] [-s 250] [endpoints] [-output-format <plain|json> [-broadcast-tx-method <async|sync|commit>]]
` + usage + `
Examples:
tm-bench localhost:26657`)

View File

@@ -165,7 +165,12 @@ func (m *Monitor) Stop() {
}
// main loop where we listen for events from the node
func (m *Monitor) listen(nodeName string, blockCh <-chan tmtypes.Header, blockLatencyCh <-chan float64, disconnectCh <-chan bool, quit <-chan struct{}) {
func (m *Monitor) listen(
nodeName string,
blockCh <-chan tmtypes.Header,
blockLatencyCh <-chan float64,
disconnectCh <-chan bool,
quit <-chan struct{}) {
logger := m.logger.With("node", nodeName)
for {

View File

@@ -61,7 +61,10 @@ func createValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter
stubs := make(map[string]interface{})
pubKey := ed25519.GenPrivKey().PubKey()
stubs["validators"] = ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}}
stubs["validators"] = ctypes.ResultValidators{
BlockHeight: blockHeight,
Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)},
}
stubs["status"] = ctypes.ResultStatus{ValidatorInfo: ctypes.ValidatorInfo{PubKey: pubKey}}
cdc := amino.NewCodec()
rpcClientMock := &mock.RpcClient{Stubs: stubs}

View File

@@ -53,7 +53,11 @@ func NewNode(rpcAddr string, options ...func(*Node)) *Node {
return NewNodeWithEventMeterAndRpcClient(rpcAddr, em, rpcClient, options...)
}
func NewNodeWithEventMeterAndRpcClient(rpcAddr string, em eventMeter, rpcClient rpc_client.HTTPClient, options ...func(*Node)) *Node {
func NewNodeWithEventMeterAndRpcClient(
rpcAddr string,
em eventMeter,
rpcClient rpc_client.HTTPClient,
options ...func(*Node)) *Node {
n := &Node{
rpcAddr: rpcAddr,
em: em,

View File

@@ -79,7 +79,10 @@ func startValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter)
stubs := make(map[string]interface{})
pubKey := ed25519.GenPrivKey().PubKey()
stubs["validators"] = ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}}
stubs["validators"] = ctypes.ResultValidators{
BlockHeight: blockHeight,
Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)},
}
stubs["status"] = ctypes.ResultStatus{ValidatorInfo: ctypes.ValidatorInfo{PubKey: pubKey}}
cdc := amino.NewCodec()
rpcClientMock := &mock.RpcClient{Stubs: stubs}

View File

@@ -67,7 +67,12 @@ func (o *Ton) printHeader() {
fmt.Fprintf(o.Output, "Avg block time: %.3f ms\n", n.AvgBlockTime)
fmt.Fprintf(o.Output, "Avg tx throughput: %.3f per sec\n", n.AvgTxThroughput)
fmt.Fprintf(o.Output, "Avg block latency: %.3f ms\n", n.AvgBlockLatency)
fmt.Fprintf(o.Output, "Active nodes: %d/%d (health: %s) Validators: %d\n", n.NumNodesMonitoredOnline, n.NumNodesMonitored, n.GetHealthString(), n.NumValidators)
fmt.Fprintf(o.Output,
"Active nodes: %d/%d (health: %s) Validators: %d\n",
n.NumNodesMonitoredOnline,
n.NumNodesMonitored,
n.GetHealthString(),
n.NumValidators)
}
func (o *Ton) printTable() {

View File

@@ -121,7 +121,13 @@ func TestRemoteSignerVoteSigningFailed(t *testing.T) {
)
}
func newMockSignerServer(t *testing.T, th *TestHarness, privKey crypto.PrivKey, breakProposalSigning bool, breakVoteSigning bool) *privval.SignerServer {
func newMockSignerServer(
t *testing.T,
th *TestHarness,
privKey crypto.PrivKey,
breakProposalSigning bool,
breakVoteSigning bool,
) *privval.SignerServer {
mockPV := types.NewMockPVWithParams(privKey, breakProposalSigning, breakVoteSigning)
dialerEndpoint := privval.NewSignerDialerEndpoint(

View File

@@ -61,7 +61,10 @@ Use "tm-signer-harness help <command>" for more information about that command.`
}
runCmd = flag.NewFlagSet("run", flag.ExitOnError)
runCmd.IntVar(&flagAcceptRetries, "accept-retries", defaultAcceptRetries, "The number of attempts to listen for incoming connections")
runCmd.IntVar(&flagAcceptRetries,
"accept-retries",
defaultAcceptRetries,
"The number of attempts to listen for incoming connections")
runCmd.StringVar(&flagBindAddr, "addr", defaultBindAddr, "Bind to this address for the testing")
runCmd.StringVar(&flagTMHome, "tmhome", defaultTMHome, "Path to the Tendermint home directory")
runCmd.Usage = func() {
@@ -76,7 +79,10 @@ Flags:`)
}
extractKeyCmd = flag.NewFlagSet("extract_key", flag.ExitOnError)
extractKeyCmd.StringVar(&flagKeyOutputPath, "output", defaultExtractKeyOutput, "Path to which signing key should be written")
extractKeyCmd.StringVar(&flagKeyOutputPath,
"output",
defaultExtractKeyOutput,
"Path to which signing key should be written")
extractKeyCmd.StringVar(&flagTMHome, "tmhome", defaultTMHome, "Path to the Tendermint home directory")
extractKeyCmd.Usage = func() {
fmt.Println(`Extracts a signing key from a local Tendermint instance for use in the remote