diff --git a/.golangci.yml b/.golangci.yml index dc154dedcd6..cb8246fd3c3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,6 +45,7 @@ linters: - structcheck - tagliatelle - typecheck + # Prefer unparam over revive's unused param. It is more thorough in its checking. - unparam - varcheck - varnamelen @@ -76,10 +77,16 @@ linters-settings: max-blank-identifiers: 3 goconst: ignore-tests: true - maligned: - suggest-new: true misspell: locale: US + gci: + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - blank # blank imports + - dot # dot imports + - prefix(github.com/cometbft/cometbft, github.com/cometbft/cometbft-db) + custom-order: true depguard: rules: main: diff --git a/abci/client/grpc_client.go b/abci/client/grpc_client.go index 2aada664593..4949496311d 100644 --- a/abci/client/grpc_client.go +++ b/abci/client/grpc_client.go @@ -7,11 +7,12 @@ import ( "sync" "time" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/cometbft/cometbft/abci/types" cmtnet "github.com/cometbft/cometbft/internal/net" "github.com/cometbft/cometbft/internal/service" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) var _ Client = (*grpcClient)(nil) diff --git a/abci/client/grpc_client_test.go b/abci/client/grpc_client_test.go index 8fb87bce29e..85b410cd06d 100644 --- a/abci/client/grpc_client_test.go +++ b/abci/client/grpc_client_test.go @@ -8,14 +8,15 @@ import ( "testing" "time" - abciserver "github.com/cometbft/cometbft/abci/server" - "github.com/cometbft/cometbft/abci/types" - cmtnet "github.com/cometbft/cometbft/internal/net" - "github.com/cometbft/cometbft/libs/log" "github.com/stretchr/testify/require" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + abciserver "github.com/cometbft/cometbft/abci/server" + "github.com/cometbft/cometbft/abci/types" + cmtnet "github.com/cometbft/cometbft/internal/net" + "github.com/cometbft/cometbft/libs/log" ) func TestGRPC(t *testing.T) { diff --git a/abci/client/socket_client_test.go b/abci/client/socket_client_test.go index b2c5ef62829..57658995ad6 100644 --- a/abci/client/socket_client_test.go +++ b/abci/client/socket_client_test.go @@ -9,12 +9,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + abcicli "github.com/cometbft/cometbft/abci/client" "github.com/cometbft/cometbft/abci/server" "github.com/cometbft/cometbft/abci/types" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/service" - "github.com/stretchr/testify/require" ) func TestCalls(t *testing.T) { diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 470b27a138f..fb89993363d 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -9,6 +9,8 @@ import ( "os" "strings" + "github.com/spf13/cobra" + abcicli "github.com/cometbft/cometbft/abci/client" "github.com/cometbft/cometbft/abci/example/kvstore" "github.com/cometbft/cometbft/abci/server" @@ -18,7 +20,6 @@ import ( crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/libs/log" - "github.com/spf13/cobra" ) // client is a global variable so it can be reused by the console. diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 30f21dbb281..6df7aaeebbd 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -6,11 +6,12 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + abcicli "github.com/cometbft/cometbft/abci/client" abciserver "github.com/cometbft/cometbft/abci/server" "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" - "github.com/stretchr/testify/require" ) const ( diff --git a/abci/server/grpc_server.go b/abci/server/grpc_server.go index 31b1fc299dd..88631ae778d 100644 --- a/abci/server/grpc_server.go +++ b/abci/server/grpc_server.go @@ -4,10 +4,11 @@ import ( "context" "net" + "google.golang.org/grpc" + "github.com/cometbft/cometbft/abci/types" cmtnet "github.com/cometbft/cometbft/internal/net" "github.com/cometbft/cometbft/internal/service" - "google.golang.org/grpc" ) type GRPCServer struct { diff --git a/abci/tests/client_server_test.go b/abci/tests/client_server_test.go index 8a7bf26485b..b1af64dec48 100644 --- a/abci/tests/client_server_test.go +++ b/abci/tests/client_server_test.go @@ -3,10 +3,11 @@ package tests import ( "testing" + "github.com/stretchr/testify/require" + abciclient "github.com/cometbft/cometbft/abci/client" "github.com/cometbft/cometbft/abci/example/kvstore" abciserver "github.com/cometbft/cometbft/abci/server" - "github.com/stretchr/testify/require" ) func TestClientServerNoAddrPrefix(t *testing.T) { diff --git a/abci/types/messages.go b/abci/types/messages.go index b8e2fe41d41..42407083a11 100644 --- a/abci/types/messages.go +++ b/abci/types/messages.go @@ -4,9 +4,10 @@ import ( "io" "math" + "github.com/cosmos/gogoproto/proto" + pb "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/cometbft/cometbft/internal/protoio" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/abci/types/messages_test.go b/abci/types/messages_test.go index 41ea0218148..e70ebc7c8cc 100644 --- a/abci/types/messages_test.go +++ b/abci/types/messages_test.go @@ -6,10 +6,11 @@ import ( "strings" "testing" - cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" ) func TestMarshalJSON(t *testing.T) { diff --git a/abci/types/types.go b/abci/types/types.go index 9499fa08ad4..533e2fa5401 100644 --- a/abci/types/types.go +++ b/abci/types/types.go @@ -4,8 +4,9 @@ package types import ( "encoding/json" - v1 "github.com/cometbft/cometbft/api/cometbft/abci/v1" "github.com/cosmos/gogoproto/grpc" + + v1 "github.com/cometbft/cometbft/api/cometbft/abci/v1" ) type ( diff --git a/abci/types/types_test.go b/abci/types/types_test.go index fa48ab3c05c..f11af133e27 100644 --- a/abci/types/types_test.go +++ b/abci/types/types_test.go @@ -3,10 +3,11 @@ package types_test import ( "testing" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/merkle" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/crypto/merkle" ) func TestHashAndProveResults(t *testing.T) { diff --git a/cmd/cometbft/commands/compact.go b/cmd/cometbft/commands/compact.go index b3a6b5aeeca..327e1dbca68 100644 --- a/cmd/cometbft/commands/compact.go +++ b/cmd/cometbft/commands/compact.go @@ -5,11 +5,12 @@ import ( "path/filepath" "sync" - "github.com/cometbft/cometbft/libs/log" "github.com/spf13/cobra" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/opt" "github.com/syndtr/goleveldb/leveldb/util" + + "github.com/cometbft/cometbft/libs/log" ) var CompactGoLevelDBCmd = &cobra.Command{ diff --git a/cmd/cometbft/commands/debug/debug.go b/cmd/cometbft/commands/debug/debug.go index 149d9e81b18..2476968048b 100644 --- a/cmd/cometbft/commands/debug/debug.go +++ b/cmd/cometbft/commands/debug/debug.go @@ -3,8 +3,9 @@ package debug import ( "os" - "github.com/cometbft/cometbft/libs/log" "github.com/spf13/cobra" + + "github.com/cometbft/cometbft/libs/log" ) var ( diff --git a/cmd/cometbft/commands/debug/dump.go b/cmd/cometbft/commands/debug/dump.go index 5fa9d642860..e38462933dd 100644 --- a/cmd/cometbft/commands/debug/dump.go +++ b/cmd/cometbft/commands/debug/dump.go @@ -7,11 +7,12 @@ import ( "path/filepath" "time" + "github.com/spf13/cobra" + "github.com/spf13/viper" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/cli" rpchttp "github.com/cometbft/cometbft/rpc/client/http" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) var dumpCmd = &cobra.Command{ diff --git a/cmd/cometbft/commands/debug/kill.go b/cmd/cometbft/commands/debug/kill.go index 847e8cdbf1f..da1e62836e2 100644 --- a/cmd/cometbft/commands/debug/kill.go +++ b/cmd/cometbft/commands/debug/kill.go @@ -10,11 +10,12 @@ import ( "syscall" "time" + "github.com/spf13/cobra" + "github.com/spf13/viper" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/cli" rpchttp "github.com/cometbft/cometbft/rpc/client/http" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) var killCmd = &cobra.Command{ diff --git a/cmd/cometbft/commands/gen_node_key.go b/cmd/cometbft/commands/gen_node_key.go index 83ca95234fa..c96f2564885 100644 --- a/cmd/cometbft/commands/gen_node_key.go +++ b/cmd/cometbft/commands/gen_node_key.go @@ -3,9 +3,10 @@ package commands import ( "fmt" + "github.com/spf13/cobra" + cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/p2p" - "github.com/spf13/cobra" ) // GenNodeKeyCmd allows the generation of a node key. It prints node's ID to diff --git a/cmd/cometbft/commands/gen_validator.go b/cmd/cometbft/commands/gen_validator.go index 6cfa7087767..072b26576dd 100644 --- a/cmd/cometbft/commands/gen_validator.go +++ b/cmd/cometbft/commands/gen_validator.go @@ -3,9 +3,10 @@ package commands import ( "fmt" + "github.com/spf13/cobra" + cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/privval" - "github.com/spf13/cobra" ) // GenValidatorCmd allows the generation of a keypair for a diff --git a/cmd/cometbft/commands/init.go b/cmd/cometbft/commands/init.go index bf14893c1ac..495c8a993a1 100644 --- a/cmd/cometbft/commands/init.go +++ b/cmd/cometbft/commands/init.go @@ -3,6 +3,8 @@ package commands import ( "fmt" + "github.com/spf13/cobra" + cfg "github.com/cometbft/cometbft/config" cmtos "github.com/cometbft/cometbft/internal/os" cmtrand "github.com/cometbft/cometbft/internal/rand" @@ -10,7 +12,6 @@ import ( "github.com/cometbft/cometbft/privval" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/spf13/cobra" ) // InitFilesCmd initializes a fresh CometBFT instance. diff --git a/cmd/cometbft/commands/inspect.go b/cmd/cometbft/commands/inspect.go index 0721223674c..c417fdb2a5a 100644 --- a/cmd/cometbft/commands/inspect.go +++ b/cmd/cometbft/commands/inspect.go @@ -6,13 +6,14 @@ import ( "os/signal" "syscall" + "github.com/spf13/cobra" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/inspect" "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/state/indexer/block" "github.com/cometbft/cometbft/internal/store" "github.com/cometbft/cometbft/types" - "github.com/spf13/cobra" ) // InspectCmd is the command for starting an inspect server. diff --git a/cmd/cometbft/commands/light.go b/cmd/cometbft/commands/light.go index 05fb7290367..d4a28d5e870 100644 --- a/cmd/cometbft/commands/light.go +++ b/cmd/cometbft/commands/light.go @@ -11,6 +11,8 @@ import ( "strings" "time" + "github.com/spf13/cobra" + dbm "github.com/cometbft/cometbft-db" cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/libs/log" @@ -20,7 +22,6 @@ import ( lrpc "github.com/cometbft/cometbft/light/rpc" dbs "github.com/cometbft/cometbft/light/store/db" rpcserver "github.com/cometbft/cometbft/rpc/jsonrpc/server" - "github.com/spf13/cobra" ) // LightCmd represents the base command when called without any subcommands. diff --git a/cmd/cometbft/commands/reindex_event.go b/cmd/cometbft/commands/reindex_event.go index 778c62b566f..ed223cef385 100644 --- a/cmd/cometbft/commands/reindex_event.go +++ b/cmd/cometbft/commands/reindex_event.go @@ -5,6 +5,8 @@ import ( "fmt" "strings" + "github.com/spf13/cobra" + dbm "github.com/cometbft/cometbft-db" abcitypes "github.com/cometbft/cometbft/abci/types" cmtcfg "github.com/cometbft/cometbft/config" @@ -16,7 +18,6 @@ import ( "github.com/cometbft/cometbft/internal/state/txindex" "github.com/cometbft/cometbft/internal/state/txindex/kv" "github.com/cometbft/cometbft/types" - "github.com/spf13/cobra" ) const ( diff --git a/cmd/cometbft/commands/reindex_event_test.go b/cmd/cometbft/commands/reindex_event_test.go index 5a0cc466eb5..c0bbde70909 100644 --- a/cmd/cometbft/commands/reindex_event_test.go +++ b/cmd/cometbft/commands/reindex_event_test.go @@ -5,6 +5,10 @@ import ( "errors" "testing" + "github.com/spf13/cobra" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abcitypes "github.com/cometbft/cometbft/abci/types" cmtcfg "github.com/cometbft/cometbft/config" @@ -13,9 +17,6 @@ import ( txmocks "github.com/cometbft/cometbft/internal/state/txindex/mocks" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/types" - "github.com/spf13/cobra" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) const ( diff --git a/cmd/cometbft/commands/reset.go b/cmd/cometbft/commands/reset.go index 0a1c2d001eb..ab17352c3b7 100644 --- a/cmd/cometbft/commands/reset.go +++ b/cmd/cometbft/commands/reset.go @@ -4,10 +4,11 @@ import ( "os" "path/filepath" + "github.com/spf13/cobra" + cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/privval" - "github.com/spf13/cobra" ) // ResetAllCmd removes the database of this CometBFT core diff --git a/cmd/cometbft/commands/reset_test.go b/cmd/cometbft/commands/reset_test.go index 163ba969f93..0006e78498c 100644 --- a/cmd/cometbft/commands/reset_test.go +++ b/cmd/cometbft/commands/reset_test.go @@ -4,9 +4,10 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/require" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/privval" - "github.com/stretchr/testify/require" ) func Test_ResetAll(t *testing.T) { diff --git a/cmd/cometbft/commands/rollback.go b/cmd/cometbft/commands/rollback.go index af231b1df06..8c5865e8321 100644 --- a/cmd/cometbft/commands/rollback.go +++ b/cmd/cometbft/commands/rollback.go @@ -4,12 +4,13 @@ import ( "fmt" "path/filepath" + "github.com/spf13/cobra" + dbm "github.com/cometbft/cometbft-db" cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/store" - "github.com/spf13/cobra" ) var removeBlock = false diff --git a/cmd/cometbft/commands/root.go b/cmd/cometbft/commands/root.go index fedaeb530b2..22f3b8680d1 100644 --- a/cmd/cometbft/commands/root.go +++ b/cmd/cometbft/commands/root.go @@ -4,12 +4,13 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + "github.com/spf13/viper" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/cli" cmtflags "github.com/cometbft/cometbft/libs/cli/flags" "github.com/cometbft/cometbft/libs/log" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) var ( diff --git a/cmd/cometbft/commands/root_test.go b/cmd/cometbft/commands/root_test.go index f3b7571b4bc..aaf3696c148 100644 --- a/cmd/cometbft/commands/root_test.go +++ b/cmd/cometbft/commands/root_test.go @@ -7,13 +7,14 @@ import ( "strconv" "testing" - cfg "github.com/cometbft/cometbft/config" - cmtos "github.com/cometbft/cometbft/internal/os" - "github.com/cometbft/cometbft/libs/cli" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cfg "github.com/cometbft/cometbft/config" + cmtos "github.com/cometbft/cometbft/internal/os" + "github.com/cometbft/cometbft/libs/cli" ) // clearConfig clears env vars, the given root dir, and resets viper. diff --git a/cmd/cometbft/commands/run_node.go b/cmd/cometbft/commands/run_node.go index bd9baca683d..22ad7180490 100644 --- a/cmd/cometbft/commands/run_node.go +++ b/cmd/cometbft/commands/run_node.go @@ -4,9 +4,10 @@ import ( "encoding/hex" "fmt" + "github.com/spf13/cobra" + cmtos "github.com/cometbft/cometbft/internal/os" nm "github.com/cometbft/cometbft/node" - "github.com/spf13/cobra" ) var genesisHash []byte diff --git a/cmd/cometbft/commands/show_node_id.go b/cmd/cometbft/commands/show_node_id.go index 53edd7a750e..17bc0ed20c4 100644 --- a/cmd/cometbft/commands/show_node_id.go +++ b/cmd/cometbft/commands/show_node_id.go @@ -3,8 +3,9 @@ package commands import ( "fmt" - "github.com/cometbft/cometbft/p2p" "github.com/spf13/cobra" + + "github.com/cometbft/cometbft/p2p" ) // ShowNodeIDCmd dumps node's ID to the standard output. diff --git a/cmd/cometbft/commands/show_validator.go b/cmd/cometbft/commands/show_validator.go index 630084fb474..4d8d97f4881 100644 --- a/cmd/cometbft/commands/show_validator.go +++ b/cmd/cometbft/commands/show_validator.go @@ -3,10 +3,11 @@ package commands import ( "fmt" + "github.com/spf13/cobra" + cmtos "github.com/cometbft/cometbft/internal/os" cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/privval" - "github.com/spf13/cobra" ) // ShowValidatorCmd adds capabilities for showing the validator info. diff --git a/cmd/cometbft/commands/testnet.go b/cmd/cometbft/commands/testnet.go index b4a9a318460..b9cd505792e 100644 --- a/cmd/cometbft/commands/testnet.go +++ b/cmd/cometbft/commands/testnet.go @@ -7,6 +7,9 @@ import ( "path/filepath" "strings" + "github.com/spf13/cobra" + "github.com/spf13/viper" + cfg "github.com/cometbft/cometbft/config" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/libs/bytes" @@ -14,8 +17,6 @@ import ( "github.com/cometbft/cometbft/privval" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) var ( diff --git a/cmd/cometbft/commands/version.go b/cmd/cometbft/commands/version.go index 77e50dec561..e14dfab3e4f 100644 --- a/cmd/cometbft/commands/version.go +++ b/cmd/cometbft/commands/version.go @@ -4,8 +4,9 @@ import ( "encoding/json" "fmt" - "github.com/cometbft/cometbft/version" "github.com/spf13/cobra" + + "github.com/cometbft/cometbft/version" ) // VersionCmd ... diff --git a/config/config_test.go b/config/config_test.go index ef0c1ac4bd9..b8fd48ac0f3 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/config" ) func TestDefaultConfig(t *testing.T) { diff --git a/config/toml_test.go b/config/toml_test.go index 8e15f1646f7..7434dd61028 100644 --- a/config/toml_test.go +++ b/config/toml_test.go @@ -5,10 +5,11 @@ import ( "path/filepath" "testing" - "github.com/cometbft/cometbft/config" - "github.com/cometbft/cometbft/internal/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/config" + "github.com/cometbft/cometbft/internal/test" ) func ensureFiles(t *testing.T, rootDir string, files ...string) { diff --git a/crypto/ed25519/bench_test.go b/crypto/ed25519/bench_test.go index 9f325430dd8..114e872735b 100644 --- a/crypto/ed25519/bench_test.go +++ b/crypto/ed25519/bench_test.go @@ -5,9 +5,10 @@ import ( "io" "testing" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/internal/benchmarking" - "github.com/stretchr/testify/require" ) func BenchmarkKeyGeneration(b *testing.B) { diff --git a/crypto/ed25519/ed25519.go b/crypto/ed25519/ed25519.go index 6f36822edfa..22035ecba09 100644 --- a/crypto/ed25519/ed25519.go +++ b/crypto/ed25519/ed25519.go @@ -7,11 +7,12 @@ import ( "fmt" "io" + "github.com/oasisprotocol/curve25519-voi/primitives/ed25519" + "github.com/oasisprotocol/curve25519-voi/primitives/ed25519/extra/cache" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/tmhash" cmtjson "github.com/cometbft/cometbft/libs/json" - "github.com/oasisprotocol/curve25519-voi/primitives/ed25519" - "github.com/oasisprotocol/curve25519-voi/primitives/ed25519/extra/cache" ) var ( diff --git a/crypto/ed25519/ed25519_test.go b/crypto/ed25519/ed25519_test.go index d6979a891e2..3405165c314 100644 --- a/crypto/ed25519/ed25519_test.go +++ b/crypto/ed25519/ed25519_test.go @@ -3,10 +3,11 @@ package ed25519_test import ( "testing" - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/ed25519" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/ed25519" ) func TestSignAndValidateEd25519(t *testing.T) { diff --git a/crypto/merkle/proof_test.go b/crypto/merkle/proof_test.go index 90c6733a05e..f1b7276bb5f 100644 --- a/crypto/merkle/proof_test.go +++ b/crypto/merkle/proof_test.go @@ -6,10 +6,11 @@ import ( "fmt" "testing" - cmtcrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" - "github.com/cometbft/cometbft/crypto/tmhash" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtcrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" + "github.com/cometbft/cometbft/crypto/tmhash" ) const ProofOpDomino = "test:domino" diff --git a/crypto/merkle/tree_test.go b/crypto/merkle/tree_test.go index d53409a92f3..6e389d331bd 100644 --- a/crypto/merkle/tree_test.go +++ b/crypto/merkle/tree_test.go @@ -4,11 +4,12 @@ import ( "encoding/hex" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto/tmhash" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/libs/test" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testItem []byte diff --git a/crypto/random_test.go b/crypto/random_test.go index 487c6d5b903..1c7bd1fb0a3 100644 --- a/crypto/random_test.go +++ b/crypto/random_test.go @@ -3,8 +3,9 @@ package crypto_test import ( "testing" - "github.com/cometbft/cometbft/crypto" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto" ) // the purpose of this test is primarily to ensure that the randomness diff --git a/crypto/secp256k1/secp256k1.go b/crypto/secp256k1/secp256k1.go index 6193bd8c6d2..551f8c732d0 100644 --- a/crypto/secp256k1/secp256k1.go +++ b/crypto/secp256k1/secp256k1.go @@ -10,9 +10,10 @@ import ( secp256k1 "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/ecdsa" + "golang.org/x/crypto/ripemd160" //nolint: staticcheck // necessary for Bitcoin address format + "github.com/cometbft/cometbft/crypto" cmtjson "github.com/cometbft/cometbft/libs/json" - "golang.org/x/crypto/ripemd160" //nolint: staticcheck // necessary for Bitcoin address format ) // -------------------------------------. diff --git a/crypto/secp256k1/secp256k1_test.go b/crypto/secp256k1/secp256k1_test.go index 1839ea83b75..a1d2ac5e4fd 100644 --- a/crypto/secp256k1/secp256k1_test.go +++ b/crypto/secp256k1/secp256k1_test.go @@ -7,10 +7,11 @@ import ( underlyingSecp256k1 "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil/base58" - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/secp256k1" ) type keyData struct { diff --git a/crypto/sr25519/batch.go b/crypto/sr25519/batch.go index 7b0918fd10d..05b71dc6334 100644 --- a/crypto/sr25519/batch.go +++ b/crypto/sr25519/batch.go @@ -4,8 +4,9 @@ import ( "errors" "fmt" - "github.com/cometbft/cometbft/crypto" "github.com/oasisprotocol/curve25519-voi/primitives/sr25519" + + "github.com/cometbft/cometbft/crypto" ) var _ crypto.BatchVerifier = &BatchVerifier{} diff --git a/crypto/sr25519/bench_test.go b/crypto/sr25519/bench_test.go index 0cccf6d3579..bee3f4f2470 100644 --- a/crypto/sr25519/bench_test.go +++ b/crypto/sr25519/bench_test.go @@ -5,9 +5,10 @@ import ( "io" "testing" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/internal/benchmarking" - "github.com/stretchr/testify/require" ) func BenchmarkKeyGeneration(b *testing.B) { diff --git a/crypto/sr25519/privkey.go b/crypto/sr25519/privkey.go index 0431c07466a..bc1c6820101 100644 --- a/crypto/sr25519/privkey.go +++ b/crypto/sr25519/privkey.go @@ -5,8 +5,9 @@ import ( "fmt" "io" - "github.com/cometbft/cometbft/crypto" "github.com/oasisprotocol/curve25519-voi/primitives/sr25519" + + "github.com/cometbft/cometbft/crypto" ) var ( diff --git a/crypto/sr25519/pubkey.go b/crypto/sr25519/pubkey.go index 854854e8216..b25718f9a43 100644 --- a/crypto/sr25519/pubkey.go +++ b/crypto/sr25519/pubkey.go @@ -4,9 +4,10 @@ import ( "bytes" "fmt" + "github.com/oasisprotocol/curve25519-voi/primitives/sr25519" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/tmhash" - "github.com/oasisprotocol/curve25519-voi/primitives/sr25519" ) var _ crypto.PubKey = PubKey{} diff --git a/crypto/sr25519/sr25519_test.go b/crypto/sr25519/sr25519_test.go index fd7298810c7..baca16bf2ad 100644 --- a/crypto/sr25519/sr25519_test.go +++ b/crypto/sr25519/sr25519_test.go @@ -5,10 +5,11 @@ import ( "encoding/json" "testing" - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/sr25519" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/sr25519" ) func TestSignAndValidateSr25519(t *testing.T) { diff --git a/crypto/tmhash/hash_test.go b/crypto/tmhash/hash_test.go index 2dfbc8684b3..0849391e576 100644 --- a/crypto/tmhash/hash_test.go +++ b/crypto/tmhash/hash_test.go @@ -4,9 +4,10 @@ import ( "crypto/sha256" "testing" - "github.com/cometbft/cometbft/crypto/tmhash" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/tmhash" ) func TestHash(t *testing.T) { diff --git a/crypto/xsalsa20symmetric/symmetric.go b/crypto/xsalsa20symmetric/symmetric.go index 7d7dd382901..cfb0466af6e 100644 --- a/crypto/xsalsa20symmetric/symmetric.go +++ b/crypto/xsalsa20symmetric/symmetric.go @@ -4,8 +4,9 @@ import ( "errors" "fmt" - "github.com/cometbft/cometbft/crypto" "golang.org/x/crypto/nacl/secretbox" + + "github.com/cometbft/cometbft/crypto" ) // TODO, make this into a struct that implements crypto.Symmetric. diff --git a/crypto/xsalsa20symmetric/symmetric_test.go b/crypto/xsalsa20symmetric/symmetric_test.go index 3fb32eed7fe..d252803c02d 100644 --- a/crypto/xsalsa20symmetric/symmetric_test.go +++ b/crypto/xsalsa20symmetric/symmetric_test.go @@ -3,10 +3,11 @@ package xsalsa20symmetric import ( "testing" - "github.com/cometbft/cometbft/crypto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/crypto/bcrypt" + + "github.com/cometbft/cometbft/crypto" ) func TestSimple(t *testing.T) { diff --git a/internal/autofile/autofile_test.go b/internal/autofile/autofile_test.go index fe748d9e839..d651f225ab5 100644 --- a/internal/autofile/autofile_test.go +++ b/internal/autofile/autofile_test.go @@ -7,9 +7,10 @@ import ( "testing" "time" - cmtos "github.com/cometbft/cometbft/internal/os" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtos "github.com/cometbft/cometbft/internal/os" ) func TestSIGHUP(t *testing.T) { diff --git a/internal/autofile/group_test.go b/internal/autofile/group_test.go index 74b5ae80527..dbc53e3f06d 100644 --- a/internal/autofile/group_test.go +++ b/internal/autofile/group_test.go @@ -6,10 +6,11 @@ import ( "path/filepath" "testing" - cmtos "github.com/cometbft/cometbft/internal/os" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtos "github.com/cometbft/cometbft/internal/os" + cmtrand "github.com/cometbft/cometbft/internal/rand" ) func createTestGroupWithHeadSizeLimit(t *testing.T, headSizeLimit int64) *Group { diff --git a/internal/bits/bit_array_test.go b/internal/bits/bit_array_test.go index 2b362653595..b72c704461f 100644 --- a/internal/bits/bit_array_test.go +++ b/internal/bits/bit_array_test.go @@ -6,9 +6,10 @@ import ( "fmt" "testing" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtrand "github.com/cometbft/cometbft/internal/rand" ) func randBitArray(bits int) *BitArray { diff --git a/internal/blocksync/metrics.go b/internal/blocksync/metrics.go index f120b4f7c44..204b127ba4a 100644 --- a/internal/blocksync/metrics.go +++ b/internal/blocksync/metrics.go @@ -1,8 +1,9 @@ package blocksync import ( - "github.com/cometbft/cometbft/types" "github.com/go-kit/kit/metrics" + + "github.com/cometbft/cometbft/types" ) const ( diff --git a/internal/blocksync/msgs.go b/internal/blocksync/msgs.go index 08f4a99ac60..d4ec73da663 100644 --- a/internal/blocksync/msgs.go +++ b/internal/blocksync/msgs.go @@ -3,9 +3,10 @@ package blocksync import ( "fmt" + "github.com/cosmos/gogoproto/proto" + bcproto "github.com/cometbft/cometbft/api/cometbft/blocksync/v1" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/blocksync/msgs_test.go b/internal/blocksync/msgs_test.go index 9cb72abec60..3fb1704bf70 100644 --- a/internal/blocksync/msgs_test.go +++ b/internal/blocksync/msgs_test.go @@ -5,12 +5,13 @@ import ( "math" "testing" - bcproto "github.com/cometbft/cometbft/api/cometbft/blocksync/v1" - "github.com/cometbft/cometbft/internal/blocksync" - "github.com/cometbft/cometbft/types" "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + bcproto "github.com/cometbft/cometbft/api/cometbft/blocksync/v1" + "github.com/cometbft/cometbft/internal/blocksync" + "github.com/cometbft/cometbft/types" ) func TestBcBlockRequestMessageValidateBasic(t *testing.T) { diff --git a/internal/blocksync/pool_test.go b/internal/blocksync/pool_test.go index 7a16749e11d..4488b215cbf 100644 --- a/internal/blocksync/pool_test.go +++ b/internal/blocksync/pool_test.go @@ -5,12 +5,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func init() { diff --git a/internal/blocksync/reactor_test.go b/internal/blocksync/reactor_test.go index d9595e22b1d..534ec7096cb 100644 --- a/internal/blocksync/reactor_test.go +++ b/internal/blocksync/reactor_test.go @@ -7,6 +7,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" cfg "github.com/cometbft/cometbft/config" @@ -19,9 +23,6 @@ import ( "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) var config *cfg.Config diff --git a/internal/clist/clist_test.go b/internal/clist/clist_test.go index b093d94de35..bf9f062feac 100644 --- a/internal/clist/clist_test.go +++ b/internal/clist/clist_test.go @@ -7,8 +7,9 @@ import ( "testing" "time" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" + + cmtrand "github.com/cometbft/cometbft/internal/rand" ) func TestPanicOnMaxLength(t *testing.T) { diff --git a/internal/consensus/byzantine_test.go b/internal/consensus/byzantine_test.go index 2f94c56ae3d..ab2befdf59e 100644 --- a/internal/consensus/byzantine_test.go +++ b/internal/consensus/byzantine_test.go @@ -9,6 +9,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abcicli "github.com/cometbft/cometbft/abci/client" abci "github.com/cometbft/cometbft/abci/types" @@ -23,8 +26,6 @@ import ( "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) //---------------------------------------------- diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 0e27334a318..1093eb2979e 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -12,6 +12,10 @@ import ( "testing" "time" + "github.com/go-kit/log/term" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abcicli "github.com/cometbft/cometbft/abci/client" "github.com/cometbft/cometbft/abci/example/kvstore" @@ -33,9 +37,6 @@ import ( "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/go-kit/log/term" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/internal/consensus/mempool_test.go b/internal/consensus/mempool_test.go index 1afa8ace1e6..a12922984c9 100644 --- a/internal/consensus/mempool_test.go +++ b/internal/consensus/mempool_test.go @@ -7,6 +7,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/abci/example/kvstore" abci "github.com/cometbft/cometbft/abci/types" @@ -14,8 +17,6 @@ import ( mempl "github.com/cometbft/cometbft/mempool" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // for testing. diff --git a/internal/consensus/metrics.go b/internal/consensus/metrics.go index 52cbdb0f074..2b52c8c6cd1 100644 --- a/internal/consensus/metrics.go +++ b/internal/consensus/metrics.go @@ -4,9 +4,10 @@ import ( "strings" "time" + "github.com/go-kit/kit/metrics" + cstypes "github.com/cometbft/cometbft/internal/consensus/types" "github.com/cometbft/cometbft/types" - "github.com/go-kit/kit/metrics" ) const ( diff --git a/internal/consensus/msgs.go b/internal/consensus/msgs.go index 442e2272d03..5446f22aee1 100644 --- a/internal/consensus/msgs.go +++ b/internal/consensus/msgs.go @@ -3,6 +3,8 @@ package consensus import ( "fmt" + "github.com/cosmos/gogoproto/proto" + cmtcons "github.com/cometbft/cometbft/api/cometbft/consensus/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/internal/bits" @@ -11,7 +13,6 @@ import ( "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" - "github.com/cosmos/gogoproto/proto" ) // TODO: This needs to be removed, but WALToProto depends on this. diff --git a/internal/consensus/msgs_test.go b/internal/consensus/msgs_test.go index 76ccded1df0..019058bff6e 100644 --- a/internal/consensus/msgs_test.go +++ b/internal/consensus/msgs_test.go @@ -6,6 +6,10 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtcons "github.com/cometbft/cometbft/api/cometbft/consensus/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto/merkle" @@ -13,9 +17,6 @@ import ( cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestMsgToProto(t *testing.T) { diff --git a/internal/consensus/reactor_test.go b/internal/consensus/reactor_test.go index a7804a0900a..621d9a70fb4 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -9,6 +9,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abcicli "github.com/cometbft/cometbft/abci/client" "github.com/cometbft/cometbft/abci/example/kvstore" @@ -32,9 +36,6 @@ import ( "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) //---------------------------------------------- diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 52852b3cc84..189e85fd6ff 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -12,6 +12,11 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/abci/example/kvstore" abci "github.com/cometbft/cometbft/abci/types" @@ -28,10 +33,6 @@ import ( "github.com/cometbft/cometbft/privval" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { diff --git a/internal/consensus/state.go b/internal/consensus/state.go index a1513ca59d1..fdebaa39686 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -11,6 +11,8 @@ import ( "sort" "time" + "github.com/cosmos/gogoproto/proto" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto" @@ -28,7 +30,6 @@ import ( "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/gogoproto/proto" ) var msgQueueSize = 1000 diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index c504f55ab59..f54152ff390 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -8,6 +8,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/example/kvstore" abci "github.com/cometbft/cometbft/abci/types" abcimocks "github.com/cometbft/cometbft/abci/types/mocks" @@ -22,9 +26,6 @@ import ( "github.com/cometbft/cometbft/libs/log" p2pmock "github.com/cometbft/cometbft/p2p/mock" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) /* diff --git a/internal/consensus/types/height_vote_set_test.go b/internal/consensus/types/height_vote_set_test.go index a7aa4c8bc0e..f81f39d4e16 100644 --- a/internal/consensus/types/height_vote_set_test.go +++ b/internal/consensus/types/height_vote_set_test.go @@ -4,13 +4,14 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/tmhash" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/require" ) var config *cfg.Config // NOTE: must be reset for each _test.go file diff --git a/internal/consensus/wal.go b/internal/consensus/wal.go index 53bbdc10463..8520636b307 100644 --- a/internal/consensus/wal.go +++ b/internal/consensus/wal.go @@ -9,6 +9,8 @@ import ( "path/filepath" "time" + "github.com/cosmos/gogoproto/proto" + cmtcons "github.com/cometbft/cometbft/api/cometbft/consensus/v1" auto "github.com/cometbft/cometbft/internal/autofile" cmtos "github.com/cometbft/cometbft/internal/os" @@ -17,7 +19,6 @@ import ( "github.com/cometbft/cometbft/libs/log" cmterrors "github.com/cometbft/cometbft/types/errors" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/consensus/wal_test.go b/internal/consensus/wal_test.go index 0052918b581..9336ea929e0 100644 --- a/internal/consensus/wal_test.go +++ b/internal/consensus/wal_test.go @@ -8,6 +8,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/merkle" "github.com/cometbft/cometbft/internal/autofile" @@ -16,8 +19,6 @@ import ( "github.com/cometbft/cometbft/libs/log" cmttypes "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/internal/events/events_test.go b/internal/events/events_test.go index f459af0f8e9..c1656d47819 100644 --- a/internal/events/events_test.go +++ b/internal/events/events_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/internal/rand" ) // TestAddListenerForEventFireOnce sets up an EventSwitch, subscribes a single diff --git a/internal/evidence/pool.go b/internal/evidence/pool.go index e4f0fddae23..df463b4d838 100644 --- a/internal/evidence/pool.go +++ b/internal/evidence/pool.go @@ -7,6 +7,9 @@ import ( "sync/atomic" "time" + "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" + dbm "github.com/cometbft/cometbft-db" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" clist "github.com/cometbft/cometbft/internal/clist" @@ -14,8 +17,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" - "github.com/cosmos/gogoproto/proto" - gogotypes "github.com/cosmos/gogoproto/types" ) const ( diff --git a/internal/evidence/pool_test.go b/internal/evidence/pool_test.go index 26f3b85a3c6..8dce49614b2 100644 --- a/internal/evidence/pool_test.go +++ b/internal/evidence/pool_test.go @@ -5,6 +5,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/internal/evidence" @@ -16,9 +20,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { diff --git a/internal/evidence/reactor.go b/internal/evidence/reactor.go index 47430c27d40..59e0edee424 100644 --- a/internal/evidence/reactor.go +++ b/internal/evidence/reactor.go @@ -4,12 +4,13 @@ import ( "fmt" "time" + "github.com/cosmos/gogoproto/proto" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" clist "github.com/cometbft/cometbft/internal/clist" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/evidence/reactor_test.go b/internal/evidence/reactor_test.go index b19e2d5b888..c9ea04311f5 100644 --- a/internal/evidence/reactor_test.go +++ b/internal/evidence/reactor_test.go @@ -7,6 +7,12 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/go-kit/log/term" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cfg "github.com/cometbft/cometbft/config" @@ -19,11 +25,6 @@ import ( "github.com/cometbft/cometbft/p2p" p2pmocks "github.com/cometbft/cometbft/p2p/mocks" "github.com/cometbft/cometbft/types" - "github.com/fortytw2/leaktest" - "github.com/go-kit/log/term" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) var ( diff --git a/internal/evidence/verify_test.go b/internal/evidence/verify_test.go index dbac3f2b33a..51e46c827f9 100644 --- a/internal/evidence/verify_test.go +++ b/internal/evidence/verify_test.go @@ -5,6 +5,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" @@ -17,8 +20,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/internal/inspect/inspect.go b/internal/inspect/inspect.go index 87decd60d14..c4d890584e1 100644 --- a/internal/inspect/inspect.go +++ b/internal/inspect/inspect.go @@ -6,6 +6,8 @@ import ( "net" "os" + "golang.org/x/sync/errgroup" + "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/inspect/rpc" "github.com/cometbft/cometbft/internal/state" @@ -17,7 +19,6 @@ import ( "github.com/cometbft/cometbft/libs/log" rpccore "github.com/cometbft/cometbft/rpc/core" "github.com/cometbft/cometbft/types" - "golang.org/x/sync/errgroup" ) var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) diff --git a/internal/inspect/inspect_test.go b/internal/inspect/inspect_test.go index 3fd629dc771..3cfd6e1ae59 100644 --- a/internal/inspect/inspect_test.go +++ b/internal/inspect/inspect_test.go @@ -10,6 +10,10 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + abcitypes "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/inspect" @@ -20,9 +24,6 @@ import ( "github.com/cometbft/cometbft/internal/test" httpclient "github.com/cometbft/cometbft/rpc/client/http" "github.com/cometbft/cometbft/types" - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestInspectConstructor(t *testing.T) { diff --git a/internal/inspect/rpc/rpc.go b/internal/inspect/rpc/rpc.go index 03ecba13235..331b5251318 100644 --- a/internal/inspect/rpc/rpc.go +++ b/internal/inspect/rpc/rpc.go @@ -5,6 +5,8 @@ import ( "net/http" "time" + "github.com/rs/cors" + "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/state/indexer" @@ -12,7 +14,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/rpc/core" "github.com/cometbft/cometbft/rpc/jsonrpc/server" - "github.com/rs/cors" ) // Server defines parameters for running an Inspector rpc server. diff --git a/internal/protoio/io_test.go b/internal/protoio/io_test.go index 5f2b16561f9..1565b7739de 100644 --- a/internal/protoio/io_test.go +++ b/internal/protoio/io_test.go @@ -37,10 +37,11 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/internal/protoio" "github.com/cosmos/gogoproto/proto" "github.com/cosmos/gogoproto/test" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/internal/protoio" ) func iotest(writer protoio.WriteCloser, reader protoio.ReadCloser) error { diff --git a/internal/pubsub/example_test.go b/internal/pubsub/example_test.go index bb703c11609..d6cf45a2c63 100644 --- a/internal/pubsub/example_test.go +++ b/internal/pubsub/example_test.go @@ -4,10 +4,11 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/internal/pubsub" "github.com/cometbft/cometbft/internal/pubsub/query" "github.com/cometbft/cometbft/libs/log" - "github.com/stretchr/testify/require" ) func TestExample(t *testing.T) { diff --git a/internal/pubsub/pubsub_test.go b/internal/pubsub/pubsub_test.go index e656c6dbf49..06e7bfd26b4 100644 --- a/internal/pubsub/pubsub_test.go +++ b/internal/pubsub/pubsub_test.go @@ -7,11 +7,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/internal/pubsub" "github.com/cometbft/cometbft/internal/pubsub/query" "github.com/cometbft/cometbft/libs/log" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/internal/pubsub/query/query_test.go b/internal/pubsub/query/query_test.go index 9ea3c14a2d9..17fe1cbd1ae 100644 --- a/internal/pubsub/query/query_test.go +++ b/internal/pubsub/query/query_test.go @@ -8,11 +8,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/pubsub" "github.com/cometbft/cometbft/internal/pubsub/query" "github.com/cometbft/cometbft/internal/pubsub/query/syntax" - "github.com/stretchr/testify/require" ) var _ pubsub.Query = (*query.Query)(nil) diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index f2f6a8fc513..5cde75e26fa 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -6,6 +6,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abciclientmocks "github.com/cometbft/cometbft/abci/client/mocks" abci "github.com/cometbft/cometbft/abci/types" @@ -27,9 +31,6 @@ import ( "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) var ( diff --git a/internal/state/indexer/block/kv/kv.go b/internal/state/indexer/block/kv/kv.go index 6a14a3e5c57..2fcf777ca6e 100644 --- a/internal/state/indexer/block/kv/kv.go +++ b/internal/state/indexer/block/kv/kv.go @@ -10,6 +10,8 @@ import ( "strconv" "strings" + "github.com/google/orderedcode" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" idxutil "github.com/cometbft/cometbft/internal/indexer" @@ -19,7 +21,6 @@ import ( "github.com/cometbft/cometbft/internal/state/indexer" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/google/orderedcode" ) var ( diff --git a/internal/state/indexer/block/kv/kv_test.go b/internal/state/indexer/block/kv/kv_test.go index 1b869280a82..99df2ceaa1e 100644 --- a/internal/state/indexer/block/kv/kv_test.go +++ b/internal/state/indexer/block/kv/kv_test.go @@ -9,6 +9,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "golang.org/x/exp/slices" + db "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/pubsub/query" @@ -16,8 +19,6 @@ import ( "github.com/cometbft/cometbft/internal/state/txindex/kv" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" ) func TestBlockerIndexer_Prune(t *testing.T) { diff --git a/internal/state/indexer/block/kv/util.go b/internal/state/indexer/block/kv/util.go index d54f39e71ff..414d1d3bcd8 100644 --- a/internal/state/indexer/block/kv/util.go +++ b/internal/state/indexer/block/kv/util.go @@ -6,11 +6,12 @@ import ( "math/big" "strconv" + "github.com/google/orderedcode" + idxutil "github.com/cometbft/cometbft/internal/indexer" "github.com/cometbft/cometbft/internal/pubsub/query/syntax" "github.com/cometbft/cometbft/internal/state/indexer" "github.com/cometbft/cometbft/types" - "github.com/google/orderedcode" ) type HeightInfo struct { diff --git a/internal/state/indexer/sink/psql/psql.go b/internal/state/indexer/sink/psql/psql.go index 83b5fcfc6f7..67c20d4f8c4 100644 --- a/internal/state/indexer/sink/psql/psql.go +++ b/internal/state/indexer/sink/psql/psql.go @@ -10,10 +10,11 @@ import ( "strings" "time" + "github.com/cosmos/gogoproto/proto" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/pubsub/query" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/state/indexer/sink/psql/psql_test.go b/internal/state/indexer/sink/psql/psql_test.go index 2b2270bbfc0..172c42c4de0 100644 --- a/internal/state/indexer/sink/psql/psql_test.go +++ b/internal/state/indexer/sink/psql/psql_test.go @@ -12,16 +12,18 @@ import ( "time" "github.com/adlio/schema" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/internal/state/txindex" - tmlog "github.com/cometbft/cometbft/libs/log" - "github.com/cometbft/cometbft/types" "github.com/cosmos/gogoproto/proto" - _ "github.com/lib/pq" "github.com/ory/dockertest" "github.com/ory/dockertest/docker" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + _ "github.com/lib/pq" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/internal/state/txindex" + tmlog "github.com/cometbft/cometbft/libs/log" + "github.com/cometbft/cometbft/types" ) var ( diff --git a/internal/state/pruner_test.go b/internal/state/pruner_test.go index c22b751a5ae..d5a66bd6aef 100644 --- a/internal/state/pruner_test.go +++ b/internal/state/pruner_test.go @@ -7,6 +7,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "golang.org/x/exp/slices" + db "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/pubsub/query" @@ -17,8 +20,6 @@ import ( "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" ) func TestPruneBlockIndexerToRetainHeight(t *testing.T) { diff --git a/internal/state/rollback_test.go b/internal/state/rollback_test.go index 024733fff4f..adf808d7490 100644 --- a/internal/state/rollback_test.go +++ b/internal/state/rollback_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" @@ -15,7 +17,6 @@ import ( "github.com/cometbft/cometbft/internal/store" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/require" ) func TestRollback(t *testing.T) { diff --git a/internal/state/state.go b/internal/state/state.go index 879737ddae1..4e8c786abc9 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -7,12 +7,13 @@ import ( "os" "time" + "github.com/cosmos/gogoproto/proto" + cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" "github.com/cometbft/cometbft/version" - "github.com/cosmos/gogoproto/proto" ) // database keys. diff --git a/internal/state/state_test.go b/internal/state/state_test.go index 2fd144a18da..303b19a99fd 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -9,6 +9,9 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/ed25519" @@ -17,8 +20,6 @@ import ( sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // setupTestCase does setup common to all test cases. diff --git a/internal/state/store.go b/internal/state/store.go index 9ae380dada6..fee7fa1412c 100644 --- a/internal/state/store.go +++ b/internal/state/store.go @@ -5,6 +5,8 @@ import ( "errors" "fmt" + "github.com/cosmos/gogoproto/proto" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" @@ -12,7 +14,6 @@ import ( cmtos "github.com/cometbft/cometbft/internal/os" cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/state/store_test.go b/internal/state/store_test.go index e5925b9f930..a80d0342d15 100644 --- a/internal/state/store_test.go +++ b/internal/state/store_test.go @@ -6,6 +6,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" @@ -19,8 +22,6 @@ import ( "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestStoreLoadValidators(t *testing.T) { diff --git a/internal/state/tx_filter_test.go b/internal/state/tx_filter_test.go index 39ca104943a..2233506e120 100644 --- a/internal/state/tx_filter_test.go +++ b/internal/state/tx_filter_test.go @@ -4,11 +4,12 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtrand "github.com/cometbft/cometbft/internal/rand" sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) func TestTxFilter(t *testing.T) { diff --git a/internal/state/txindex/indexer_service_test.go b/internal/state/txindex/indexer_service_test.go index 7d1ac113039..5d21d7cdcfc 100644 --- a/internal/state/txindex/indexer_service_test.go +++ b/internal/state/txindex/indexer_service_test.go @@ -5,6 +5,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + db "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/state/indexer" @@ -13,7 +15,6 @@ import ( "github.com/cometbft/cometbft/internal/state/txindex/kv" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) func TestIndexerServiceIndexesBlocks(t *testing.T) { diff --git a/internal/state/txindex/kv/kv.go b/internal/state/txindex/kv/kv.go index 9c16972ba95..1df206868e5 100644 --- a/internal/state/txindex/kv/kv.go +++ b/internal/state/txindex/kv/kv.go @@ -12,6 +12,8 @@ import ( "strconv" "strings" + "github.com/cosmos/gogoproto/proto" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" idxutil "github.com/cometbft/cometbft/internal/indexer" @@ -22,7 +24,6 @@ import ( "github.com/cometbft/cometbft/internal/state/txindex" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/internal/state/txindex/kv/kv_test.go b/internal/state/txindex/kv/kv_test.go index 019c9ee8249..cec0190aeca 100644 --- a/internal/state/txindex/kv/kv_test.go +++ b/internal/state/txindex/kv/kv_test.go @@ -7,6 +7,11 @@ import ( "os" "testing" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/exp/slices" + db "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/internal/pubsub/query" @@ -14,10 +19,6 @@ import ( blockidxkv "github.com/cometbft/cometbft/internal/state/indexer/block/kv" "github.com/cometbft/cometbft/internal/state/txindex" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" ) func TestTxIndex(t *testing.T) { diff --git a/internal/state/txindex/kv/utils.go b/internal/state/txindex/kv/utils.go index bfeabce2d1c..9d8def47263 100644 --- a/internal/state/txindex/kv/utils.go +++ b/internal/state/txindex/kv/utils.go @@ -5,12 +5,13 @@ import ( "fmt" "math/big" + "github.com/google/orderedcode" + abci "github.com/cometbft/cometbft/abci/types" idxutil "github.com/cometbft/cometbft/internal/indexer" cmtsyntax "github.com/cometbft/cometbft/internal/pubsub/query/syntax" "github.com/cometbft/cometbft/internal/state/indexer" "github.com/cometbft/cometbft/types" - "github.com/google/orderedcode" ) type HeightInfo struct { diff --git a/internal/state/validation_test.go b/internal/state/validation_test.go index 863b249926b..ae41404dd8b 100644 --- a/internal/state/validation_test.go +++ b/internal/state/validation_test.go @@ -4,6 +4,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/ed25519" @@ -17,9 +21,6 @@ import ( "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) const validationTestsStopHeight int64 = 10 diff --git a/internal/statesync/chunks_test.go b/internal/statesync/chunks_test.go index 6f0cad404ec..7f79abce277 100644 --- a/internal/statesync/chunks_test.go +++ b/internal/statesync/chunks_test.go @@ -4,9 +4,10 @@ import ( "os" "testing" - "github.com/cometbft/cometbft/p2p" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/p2p" ) func setupChunkQueue(t *testing.T) (*chunkQueue, func()) { diff --git a/internal/statesync/messages.go b/internal/statesync/messages.go index 716664df231..e9287f166bb 100644 --- a/internal/statesync/messages.go +++ b/internal/statesync/messages.go @@ -4,8 +4,9 @@ import ( "errors" "fmt" - ssproto "github.com/cometbft/cometbft/api/cometbft/statesync/v1" "github.com/cosmos/gogoproto/proto" + + ssproto "github.com/cometbft/cometbft/api/cometbft/statesync/v1" ) const ( diff --git a/internal/statesync/messages_test.go b/internal/statesync/messages_test.go index 1c77af54430..de516280c7a 100644 --- a/internal/statesync/messages_test.go +++ b/internal/statesync/messages_test.go @@ -4,11 +4,12 @@ import ( "encoding/hex" "testing" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/require" + ssproto "github.com/cometbft/cometbft/api/cometbft/statesync/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/require" ) func TestValidateMsg(t *testing.T) { diff --git a/internal/statesync/reactor_test.go b/internal/statesync/reactor_test.go index 8ec54757adb..b65fde230e8 100644 --- a/internal/statesync/reactor_test.go +++ b/internal/statesync/reactor_test.go @@ -4,16 +4,17 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" ssproto "github.com/cometbft/cometbft/api/cometbft/statesync/v1" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/p2p" p2pmocks "github.com/cometbft/cometbft/p2p/mocks" proxymocks "github.com/cometbft/cometbft/proxy/mocks" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestReactor_Receive_ChunkRequest(t *testing.T) { diff --git a/internal/statesync/snapshots_test.go b/internal/statesync/snapshots_test.go index 2f09c8193da..d2c52976662 100644 --- a/internal/statesync/snapshots_test.go +++ b/internal/statesync/snapshots_test.go @@ -3,10 +3,11 @@ package statesync import ( "testing" - "github.com/cometbft/cometbft/p2p" - p2pmocks "github.com/cometbft/cometbft/p2p/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/p2p" + p2pmocks "github.com/cometbft/cometbft/p2p/mocks" ) func TestSnapshot_Key(t *testing.T) { diff --git a/internal/statesync/syncer_test.go b/internal/statesync/syncer_test.go index fe8bf59b000..cebd6ea5d48 100644 --- a/internal/statesync/syncer_test.go +++ b/internal/statesync/syncer_test.go @@ -5,6 +5,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" cmtstate "github.com/cometbft/cometbft/api/cometbft/state/v1" ssproto "github.com/cometbft/cometbft/api/cometbft/statesync/v1" @@ -20,9 +24,6 @@ import ( proxymocks "github.com/cometbft/cometbft/proxy/mocks" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) const testAppVersion = 9 diff --git a/internal/store/store.go b/internal/store/store.go index 0d92043690e..4b8df06081b 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -5,6 +5,8 @@ import ( "fmt" "strconv" + "github.com/cosmos/gogoproto/proto" + dbm "github.com/cometbft/cometbft-db" cmtstore "github.com/cometbft/cometbft/api/cometbft/store/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" @@ -13,7 +15,6 @@ import ( cmtsync "github.com/cometbft/cometbft/internal/sync" "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" - "github.com/cosmos/gogoproto/proto" ) // Assuming the length of a block part is 64kB (`types.BlockPartSizeBytes`), diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 0fc5a9a2fd5..dadb6e8dc47 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -8,6 +8,10 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtstore "github.com/cometbft/cometbft/api/cometbft/store/v1" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" @@ -24,9 +28,6 @@ import ( "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" "github.com/cometbft/cometbft/version" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // make an extended commit with a single vote containing just the height and a diff --git a/internal/tempfile/tempfile_test.go b/internal/tempfile/tempfile_test.go index 5dc628c1412..014826351e5 100644 --- a/internal/tempfile/tempfile_test.go +++ b/internal/tempfile/tempfile_test.go @@ -8,8 +8,9 @@ import ( "os" testing "testing" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/require" + + cmtrand "github.com/cometbft/cometbft/internal/rand" ) func TestWriteFileAtomic(t *testing.T) { diff --git a/internal/test/block.go b/internal/test/block.go index bd30c8de008..16491a0e4cb 100644 --- a/internal/test/block.go +++ b/internal/test/block.go @@ -4,11 +4,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/require" ) const ( diff --git a/internal/test/factory_test.go b/internal/test/factory_test.go index 49f36804791..07bc2824d57 100644 --- a/internal/test/factory_test.go +++ b/internal/test/factory_test.go @@ -3,8 +3,9 @@ package test import ( "testing" - "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/types" ) func TestMakeHeader(t *testing.T) { diff --git a/internal/test/validator.go b/internal/test/validator.go index 9ad0b0b79d4..6aad2fc0eeb 100644 --- a/internal/test/validator.go +++ b/internal/test/validator.go @@ -5,8 +5,9 @@ import ( "sort" "testing" - "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/types" ) func Validator(_ context.Context, votingPower int64) (*types.Validator, types.PrivValidator, error) { diff --git a/internal/timer/throttle_timer_test.go b/internal/timer/throttle_timer_test.go index b01d0f1b1ed..14df4bebced 100644 --- a/internal/timer/throttle_timer_test.go +++ b/internal/timer/throttle_timer_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" - cmtsync "github.com/cometbft/cometbft/internal/sync" asrt "github.com/stretchr/testify/assert" + + cmtsync "github.com/cometbft/cometbft/internal/sync" ) type thCounter struct { diff --git a/libs/json/decoder_test.go b/libs/json/decoder_test.go index 4f2fc016ac9..9a33bf0e2ad 100644 --- a/libs/json/decoder_test.go +++ b/libs/json/decoder_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/libs/json" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/json" ) func TestUnmarshal(t *testing.T) { diff --git a/libs/json/encoder_test.go b/libs/json/encoder_test.go index d1effe83044..e6eb18a1225 100644 --- a/libs/json/encoder_test.go +++ b/libs/json/encoder_test.go @@ -4,9 +4,10 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/libs/json" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/json" ) func TestMarshal(t *testing.T) { diff --git a/libs/log/tmfmt_logger_test.go b/libs/log/tmfmt_logger_test.go index c5c54fe07be..362a677838c 100644 --- a/libs/log/tmfmt_logger_test.go +++ b/libs/log/tmfmt_logger_test.go @@ -8,9 +8,10 @@ import ( "regexp" "testing" - "github.com/cometbft/cometbft/libs/log" kitlog "github.com/go-kit/log" "github.com/stretchr/testify/assert" + + "github.com/cometbft/cometbft/libs/log" ) func TestTMFmtLogger(t *testing.T) { diff --git a/libs/log/tracing_logger_test.go b/libs/log/tracing_logger_test.go index b81a88c59c6..9af2fd0ef4d 100644 --- a/libs/log/tracing_logger_test.go +++ b/libs/log/tracing_logger_test.go @@ -7,8 +7,9 @@ import ( "strings" "testing" - "github.com/cometbft/cometbft/libs/log" "github.com/pkg/errors" + + "github.com/cometbft/cometbft/libs/log" ) func TestTracingLogger(t *testing.T) { diff --git a/light/client_test.go b/light/client_test.go index 3069a8ad240..7f8ba20fa95 100644 --- a/light/client_test.go +++ b/light/client_test.go @@ -6,6 +6,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/libs/log" @@ -14,8 +17,6 @@ import ( mockp "github.com/cometbft/cometbft/light/provider/mock" dbs "github.com/cometbft/cometbft/light/store/db" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/light/detector_test.go b/light/detector_test.go index 78b4242bf27..bc31d181ddc 100644 --- a/light/detector_test.go +++ b/light/detector_test.go @@ -4,6 +4,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/light" @@ -11,8 +14,6 @@ import ( mockp "github.com/cometbft/cometbft/light/provider/mock" dbs "github.com/cometbft/cometbft/light/store/db" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestLightClientAttackEvidence_Lunatic(t *testing.T) { diff --git a/light/provider/http/http_test.go b/light/provider/http/http_test.go index 7b9add58d81..f6b4565d9a0 100644 --- a/light/provider/http/http_test.go +++ b/light/provider/http/http_test.go @@ -7,6 +7,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/example/kvstore" "github.com/cometbft/cometbft/light/provider" lighthttp "github.com/cometbft/cometbft/light/provider/http" @@ -14,8 +17,6 @@ import ( rpchttp "github.com/cometbft/cometbft/rpc/client/http" rpctest "github.com/cometbft/cometbft/rpc/test" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNewProvider(t *testing.T) { diff --git a/light/store/db/db_test.go b/light/store/db/db_test.go index e5f7077bdc2..f170f052cfe 100644 --- a/light/store/db/db_test.go +++ b/light/store/db/db_test.go @@ -5,6 +5,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" @@ -12,8 +15,6 @@ import ( cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestLast_FirstLightBlockHeight(t *testing.T) { diff --git a/light/verifier_test.go b/light/verifier_test.go index 44523bd6329..b09e3a5ee14 100644 --- a/light/verifier_test.go +++ b/light/verifier_test.go @@ -5,11 +5,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/cometbft/cometbft/light" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/mempool/bench_test.go b/mempool/bench_test.go index 04c80cb036d..035528188b7 100644 --- a/mempool/bench_test.go +++ b/mempool/bench_test.go @@ -5,14 +5,15 @@ import ( "sync/atomic" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/example/kvstore" abciserver "github.com/cometbft/cometbft/abci/server" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/test" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/proxy" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func BenchmarkReap(b *testing.B) { diff --git a/mempool/cache_test.go b/mempool/cache_test.go index 022e919ac75..35089ba4790 100644 --- a/mempool/cache_test.go +++ b/mempool/cache_test.go @@ -6,11 +6,12 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/example/kvstore" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) func TestCacheRemove(t *testing.T) { diff --git a/mempool/clist_mempool_test.go b/mempool/clist_mempool_test.go index a115e7119cd..bfb4dad6069 100644 --- a/mempool/clist_mempool_test.go +++ b/mempool/clist_mempool_test.go @@ -10,6 +10,12 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + abciclient "github.com/cometbft/cometbft/abci/client" abciclimocks "github.com/cometbft/cometbft/abci/client/mocks" "github.com/cometbft/cometbft/abci/example/kvstore" @@ -22,11 +28,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) // A cleanupFunc cleans up any config / test files created for a particular diff --git a/mempool/nop_mempool_test.go b/mempool/nop_mempool_test.go index 0c76f1bfa3e..a89ccf61aa9 100644 --- a/mempool/nop_mempool_test.go +++ b/mempool/nop_mempool_test.go @@ -3,9 +3,10 @@ package mempool import ( "testing" - "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/types" ) var tx = types.Tx([]byte{0x01}) diff --git a/mempool/reactor.go b/mempool/reactor.go index 45e0cd495b8..302c916fb7f 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -7,6 +7,8 @@ import ( "sync/atomic" "time" + "golang.org/x/sync/semaphore" + abci "github.com/cometbft/cometbft/abci/types" protomem "github.com/cometbft/cometbft/api/cometbft/mempool/v1" cfg "github.com/cometbft/cometbft/config" @@ -15,7 +17,6 @@ import ( "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/types" - "golang.org/x/sync/semaphore" ) // Reactor handles mempool tx broadcasting amongst peers. diff --git a/mempool/reactor_test.go b/mempool/reactor_test.go index c15fd8d6242..dc8c7571621 100644 --- a/mempool/reactor_test.go +++ b/mempool/reactor_test.go @@ -8,6 +8,11 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/go-kit/log/term" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/abci/example/kvstore" abci "github.com/cometbft/cometbft/abci/types" memproto "github.com/cometbft/cometbft/api/cometbft/mempool/v1" @@ -16,10 +21,6 @@ import ( "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" - "github.com/fortytw2/leaktest" - "github.com/go-kit/log/term" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/node/node.go b/node/node.go index 17336d4f6b0..076eb00d0b0 100644 --- a/node/node.go +++ b/node/node.go @@ -7,10 +7,15 @@ import ( "fmt" "net" "net/http" - _ "net/http/pprof" //nolint: gosec "os" "time" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/cors" + + _ "net/http/pprof" //nolint: gosec + cfg "github.com/cometbft/cometbft/config" bc "github.com/cometbft/cometbft/internal/blocksync" cs "github.com/cometbft/cometbft/internal/consensus" @@ -36,9 +41,6 @@ import ( "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" "github.com/cometbft/cometbft/version" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/rs/cors" ) // Node is the highest level interface to a full CometBFT node. diff --git a/node/node_test.go b/node/node_test.go index e9cea41783c..2f4c1660f1f 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -12,6 +12,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/abci/example/kvstore" cfg "github.com/cometbft/cometbft/config" @@ -33,8 +36,6 @@ import ( "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNodeStartStop(t *testing.T) { diff --git a/node/setup.go b/node/setup.go index cf36f60e354..da87ff2cc52 100644 --- a/node/setup.go +++ b/node/setup.go @@ -6,11 +6,14 @@ import ( "encoding/hex" "fmt" "net" - _ "net/http/pprof" //nolint: gosec // securely exposed on separate, optional port "os" "strings" "time" + _ "net/http/pprof" //nolint: gosec,gci // securely exposed on separate, optional port + + _ "github.com/lib/pq" //nolint: gci // provide the psql db driver. + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" cfg "github.com/cometbft/cometbft/config" @@ -34,7 +37,6 @@ import ( "github.com/cometbft/cometbft/proxy" "github.com/cometbft/cometbft/types" "github.com/cometbft/cometbft/version" - _ "github.com/lib/pq" // provide the psql db driver ) const readHeaderTimeout = 10 * time.Second diff --git a/p2p/conn/connection.go b/p2p/conn/connection.go index 4e9afe0af9f..109da6031a4 100644 --- a/p2p/conn/connection.go +++ b/p2p/conn/connection.go @@ -12,6 +12,8 @@ import ( "sync/atomic" "time" + "github.com/cosmos/gogoproto/proto" + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/config" flow "github.com/cometbft/cometbft/internal/flowrate" @@ -21,7 +23,6 @@ import ( "github.com/cometbft/cometbft/internal/timer" "github.com/cometbft/cometbft/libs/log" cmtmath "github.com/cometbft/cometbft/libs/math" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/p2p/conn/connection_test.go b/p2p/conn/connection_test.go index 04d6d6a08c3..85ef1d200da 100644 --- a/p2p/conn/connection_test.go +++ b/p2p/conn/connection_test.go @@ -6,14 +6,15 @@ import ( "testing" "time" - tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" - pbtypes "github.com/cometbft/cometbft/api/cometbft/types/v1" - "github.com/cometbft/cometbft/internal/protoio" - "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/gogoproto/proto" "github.com/fortytw2/leaktest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" + pbtypes "github.com/cometbft/cometbft/api/cometbft/types/v1" + "github.com/cometbft/cometbft/internal/protoio" + "github.com/cometbft/cometbft/libs/log" ) const maxPingPongPacketSize = 1024 // bytes diff --git a/p2p/conn/evil_secret_connection_test.go b/p2p/conn/evil_secret_connection_test.go index 553a15a5de0..c8b8347085e 100644 --- a/p2p/conn/evil_secret_connection_test.go +++ b/p2p/conn/evil_secret_connection_test.go @@ -6,16 +6,17 @@ import ( "io" "testing" - tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/ed25519" - cryptoenc "github.com/cometbft/cometbft/crypto/encoding" - "github.com/cometbft/cometbft/internal/protoio" gogotypes "github.com/cosmos/gogoproto/types" "github.com/oasisprotocol/curve25519-voi/primitives/merlin" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/crypto/chacha20poly1305" + + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/ed25519" + cryptoenc "github.com/cometbft/cometbft/crypto/encoding" + "github.com/cometbft/cometbft/internal/protoio" ) type buffer struct { diff --git a/p2p/conn/secret_connection.go b/p2p/conn/secret_connection.go index b8d01be27d0..3d510df6f52 100644 --- a/p2p/conn/secret_connection.go +++ b/p2p/conn/secret_connection.go @@ -13,13 +13,6 @@ import ( "net" "time" - tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" - "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/ed25519" - cryptoenc "github.com/cometbft/cometbft/crypto/encoding" - "github.com/cometbft/cometbft/internal/async" - "github.com/cometbft/cometbft/internal/protoio" - cmtsync "github.com/cometbft/cometbft/internal/sync" gogotypes "github.com/cosmos/gogoproto/types" pool "github.com/libp2p/go-buffer-pool" "github.com/oasisprotocol/curve25519-voi/primitives/merlin" @@ -27,6 +20,14 @@ import ( "golang.org/x/crypto/curve25519" "golang.org/x/crypto/hkdf" "golang.org/x/crypto/nacl/box" + + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/ed25519" + cryptoenc "github.com/cometbft/cometbft/crypto/encoding" + "github.com/cometbft/cometbft/internal/async" + "github.com/cometbft/cometbft/internal/protoio" + cmtsync "github.com/cometbft/cometbft/internal/sync" ) // 4 + 1024 == 1028 total frame size. diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index d3fe1368563..c6ceb63649b 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -14,14 +14,15 @@ import ( "sync" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/crypto/sr25519" "github.com/cometbft/cometbft/internal/async" cmtos "github.com/cometbft/cometbft/internal/os" cmtrand "github.com/cometbft/cometbft/internal/rand" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // Run go test -update from within this module diff --git a/p2p/key_test.go b/p2p/key_test.go index 95a0deb8497..ce249fc6da1 100644 --- a/p2p/key_test.go +++ b/p2p/key_test.go @@ -6,10 +6,11 @@ import ( "path/filepath" "testing" - "github.com/cometbft/cometbft/crypto/ed25519" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/ed25519" + cmtrand "github.com/cometbft/cometbft/internal/rand" ) func TestLoadOrGenNodeKey(t *testing.T) { diff --git a/p2p/node_info_test.go b/p2p/node_info_test.go index 583035f02d2..bb8b87dae36 100644 --- a/p2p/node_info_test.go +++ b/p2p/node_info_test.go @@ -3,9 +3,10 @@ package p2p import ( "testing" - "github.com/cometbft/cometbft/crypto/ed25519" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/ed25519" ) func TestNodeInfoValidate(t *testing.T) { diff --git a/p2p/peer.go b/p2p/peer.go index ad69f8275f5..0d16722702c 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -6,12 +6,13 @@ import ( "reflect" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/cometbft/cometbft/internal/cmap" "github.com/cometbft/cometbft/internal/service" "github.com/cometbft/cometbft/libs/log" cmtconn "github.com/cometbft/cometbft/p2p/conn" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) //go:generate ../scripts/mockery_generate.sh Peer diff --git a/p2p/peer_set_test.go b/p2p/peer_set_test.go index d0e790488e4..23f23cc1d6b 100644 --- a/p2p/peer_set_test.go +++ b/p2p/peer_set_test.go @@ -5,9 +5,10 @@ import ( "sync" "testing" + "github.com/stretchr/testify/assert" + "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/internal/service" - "github.com/stretchr/testify/assert" ) // mockPeer for testing the PeerSet. diff --git a/p2p/peer_test.go b/p2p/peer_test.go index f761d22b545..927a9645047 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -7,6 +7,10 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + p2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto" @@ -14,9 +18,6 @@ import ( "github.com/cometbft/cometbft/libs/bytes" "github.com/cometbft/cometbft/libs/log" cmtconn "github.com/cometbft/cometbft/p2p/conn" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPeerBasic(t *testing.T) { diff --git a/p2p/pex/addrbook.go b/p2p/pex/addrbook.go index 8c564dcc3dd..c48d6cc4a91 100644 --- a/p2p/pex/addrbook.go +++ b/p2p/pex/addrbook.go @@ -14,6 +14,8 @@ import ( "sync" "time" + "github.com/minio/highwayhash" + "github.com/cometbft/cometbft/crypto" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/service" @@ -21,7 +23,6 @@ import ( "github.com/cometbft/cometbft/libs/log" cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/cometbft/cometbft/p2p" - "github.com/minio/highwayhash" ) const ( diff --git a/p2p/pex/addrbook_test.go b/p2p/pex/addrbook_test.go index f5e36bb3978..01760091690 100644 --- a/p2p/pex/addrbook_test.go +++ b/p2p/pex/addrbook_test.go @@ -9,12 +9,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/libs/log" cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/cometbft/cometbft/p2p" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // FIXME These tests should not rely on .(*addrBook) assertions diff --git a/p2p/pex/pex_reactor_test.go b/p2p/pex/pex_reactor_test.go index 6a2769c399f..1c85b6beda1 100644 --- a/p2p/pex/pex_reactor_test.go +++ b/p2p/pex/pex_reactor_test.go @@ -8,15 +8,16 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/p2p/mock" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var cfg *config.P2PConfig diff --git a/p2p/switch.go b/p2p/switch.go index 129115c2e5e..7bbae2343a4 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -6,12 +6,13 @@ import ( "sync" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/internal/cmap" "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/service" "github.com/cometbft/cometbft/p2p/conn" - "github.com/cosmos/gogoproto/proto" ) const ( diff --git a/p2p/switch_test.go b/p2p/switch_test.go index 7b398df5b6c..c5e2cc923cd 100644 --- a/p2p/switch_test.go +++ b/p2p/switch_test.go @@ -14,16 +14,17 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + p2pproto "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/ed25519" cmtsync "github.com/cometbft/cometbft/internal/sync" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p/conn" - "github.com/cosmos/gogoproto/proto" - "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var cfg *config.P2PConfig diff --git a/p2p/transport.go b/p2p/transport.go index 8cb56bd7bf7..9f6ddfba956 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -6,12 +6,13 @@ import ( "net" "time" + "github.com/cosmos/gogoproto/proto" + "golang.org/x/net/netutil" + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/internal/protoio" "github.com/cometbft/cometbft/p2p/conn" - "github.com/cosmos/gogoproto/proto" - "golang.org/x/net/netutil" ) const ( diff --git a/p2p/types.go b/p2p/types.go index 1793aa2d172..153c5d7b384 100644 --- a/p2p/types.go +++ b/p2p/types.go @@ -1,10 +1,11 @@ package p2p import ( + "github.com/cosmos/gogoproto/proto" + tmp2p "github.com/cometbft/cometbft/api/cometbft/p2p/v1" "github.com/cometbft/cometbft/p2p/conn" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" ) type ( diff --git a/privval/file.go b/privval/file.go index 4073883118e..4356a8b178b 100644 --- a/privval/file.go +++ b/privval/file.go @@ -7,6 +7,8 @@ import ( "os" "time" + "github.com/cosmos/gogoproto/proto" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" @@ -17,7 +19,6 @@ import ( cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/gogoproto/proto" ) // TODO: type ? diff --git a/privval/file_test.go b/privval/file_test.go index 6254f374149..cbec500ae1a 100644 --- a/privval/file_test.go +++ b/privval/file_test.go @@ -7,14 +7,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/crypto/tmhash" cmtrand "github.com/cometbft/cometbft/internal/rand" cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestGenLoadValidator(t *testing.T) { diff --git a/privval/msgs.go b/privval/msgs.go index de1f0a92715..1e383ad5949 100644 --- a/privval/msgs.go +++ b/privval/msgs.go @@ -3,8 +3,9 @@ package privval import ( "fmt" - pvproto "github.com/cometbft/cometbft/api/cometbft/privval/v1" "github.com/cosmos/gogoproto/proto" + + pvproto "github.com/cometbft/cometbft/api/cometbft/privval/v1" ) // TODO: Add ChainIDRequest diff --git a/privval/msgs_test.go b/privval/msgs_test.go index 8f049cef21a..7911cfb489d 100644 --- a/privval/msgs_test.go +++ b/privval/msgs_test.go @@ -5,6 +5,9 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/require" + cryptoproto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" privproto "github.com/cometbft/cometbft/api/cometbft/privval/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" @@ -13,8 +16,6 @@ import ( cryptoenc "github.com/cometbft/cometbft/crypto/encoding" "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/require" ) var stamp = time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC) diff --git a/privval/signer_client_test.go b/privval/signer_client_test.go index ffca9560148..6b986033af3 100644 --- a/privval/signer_client_test.go +++ b/privval/signer_client_test.go @@ -5,6 +5,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cryptoproto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" privvalproto "github.com/cometbft/cometbft/api/cometbft/privval/v1" "github.com/cometbft/cometbft/crypto" @@ -12,8 +15,6 @@ import ( cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/types" cmterrors "github.com/cometbft/cometbft/types/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type signerTestCase struct { diff --git a/privval/signer_listener_endpoint_test.go b/privval/signer_listener_endpoint_test.go index b47a40353cf..9abec9eebc6 100644 --- a/privval/signer_listener_endpoint_test.go +++ b/privval/signer_listener_endpoint_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto/ed25519" cmtnet "github.com/cometbft/cometbft/internal/net" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/privval/socket_dialers_test.go b/privval/socket_dialers_test.go index 3dc520394e3..a511d6420e6 100644 --- a/privval/socket_dialers_test.go +++ b/privval/socket_dialers_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/crypto/ed25519" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/ed25519" ) func getDialerTestCases(t *testing.T) []dialerTestCase { diff --git a/proxy/app_conn.go b/proxy/app_conn.go index 29d059bc7b3..58723894884 100644 --- a/proxy/app_conn.go +++ b/proxy/app_conn.go @@ -4,9 +4,10 @@ import ( "context" "time" + "github.com/go-kit/kit/metrics" + abcicli "github.com/cometbft/cometbft/abci/client" types "github.com/cometbft/cometbft/abci/types" - "github.com/go-kit/kit/metrics" ) //go:generate ../scripts/mockery_generate.sh AppConnConsensus|AppConnMempool|AppConnQuery|AppConnSnapshot diff --git a/proxy/multi_app_conn_test.go b/proxy/multi_app_conn_test.go index c74b5f53d98..a3c5a1cd055 100644 --- a/proxy/multi_app_conn_test.go +++ b/proxy/multi_app_conn_test.go @@ -8,10 +8,11 @@ import ( "testing" "time" - abcimocks "github.com/cometbft/cometbft/abci/client/mocks" - "github.com/cometbft/cometbft/proxy/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + + abcimocks "github.com/cometbft/cometbft/abci/client/mocks" + "github.com/cometbft/cometbft/proxy/mocks" ) func TestAppConns_Start_Stop(t *testing.T) { diff --git a/rpc/client/event_test.go b/rpc/client/event_test.go index 494669a07e6..47dd97354e4 100644 --- a/rpc/client/event_test.go +++ b/rpc/client/event_test.go @@ -7,13 +7,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/rpc/client" ctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var waitForEventTimeout = 8 * time.Second diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index 1f6035c44c7..995916a845c 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -6,6 +6,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto/ed25519" cryptoenc "github.com/cometbft/cometbft/crypto/encoding" @@ -16,8 +19,6 @@ import ( "github.com/cometbft/cometbft/rpc/client" rpctest "github.com/cometbft/cometbft/rpc/test" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // For some reason the empty node used in tests has a time of diff --git a/rpc/client/helpers_test.go b/rpc/client/helpers_test.go index e00d244fc02..e520cdb187c 100644 --- a/rpc/client/helpers_test.go +++ b/rpc/client/helpers_test.go @@ -5,11 +5,12 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/rpc/client" "github.com/cometbft/cometbft/rpc/client/mock" ctypes "github.com/cometbft/cometbft/rpc/core/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestWaitForHeight(t *testing.T) { diff --git a/rpc/client/mock/status_test.go b/rpc/client/mock/status_test.go index 13dd0f71caa..5bc00177eef 100644 --- a/rpc/client/mock/status_test.go +++ b/rpc/client/mock/status_test.go @@ -4,11 +4,12 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/libs/bytes" "github.com/cometbft/cometbft/rpc/client/mock" ctypes "github.com/cometbft/cometbft/rpc/core/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestStatus(t *testing.T) { diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index ef99c66957e..9d6e17bf872 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -11,6 +11,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" cmtjson "github.com/cometbft/cometbft/libs/json" "github.com/cometbft/cometbft/libs/log" @@ -22,8 +25,6 @@ import ( rpcclient "github.com/cometbft/cometbft/rpc/jsonrpc/client" rpctest "github.com/cometbft/cometbft/rpc/test" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ctx = context.Background() diff --git a/rpc/core/blocks_test.go b/rpc/core/blocks_test.go index b44848d35b5..bc4e0bdb469 100644 --- a/rpc/core/blocks_test.go +++ b/rpc/core/blocks_test.go @@ -4,14 +4,15 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/state/mocks" ctypes "github.com/cometbft/cometbft/rpc/core/types" rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestBlockchainInfo(t *testing.T) { diff --git a/rpc/core/net_test.go b/rpc/core/net_test.go index dfdb635b17c..9c58b62784e 100644 --- a/rpc/core/net_test.go +++ b/rpc/core/net_test.go @@ -3,12 +3,13 @@ package core import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/p2p" rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestUnsafeDialSeeds(t *testing.T) { diff --git a/rpc/core/types/responses_test.go b/rpc/core/types/responses_test.go index 77edae0c90d..772fb6d6166 100644 --- a/rpc/core/types/responses_test.go +++ b/rpc/core/types/responses_test.go @@ -3,8 +3,9 @@ package coretypes import ( "testing" - "github.com/cometbft/cometbft/p2p" "github.com/stretchr/testify/assert" + + "github.com/cometbft/cometbft/p2p" ) func TestStatusIndexer(t *testing.T) { diff --git a/rpc/grpc/client/block_results_service.go b/rpc/grpc/client/block_results_service.go index 85b65db3a9a..bcb85f3a594 100644 --- a/rpc/grpc/client/block_results_service.go +++ b/rpc/grpc/client/block_results_service.go @@ -4,10 +4,11 @@ import ( "context" "fmt" + "github.com/cosmos/gogoproto/grpc" + abci "github.com/cometbft/cometbft/abci/types" brs "github.com/cometbft/cometbft/api/cometbft/services/block_results/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - "github.com/cosmos/gogoproto/grpc" ) type BlockResults struct { diff --git a/rpc/grpc/client/block_service.go b/rpc/grpc/client/block_service.go index 9ce54fd3b05..e4d52b12e7f 100644 --- a/rpc/grpc/client/block_service.go +++ b/rpc/grpc/client/block_service.go @@ -4,10 +4,11 @@ import ( "context" "fmt" + "github.com/cosmos/gogoproto/grpc" + blocksvc "github.com/cometbft/cometbft/api/cometbft/services/block/v1" cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/types" - "github.com/cosmos/gogoproto/grpc" ) // Block data returned by the CometBFT BlockService gRPC API. diff --git a/rpc/grpc/client/client.go b/rpc/grpc/client/client.go index a34570dc27f..da0fc892572 100644 --- a/rpc/grpc/client/client.go +++ b/rpc/grpc/client/client.go @@ -9,9 +9,10 @@ import ( "fmt" "net" - cmtnet "github.com/cometbft/cometbft/internal/net" ggrpc "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + cmtnet "github.com/cometbft/cometbft/internal/net" ) type Option func(*clientBuilder) diff --git a/rpc/grpc/client/privileged/privileged.go b/rpc/grpc/client/privileged/privileged.go index 4e4bd9af447..a85de564d82 100644 --- a/rpc/grpc/client/privileged/privileged.go +++ b/rpc/grpc/client/privileged/privileged.go @@ -5,9 +5,10 @@ import ( "fmt" "net" - cmtnet "github.com/cometbft/cometbft/internal/net" ggrpc "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + cmtnet "github.com/cometbft/cometbft/internal/net" ) type Option func(*clientBuilder) diff --git a/rpc/grpc/client/privileged/pruning_service.go b/rpc/grpc/client/privileged/pruning_service.go index a4e0176b90c..d7036fff82a 100644 --- a/rpc/grpc/client/privileged/pruning_service.go +++ b/rpc/grpc/client/privileged/pruning_service.go @@ -3,8 +3,9 @@ package privileged import ( "context" - pbsvc "github.com/cometbft/cometbft/api/cometbft/services/pruning/v1" "github.com/cosmos/gogoproto/grpc" + + pbsvc "github.com/cometbft/cometbft/api/cometbft/services/pruning/v1" ) // RetainHeights provides information on which block height limits have been diff --git a/rpc/grpc/client/version_service.go b/rpc/grpc/client/version_service.go index 3f117e4dc5d..bef0fa445eb 100644 --- a/rpc/grpc/client/version_service.go +++ b/rpc/grpc/client/version_service.go @@ -3,8 +3,9 @@ package client import ( "context" - pbsvc "github.com/cometbft/cometbft/api/cometbft/services/version/v1" "github.com/cosmos/gogoproto/grpc" + + pbsvc "github.com/cometbft/cometbft/api/cometbft/services/version/v1" ) // Version provides version information about a particular CometBFT node. diff --git a/rpc/grpc/server/privileged/privileged.go b/rpc/grpc/server/privileged/privileged.go index 6295e99068d..bde0ce28a30 100644 --- a/rpc/grpc/server/privileged/privileged.go +++ b/rpc/grpc/server/privileged/privileged.go @@ -4,11 +4,12 @@ import ( "fmt" "net" + "google.golang.org/grpc" + pbpruningsvc "github.com/cometbft/cometbft/api/cometbft/services/pruning/v1" sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/rpc/grpc/server/services/pruningservice" - "google.golang.org/grpc" ) // Option is any function that allows for configuration of the gRPC server diff --git a/rpc/grpc/server/server.go b/rpc/grpc/server/server.go index 6acf372a326..012d06f1277 100644 --- a/rpc/grpc/server/server.go +++ b/rpc/grpc/server/server.go @@ -5,6 +5,8 @@ import ( "net" "strings" + "google.golang.org/grpc" + pbblocksvc "github.com/cometbft/cometbft/api/cometbft/services/block/v1" brs "github.com/cometbft/cometbft/api/cometbft/services/block_results/v1" pbversionsvc "github.com/cometbft/cometbft/api/cometbft/services/version/v1" @@ -15,7 +17,6 @@ import ( "github.com/cometbft/cometbft/rpc/grpc/server/services/blockservice" "github.com/cometbft/cometbft/rpc/grpc/server/services/versionservice" "github.com/cometbft/cometbft/types" - "google.golang.org/grpc" ) // Option is any function that allows for configuration of the gRPC server diff --git a/rpc/grpc/server/services/blockresultservice/service.go b/rpc/grpc/server/services/blockresultservice/service.go index baff554f632..82c27030538 100644 --- a/rpc/grpc/server/services/blockresultservice/service.go +++ b/rpc/grpc/server/services/blockresultservice/service.go @@ -3,12 +3,13 @@ package blockresultservice import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + brs "github.com/cometbft/cometbft/api/cometbft/services/block_results/v1" sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/internal/store" "github.com/cometbft/cometbft/libs/log" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type blockResultsService struct { diff --git a/rpc/grpc/server/services/blockservice/service.go b/rpc/grpc/server/services/blockservice/service.go index a1b1bfd97f7..cc43fbd1406 100644 --- a/rpc/grpc/server/services/blockservice/service.go +++ b/rpc/grpc/server/services/blockservice/service.go @@ -4,6 +4,9 @@ import ( context "context" "fmt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + blocksvc "github.com/cometbft/cometbft/api/cometbft/services/block/v1" ptypes "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtpubsub "github.com/cometbft/cometbft/internal/pubsub" @@ -11,8 +14,6 @@ import ( "github.com/cometbft/cometbft/internal/store" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type blockServiceServer struct { diff --git a/rpc/grpc/server/services/pruningservice/service.go b/rpc/grpc/server/services/pruningservice/service.go index c5ae94594c9..88af14fff97 100644 --- a/rpc/grpc/server/services/pruningservice/service.go +++ b/rpc/grpc/server/services/pruningservice/service.go @@ -5,12 +5,13 @@ import ( "fmt" "math" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + pbsvc "github.com/cometbft/cometbft/api/cometbft/services/pruning/v1" "github.com/cometbft/cometbft/internal/rpctrace" sm "github.com/cometbft/cometbft/internal/state" "github.com/cometbft/cometbft/libs/log" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type pruningServiceServer struct { diff --git a/rpc/jsonrpc/client/ws_client.go b/rpc/jsonrpc/client/ws_client.go index dfe8f1ab474..b331d76beac 100644 --- a/rpc/jsonrpc/client/ws_client.go +++ b/rpc/jsonrpc/client/ws_client.go @@ -9,13 +9,14 @@ import ( "sync" "time" + "github.com/gorilla/websocket" + metrics "github.com/rcrowley/go-metrics" + cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/internal/service" cmtsync "github.com/cometbft/cometbft/internal/sync" "github.com/cometbft/cometbft/libs/log" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/gorilla/websocket" - metrics "github.com/rcrowley/go-metrics" ) const ( diff --git a/rpc/jsonrpc/client/ws_client_test.go b/rpc/jsonrpc/client/ws_client_test.go index 8b6f2343742..61854993ba7 100644 --- a/rpc/jsonrpc/client/ws_client_test.go +++ b/rpc/jsonrpc/client/ws_client_test.go @@ -9,11 +9,12 @@ import ( "testing" "time" + "github.com/gorilla/websocket" + "github.com/stretchr/testify/require" + cmtsync "github.com/cometbft/cometbft/internal/sync" "github.com/cometbft/cometbft/libs/log" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/gorilla/websocket" - "github.com/stretchr/testify/require" ) var wsCallTimeout = 5 * time.Second diff --git a/rpc/jsonrpc/jsonrpc_test.go b/rpc/jsonrpc/jsonrpc_test.go index 5e1598ba639..0ba2f879aad 100644 --- a/rpc/jsonrpc/jsonrpc_test.go +++ b/rpc/jsonrpc/jsonrpc_test.go @@ -15,15 +15,16 @@ import ( "testing" "time" + "github.com/go-kit/log/term" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtrand "github.com/cometbft/cometbft/internal/rand" cmtbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cometbft/cometbft/libs/log" client "github.com/cometbft/cometbft/rpc/jsonrpc/client" server "github.com/cometbft/cometbft/rpc/jsonrpc/server" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/go-kit/log/term" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // Client and Server should work over tcp or unix sockets. diff --git a/rpc/jsonrpc/server/http_json_handler_test.go b/rpc/jsonrpc/server/http_json_handler_test.go index 6409d24637a..93be2582b13 100644 --- a/rpc/jsonrpc/server/http_json_handler_test.go +++ b/rpc/jsonrpc/server/http_json_handler_test.go @@ -9,10 +9,11 @@ import ( "strings" "testing" - "github.com/cometbft/cometbft/libs/log" - types "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/log" + types "github.com/cometbft/cometbft/rpc/jsonrpc/types" ) func testMux() *http.ServeMux { diff --git a/rpc/jsonrpc/server/http_server.go b/rpc/jsonrpc/server/http_server.go index 32ffb431a89..168ad3e42b9 100644 --- a/rpc/jsonrpc/server/http_server.go +++ b/rpc/jsonrpc/server/http_server.go @@ -14,9 +14,10 @@ import ( "strings" "time" + "golang.org/x/net/netutil" + "github.com/cometbft/cometbft/libs/log" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "golang.org/x/net/netutil" ) // Config is a RPC server configuration. diff --git a/rpc/jsonrpc/server/http_server_test.go b/rpc/jsonrpc/server/http_server_test.go index b9c4ce99e40..03a2ce8e7e4 100644 --- a/rpc/jsonrpc/server/http_server_test.go +++ b/rpc/jsonrpc/server/http_server_test.go @@ -13,10 +13,11 @@ import ( "testing" "time" - "github.com/cometbft/cometbft/libs/log" - types "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/log" + types "github.com/cometbft/cometbft/rpc/jsonrpc/types" ) type sampleResult struct { diff --git a/rpc/jsonrpc/server/parse_test.go b/rpc/jsonrpc/server/parse_test.go index 06290e3182c..39e093c2bd1 100644 --- a/rpc/jsonrpc/server/parse_test.go +++ b/rpc/jsonrpc/server/parse_test.go @@ -7,10 +7,11 @@ import ( "strconv" "testing" - "github.com/cometbft/cometbft/libs/bytes" - types "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/bytes" + types "github.com/cometbft/cometbft/rpc/jsonrpc/types" ) func TestParseJSONMap(t *testing.T) { diff --git a/rpc/jsonrpc/server/ws_handler.go b/rpc/jsonrpc/server/ws_handler.go index 555954ea940..32ae580b9f4 100644 --- a/rpc/jsonrpc/server/ws_handler.go +++ b/rpc/jsonrpc/server/ws_handler.go @@ -10,10 +10,11 @@ import ( "runtime/debug" "time" + "github.com/gorilla/websocket" + "github.com/cometbft/cometbft/internal/service" "github.com/cometbft/cometbft/libs/log" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" - "github.com/gorilla/websocket" ) // WebSocket handler diff --git a/rpc/jsonrpc/server/ws_handler_test.go b/rpc/jsonrpc/server/ws_handler_test.go index 3790e4b69e0..b403151950c 100644 --- a/rpc/jsonrpc/server/ws_handler_test.go +++ b/rpc/jsonrpc/server/ws_handler_test.go @@ -5,10 +5,11 @@ import ( "net/http/httptest" "testing" - "github.com/cometbft/cometbft/libs/log" - types "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/gorilla/websocket" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/libs/log" + types "github.com/cometbft/cometbft/rpc/jsonrpc/types" ) func TestWebsocketManagerHandler(t *testing.T) { diff --git a/scripts/metricsgen/metricsdiff/metricsdiff_test.go b/scripts/metricsgen/metricsdiff/metricsdiff_test.go index 6b63ce69f20..122eaf67393 100644 --- a/scripts/metricsgen/metricsdiff/metricsdiff_test.go +++ b/scripts/metricsgen/metricsdiff/metricsdiff_test.go @@ -5,8 +5,9 @@ import ( "io" "testing" - metricsdiff "github.com/cometbft/cometbft/scripts/metricsgen/metricsdiff" "github.com/stretchr/testify/require" + + metricsdiff "github.com/cometbft/cometbft/scripts/metricsgen/metricsdiff" ) func TestDiff(t *testing.T) { diff --git a/scripts/metricsgen/metricsgen_test.go b/scripts/metricsgen/metricsgen_test.go index 45447f09921..906d9bbb456 100644 --- a/scripts/metricsgen/metricsgen_test.go +++ b/scripts/metricsgen/metricsgen_test.go @@ -11,8 +11,9 @@ import ( "path/filepath" "testing" - metricsgen "github.com/cometbft/cometbft/scripts/metricsgen" "github.com/stretchr/testify/require" + + metricsgen "github.com/cometbft/cometbft/scripts/metricsgen" ) const testDataDir = "./testdata" diff --git a/test/e2e/app/log_abci.go b/test/e2e/app/log_abci.go index 343ccf1d91a..26b12e4bf3c 100644 --- a/test/e2e/app/log_abci.go +++ b/test/e2e/app/log_abci.go @@ -5,8 +5,9 @@ import ( "fmt" "strings" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/gogoproto/proto" + + abci "github.com/cometbft/cometbft/abci/types" ) const AbciReq = "abci-req" diff --git a/test/e2e/app/log_abci_test.go b/test/e2e/app/log_abci_test.go index 1d9a5cbc42c..ed4f8224567 100644 --- a/test/e2e/app/log_abci_test.go +++ b/test/e2e/app/log_abci_test.go @@ -3,8 +3,9 @@ package app import ( "testing" - abci "github.com/cometbft/cometbft/abci/types" "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" ) // Tests for logging each type of requests. diff --git a/test/e2e/generator/generate.go b/test/e2e/generator/generate.go index f47d21122d8..270cbda40be 100644 --- a/test/e2e/generator/generate.go +++ b/test/e2e/generator/generate.go @@ -10,10 +10,11 @@ import ( "time" "github.com/Masterminds/semver/v3" - e2e "github.com/cometbft/cometbft/test/e2e/pkg" - "github.com/cometbft/cometbft/version" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing/object" + + e2e "github.com/cometbft/cometbft/test/e2e/pkg" + "github.com/cometbft/cometbft/version" ) var ( diff --git a/test/e2e/generator/generate_test.go b/test/e2e/generator/generate_test.go index 13af09d246a..7116c968e5d 100644 --- a/test/e2e/generator/generate_test.go +++ b/test/e2e/generator/generate_test.go @@ -6,9 +6,10 @@ import ( "path/filepath" "testing" - e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + e2e "github.com/cometbft/cometbft/test/e2e/pkg" ) // TestGenerator tests that only valid manifests are generated. diff --git a/test/e2e/generator/main.go b/test/e2e/generator/main.go index 29680464365..f4f8140c0c1 100644 --- a/test/e2e/generator/main.go +++ b/test/e2e/generator/main.go @@ -7,8 +7,9 @@ import ( "os" "path/filepath" - "github.com/cometbft/cometbft/libs/log" "github.com/spf13/cobra" + + "github.com/cometbft/cometbft/libs/log" ) const ( diff --git a/test/e2e/node/config.go b/test/e2e/node/config.go index 0ca24719bf8..a3ebb2687c8 100644 --- a/test/e2e/node/config.go +++ b/test/e2e/node/config.go @@ -5,6 +5,7 @@ import ( "time" "github.com/BurntSushi/toml" + "github.com/cometbft/cometbft/test/e2e/app" cmterrors "github.com/cometbft/cometbft/types/errors" ) diff --git a/test/e2e/node/main.go b/test/e2e/node/main.go index 65d7538fe0d..1b78c1c4a31 100644 --- a/test/e2e/node/main.go +++ b/test/e2e/node/main.go @@ -11,6 +11,8 @@ import ( "strings" "time" + "github.com/spf13/viper" + "github.com/cometbft/cometbft/abci/server" "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/ed25519" @@ -28,7 +30,6 @@ import ( rpcserver "github.com/cometbft/cometbft/rpc/jsonrpc/server" "github.com/cometbft/cometbft/test/e2e/app" e2e "github.com/cometbft/cometbft/test/e2e/pkg" - "github.com/spf13/viper" ) var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)) diff --git a/test/e2e/pkg/grammar/checker_test.go b/test/e2e/pkg/grammar/checker_test.go index 6df2e19db0a..a568fd9f0f8 100644 --- a/test/e2e/pkg/grammar/checker_test.go +++ b/test/e2e/pkg/grammar/checker_test.go @@ -4,8 +4,9 @@ import ( "fmt" "testing" - abci "github.com/cometbft/cometbft/abci/types" "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" ) var ( diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index 08b2f122c42..5a511e4d0a0 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -3,7 +3,6 @@ package e2e import ( "bytes" "context" - _ "embed" "encoding/csv" "errors" "fmt" @@ -18,6 +17,8 @@ import ( "text/template" "time" + _ "embed" + "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/crypto/secp256k1" diff --git a/test/e2e/runner/load.go b/test/e2e/runner/load.go index ae58dcbf105..5437efb48b2 100644 --- a/test/e2e/runner/load.go +++ b/test/e2e/runner/load.go @@ -7,12 +7,13 @@ import ( "sync" "time" + "github.com/google/uuid" + "github.com/cometbft/cometbft/libs/log" rpchttp "github.com/cometbft/cometbft/rpc/client/http" e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/test/loadtime/payload" "github.com/cometbft/cometbft/types" - "github.com/google/uuid" ) const workerPoolSize = 16 diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index eb33460b500..51a57a8b39a 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -8,12 +8,13 @@ import ( "os" "strconv" + "github.com/spf13/cobra" + "github.com/cometbft/cometbft/libs/log" e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/test/e2e/pkg/infra" "github.com/cometbft/cometbft/test/e2e/pkg/infra/digitalocean" "github.com/cometbft/cometbft/test/e2e/pkg/infra/docker" - "github.com/spf13/cobra" ) const randomSeed = 2308084734268 diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index 1e38673afc5..cd78b7b4618 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -15,6 +15,7 @@ import ( "time" "github.com/BurntSushi/toml" + "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/libs/log" diff --git a/test/e2e/tests/abci_test.go b/test/e2e/tests/abci_test.go index 41f00334555..82d7fdb8cc2 100644 --- a/test/e2e/tests/abci_test.go +++ b/test/e2e/tests/abci_test.go @@ -3,9 +3,10 @@ package e2e_test import ( "testing" + "github.com/stretchr/testify/require" + e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/test/e2e/pkg/grammar" - "github.com/stretchr/testify/require" ) func TestCheckABCIGrammar(t *testing.T) { diff --git a/test/e2e/tests/app_test.go b/test/e2e/tests/app_test.go index 6cbd490a334..af6467b1210 100644 --- a/test/e2e/tests/app_test.go +++ b/test/e2e/tests/app_test.go @@ -9,10 +9,11 @@ import ( "testing" "time" - e2e "github.com/cometbft/cometbft/test/e2e/pkg" - "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + e2e "github.com/cometbft/cometbft/test/e2e/pkg" + "github.com/cometbft/cometbft/types" ) // Tests that any initial state given in genesis has made it into the app. diff --git a/test/e2e/tests/block_test.go b/test/e2e/tests/block_test.go index a4fa9399c50..14741a35c9d 100644 --- a/test/e2e/tests/block_test.go +++ b/test/e2e/tests/block_test.go @@ -3,9 +3,10 @@ package e2e_test import ( "testing" - e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + e2e "github.com/cometbft/cometbft/test/e2e/pkg" ) // Tests that block headers are identical across nodes where present. diff --git a/test/e2e/tests/e2e_test.go b/test/e2e/tests/e2e_test.go index f71a26e2511..8dcfdc9de52 100644 --- a/test/e2e/tests/e2e_test.go +++ b/test/e2e/tests/e2e_test.go @@ -9,13 +9,14 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" rpchttp "github.com/cometbft/cometbft/rpc/client/http" rpctypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cometbft/cometbft/test/e2e/app" e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) func init() { diff --git a/test/e2e/tests/grpc_test.go b/test/e2e/tests/grpc_test.go index 2b2271e56e1..d1462a0539e 100644 --- a/test/e2e/tests/grpc_test.go +++ b/test/e2e/tests/grpc_test.go @@ -6,11 +6,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + coretypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/cometbft/cometbft/rpc/grpc/client/privileged" e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/require" ) func TestGRPC_Version(t *testing.T) { diff --git a/test/e2e/tests/net_test.go b/test/e2e/tests/net_test.go index fe320ab4015..84fbe3290f2 100644 --- a/test/e2e/tests/net_test.go +++ b/test/e2e/tests/net_test.go @@ -3,8 +3,9 @@ package e2e_test import ( "testing" - e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/stretchr/testify/require" + + e2e "github.com/cometbft/cometbft/test/e2e/pkg" ) // Tests that all nodes have peered with each other, regardless of discovery method. diff --git a/test/e2e/tests/validator_test.go b/test/e2e/tests/validator_test.go index cd3d701dad8..1d75bc20060 100644 --- a/test/e2e/tests/validator_test.go +++ b/test/e2e/tests/validator_test.go @@ -4,9 +4,10 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/require" + e2e "github.com/cometbft/cometbft/test/e2e/pkg" "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" ) // Tests that validator sets are available and correct according to diff --git a/test/fuzz/mempool/fuzz_test.go b/test/fuzz/mempool/fuzz_test.go index 1f3350a6beb..215703206cb 100644 --- a/test/fuzz/mempool/fuzz_test.go +++ b/test/fuzz/mempool/fuzz_test.go @@ -6,8 +6,9 @@ import ( "path/filepath" "testing" - mempl "github.com/cometbft/cometbft/test/fuzz/mempool" "github.com/stretchr/testify/require" + + mempl "github.com/cometbft/cometbft/test/fuzz/mempool" ) const testdataCasesDir = "testdata/cases" diff --git a/test/loadtime/cmd/load/main.go b/test/loadtime/cmd/load/main.go index fd8a3d9c553..d6bb798bc1d 100644 --- a/test/loadtime/cmd/load/main.go +++ b/test/loadtime/cmd/load/main.go @@ -3,9 +3,10 @@ package main import ( "fmt" - "github.com/cometbft/cometbft/test/loadtime/payload" "github.com/google/uuid" "github.com/informalsystems/tm-load-test/pkg/loadtest" + + "github.com/cometbft/cometbft/test/loadtime/payload" ) // Ensure all of the interfaces are correctly satisfied. diff --git a/test/loadtime/payload/payload_test.go b/test/loadtime/payload/payload_test.go index 8c79dd6588d..b095a6781af 100644 --- a/test/loadtime/payload/payload_test.go +++ b/test/loadtime/payload/payload_test.go @@ -4,8 +4,9 @@ import ( "bytes" "testing" - "github.com/cometbft/cometbft/test/loadtime/payload" "github.com/google/uuid" + + "github.com/cometbft/cometbft/test/loadtime/payload" ) const payloadSizeTarget = 1024 // 1kb diff --git a/test/loadtime/report/report.go b/test/loadtime/report/report.go index 8171753ff74..83b994b0e0e 100644 --- a/test/loadtime/report/report.go +++ b/test/loadtime/report/report.go @@ -6,10 +6,11 @@ import ( "sync" "time" - "github.com/cometbft/cometbft/test/loadtime/payload" - "github.com/cometbft/cometbft/types" "github.com/gofrs/uuid" "gonum.org/v1/gonum/stat" + + "github.com/cometbft/cometbft/test/loadtime/payload" + "github.com/cometbft/cometbft/types" ) // BlockStore defines the set of methods needed by the report generator from diff --git a/test/loadtime/report/report_test.go b/test/loadtime/report/report_test.go index 90046786ef9..1d9cdecba8b 100644 --- a/test/loadtime/report/report_test.go +++ b/test/loadtime/report/report_test.go @@ -4,11 +4,12 @@ import ( "testing" "time" + "github.com/google/uuid" + "google.golang.org/protobuf/types/known/timestamppb" + "github.com/cometbft/cometbft/test/loadtime/payload" "github.com/cometbft/cometbft/test/loadtime/report" "github.com/cometbft/cometbft/types" - "github.com/google/uuid" - "google.golang.org/protobuf/types/known/timestamppb" ) const ( diff --git a/types/block.go b/types/block.go index 19710819fe4..0c1ad50806a 100644 --- a/types/block.go +++ b/types/block.go @@ -7,6 +7,9 @@ import ( "strings" "time" + "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" @@ -17,8 +20,6 @@ import ( cmtbytes "github.com/cometbft/cometbft/libs/bytes" cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/cometbft/cometbft/version" - "github.com/cosmos/gogoproto/proto" - gogotypes "github.com/cosmos/gogoproto/types" ) const ( diff --git a/types/block_meta_test.go b/types/block_meta_test.go index e96d5b6d140..4c08878d592 100644 --- a/types/block_meta_test.go +++ b/types/block_meta_test.go @@ -3,9 +3,10 @@ package types import ( "testing" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto/tmhash" cmtrand "github.com/cometbft/cometbft/internal/rand" - "github.com/stretchr/testify/require" ) func TestBlockMeta_ToProto(t *testing.T) { diff --git a/types/block_test.go b/types/block_test.go index f00bd4ef236..ea23d97f53f 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -9,6 +9,10 @@ import ( "testing" "time" + gogotypes "github.com/cosmos/gogoproto/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/merkle" @@ -18,9 +22,6 @@ import ( "github.com/cometbft/cometbft/libs/bytes" cmttime "github.com/cometbft/cometbft/types/time" "github.com/cometbft/cometbft/version" - gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { diff --git a/types/encoding_helper.go b/types/encoding_helper.go index 0efabedb80a..faf21dcda3a 100644 --- a/types/encoding_helper.go +++ b/types/encoding_helper.go @@ -1,8 +1,9 @@ package types import ( - "github.com/cometbft/cometbft/libs/bytes" gogotypes "github.com/cosmos/gogoproto/types" + + "github.com/cometbft/cometbft/libs/bytes" ) // cdcEncode returns nil if the input is nil, otherwise returns diff --git a/types/event_bus_test.go b/types/event_bus_test.go index 6c8e5f18337..62b52daa45e 100644 --- a/types/event_bus_test.go +++ b/types/event_bus_test.go @@ -7,11 +7,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" cmtpubsub "github.com/cometbft/cometbft/internal/pubsub" cmtquery "github.com/cometbft/cometbft/internal/pubsub/query" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestEventBusPublishEventTx(t *testing.T) { diff --git a/types/evidence_test.go b/types/evidence_test.go index 812451bf752..5b5fff448b9 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/tmhash" cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var defaultVoteTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) diff --git a/types/genesis_test.go b/types/genesis_test.go index 56f6f21d4dd..6b7651faf23 100644 --- a/types/genesis_test.go +++ b/types/genesis_test.go @@ -4,11 +4,12 @@ import ( "os" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto/ed25519" cmtjson "github.com/cometbft/cometbft/libs/json" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestGenesisBad(t *testing.T) { diff --git a/types/light_test.go b/types/light_test.go index 5860cd1df02..d2e478b3b07 100644 --- a/types/light_test.go +++ b/types/light_test.go @@ -5,11 +5,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestLightBlockValidateBasic(t *testing.T) { diff --git a/types/params_test.go b/types/params_test.go index b490e639129..43a20a04aea 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -6,9 +6,10 @@ import ( "testing" "time" - cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" ) var ( diff --git a/types/part_set_test.go b/types/part_set_test.go index 4a956e9a080..9f8b1004f54 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -4,10 +4,11 @@ import ( "io" "testing" - "github.com/cometbft/cometbft/crypto/merkle" - cmtrand "github.com/cometbft/cometbft/internal/rand" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/cometbft/cometbft/crypto/merkle" + cmtrand "github.com/cometbft/cometbft/internal/rand" ) const ( diff --git a/types/proposal_test.go b/types/proposal_test.go index 6b32d1094e3..a2b1597b155 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -5,13 +5,14 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cometbft/cometbft/internal/protoio" cmtrand "github.com/cometbft/cometbft/internal/rand" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/types/protobuf_test.go b/types/protobuf_test.go index 565cbc247ea..3a822b52f5d 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -3,12 +3,13 @@ package types import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" cryptoenc "github.com/cometbft/cometbft/crypto/encoding" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestABCIPubKey(t *testing.T) { diff --git a/types/results_test.go b/types/results_test.go index 87a93da2b3e..e08c67185d3 100644 --- a/types/results_test.go +++ b/types/results_test.go @@ -3,9 +3,10 @@ package types import ( "testing" - abci "github.com/cometbft/cometbft/abci/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + abci "github.com/cometbft/cometbft/abci/types" ) func TestABCIResults(t *testing.T) { diff --git a/types/test_util.go b/types/test_util.go index 0ab9bf2bf57..7e9dc593ed0 100644 --- a/types/test_util.go +++ b/types/test_util.go @@ -5,9 +5,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + cmtversion "github.com/cometbft/cometbft/api/cometbft/version/v1" "github.com/cometbft/cometbft/version" - "github.com/stretchr/testify/require" ) func MakeExtCommit(blockID BlockID, height int64, round int32, diff --git a/types/tx_test.go b/types/tx_test.go index 33a9682bdae..9bd8c3c89af 100644 --- a/types/tx_test.go +++ b/types/tx_test.go @@ -5,11 +5,12 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtrand "github.com/cometbft/cometbft/internal/rand" ctest "github.com/cometbft/cometbft/libs/test" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func makeTxs(cnt, size int) Txs { diff --git a/types/validation_test.go b/types/validation_test.go index 138c1f5d23f..cf2c3208b2b 100644 --- a/types/validation_test.go +++ b/types/validation_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - cmtmath "github.com/cometbft/cometbft/libs/math" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + cmtmath "github.com/cometbft/cometbft/libs/math" ) // Check VerifyCommit, VerifyCommitLight and VerifyCommitLightTrusting basic diff --git a/types/validator_set_test.go b/types/validator_set_test.go index 5f73a00ec83..ec44f9cfca2 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -9,13 +9,14 @@ import ( "testing" "testing/quick" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" cmtrand "github.com/cometbft/cometbft/internal/rand" cmtmath "github.com/cometbft/cometbft/libs/math" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestValidatorSetBasic(t *testing.T) { diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 243fd51e454..e74e319b476 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -4,11 +4,12 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/cometbft/cometbft/crypto" cmtrand "github.com/cometbft/cometbft/internal/rand" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestVoteSet_AddVote_Good(t *testing.T) { diff --git a/types/vote_test.go b/types/vote_test.go index c349d3ba04e..acc4a04ddbe 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -4,15 +4,16 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cometbft/cometbft/internal/protoio" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func examplePrevote() *Vote {