From 8853e8d3d184654ecad3d964670cad6703a37573 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 10:13:31 -0400 Subject: [PATCH 1/7] linters and format --- .github/lint.yml | 12 ++++ Makefile | 13 ++++ app/sim_test.go | 9 +-- cmd/kvcli/main.go | 6 +- cmd/kvd/add_account.go | 3 +- go.mod | 1 + golangci.yml | 63 +++++++++++++++++++ rest_test/setup/setuptest.go | 9 +-- x/auction/alias.go | 46 +++++++------- x/auction/keeper/auctions.go | 1 + x/auction/keeper/params.go | 1 + x/auction/keeper/querier_test.go | 7 ++- x/bep3/client/cli/tx.go | 3 +- x/bep3/client/rest/query.go | 1 + x/bep3/keeper/asset_test.go | 7 ++- x/bep3/keeper/integration_test.go | 5 +- x/bep3/keeper/keeper.go | 3 +- x/bep3/keeper/keeper_test.go | 7 ++- x/bep3/keeper/params_test.go | 7 ++- x/bep3/keeper/swap.go | 14 ++--- x/bep3/simulation/genesis.go | 1 + x/bep3/types/common_test.go | 3 +- x/bep3/types/genesis_test.go | 3 +- x/bep3/types/hash_test.go | 5 +- x/bep3/types/params_test.go | 3 +- x/cdp/abci.go | 3 +- x/cdp/abci_test.go | 7 ++- x/cdp/genesis.go | 1 + x/cdp/genesis_test.go | 3 +- x/cdp/handler_test.go | 5 +- x/cdp/integration_test.go | 15 ++--- x/cdp/keeper/auctions.go | 1 + x/cdp/keeper/auctions_test.go | 1 + x/cdp/keeper/cdp.go | 3 +- x/cdp/keeper/cdp_test.go | 7 ++- x/cdp/keeper/deposit.go | 1 + x/cdp/keeper/deposit_test.go | 7 ++- x/cdp/keeper/draw.go | 1 + x/cdp/keeper/draw_test.go | 7 ++- x/cdp/keeper/fees.go | 1 + x/cdp/keeper/fees_test.go | 5 +- x/cdp/keeper/integration_test.go | 15 ++--- x/cdp/keeper/keeper.go | 1 + x/cdp/keeper/keeper_bench_test.go | 5 +- x/cdp/keeper/params.go | 1 + x/cdp/keeper/querier_test.go | 7 ++- x/cdp/keeper/savings.go | 1 + x/cdp/keeper/savings_test.go | 7 ++- x/cdp/keeper/seize.go | 1 + x/cdp/simulation/genesis.go | 1 + x/cdp/simulation/utils_test.go | 3 +- x/cdp/types/expected_keepers.go | 1 + x/cdp/types/genesis_test.go | 2 +- x/cdp/types/keys.go | 2 +- x/cdp/types/params_test.go | 3 +- x/cdp/types/utils_test.go | 1 - x/committee/genesis.go | 1 + x/committee/proposal_handler_test.go | 4 +- x/committee/types/committee.go | 5 +- x/committee/types/genesis.go | 4 +- x/committee/types/proposal.go | 2 +- x/incentive/abci.go | 1 + x/incentive/client/cli/query.go | 3 +- x/incentive/client/cli/tx.go | 3 +- x/incentive/client/rest/query.go | 1 + x/incentive/client/rest/tx.go | 1 + x/incentive/genesis.go | 1 + x/incentive/handler.go | 1 + x/incentive/handler_test.go | 7 ++- x/incentive/keeper/keeper.go | 1 + x/incentive/keeper/keeper_test.go | 7 ++- x/incentive/keeper/params.go | 1 + x/incentive/keeper/payout.go | 1 + x/incentive/keeper/payout_test.go | 3 +- x/incentive/keeper/querier.go | 3 +- x/incentive/keeper/querier_test.go | 3 +- x/incentive/keeper/rewards.go | 3 +- x/incentive/keeper/rewards_test.go | 9 +-- x/incentive/module.go | 5 +- x/incentive/simulation/params.go | 1 + x/incentive/types/account_test.go | 5 +- x/incentive/types/expected_keepers.go | 1 + x/incentive/types/msg_test.go | 9 +-- x/incentive/types/params.go | 3 +- x/incentive/types/params_test.go | 19 +++--- x/kavadist/genesis.go | 3 +- x/kavadist/keeper/keeper.go | 1 + x/kavadist/keeper/mint.go | 3 +- x/kavadist/keeper/mint_test.go | 7 ++- x/kavadist/keeper/params.go | 1 + x/kavadist/module.go | 3 +- x/kavadist/types/params.go | 3 +- x/kavadist/types/params_test.go | 9 +-- x/pricefeed/client/cli/query.go | 3 +- x/pricefeed/client/cli/tx.go | 3 +- x/pricefeed/client/rest/tx.go | 3 +- x/pricefeed/genesis_test.go | 1 + x/pricefeed/integration_test.go | 16 ++--- x/pricefeed/keeper/integration_test.go | 8 +-- x/pricefeed/keeper/params_test.go | 5 +- x/validator-vesting/abci.go | 3 +- x/validator-vesting/abci_test.go | 7 ++- x/validator-vesting/client/rest/query.go | 1 + x/validator-vesting/genesis.go | 1 + x/validator-vesting/keeper/keeper.go | 3 +- x/validator-vesting/keeper/keeper_test.go | 9 +-- x/validator-vesting/keeper/test_common.go | 1 + x/validator-vesting/module.go | 1 + x/validator-vesting/simulation/decoder.go | 3 +- .../simulation/decoder_test.go | 3 +- x/validator-vesting/simulation/genesis.go | 1 + x/validator-vesting/test_common.go | 1 + .../types/validator_vesting_account.go | 2 +- .../types/validator_vesting_account_test.go | 4 +- 114 files changed, 377 insertions(+), 192 deletions(-) create mode 100644 .github/lint.yml create mode 100644 golangci.yml diff --git a/.github/lint.yml b/.github/lint.yml new file mode 100644 index 00000000..de312698 --- /dev/null +++ b/.github/lint.yml @@ -0,0 +1,12 @@ +name: Lint +on: [pull_request] +jobs: + golangci-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: golangci-lint + uses: reviewdog/action-golangci-lint@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review diff --git a/Makefile b/Makefile index 7becb364..23bc0592 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,19 @@ clean: link-check: @go run github.com/raviqqe/liche -r . --exclude "^http://127.*|^https://riot.im/app*|^http://kava-testnet*|^https://testnet-dex*" + +lint: + golangci-lint run + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s + go mod verify +.PHONY: lint + +format: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs gofmt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/kava-labs/kava +.PHONY: format + ######################################## ### Testing diff --git a/app/sim_test.go b/app/sim_test.go index d6bd256b..3b341cbd 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -20,6 +20,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" + "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/bep3" "github.com/kava-labs/kava/x/cdp" @@ -27,10 +32,6 @@ import ( "github.com/kava-labs/kava/x/kavadist" "github.com/kava-labs/kava/x/pricefeed" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" ) type StoreKeysPrefixes struct { diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index 8700f0ac..5c637dd4 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -8,13 +8,13 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" @@ -79,7 +79,7 @@ func main() { } } -func queryCmd(cdc *amino.Codec) *cobra.Command { +func queryCmd(cdc *codec.Codec) *cobra.Command { queryCmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, @@ -102,7 +102,7 @@ func queryCmd(cdc *amino.Codec) *cobra.Command { return queryCmd } -func txCmd(cdc *amino.Codec) *cobra.Command { +func txCmd(cdc *codec.Codec) *cobra.Command { txCmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", diff --git a/cmd/kvd/add_account.go b/cmd/kvd/add_account.go index 95ae9b0e..9349a078 100644 --- a/cmd/kvd/add_account.go +++ b/cmd/kvd/add_account.go @@ -9,9 +9,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - validatorvesting "github.com/kava-labs/kava/x/validator-vesting" "github.com/tendermint/tendermint/libs/cli" + validatorvesting "github.com/kava-labs/kava/x/validator-vesting" + "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server" diff --git a/go.mod b/go.mod index 2b057cfa..ed8d8905 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/cosmos/cosmos-sdk v0.38.3 + github.com/gogo/protobuf v1.3.1 github.com/gorilla/mux v1.7.3 github.com/spf13/cobra v0.0.6 github.com/spf13/viper v1.6.2 diff --git a/golangci.yml b/golangci.yml new file mode 100644 index 00000000..307611ef --- /dev/null +++ b/golangci.yml @@ -0,0 +1,63 @@ +run: + tests: false +# # timeout for analysis, e.g. 30s, 5m, default is 1m +# timeout: 5m + +linters: + disable-all: true + enable: + - bodyclose + - deadcode + - depguard + - dogsled + # - errcheck + - goconst + - gocritic + - gofmt + - goimports + - golint + - gosec + - gosimple + - govet + - ineffassign + - interfacer + - maligned + - misspell + - nakedret + - prealloc + - scopelint + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unused + - misspell + - wsl + +issues: + exclude-rules: + - text: "Use of weak random number generator" + linters: + - gosec + - text: "comment on exported var" + linters: + - golint + - text: "don't use an underscore in package name" + linters: + - golint + - text: "ST1003:" + linters: + - stylecheck + # FIXME: Disabled until golangci-lint updates stylecheck with this fix: + # https://github.com/dominikh/go-tools/issues/389 + - text: "ST1016:" + linters: + - stylecheck + +linters-settings: + dogsled: + max-blank-identifiers: 3 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true diff --git a/rest_test/setup/setuptest.go b/rest_test/setup/setuptest.go index 6419b88c..4f7daca6 100644 --- a/rest_test/setup/setuptest.go +++ b/rest_test/setup/setuptest.go @@ -10,6 +10,7 @@ import ( "time" "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" sdkrest "github.com/cosmos/cosmos-sdk/types/rest" @@ -21,11 +22,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/staking" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - "github.com/tendermint/go-amino" - tmtime "github.com/tendermint/tendermint/types/time" ) func init() { @@ -394,7 +395,7 @@ func getKeybase() crkeys.Keybase { } // sendMsgToBlockchain sends a message to the blockchain via the rest api -func sendMsgToBlockchain(cdc *amino.Codec, address string, keyname string, +func sendMsgToBlockchain(cdc *codec.Codec, address string, keyname string, password string, msg []sdk.Msg, keybase crkeys.Keybase) { // get the account number and sequence number @@ -450,7 +451,7 @@ func sendMsgToBlockchain(cdc *amino.Codec, address string, keyname string, } // getAccountNumberAndSequenceNumber gets an account number and sequence number from the blockchain -func getAccountNumberAndSequenceNumber(cdc *amino.Codec, address string) (accountNumber uint64, sequenceNumber uint64) { +func getAccountNumberAndSequenceNumber(cdc *codec.Codec, address string) (accountNumber uint64, sequenceNumber uint64) { // we need to setup the account number and sequence in order to have a valid transaction resp, err := http.Get("http://localhost:1317/auth/accounts/" + address) diff --git a/x/auction/alias.go b/x/auction/alias.go index 0ac1a7dd..1cbf3593 100644 --- a/x/auction/alias.go +++ b/x/auction/alias.go @@ -12,29 +12,29 @@ import ( // ALIASGEN: github.com/kava-labs/kava/x/auction/types const ( - EventTypeAuctionStart = types.EventTypeAuctionStart - EventTypeAuctionBid = types.EventTypeAuctionBid - EventTypeAuctionClose = types.EventTypeAuctionClose - AttributeValueCategory = types.AttributeValueCategory - AttributeKeyAuctionID = types.AttributeKeyAuctionID - AttributeKeyAuctionType = types.AttributeKeyAuctionType - AttributeKeyBidder = types.AttributeKeyBidder - AttributeKeyBidDenom = types.AttributeKeyBidDenom - AttributeKeyLotDenom = types.AttributeKeyLotDenom - AttributeKeyBidAmount = types.AttributeKeyBidAmount - AttributeKeyLotAmount = types.AttributeKeyLotAmount - AttributeKeyEndTime = types.AttributeKeyEndTime - DefaultNextAuctionID = types.DefaultNextAuctionID - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - DefaultParamspace = types.DefaultParamspace - QuerierRoute = types.QuerierRoute - DefaultMaxAuctionDuration = types.DefaultMaxAuctionDuration - DefaultBidDuration = types.DefaultBidDuration - QueryGetAuction = types.QueryGetAuction - QueryGetAuctions = types.QueryGetAuctions - QueryGetParams = types.QueryGetParams + EventTypeAuctionStart = types.EventTypeAuctionStart + EventTypeAuctionBid = types.EventTypeAuctionBid + EventTypeAuctionClose = types.EventTypeAuctionClose + AttributeValueCategory = types.AttributeValueCategory + AttributeKeyAuctionID = types.AttributeKeyAuctionID + AttributeKeyAuctionType = types.AttributeKeyAuctionType + AttributeKeyBidder = types.AttributeKeyBidder + AttributeKeyBidDenom = types.AttributeKeyBidDenom + AttributeKeyLotDenom = types.AttributeKeyLotDenom + AttributeKeyBidAmount = types.AttributeKeyBidAmount + AttributeKeyLotAmount = types.AttributeKeyLotAmount + AttributeKeyEndTime = types.AttributeKeyEndTime + DefaultNextAuctionID = types.DefaultNextAuctionID + ModuleName = types.ModuleName + StoreKey = types.StoreKey + RouterKey = types.RouterKey + DefaultParamspace = types.DefaultParamspace + QuerierRoute = types.QuerierRoute + DefaultMaxAuctionDuration = types.DefaultMaxAuctionDuration + DefaultBidDuration = types.DefaultBidDuration + QueryGetAuction = types.QueryGetAuction + QueryGetAuctions = types.QueryGetAuctions + QueryGetParams = types.QueryGetParams ) var ( diff --git a/x/auction/keeper/auctions.go b/x/auction/keeper/auctions.go index c1722dee..c6152652 100644 --- a/x/auction/keeper/auctions.go +++ b/x/auction/keeper/auctions.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/auction/types" ) diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go index 6d7ddfd5..3ffc3da4 100644 --- a/x/auction/keeper/params.go +++ b/x/auction/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/auction/types" ) diff --git a/x/auction/keeper/querier_test.go b/x/auction/keeper/querier_test.go index fa0d1b9f..78ce6b5d 100644 --- a/x/auction/keeper/querier_test.go +++ b/x/auction/keeper/querier_test.go @@ -10,13 +10,14 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/auction/keeper" "github.com/kava-labs/kava/x/auction/types" "github.com/kava-labs/kava/x/cdp" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/bep3/client/cli/tx.go b/x/bep3/client/cli/tx.go index 9543d5c2..6de11a45 100644 --- a/x/bep3/client/cli/tx.go +++ b/x/bep3/client/cli/tx.go @@ -14,9 +14,10 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/bep3/types" "github.com/spf13/cobra" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/bep3/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/bep3/client/rest/query.go b/x/bep3/client/rest/query.go index 559919f5..7ae9bc35 100644 --- a/x/bep3/client/rest/query.go +++ b/x/bep3/client/rest/query.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" + "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index 9c167289..4d4f2748 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -4,12 +4,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) type AssetTestSuite struct { diff --git a/x/bep3/keeper/integration_test.go b/x/bep3/keeper/integration_test.go index 5e4d4a37..6b231bb2 100644 --- a/x/bep3/keeper/integration_test.go +++ b/x/bep3/keeper/integration_test.go @@ -4,11 +4,12 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3" "github.com/kava-labs/kava/x/bep3/types" - "github.com/tendermint/tendermint/crypto" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/bep3/keeper/keeper.go b/x/bep3/keeper/keeper.go index 3a800422..f7612aaf 100644 --- a/x/bep3/keeper/keeper.go +++ b/x/bep3/keeper/keeper.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" - "github.com/kava-labs/kava/x/bep3/types" "github.com/tendermint/tendermint/libs/log" + + "github.com/kava-labs/kava/x/bep3/types" ) // Keeper of the bep3 store diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 9837a747..4bd4e109 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) const LongtermStorageDuration = 86400 diff --git a/x/bep3/keeper/params_test.go b/x/bep3/keeper/params_test.go index 3c4bae7d..b4131dc0 100644 --- a/x/bep3/keeper/params_test.go +++ b/x/bep3/keeper/params_test.go @@ -5,12 +5,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/bep3/keeper" - "github.com/kava-labs/kava/x/bep3/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/bep3/keeper" + "github.com/kava-labs/kava/x/bep3/types" ) type ParamsTestSuite struct { diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index 58d53121..6e94e555 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -245,13 +245,13 @@ func (k Keeper) UpdateExpiredAtomicSwaps(ctx sdk.Context) error { } // Emit 'swaps_expired' event - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeSwapsExpired, - sdk.NewAttribute(types.AttributeKeyAtomicSwapIDs, fmt.Sprintf("%s", expiredSwapIDs)), - sdk.NewAttribute(types.AttributeExpirationBlock, fmt.Sprintf("%d", ctx.BlockHeight())), - ), - ) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSwapsExpired, + sdk.NewAttribute(types.AttributeKeyAtomicSwapIDs, fmt.Sprintf("%s", expiredSwapIDs)), + sdk.NewAttribute(types.AttributeExpirationBlock, fmt.Sprintf("%d", ctx.BlockHeight())), + ), + ) return nil } diff --git a/x/bep3/simulation/genesis.go b/x/bep3/simulation/genesis.go index bfac2d88..f2a8e34a 100644 --- a/x/bep3/simulation/genesis.go +++ b/x/bep3/simulation/genesis.go @@ -12,6 +12,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/types/common_test.go b/x/bep3/types/common_test.go index 57601d1e..0e0d9743 100644 --- a/x/bep3/types/common_test.go +++ b/x/bep3/types/common_test.go @@ -4,8 +4,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/bep3/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/bep3/types" ) func i(in int64) sdk.Int { return sdk.NewInt(in) } diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index b72f9be8..772a84f0 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type GenesisTestSuite struct { diff --git a/x/bep3/types/hash_test.go b/x/bep3/types/hash_test.go index 0161a059..b38c59a7 100644 --- a/x/bep3/types/hash_test.go +++ b/x/bep3/types/hash_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type HashTestSuite struct { @@ -58,4 +59,4 @@ func (suite *HashTestSuite) TestCalculateSwapID() { func TestHashTestSuite(t *testing.T) { suite.Run(t, new(HashTestSuite)) -} \ No newline at end of file +} diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index 65e49cfd..0965a447 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" - "github.com/stretchr/testify/suite" ) type ParamsTestSuite struct { diff --git a/x/cdp/abci.go b/x/cdp/abci.go index f8c031ce..7df7e69d 100644 --- a/x/cdp/abci.go +++ b/x/cdp/abci.go @@ -4,8 +4,9 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/types" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/cdp/types" ) // BeginBlocker compounds the debt in outstanding cdps and liquidates cdps that are below the required collateralization ratio diff --git a/x/cdp/abci_test.go b/x/cdp/abci_test.go index 74af46da..d9a37977 100644 --- a/x/cdp/abci_test.go +++ b/x/cdp/abci_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/auction" - "github.com/kava-labs/kava/x/cdp" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/auction" + "github.com/kava-labs/kava/x/cdp" ) type ModuleTestSuite struct { diff --git a/x/cdp/genesis.go b/x/cdp/genesis.go index 241fdcd7..176554c3 100644 --- a/x/cdp/genesis.go +++ b/x/cdp/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/genesis_test.go b/x/cdp/genesis_test.go index 3d34b7c9..c02574e2 100644 --- a/x/cdp/genesis_test.go +++ b/x/cdp/genesis_test.go @@ -6,9 +6,10 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" - "github.com/stretchr/testify/suite" ) type GenesisTestSuite struct { diff --git a/x/cdp/handler_test.go b/x/cdp/handler_test.go index fd452a65..7d26c1de 100644 --- a/x/cdp/handler_test.go +++ b/x/cdp/handler_test.go @@ -4,11 +4,12 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp" + "github.com/stretchr/testify/suite" ) diff --git a/x/cdp/integration_test.go b/x/cdp/integration_test.go index eb50665c..b258a3e0 100644 --- a/x/cdp/integration_test.go +++ b/x/cdp/integration_test.go @@ -5,10 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - tmtime "github.com/tendermint/tendermint/types/time" ) // Avoid cluttering test cases with long function names @@ -21,11 +22,11 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: asset + ":usd", OracleAddress: sdk.AccAddress{}, Price: price, @@ -77,18 +78,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/cdp/keeper/auctions.go b/x/cdp/keeper/auctions.go index 67b7b292..640a21e7 100644 --- a/x/cdp/keeper/auctions.go +++ b/x/cdp/keeper/auctions.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/auctions_test.go b/x/cdp/keeper/auctions_test.go index 59cb45fa..4be3af65 100644 --- a/x/cdp/keeper/auctions_test.go +++ b/x/cdp/keeper/auctions_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/cdp/keeper" diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index 712f817f..6b2ad8e4 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) @@ -431,7 +432,7 @@ func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) (types.Augmente return types.AugmentedCDP{}, err } - // total debt is the sum of all oustanding principal and fees + // total debt is the sum of all outstanding principal and fees var totalDebt int64 totalDebt += cdp.Principal.Amount.Int64() totalDebt += cdp.AccumulatedFees.Amount.Int64() diff --git a/x/cdp/keeper/cdp_test.go b/x/cdp/keeper/cdp_test.go index d98ee299..a7630c49 100644 --- a/x/cdp/keeper/cdp_test.go +++ b/x/cdp/keeper/cdp_test.go @@ -6,12 +6,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type CdpTestSuite struct { diff --git a/x/cdp/keeper/deposit.go b/x/cdp/keeper/deposit.go index 735e9b1d..7d1d46bb 100644 --- a/x/cdp/keeper/deposit.go +++ b/x/cdp/keeper/deposit.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/deposit_test.go b/x/cdp/keeper/deposit_test.go index 1eb11650..76a0a1b3 100644 --- a/x/cdp/keeper/deposit_test.go +++ b/x/cdp/keeper/deposit_test.go @@ -5,12 +5,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type DepositTestSuite struct { diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index 655038a6..e1543a1f 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/draw_test.go b/x/cdp/keeper/draw_test.go index 44a26374..e4a9991b 100644 --- a/x/cdp/keeper/draw_test.go +++ b/x/cdp/keeper/draw_test.go @@ -6,12 +6,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type DrawTestSuite struct { diff --git a/x/cdp/keeper/fees.go b/x/cdp/keeper/fees.go index 109ae0af..ec1e7a4e 100644 --- a/x/cdp/keeper/fees.go +++ b/x/cdp/keeper/fees.go @@ -3,6 +3,7 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/fees_test.go b/x/cdp/keeper/fees_test.go index 90513e73..7c7ced3b 100644 --- a/x/cdp/keeper/fees_test.go +++ b/x/cdp/keeper/fees_test.go @@ -6,11 +6,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" ) type FeeTestSuite struct { diff --git a/x/cdp/keeper/integration_test.go b/x/cdp/keeper/integration_test.go index f936298d..ae3be395 100644 --- a/x/cdp/keeper/integration_test.go +++ b/x/cdp/keeper/integration_test.go @@ -5,10 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/pricefeed" - tmtime "github.com/tendermint/tendermint/types/time" ) // Avoid cluttering test cases with long function names @@ -21,11 +22,11 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: asset + ":usd", BaseAsset: asset, QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: asset + ":usd", OracleAddress: sdk.AccAddress{}, Price: price, @@ -77,18 +78,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/cdp/keeper/keeper.go b/x/cdp/keeper/keeper.go index f7d3e585..0e028b59 100644 --- a/x/cdp/keeper/keeper.go +++ b/x/cdp/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/keeper_bench_test.go b/x/cdp/keeper/keeper_bench_test.go index 76e61331..462d3275 100644 --- a/x/cdp/keeper/keeper_bench_test.go +++ b/x/cdp/keeper/keeper_bench_test.go @@ -5,11 +5,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/exported" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/cdp/keeper" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) // saving the result to a module level variable ensures the compiler doesn't optimize the test away diff --git a/x/cdp/keeper/params.go b/x/cdp/keeper/params.go index 08a3bc9e..703cd273 100644 --- a/x/cdp/keeper/params.go +++ b/x/cdp/keeper/params.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/querier_test.go b/x/cdp/keeper/querier_test.go index be4c8fa9..171bbdb5 100644 --- a/x/cdp/keeper/querier_test.go +++ b/x/cdp/keeper/querier_test.go @@ -9,14 +9,15 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp/keeper" "github.com/kava-labs/kava/x/cdp/types" pfkeeper "github.com/kava-labs/kava/x/pricefeed/keeper" pftypes "github.com/kava-labs/kava/x/pricefeed/types" - "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) const ( diff --git a/x/cdp/keeper/savings.go b/x/cdp/keeper/savings.go index ec9c5944..fe5a8840 100644 --- a/x/cdp/keeper/savings.go +++ b/x/cdp/keeper/savings.go @@ -9,6 +9,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + auctiontypes "github.com/kava-labs/kava/x/auction/types" "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/keeper/savings_test.go b/x/cdp/keeper/savings_test.go index 5c04b269..8d64889d 100644 --- a/x/cdp/keeper/savings_test.go +++ b/x/cdp/keeper/savings_test.go @@ -4,12 +4,13 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/cdp/keeper" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/cdp/keeper" + "github.com/kava-labs/kava/x/cdp/types" ) type SavingsTestSuite struct { diff --git a/x/cdp/keeper/seize.go b/x/cdp/keeper/seize.go index 46183f77..5a3fa8cf 100644 --- a/x/cdp/keeper/seize.go +++ b/x/cdp/keeper/seize.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/simulation/genesis.go b/x/cdp/simulation/genesis.go index a954476e..e0f4591d 100644 --- a/x/cdp/simulation/genesis.go +++ b/x/cdp/simulation/genesis.go @@ -10,6 +10,7 @@ import ( authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/supply" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/simulation/utils_test.go b/x/cdp/simulation/utils_test.go index 448366fa..216c057f 100644 --- a/x/cdp/simulation/utils_test.go +++ b/x/cdp/simulation/utils_test.go @@ -4,8 +4,9 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/simulation" "github.com/stretchr/testify/require" + + "github.com/kava-labs/kava/x/cdp/simulation" ) func TestShiftDec(t *testing.T) { diff --git a/x/cdp/types/expected_keepers.go b/x/cdp/types/expected_keepers.go index c0e2e3d9..b960ed79 100644 --- a/x/cdp/types/expected_keepers.go +++ b/x/cdp/types/expected_keepers.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + pftypes "github.com/kava-labs/kava/x/pricefeed/types" ) diff --git a/x/cdp/types/genesis_test.go b/x/cdp/types/genesis_test.go index f894492f..5895e370 100644 --- a/x/cdp/types/genesis_test.go +++ b/x/cdp/types/genesis_test.go @@ -19,4 +19,4 @@ func TestEqualProposalID(t *testing.T) { state2.StartingCdpID = 1 require.Equal(t, state1, state2) require.True(t, state1.Equal(state2)) -} \ No newline at end of file +} diff --git a/x/cdp/types/keys.go b/x/cdp/types/keys.go index 8f4a8097..1469ffa5 100644 --- a/x/cdp/types/keys.go +++ b/x/cdp/types/keys.go @@ -140,7 +140,7 @@ func CollateralRatioKey(denomByte byte, cdpID uint64, ratio sdk.Dec) []byte { // SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio func SplitCollateralRatioKey(key []byte) (denom byte, cdpID uint64, ratio sdk.Dec) { - cdpID = GetCdpIDFromBytes(key[len(key)-8 : len(key)]) + cdpID = GetCdpIDFromBytes(key[len(key)-8:]) split := bytes.Split(key[:len(key)-8], sep) denom = split[0][0] diff --git a/x/cdp/types/params_test.go b/x/cdp/types/params_test.go index 38879436..ea2c1e72 100644 --- a/x/cdp/types/params_test.go +++ b/x/cdp/types/params_test.go @@ -6,8 +6,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/cdp/types" ) type ParamsTestSuite struct { diff --git a/x/cdp/types/utils_test.go b/x/cdp/types/utils_test.go index 7a32d4e8..9b8b41c0 100644 --- a/x/cdp/types/utils_test.go +++ b/x/cdp/types/utils_test.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ) func TestSortableDecBytes(t *testing.T) { diff --git a/x/committee/genesis.go b/x/committee/genesis.go index af29c0e1..3a0b4110 100644 --- a/x/committee/genesis.go +++ b/x/committee/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/committee/types" ) diff --git a/x/committee/proposal_handler_test.go b/x/committee/proposal_handler_test.go index 0a97cfc0..f0ef01ea 100644 --- a/x/committee/proposal_handler_test.go +++ b/x/committee/proposal_handler_test.go @@ -100,7 +100,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_ChangeCommittee() { { name: "invalid title", proposal: committee.NewCommitteeChangeProposal( - "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fullfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", + "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fulfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", "A proposal description.", suite.testGenesis.Committees[0], ), @@ -177,7 +177,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_DeleteCommittee() { { name: "invalid title", proposal: committee.NewCommitteeDeleteProposal( - "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fullfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", + "A Title That Is Much Too Long And Really Quite Unreasonable Given That It Is Trying To Fulfill The Roll Of An Acceptable Governance Proposal Title That Should Succinctly Communicate The Goal And Contents Of The Proposed Proposal To All Parties Involved", "A proposal description.", suite.testGenesis.Committees[1].ID, ), diff --git a/x/committee/types/committee.go b/x/committee/types/committee.go index c240ac52..fcb54720 100644 --- a/x/committee/types/committee.go +++ b/x/committee/types/committee.go @@ -4,9 +4,10 @@ import ( "fmt" "time" + yaml "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "gopkg.in/yaml.v2" ) const MaxCommitteeDescriptionLength int = 512 @@ -98,7 +99,7 @@ func (c Committee) Validate() error { // PubProposal is the interface that all proposals must fulfill to be submitted to a committee. // Proposal types can be created external to this module. For example a ParamChangeProposal, or CommunityPoolSpendProposal. -// It is pinned to the equivalent type in the gov module to create compatability between proposal types. +// It is pinned to the equivalent type in the gov module to create compatibility between proposal types. type PubProposal govtypes.Content // Proposal is an internal record of a governance proposal submitted to a committee. diff --git a/x/committee/types/genesis.go b/x/committee/types/genesis.go index fda51064..a7539a45 100644 --- a/x/committee/types/genesis.go +++ b/x/committee/types/genesis.go @@ -81,7 +81,7 @@ func (gs GenesisState) Validate() error { // check committee exists if !committeeMap[p.CommitteeID] { - return fmt.Errorf("proposal refers to non existant committee; proposal: %+v", p) + return fmt.Errorf("proposal refers to non existent committee; proposal: %+v", p) } // validate pubProposal @@ -94,7 +94,7 @@ func (gs GenesisState) Validate() error { for _, v := range gs.Votes { // check proposal exists if !proposalMap[v.ProposalID] { - return fmt.Errorf("vote refers to non existant proposal; vote: %+v", v) + return fmt.Errorf("vote refers to non existent proposal; vote: %+v", v) } // validate address if v.Voter.Empty() { diff --git a/x/committee/types/proposal.go b/x/committee/types/proposal.go index 426df42d..ebc1baaf 100644 --- a/x/committee/types/proposal.go +++ b/x/committee/types/proposal.go @@ -1,7 +1,7 @@ package types import ( - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" diff --git a/x/incentive/abci.go b/x/incentive/abci.go index e6c0b293..f9786c0f 100644 --- a/x/incentive/abci.go +++ b/x/incentive/abci.go @@ -2,6 +2,7 @@ package incentive import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/keeper" ) diff --git a/x/incentive/client/cli/query.go b/x/incentive/client/cli/query.go index c9201c53..f36300b9 100644 --- a/x/incentive/client/cli/query.go +++ b/x/incentive/client/cli/query.go @@ -9,8 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/kava-labs/kava/x/incentive/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/incentive/types" ) // GetQueryCmd returns the cli query commands for the incentive module diff --git a/x/incentive/client/cli/tx.go b/x/incentive/client/cli/tx.go index 559cbd37..c17e1047 100644 --- a/x/incentive/client/cli/tx.go +++ b/x/incentive/client/cli/tx.go @@ -12,8 +12,9 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/incentive/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/incentive/types" ) // GetTxCmd returns the transaction cli commands for the incentive module diff --git a/x/incentive/client/rest/query.go b/x/incentive/client/rest/query.go index e8e0e5e1..9f541b1e 100644 --- a/x/incentive/client/rest/query.go +++ b/x/incentive/client/rest/query.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/client/rest/tx.go b/x/incentive/client/rest/tx.go index 13ccd94a..254fbb36 100644 --- a/x/incentive/client/rest/tx.go +++ b/x/incentive/client/rest/tx.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/genesis.go b/x/incentive/genesis.go index 5a38e146..5b14a944 100644 --- a/x/incentive/genesis.go +++ b/x/incentive/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/handler.go b/x/incentive/handler.go index 1fdf8a58..bd8f430e 100644 --- a/x/incentive/handler.go +++ b/x/incentive/handler.go @@ -3,6 +3,7 @@ package incentive import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/handler_test.go b/x/incentive/handler_test.go index 70253ef3..a2d4c5f0 100644 --- a/x/incentive/handler_test.go +++ b/x/incentive/handler_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/incentive" - "github.com/kava-labs/kava/x/kavadist" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/incentive" + "github.com/kava-labs/kava/x/kavadist" ) func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 3c2aa383..cf7705b7 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/keeper/keeper_test.go b/x/incentive/keeper/keeper_test.go index 0d56b2d5..de8e61e7 100644 --- a/x/incentive/keeper/keeper_test.go +++ b/x/incentive/keeper/keeper_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/incentive/keeper" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/incentive/keeper" + "github.com/kava-labs/kava/x/incentive/types" ) // Test suite used for all keeper tests diff --git a/x/incentive/keeper/params.go b/x/incentive/keeper/params.go index ad80a0e8..0d6b6f78 100644 --- a/x/incentive/keeper/params.go +++ b/x/incentive/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/keeper/payout.go b/x/incentive/keeper/payout.go index ac3142b8..20b339fe 100644 --- a/x/incentive/keeper/payout.go +++ b/x/incentive/keeper/payout.go @@ -9,6 +9,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" supplyExported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/incentive/types" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" ) diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go index caefc6dd..e7152d74 100644 --- a/x/incentive/keeper/payout_test.go +++ b/x/incentive/keeper/payout_test.go @@ -7,12 +7,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/incentive/types" "github.com/kava-labs/kava/x/kavadist" validatorvesting "github.com/kava-labs/kava/x/validator-vesting" - abci "github.com/tendermint/tendermint/abci/types" ) func (suite *KeeperTestSuite) setupChain() { diff --git a/x/incentive/keeper/querier.go b/x/incentive/keeper/querier.go index f5a3654c..d56d2432 100644 --- a/x/incentive/keeper/querier.go +++ b/x/incentive/keeper/querier.go @@ -4,8 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/kava-labs/kava/x/incentive/types" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/incentive/types" ) // NewQuerier is the module level router for state queries diff --git a/x/incentive/keeper/querier_test.go b/x/incentive/keeper/querier_test.go index 156d0e8d..9e1e9d17 100644 --- a/x/incentive/keeper/querier_test.go +++ b/x/incentive/keeper/querier_test.go @@ -3,9 +3,10 @@ package keeper_test import ( "strings" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/types" - abci "github.com/tendermint/tendermint/abci/types" ) func (suite *KeeperTestSuite) TestQuerier() { diff --git a/x/incentive/keeper/rewards.go b/x/incentive/keeper/rewards.go index 83faf7b1..9fd11d20 100644 --- a/x/incentive/keeper/rewards.go +++ b/x/incentive/keeper/rewards.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + cdptypes "github.com/kava-labs/kava/x/cdp/types" "github.com/kava-labs/kava/x/incentive/types" ) @@ -19,7 +20,7 @@ func (k Keeper) HandleRewardPeriodExpiry(ctx sdk.Context, rp types.RewardPeriod) // CreateNewRewardPeriod creates a new reward period from the input reward func (k Keeper) CreateNewRewardPeriod(ctx sdk.Context, reward types.Reward) { - // reward periods store the amount of rewards payed PER SECOND + // reward periods store the amount of rewards paid PER SECOND rewardsPerSecond := sdk.NewDecFromInt(reward.AvailableRewards.Amount).Quo(sdk.NewDecFromInt(sdk.NewInt(int64(reward.Duration.Seconds())))).TruncateInt() rewardCoinPerSecond := sdk.NewCoin(reward.AvailableRewards.Denom, rewardsPerSecond) rp := types.RewardPeriod{ diff --git a/x/incentive/keeper/rewards_test.go b/x/incentive/keeper/rewards_test.go index b61cac31..f62e5d7b 100644 --- a/x/incentive/keeper/rewards_test.go +++ b/x/incentive/keeper/rewards_test.go @@ -4,12 +4,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + tmtime "github.com/tendermint/tendermint/types/time" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" "github.com/kava-labs/kava/x/incentive/types" "github.com/kava-labs/kava/x/pricefeed" - abci "github.com/tendermint/tendermint/abci/types" - tmtime "github.com/tendermint/tendermint/types/time" ) func (suite *KeeperTestSuite) TestExpireRewardPeriod() { @@ -160,11 +161,11 @@ func (suite *KeeperTestSuite) setupCdpChain() { pricefeedGS := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "bnb:usd", BaseAsset: "bnb", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "bnb:usd", BaseAsset: "bnb", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, Price: d("12.29"), diff --git a/x/incentive/module.go b/x/incentive/module.go index 9c464e00..b6b8bcc5 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -11,13 +11,14 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/gorilla/mux" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/incentive/client/cli" "github.com/kava-labs/kava/x/incentive/client/rest" "github.com/kava-labs/kava/x/incentive/keeper" "github.com/kava-labs/kava/x/incentive/simulation" "github.com/kava-labs/kava/x/incentive/types" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" ) var ( diff --git a/x/incentive/simulation/params.go b/x/incentive/simulation/params.go index dd47e83f..a8306bf2 100644 --- a/x/incentive/simulation/params.go +++ b/x/incentive/simulation/params.go @@ -5,6 +5,7 @@ import ( "math/rand" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/types/account_test.go b/x/incentive/types/account_test.go index 525a3d02..9bef19fe 100644 --- a/x/incentive/types/account_test.go +++ b/x/incentive/types/account_test.go @@ -5,8 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/incentive/types" ) type accountTest struct { @@ -22,7 +23,7 @@ type AccountTestSuite struct { func (suite *AccountTestSuite) SetupTest() { tests := []accountTest{ - accountTest{ + { periods: vesting.Periods{ vesting.Period{ Length: int64(100), diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index ccb20830..83cb47a6 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + cdptypes "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/incentive/types/msg_test.go b/x/incentive/types/msg_test.go index dbe06fe7..d1456291 100644 --- a/x/incentive/types/msg_test.go +++ b/x/incentive/types/msg_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" "github.com/tendermint/tendermint/crypto" + + "github.com/kava-labs/kava/x/incentive/types" ) type msgTest struct { @@ -23,17 +24,17 @@ type MsgTestSuite struct { func (suite *MsgTestSuite) SetupTest() { tests := []msgTest{ - msgTest{ + { from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), denom: "bnb", expectPass: true, }, - msgTest{ + { from: sdk.AccAddress(crypto.AddressHash([]byte("KavaTest1"))), denom: "", expectPass: false, }, - msgTest{ + { from: sdk.AccAddress{}, denom: "bnb", expectPass: false, diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 524cfb83..8348bb65 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -7,9 +7,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" + tmtime "github.com/tendermint/tendermint/types/time" + cdptypes "github.com/kava-labs/kava/x/cdp/types" kavadistTypes "github.com/kava-labs/kava/x/kavadist/types" - tmtime "github.com/tendermint/tendermint/types/time" ) // Parameter keys and default values diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index a35a2508..9c0baf68 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -6,8 +6,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/incentive/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/incentive/types" ) type paramTest struct { @@ -29,7 +30,7 @@ type ParamTestSuite struct { func (suite *ParamTestSuite) SetupTest() { suite.tests = []paramTest{ - paramTest{ + { name: "valid - active", params: types.Params{ Active: true, @@ -49,7 +50,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "", }, }, - paramTest{ + { name: "valid - inactive", params: types.Params{ Active: false, @@ -69,7 +70,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "", }, }, - paramTest{ + { name: "duplicate reward", params: types.Params{ Active: true, @@ -97,7 +98,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "cannot have duplicate reward denoms", }, }, - paramTest{ + { name: "negative reward duration", params: types.Params{ Active: true, @@ -117,7 +118,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward duration must be positive", }, }, - paramTest{ + { name: "negative time lock", params: types.Params{ Active: true, @@ -137,7 +138,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward timelock must be non-negative", }, }, - paramTest{ + { name: "zero claim duration", params: types.Params{ Active: true, @@ -157,7 +158,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "claim duration must be positive", }, }, - paramTest{ + { name: "zero reward", params: types.Params{ Active: true, @@ -177,7 +178,7 @@ func (suite *ParamTestSuite) SetupTest() { contains: "reward amount must be positive", }, }, - paramTest{ + { name: "empty reward denom", params: types.Params{ Active: true, diff --git a/x/kavadist/genesis.go b/x/kavadist/genesis.go index c4219a02..d1e7d25d 100644 --- a/x/kavadist/genesis.go +++ b/x/kavadist/genesis.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/kavadist/types" ) @@ -35,5 +36,5 @@ func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState { if !found { previousBlockTime = DefaultPreviousBlockTime } - return NewGenesisState(params,previousBlockTime) + return NewGenesisState(params, previousBlockTime) } diff --git a/x/kavadist/keeper/keeper.go b/x/kavadist/keeper/keeper.go index 34faa329..25e9ff1c 100644 --- a/x/kavadist/keeper/keeper.go +++ b/x/kavadist/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/kava-labs/kava/x/kavadist/types" ) diff --git a/x/kavadist/keeper/mint.go b/x/kavadist/keeper/mint.go index c5d19215..8f909cd7 100644 --- a/x/kavadist/keeper/mint.go +++ b/x/kavadist/keeper/mint.go @@ -2,11 +2,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + cdptypes "github.com/kava-labs/kava/x/cdp/types" "github.com/kava-labs/kava/x/kavadist/types" ) -// MintPeriodInflation mints new tokens according to the inflation schedule specified in the paramters +// MintPeriodInflation mints new tokens according to the inflation schedule specified in the parameters func (k Keeper) MintPeriodInflation(ctx sdk.Context) error { params := k.GetParams(ctx) if !params.Active { diff --git a/x/kavadist/keeper/mint_test.go b/x/kavadist/keeper/mint_test.go index c9b77753..b7ceb6de 100644 --- a/x/kavadist/keeper/mint_test.go +++ b/x/kavadist/keeper/mint_test.go @@ -5,12 +5,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/kavadist/keeper" - "github.com/kava-labs/kava/x/kavadist/types" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/kavadist/keeper" + "github.com/kava-labs/kava/x/kavadist/types" ) type MintTestSuite struct { diff --git a/x/kavadist/keeper/params.go b/x/kavadist/keeper/params.go index 526cb255..fe2c4a11 100644 --- a/x/kavadist/keeper/params.go +++ b/x/kavadist/keeper/params.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/kavadist/types" ) diff --git a/x/kavadist/module.go b/x/kavadist/module.go index f24005c8..e9dc22e4 100644 --- a/x/kavadist/module.go +++ b/x/kavadist/module.go @@ -12,9 +12,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/kava-labs/kava/x/kavadist/simulation" "github.com/kava-labs/kava/x/kavadist/types" - abci "github.com/tendermint/tendermint/abci/types" ) var ( diff --git a/x/kavadist/types/params.go b/x/kavadist/types/params.go index 9eb01b08..46a2906d 100644 --- a/x/kavadist/types/params.go +++ b/x/kavadist/types/params.go @@ -6,8 +6,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" - cdptypes "github.com/kava-labs/kava/x/cdp/types" tmtime "github.com/tendermint/tendermint/types/time" + + cdptypes "github.com/kava-labs/kava/x/cdp/types" ) // Parameter keys and default values diff --git a/x/kavadist/types/params_test.go b/x/kavadist/types/params_test.go index f2e02b90..e612fda3 100644 --- a/x/kavadist/types/params_test.go +++ b/x/kavadist/types/params_test.go @@ -5,8 +5,9 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/kavadist/types" "github.com/stretchr/testify/suite" + + "github.com/kava-labs/kava/x/kavadist/types" ) type paramTest struct { @@ -68,15 +69,15 @@ func (suite *ParamTestSuite) SetupTest() { } suite.tests = []paramTest{ - paramTest{ + { params: p1, expectPass: true, }, - paramTest{ + { params: p2, expectPass: false, }, - paramTest{ + { params: p3, expectPass: false, }, diff --git a/x/pricefeed/client/cli/query.go b/x/pricefeed/client/cli/query.go index b41d388a..3930bbf9 100644 --- a/x/pricefeed/client/cli/query.go +++ b/x/pricefeed/client/cli/query.go @@ -8,8 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/pricefeed/types" "github.com/spf13/cobra" + + "github.com/kava-labs/kava/x/pricefeed/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index 2aec48d6..726a8050 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -14,8 +14,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/kava-labs/kava/x/pricefeed/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/pricefeed/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/pricefeed/client/rest/tx.go b/x/pricefeed/client/rest/tx.go index 6e0b87e6..89a8df42 100644 --- a/x/pricefeed/client/rest/tx.go +++ b/x/pricefeed/client/rest/tx.go @@ -10,8 +10,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" "github.com/gorilla/mux" - "github.com/kava-labs/kava/x/pricefeed/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/x/pricefeed/types" ) func registerTxRoutes(cliCtx context.CLIContext, r *mux.Router) { diff --git a/x/pricefeed/genesis_test.go b/x/pricefeed/genesis_test.go index 968729bc..8c92b209 100644 --- a/x/pricefeed/genesis_test.go +++ b/x/pricefeed/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed" diff --git a/x/pricefeed/integration_test.go b/x/pricefeed/integration_test.go index 4d5f2c76..24629f4c 100644 --- a/x/pricefeed/integration_test.go +++ b/x/pricefeed/integration_test.go @@ -13,18 +13,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), @@ -39,18 +39,18 @@ func NewPricefeedGenStateWithOracles(addrs []sdk.AccAddress) app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: addrs, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: addrs, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: addrs, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: addrs, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: addrs[0], Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: addrs[0], Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/pricefeed/keeper/integration_test.go b/x/pricefeed/keeper/integration_test.go index 5594cda8..f9397c97 100644 --- a/x/pricefeed/keeper/integration_test.go +++ b/x/pricefeed/keeper/integration_test.go @@ -13,18 +13,18 @@ func NewPricefeedGenStateMulti() app.GenesisState { pfGenesis := pricefeed.GenesisState{ Params: pricefeed.Params{ Markets: []pricefeed.Market{ - pricefeed.Market{MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, - pricefeed.Market{MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "btc:usd", BaseAsset: "btc", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, + {MarketID: "xrp:usd", BaseAsset: "xrp", QuoteAsset: "usd", Oracles: []sdk.AccAddress{}, Active: true}, }, }, PostedPrices: []pricefeed.PostedPrice{ - pricefeed.PostedPrice{ + { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, - pricefeed.PostedPrice{ + { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, Price: sdk.MustNewDecFromStr("0.25"), diff --git a/x/pricefeed/keeper/params_test.go b/x/pricefeed/keeper/params_test.go index d4ccc483..c9849d39 100644 --- a/x/pricefeed/keeper/params_test.go +++ b/x/pricefeed/keeper/params_test.go @@ -4,11 +4,12 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/app" - "github.com/kava-labs/kava/x/pricefeed/keeper" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/kava-labs/kava/app" + "github.com/kava-labs/kava/x/pricefeed/keeper" ) type KeeperTestSuite struct { diff --git a/x/validator-vesting/abci.go b/x/validator-vesting/abci.go index bd896d56..6b9c6d14 100644 --- a/x/validator-vesting/abci.go +++ b/x/validator-vesting/abci.go @@ -7,8 +7,9 @@ import ( tmtime "github.com/tendermint/tendermint/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/validator-vesting/keeper" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/kava-labs/kava/x/validator-vesting/keeper" ) // BeginBlocker updates the vote signing information for each validator vesting account, updates account when period changes, and updates the previousBlockTime value in the store. diff --git a/x/validator-vesting/abci_test.go b/x/validator-vesting/abci_test.go index dcac8266..16b7e1ab 100644 --- a/x/validator-vesting/abci_test.go +++ b/x/validator-vesting/abci_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/kava-labs/kava/x/validator-vesting/keeper" "github.com/kava-labs/kava/x/validator-vesting/types" ) @@ -260,7 +261,7 @@ func TestBeginBlockerSuccessfulPeriod(t *testing.T) { vva = vvk.GetAccountFromAuthKeeper(ctx, vva.Address) // t.Log(vva.MarshalYAML()) - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) } func TestBeginBlockerUnsuccessfulPeriod(t *testing.T) { @@ -320,8 +321,8 @@ func TestBeginBlockerUnsuccessfulPeriod(t *testing.T) { } vva = vvk.GetAccountFromAuthKeeper(ctx, vva.Address) - // check that the period was unsucessful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + // check that the period was unsuccessful + require.Equal(t, []types.VestingProgress{{true, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // check that there is debt after the period. require.Equal(t, sdk.Coins{sdk.NewInt64Coin("stake", 30000000)}, vva.DebtAfterFailedVesting) diff --git a/x/validator-vesting/client/rest/query.go b/x/validator-vesting/client/rest/query.go index ebe1de2e..f132ed35 100644 --- a/x/validator-vesting/client/rest/query.go +++ b/x/validator-vesting/client/rest/query.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/genesis.go b/x/validator-vesting/genesis.go index e987b00c..00b6fd5f 100644 --- a/x/validator-vesting/genesis.go +++ b/x/validator-vesting/genesis.go @@ -2,6 +2,7 @@ package validatorvesting import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/keeper/keeper.go b/x/validator-vesting/keeper/keeper.go index f6bdade1..1bda605a 100644 --- a/x/validator-vesting/keeper/keeper.go +++ b/x/validator-vesting/keeper/keeper.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/tendermint/tendermint/libs/log" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) // Keeper of the validatorvesting store diff --git a/x/validator-vesting/keeper/keeper_test.go b/x/validator-vesting/keeper/keeper_test.go index c3aaafb8..393ffa8d 100644 --- a/x/validator-vesting/keeper/keeper_test.go +++ b/x/validator-vesting/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/kava-labs/kava/x/validator-vesting/types" ) @@ -152,7 +153,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { ak.SetAccount(ctx, vva) // require all vesting period tracking variables to be zero after validator vesting account is initialized - require.Equal(t, []types.VestingProgress{types.VestingProgress{false, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{false, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // period 0 passes with all blocks signed vva.CurrentPeriodProgress.MissedBlocks = 0 @@ -164,7 +165,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that debt is zerox require.Equal(t, sdk.Coins(nil), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is successful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) @@ -183,7 +184,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that debt is zero require.Equal(t, sdk.Coins(nil), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is successful - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, true}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, true}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) @@ -199,7 +200,7 @@ func TestUpdateVestedCoinsProgress(t *testing.T) { // require that period 1 coins have become debt require.Equal(t, sdk.NewCoins(sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)), vva.DebtAfterFailedVesting) // require that the first vesting progress variable is {true, false} - require.Equal(t, []types.VestingProgress{types.VestingProgress{true, false}, types.VestingProgress{false, false}, types.VestingProgress{false, false}}, vva.VestingPeriodProgress) + require.Equal(t, []types.VestingProgress{{true, false}, {false, false}, {false, false}}, vva.VestingPeriodProgress) // require that the missing block counter has reset require.Equal(t, types.CurrentPeriodProgress{0, 0}, vva.CurrentPeriodProgress) } diff --git a/x/validator-vesting/keeper/test_common.go b/x/validator-vesting/keeper/test_common.go index fbb817ca..a9cc1e9b 100644 --- a/x/validator-vesting/keeper/test_common.go +++ b/x/validator-vesting/keeper/test_common.go @@ -25,6 +25,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index f918d028..c4a3e704 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -13,6 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/validator-vesting/client/cli" "github.com/kava-labs/kava/x/validator-vesting/client/rest" "github.com/kava-labs/kava/x/validator-vesting/simulation" diff --git a/x/validator-vesting/simulation/decoder.go b/x/validator-vesting/simulation/decoder.go index 7dc83ff6..d0533eb9 100644 --- a/x/validator-vesting/simulation/decoder.go +++ b/x/validator-vesting/simulation/decoder.go @@ -7,8 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/tendermint/tendermint/libs/kv" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) // DecodeStore unmarshals the KVPair's Value to the corresponding auth type diff --git a/x/validator-vesting/simulation/decoder_test.go b/x/validator-vesting/simulation/decoder_test.go index c029499b..4451e1b5 100644 --- a/x/validator-vesting/simulation/decoder_test.go +++ b/x/validator-vesting/simulation/decoder_test.go @@ -8,10 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/kava-labs/kava/x/validator-vesting/types" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/kv" + + "github.com/kava-labs/kava/x/validator-vesting/types" ) var ( diff --git a/x/validator-vesting/simulation/genesis.go b/x/validator-vesting/simulation/genesis.go index 414bb0f9..9a39dd5b 100644 --- a/x/validator-vesting/simulation/genesis.go +++ b/x/validator-vesting/simulation/genesis.go @@ -11,6 +11,7 @@ import ( vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/simulation" + "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/test_common.go b/x/validator-vesting/test_common.go index fdb4f83f..176d1737 100644 --- a/x/validator-vesting/test_common.go +++ b/x/validator-vesting/test_common.go @@ -18,6 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" + "github.com/kava-labs/kava/x/validator-vesting/keeper" "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/types/validator_vesting_account.go b/x/validator-vesting/types/validator_vesting_account.go index 27eb452e..a1180e88 100644 --- a/x/validator-vesting/types/validator_vesting_account.go +++ b/x/validator-vesting/types/validator_vesting_account.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" diff --git a/x/validator-vesting/types/validator_vesting_account_test.go b/x/validator-vesting/types/validator_vesting_account_test.go index 5bb91d76..4abad811 100644 --- a/x/validator-vesting/types/validator_vesting_account_test.go +++ b/x/validator-vesting/types/validator_vesting_account_test.go @@ -254,7 +254,7 @@ func TestGetFailedVestedCoins(t *testing.T) { vva := NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) vva.VestingPeriodProgress[0] = VestingProgress{true, false} - // require that period 1 coins are failed if the period completed unsucessfully. + // require that period 1 coins are failed if the period completed unsuccessfully. require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vva.GetFailedVestedCoins(), @@ -362,7 +362,7 @@ func TestTrackUndelegationPeriodicVestingAcc(t *testing.T) { require.Nil(t, vva.DelegatedFree) require.Nil(t, vva.DelegatedVesting) - // successfuly vest period 1 and delegate to two validators + // successfully vest period 1 and delegate to two validators vva = NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) vva.VestingPeriodProgress[0] = VestingProgress{true, true} vva.TrackDelegation(now.Add(12*time.Hour), sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}) From fe72a24aa09ae82c557787d67674523ae7b7bf55 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 10:23:41 -0400 Subject: [PATCH 2/7] update format --- Makefile | 2 ++ app/app.go | 3 ++- app/app_test.go | 3 ++- app/sim_test.go | 6 ++++-- app/test_common.go | 3 ++- cmd/kvcli/cmd_keys.go | 5 +++-- cmd/kvd/main.go | 3 ++- rest_test/setup/setuptest.go | 1 + x/auction/abci_test.go | 4 +++- x/auction/keeper/auctions_test.go | 4 +++- x/auction/keeper/bidding_test.go | 4 +++- x/auction/keeper/keeper.go | 1 + x/auction/keeper/keeper_test.go | 1 + x/auction/keeper/math_test.go | 3 ++- x/auction/keeper/querier_test.go | 4 +++- x/auction/module.go | 1 + x/auction/simulation/decoder_test.go | 1 + x/auction/types/auctions_test.go | 3 ++- x/auction/types/genesis_test.go | 3 ++- x/auction/types/msg_test.go | 3 ++- x/auction/types/params_test.go | 3 ++- x/bep3/client/cli/query.go | 4 +++- x/bep3/client/cli/tx.go | 4 +++- x/bep3/client/rest/tx.go | 3 ++- x/bep3/genesis_test.go | 4 +++- x/bep3/integration_test.go | 1 + x/bep3/keeper/asset_test.go | 4 +++- x/bep3/keeper/integration_test.go | 1 + x/bep3/keeper/keeper.go | 1 + x/bep3/keeper/keeper_test.go | 4 +++- x/bep3/keeper/params_test.go | 4 +++- x/bep3/module.go | 6 ++++-- x/bep3/types/common_test.go | 1 + x/bep3/types/genesis_test.go | 3 ++- x/bep3/types/hash.go | 1 + x/bep3/types/hash_test.go | 3 ++- x/bep3/types/params_test.go | 3 ++- x/cdp/abci.go | 1 + x/cdp/abci_test.go | 4 +++- x/cdp/genesis_test.go | 3 ++- x/cdp/handler_test.go | 1 + x/cdp/keeper/auctions_test.go | 1 + x/cdp/keeper/cdp_test.go | 4 +++- x/cdp/keeper/deposit_test.go | 4 +++- x/cdp/keeper/draw_test.go | 4 +++- x/cdp/keeper/fees_test.go | 1 + x/cdp/keeper/keeper_bench_test.go | 1 + x/cdp/keeper/querier_test.go | 4 +++- x/cdp/keeper/savings_test.go | 4 +++- x/cdp/keeper/seize_test.go | 4 +++- x/cdp/module.go | 1 + x/cdp/simulation/decoder_test.go | 1 + x/cdp/simulation/utils_test.go | 3 ++- x/cdp/types/keys_test.go | 4 +++- x/cdp/types/msg_test.go | 3 ++- x/cdp/types/params.go | 1 + x/cdp/types/params_test.go | 3 ++- x/cdp/types/utils_test.go | 3 ++- x/committee/abci.go | 1 + x/committee/abci_test.go | 1 + x/committee/client/cli/cli_test.go | 3 ++- x/committee/client/cli/tx.go | 1 + x/committee/genesis_test.go | 1 + x/committee/handler_test.go | 4 +++- x/committee/keeper/keeper_test.go | 1 + x/committee/keeper/proposal_test.go | 1 + x/committee/keeper/querier.go | 1 + x/committee/keeper/querier_test.go | 1 + x/committee/module.go | 1 + x/committee/proposal_handler_test.go | 4 +++- x/committee/simulation/decoder.go | 1 + x/committee/types/committee_test.go | 3 ++- x/committee/types/genesis_test.go | 1 + x/committee/types/permissions_test.go | 3 ++- x/incentive/client/cli/query.go | 3 ++- x/incentive/client/cli/tx.go | 3 ++- x/incentive/client/rest/query.go | 3 ++- x/incentive/client/rest/tx.go | 3 ++- x/incentive/handler_test.go | 4 +++- x/incentive/keeper/keeper_test.go | 4 +++- x/incentive/keeper/payout_test.go | 1 + x/incentive/keeper/querier.go | 1 + x/incentive/keeper/rewards_test.go | 1 + x/incentive/module.go | 6 ++++-- x/incentive/simulation/decoder.go | 1 + x/incentive/simulation/decoder_test.go | 4 +++- x/incentive/types/account_test.go | 3 ++- x/incentive/types/msg_test.go | 4 +++- x/incentive/types/params.go | 1 + x/incentive/types/params_test.go | 3 ++- x/kavadist/keeper/mint_test.go | 4 +++- x/kavadist/module.go | 1 + x/kavadist/simulation/utils_test.go | 3 ++- x/kavadist/types/params.go | 1 + x/kavadist/types/params_test.go | 3 ++- x/pricefeed/client/cli/query.go | 3 ++- x/pricefeed/client/cli/tx.go | 1 + x/pricefeed/client/rest/rest.go | 3 ++- x/pricefeed/client/rest/tx.go | 4 +++- x/pricefeed/keeper/keeper_test.go | 4 +++- x/pricefeed/keeper/params_test.go | 4 +++- x/pricefeed/module.go | 1 + x/pricefeed/simulation/decoder.go | 1 + x/pricefeed/simulation/decoder_test.go | 1 + x/pricefeed/types/msgs_test.go | 4 +++- x/validator-vesting/abci.go | 1 + x/validator-vesting/abci_test.go | 4 +++- x/validator-vesting/client/rest/query.go | 3 ++- x/validator-vesting/keeper/keeper.go | 1 + x/validator-vesting/keeper/keeper_test.go | 1 + x/validator-vesting/keeper/test_common.go | 3 ++- x/validator-vesting/module.go | 1 + x/validator-vesting/simulation/decoder.go | 1 + x/validator-vesting/simulation/decoder_test.go | 4 +++- x/validator-vesting/types/validator_vesting_account.go | 1 + x/validator-vesting/types/validator_vesting_account_test.go | 1 + 116 files changed, 223 insertions(+), 72 deletions(-) diff --git a/Makefile b/Makefile index 23bc0592..9bb3f462 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,8 @@ lint: format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/tendermint/tendermint + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/kava-labs/kava .PHONY: format diff --git a/app/app.go b/app/app.go index ba62c3c2..f1ba2e71 100644 --- a/app/app.go +++ b/app/app.go @@ -4,10 +4,11 @@ import ( "io" "os" + dbm "github.com/tendermint/tm-db" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" - dbm "github.com/tendermint/tm-db" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" diff --git a/app/app_test.go b/app/app_test.go index ae3dfbf2..19801b7b 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,9 +5,10 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" db "github.com/tendermint/tm-db" + "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" abci "github.com/tendermint/tendermint/abci/types" diff --git a/app/sim_test.go b/app/sim_test.go index 3b341cbd..52741ab5 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -6,6 +6,9 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + dbm "github.com/tendermint/tm-db" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/simapp/helpers" @@ -20,10 +23,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/bep3" diff --git a/app/test_common.go b/app/test_common.go index f0d4b0e7..78b80486 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -6,12 +6,13 @@ import ( "github.com/stretchr/testify/require" + tmdb "github.com/tendermint/tm-db" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/tendermint/tendermint/libs/log" - tmdb "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/cmd/kvcli/cmd_keys.go b/cmd/kvcli/cmd_keys.go index d1bc35cd..c17d8927 100644 --- a/cmd/kvcli/cmd_keys.go +++ b/cmd/kvcli/cmd_keys.go @@ -3,11 +3,12 @@ package main import ( "fmt" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" - "github.com/spf13/viper" "github.com/kava-labs/kava/app" ) diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index 148f3ba8..d551ab96 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -7,11 +7,12 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + dbm "github.com/tendermint/tm-db" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" diff --git a/rest_test/setup/setuptest.go b/rest_test/setup/setuptest.go index 4f7daca6..c6d384a3 100644 --- a/rest_test/setup/setuptest.go +++ b/rest_test/setup/setuptest.go @@ -22,6 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/staking" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/app" diff --git a/x/auction/abci_test.go b/x/auction/abci_test.go index c7274b7b..fed82a39 100644 --- a/x/auction/abci_test.go +++ b/x/auction/abci_test.go @@ -3,11 +3,13 @@ package auction_test import ( "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/auction/keeper/auctions_test.go b/x/auction/keeper/auctions_test.go index c8c19c1b..2da0a9f4 100644 --- a/x/auction/keeper/auctions_test.go +++ b/x/auction/keeper/auctions_test.go @@ -4,11 +4,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/auction/keeper/bidding_test.go b/x/auction/keeper/bidding_test.go index 9a34cabc..34638194 100644 --- a/x/auction/keeper/bidding_test.go +++ b/x/auction/keeper/bidding_test.go @@ -6,11 +6,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index da8caf89..7250db4e 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/tendermint/tendermint/libs/log" "github.com/kava-labs/kava/x/auction/types" diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index 4b811bb9..48044b85 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -5,6 +5,7 @@ import ( "time" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/auction/keeper/math_test.go b/x/auction/keeper/math_test.go index ee42c594..6ff02765 100644 --- a/x/auction/keeper/math_test.go +++ b/x/auction/keeper/math_test.go @@ -3,8 +3,9 @@ package keeper import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestSplitIntIntoWeightedBuckets(t *testing.T) { diff --git a/x/auction/keeper/querier_test.go b/x/auction/keeper/querier_test.go index 78ce6b5d..20763bc8 100644 --- a/x/auction/keeper/querier_test.go +++ b/x/auction/keeper/querier_test.go @@ -5,12 +5,14 @@ import ( "strings" "testing" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/cosmos/cosmos-sdk/x/supply" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/auction/module.go b/x/auction/module.go index dd1134a0..617ecc82 100644 --- a/x/auction/module.go +++ b/x/auction/module.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/auction/client/cli" diff --git a/x/auction/simulation/decoder_test.go b/x/auction/simulation/decoder_test.go index f1109332..e46f2a72 100644 --- a/x/auction/simulation/decoder_test.go +++ b/x/auction/simulation/decoder_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/kv" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/auction/types/auctions_test.go b/x/auction/types/auctions_test.go index f46968d6..49953cbe 100644 --- a/x/auction/types/auctions_test.go +++ b/x/auction/types/auctions_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( diff --git a/x/auction/types/genesis_test.go b/x/auction/types/genesis_test.go index 4810741e..4248d6e6 100644 --- a/x/auction/types/genesis_test.go +++ b/x/auction/types/genesis_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var testCoin = sdk.NewInt64Coin("test", 20) diff --git a/x/auction/types/msg_test.go b/x/auction/types/msg_test.go index f78e7102..7ac2909c 100644 --- a/x/auction/types/msg_test.go +++ b/x/auction/types/msg_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestMsgPlaceBid_ValidateBasic(t *testing.T) { diff --git a/x/auction/types/params_test.go b/x/auction/types/params_test.go index 253a180a..f2d65091 100644 --- a/x/auction/types/params_test.go +++ b/x/auction/types/params_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestParams_Validate(t *testing.T) { diff --git a/x/bep3/client/cli/query.go b/x/bep3/client/cli/query.go index a60e52af..edcca618 100644 --- a/x/bep3/client/cli/query.go +++ b/x/bep3/client/cli/query.go @@ -6,11 +6,13 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/x/bep3/types" diff --git a/x/bep3/client/cli/tx.go b/x/bep3/client/cli/tx.go index 6de11a45..47c45410 100644 --- a/x/bep3/client/cli/tx.go +++ b/x/bep3/client/cli/tx.go @@ -7,6 +7,8 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -14,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/spf13/cobra" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/x/bep3/types" diff --git a/x/bep3/client/rest/tx.go b/x/bep3/client/rest/tx.go index 022993e3..2f5a08ae 100644 --- a/x/bep3/client/rest/tx.go +++ b/x/bep3/client/rest/tx.go @@ -4,11 +4,12 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/gorilla/mux" "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/genesis_test.go b/x/bep3/genesis_test.go index 7b76af77..e29ef730 100644 --- a/x/bep3/genesis_test.go +++ b/x/bep3/genesis_test.go @@ -3,8 +3,10 @@ package bep3_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/bep3/integration_test.go b/x/bep3/integration_test.go index bb9bc7c2..1abfd8ee 100644 --- a/x/bep3/integration_test.go +++ b/x/bep3/integration_test.go @@ -4,6 +4,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/app" diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index 4d4f2748..67447c55 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -3,8 +3,10 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/bep3/keeper/integration_test.go b/x/bep3/keeper/integration_test.go index 6b231bb2..88c38d3f 100644 --- a/x/bep3/keeper/integration_test.go +++ b/x/bep3/keeper/integration_test.go @@ -4,6 +4,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/bep3/keeper/keeper.go b/x/bep3/keeper/keeper.go index f7612aaf..430f658d 100644 --- a/x/bep3/keeper/keeper.go +++ b/x/bep3/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/subspace" + "github.com/tendermint/tendermint/libs/log" "github.com/kava-labs/kava/x/bep3/types" diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 4bd4e109..363a0ea3 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -4,8 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/bep3/keeper/params_test.go b/x/bep3/keeper/params_test.go index b4131dc0..8c602dba 100644 --- a/x/bep3/keeper/params_test.go +++ b/x/bep3/keeper/params_test.go @@ -4,8 +4,10 @@ import ( "errors" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/bep3/module.go b/x/bep3/module.go index bf675bff..de15fac9 100644 --- a/x/bep3/module.go +++ b/x/bep3/module.go @@ -4,14 +4,16 @@ import ( "encoding/json" "math/rand" + "github.com/gorilla/mux" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/gorilla/mux" - "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/bep3/client/cli" diff --git a/x/bep3/types/common_test.go b/x/bep3/types/common_test.go index 0e0d9743..2dccb4fe 100644 --- a/x/bep3/types/common_test.go +++ b/x/bep3/types/common_test.go @@ -4,6 +4,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/x/bep3/types" diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index 772a84f0..4c2be611 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/types/hash.go b/x/bep3/types/hash.go index bcb23fcf..f5772eb0 100644 --- a/x/bep3/types/hash.go +++ b/x/bep3/types/hash.go @@ -8,6 +8,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto/tmhash" ) diff --git a/x/bep3/types/hash_test.go b/x/bep3/types/hash_test.go index b38c59a7..ebfb0e46 100644 --- a/x/bep3/types/hash_test.go +++ b/x/bep3/types/hash_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index 0965a447..9532cbf5 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/bep3/types" ) diff --git a/x/cdp/abci.go b/x/cdp/abci.go index 7df7e69d..23410150 100644 --- a/x/cdp/abci.go +++ b/x/cdp/abci.go @@ -4,6 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/cdp/types" diff --git a/x/cdp/abci_test.go b/x/cdp/abci_test.go index d9a37977..7f627976 100644 --- a/x/cdp/abci_test.go +++ b/x/cdp/abci_test.go @@ -5,9 +5,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/genesis_test.go b/x/cdp/genesis_test.go index c02574e2..849583eb 100644 --- a/x/cdp/genesis_test.go +++ b/x/cdp/genesis_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp" ) diff --git a/x/cdp/handler_test.go b/x/cdp/handler_test.go index 7d26c1de..13509145 100644 --- a/x/cdp/handler_test.go +++ b/x/cdp/handler_test.go @@ -4,6 +4,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/auctions_test.go b/x/cdp/keeper/auctions_test.go index 4be3af65..ba276772 100644 --- a/x/cdp/keeper/auctions_test.go +++ b/x/cdp/keeper/auctions_test.go @@ -11,6 +11,7 @@ import ( "github.com/kava-labs/kava/x/cdp/types" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" ) diff --git a/x/cdp/keeper/cdp_test.go b/x/cdp/keeper/cdp_test.go index a7630c49..87d0d8ef 100644 --- a/x/cdp/keeper/cdp_test.go +++ b/x/cdp/keeper/cdp_test.go @@ -5,8 +5,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/deposit_test.go b/x/cdp/keeper/deposit_test.go index 76a0a1b3..7a1e27d7 100644 --- a/x/cdp/keeper/deposit_test.go +++ b/x/cdp/keeper/deposit_test.go @@ -4,8 +4,10 @@ import ( "errors" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/draw_test.go b/x/cdp/keeper/draw_test.go index e4a9991b..8948ba80 100644 --- a/x/cdp/keeper/draw_test.go +++ b/x/cdp/keeper/draw_test.go @@ -5,8 +5,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/fees_test.go b/x/cdp/keeper/fees_test.go index 7c7ced3b..fc2966d0 100644 --- a/x/cdp/keeper/fees_test.go +++ b/x/cdp/keeper/fees_test.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/keeper_bench_test.go b/x/cdp/keeper/keeper_bench_test.go index 462d3275..cd7bf70c 100644 --- a/x/cdp/keeper/keeper_bench_test.go +++ b/x/cdp/keeper/keeper_bench_test.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/exported" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/querier_test.go b/x/cdp/keeper/querier_test.go index 171bbdb5..879ab5ac 100644 --- a/x/cdp/keeper/querier_test.go +++ b/x/cdp/keeper/querier_test.go @@ -7,9 +7,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/savings_test.go b/x/cdp/keeper/savings_test.go index 8d64889d..a72c5146 100644 --- a/x/cdp/keeper/savings_test.go +++ b/x/cdp/keeper/savings_test.go @@ -3,8 +3,10 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/keeper/seize_test.go b/x/cdp/keeper/seize_test.go index 92fe3319..45b707b9 100644 --- a/x/cdp/keeper/seize_test.go +++ b/x/cdp/keeper/seize_test.go @@ -6,9 +6,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/cdp/module.go b/x/cdp/module.go index 9eb8ad3d..49db2add 100644 --- a/x/cdp/module.go +++ b/x/cdp/module.go @@ -12,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/cdp/client/cli" diff --git a/x/cdp/simulation/decoder_test.go b/x/cdp/simulation/decoder_test.go index cbb78fcd..459d87d7 100644 --- a/x/cdp/simulation/decoder_test.go +++ b/x/cdp/simulation/decoder_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/kv" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/cdp/simulation/utils_test.go b/x/cdp/simulation/utils_test.go index 216c057f..e8634022 100644 --- a/x/cdp/simulation/utils_test.go +++ b/x/cdp/simulation/utils_test.go @@ -3,9 +3,10 @@ package simulation_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/simulation" ) diff --git a/x/cdp/types/keys_test.go b/x/cdp/types/keys_test.go index 935f6415..c016fa18 100644 --- a/x/cdp/types/keys_test.go +++ b/x/cdp/types/keys_test.go @@ -3,8 +3,10 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto/ed25519" ) diff --git a/x/cdp/types/msg_test.go b/x/cdp/types/msg_test.go index ac6beebb..8fb7c50a 100644 --- a/x/cdp/types/msg_test.go +++ b/x/cdp/types/msg_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/cdp/types/params.go b/x/cdp/types/params.go index 430ccdfe..02bf75cb 100644 --- a/x/cdp/types/params.go +++ b/x/cdp/types/params.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/params" + tmtime "github.com/tendermint/tendermint/types/time" ) diff --git a/x/cdp/types/params_test.go b/x/cdp/types/params_test.go index ea2c1e72..5bba5871 100644 --- a/x/cdp/types/params_test.go +++ b/x/cdp/types/params_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/cdp/types" ) diff --git a/x/cdp/types/utils_test.go b/x/cdp/types/utils_test.go index 9b8b41c0..48a6947e 100644 --- a/x/cdp/types/utils_test.go +++ b/x/cdp/types/utils_test.go @@ -3,9 +3,10 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestSortableDecBytes(t *testing.T) { diff --git a/x/committee/abci.go b/x/committee/abci.go index 8e1c220e..d6ec639c 100644 --- a/x/committee/abci.go +++ b/x/committee/abci.go @@ -2,6 +2,7 @@ package committee import ( sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/committee/abci_test.go b/x/committee/abci_test.go index 8750822e..d112bb30 100644 --- a/x/committee/abci_test.go +++ b/x/committee/abci_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/client/cli/cli_test.go b/x/committee/client/cli/cli_test.go index 20b6c564..37e5d086 100644 --- a/x/committee/client/cli/cli_test.go +++ b/x/committee/client/cli/cli_test.go @@ -3,9 +3,10 @@ package cli_test import ( "testing" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/committee/client/cli" ) diff --git a/x/committee/client/cli/tx.go b/x/committee/client/cli/tx.go index ea8fc273..d4575a47 100644 --- a/x/committee/client/cli/tx.go +++ b/x/committee/client/cli/tx.go @@ -19,6 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/client/utils" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/params" + "github.com/tendermint/tendermint/crypto" "github.com/kava-labs/kava/x/committee/types" diff --git a/x/committee/genesis_test.go b/x/committee/genesis_test.go index c64664eb..5cf8f7de 100644 --- a/x/committee/genesis_test.go +++ b/x/committee/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/committee/handler_test.go b/x/committee/handler_test.go index 7ae9d781..2b71239e 100644 --- a/x/committee/handler_test.go +++ b/x/committee/handler_test.go @@ -4,10 +4,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/params" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/keeper/keeper_test.go b/x/committee/keeper/keeper_test.go index 3001eec0..1d712e1c 100644 --- a/x/committee/keeper/keeper_test.go +++ b/x/committee/keeper/keeper_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/keeper/proposal_test.go b/x/committee/keeper/proposal_test.go index e8fddd5e..7f8be16b 100644 --- a/x/committee/keeper/proposal_test.go +++ b/x/committee/keeper/proposal_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/params" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/keeper/querier.go b/x/committee/keeper/querier.go index 6e33c7c1..ca4ce994 100644 --- a/x/committee/keeper/querier.go +++ b/x/committee/keeper/querier.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/committee/types" diff --git a/x/committee/keeper/querier_test.go b/x/committee/keeper/querier_test.go index 2278fcc6..762bf605 100644 --- a/x/committee/keeper/querier_test.go +++ b/x/committee/keeper/querier_test.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/module.go b/x/committee/module.go index 84f06265..857d8a1e 100644 --- a/x/committee/module.go +++ b/x/committee/module.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/committee/client/cli" diff --git a/x/committee/proposal_handler_test.go b/x/committee/proposal_handler_test.go index f0ef01ea..4fa97b26 100644 --- a/x/committee/proposal_handler_test.go +++ b/x/committee/proposal_handler_test.go @@ -4,10 +4,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/committee/simulation/decoder.go b/x/committee/simulation/decoder.go index bcbba73f..954c1f3a 100644 --- a/x/committee/simulation/decoder.go +++ b/x/committee/simulation/decoder.go @@ -2,6 +2,7 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/tendermint/tendermint/libs/kv" ) diff --git a/x/committee/types/committee_test.go b/x/committee/types/committee_test.go index 54204292..8582b447 100644 --- a/x/committee/types/committee_test.go +++ b/x/committee/types/committee_test.go @@ -4,9 +4,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/suite" ) var _ PubProposal = UnregisteredPubProposal{} diff --git a/x/committee/types/genesis_test.go b/x/committee/types/genesis_test.go index d1ba83d7..3cfe64e4 100644 --- a/x/committee/types/genesis_test.go +++ b/x/committee/types/genesis_test.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/tendermint/tendermint/crypto" ) diff --git a/x/committee/types/permissions_test.go b/x/committee/types/permissions_test.go index 8218985f..54baaa10 100644 --- a/x/committee/types/permissions_test.go +++ b/x/committee/types/permissions_test.go @@ -3,9 +3,10 @@ package types import ( "testing" + "github.com/stretchr/testify/suite" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/suite" ) type PermissionsTestSuite struct { diff --git a/x/incentive/client/cli/query.go b/x/incentive/client/cli/query.go index f36300b9..ea37bd97 100644 --- a/x/incentive/client/cli/query.go +++ b/x/incentive/client/cli/query.go @@ -4,12 +4,13 @@ import ( "fmt" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/spf13/cobra" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/client/cli/tx.go b/x/incentive/client/cli/tx.go index c17e1047..5e77d2f0 100644 --- a/x/incentive/client/cli/tx.go +++ b/x/incentive/client/cli/tx.go @@ -5,6 +5,8 @@ import ( "fmt" "strings" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -12,7 +14,6 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/spf13/cobra" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/client/rest/query.go b/x/incentive/client/rest/query.go index 9f541b1e..3d1b1aed 100644 --- a/x/incentive/client/rest/query.go +++ b/x/incentive/client/rest/query.go @@ -4,10 +4,11 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/client/rest/tx.go b/x/incentive/client/rest/tx.go index 254fbb36..34b2aa96 100644 --- a/x/incentive/client/rest/tx.go +++ b/x/incentive/client/rest/tx.go @@ -3,11 +3,12 @@ package rest import ( "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/gorilla/mux" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/handler_test.go b/x/incentive/handler_test.go index a2d4c5f0..2e9e809a 100644 --- a/x/incentive/handler_test.go +++ b/x/incentive/handler_test.go @@ -4,8 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/incentive/keeper/keeper_test.go b/x/incentive/keeper/keeper_test.go index de8e61e7..8da12fd6 100644 --- a/x/incentive/keeper/keeper_test.go +++ b/x/incentive/keeper/keeper_test.go @@ -4,10 +4,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" - "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go index e7152d74..cfdfa652 100644 --- a/x/incentive/keeper/payout_test.go +++ b/x/incentive/keeper/payout_test.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/incentive/keeper/querier.go b/x/incentive/keeper/querier.go index d56d2432..428c8635 100644 --- a/x/incentive/keeper/querier.go +++ b/x/incentive/keeper/querier.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/incentive/types" diff --git a/x/incentive/keeper/rewards_test.go b/x/incentive/keeper/rewards_test.go index f62e5d7b..be2951a7 100644 --- a/x/incentive/keeper/rewards_test.go +++ b/x/incentive/keeper/rewards_test.go @@ -4,6 +4,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/incentive/module.go b/x/incentive/module.go index b6b8bcc5..394e3a88 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -4,14 +4,16 @@ import ( "encoding/json" "math/rand" + "github.com/gorilla/mux" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/gorilla/mux" - "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/incentive/client/cli" diff --git a/x/incentive/simulation/decoder.go b/x/incentive/simulation/decoder.go index dda10310..9263de22 100644 --- a/x/incentive/simulation/decoder.go +++ b/x/incentive/simulation/decoder.go @@ -7,6 +7,7 @@ import ( "time" "github.com/cosmos/cosmos-sdk/codec" + "github.com/tendermint/tendermint/libs/kv" "github.com/kava-labs/kava/x/incentive/types" diff --git a/x/incentive/simulation/decoder_test.go b/x/incentive/simulation/decoder_test.go index 7eb08ebd..1759f5b3 100644 --- a/x/incentive/simulation/decoder_test.go +++ b/x/incentive/simulation/decoder_test.go @@ -5,9 +5,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/kv" "github.com/kava-labs/kava/x/incentive/types" diff --git a/x/incentive/types/account_test.go b/x/incentive/types/account_test.go index 9bef19fe..5c1f6560 100644 --- a/x/incentive/types/account_test.go +++ b/x/incentive/types/account_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" + "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/incentive/types/msg_test.go b/x/incentive/types/msg_test.go index d1456291..00eccee8 100644 --- a/x/incentive/types/msg_test.go +++ b/x/incentive/types/msg_test.go @@ -3,8 +3,10 @@ package types_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto" "github.com/kava-labs/kava/x/incentive/types" diff --git a/x/incentive/types/params.go b/x/incentive/types/params.go index 8348bb65..17ca6a20 100644 --- a/x/incentive/types/params.go +++ b/x/incentive/types/params.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" + tmtime "github.com/tendermint/tendermint/types/time" cdptypes "github.com/kava-labs/kava/x/cdp/types" diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index 9c0baf68..97f3fbc7 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/incentive/types" ) diff --git a/x/kavadist/keeper/mint_test.go b/x/kavadist/keeper/mint_test.go index b7ceb6de..48539c61 100644 --- a/x/kavadist/keeper/mint_test.go +++ b/x/kavadist/keeper/mint_test.go @@ -4,8 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/kavadist/module.go b/x/kavadist/module.go index e9dc22e4..e91dae17 100644 --- a/x/kavadist/module.go +++ b/x/kavadist/module.go @@ -12,6 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/kavadist/simulation" diff --git a/x/kavadist/simulation/utils_test.go b/x/kavadist/simulation/utils_test.go index 81a76c39..2521bb5f 100644 --- a/x/kavadist/simulation/utils_test.go +++ b/x/kavadist/simulation/utils_test.go @@ -3,8 +3,9 @@ package simulation import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestApproxRoot(t *testing.T) { diff --git a/x/kavadist/types/params.go b/x/kavadist/types/params.go index 46a2906d..8fa015aa 100644 --- a/x/kavadist/types/params.go +++ b/x/kavadist/types/params.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" + tmtime "github.com/tendermint/tendermint/types/time" cdptypes "github.com/kava-labs/kava/x/cdp/types" diff --git a/x/kavadist/types/params_test.go b/x/kavadist/types/params_test.go index e612fda3..ff3335bb 100644 --- a/x/kavadist/types/params_test.go +++ b/x/kavadist/types/params_test.go @@ -4,9 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/kava-labs/kava/x/kavadist/types" ) diff --git a/x/pricefeed/client/cli/query.go b/x/pricefeed/client/cli/query.go index 3930bbf9..73ae9796 100644 --- a/x/pricefeed/client/cli/query.go +++ b/x/pricefeed/client/cli/query.go @@ -3,12 +3,13 @@ package cli import ( "fmt" + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" "github.com/kava-labs/kava/x/pricefeed/types" ) diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index 726a8050..52e8414d 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -14,6 +14,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/x/pricefeed/types" diff --git a/x/pricefeed/client/rest/rest.go b/x/pricefeed/client/rest/rest.go index fa1f5cb7..12c4a863 100644 --- a/x/pricefeed/client/rest/rest.go +++ b/x/pricefeed/client/rest/rest.go @@ -1,9 +1,10 @@ package rest import ( + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" ) const ( diff --git a/x/pricefeed/client/rest/tx.go b/x/pricefeed/client/rest/tx.go index 89a8df42..06c1cda5 100644 --- a/x/pricefeed/client/rest/tx.go +++ b/x/pricefeed/client/rest/tx.go @@ -5,11 +5,13 @@ import ( "net/http" "time" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth/client/utils" - "github.com/gorilla/mux" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/kava-labs/kava/x/pricefeed/types" diff --git a/x/pricefeed/keeper/keeper_test.go b/x/pricefeed/keeper/keeper_test.go index 2288fa87..92e33635 100644 --- a/x/pricefeed/keeper/keeper_test.go +++ b/x/pricefeed/keeper/keeper_test.go @@ -4,8 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/app" diff --git a/x/pricefeed/keeper/params_test.go b/x/pricefeed/keeper/params_test.go index c9849d39..3c293c74 100644 --- a/x/pricefeed/keeper/params_test.go +++ b/x/pricefeed/keeper/params_test.go @@ -3,8 +3,10 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/pricefeed/module.go b/x/pricefeed/module.go index 3426a860..c2d9cd9c 100644 --- a/x/pricefeed/module.go +++ b/x/pricefeed/module.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" sim "github.com/cosmos/cosmos-sdk/x/simulation" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/pricefeed/client/cli" diff --git a/x/pricefeed/simulation/decoder.go b/x/pricefeed/simulation/decoder.go index e40c1932..cb6b8343 100644 --- a/x/pricefeed/simulation/decoder.go +++ b/x/pricefeed/simulation/decoder.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/codec" + "github.com/tendermint/tendermint/libs/kv" "github.com/kava-labs/kava/x/pricefeed/types" diff --git a/x/pricefeed/simulation/decoder_test.go b/x/pricefeed/simulation/decoder_test.go index 33ef65a8..de524923 100644 --- a/x/pricefeed/simulation/decoder_test.go +++ b/x/pricefeed/simulation/decoder_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/kv" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/pricefeed/types/msgs_test.go b/x/pricefeed/types/msgs_test.go index 74192420..c9d16fc8 100644 --- a/x/pricefeed/types/msgs_test.go +++ b/x/pricefeed/types/msgs_test.go @@ -3,8 +3,10 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + tmtime "github.com/tendermint/tendermint/types/time" ) diff --git a/x/validator-vesting/abci.go b/x/validator-vesting/abci.go index 6b9c6d14..97a976e4 100644 --- a/x/validator-vesting/abci.go +++ b/x/validator-vesting/abci.go @@ -7,6 +7,7 @@ import ( tmtime "github.com/tendermint/tendermint/types/time" sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/kava-labs/kava/x/validator-vesting/keeper" diff --git a/x/validator-vesting/abci_test.go b/x/validator-vesting/abci_test.go index 16b7e1ab..a423740a 100644 --- a/x/validator-vesting/abci_test.go +++ b/x/validator-vesting/abci_test.go @@ -4,8 +4,10 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" tmtime "github.com/tendermint/tendermint/types/time" diff --git a/x/validator-vesting/client/rest/query.go b/x/validator-vesting/client/rest/query.go index f132ed35..0a9d6704 100644 --- a/x/validator-vesting/client/rest/query.go +++ b/x/validator-vesting/client/rest/query.go @@ -5,9 +5,10 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" "github.com/kava-labs/kava/x/validator-vesting/types" ) diff --git a/x/validator-vesting/keeper/keeper.go b/x/validator-vesting/keeper/keeper.go index 1bda605a..933d2adc 100644 --- a/x/validator-vesting/keeper/keeper.go +++ b/x/validator-vesting/keeper/keeper.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported" + "github.com/tendermint/tendermint/libs/log" "github.com/kava-labs/kava/x/validator-vesting/types" diff --git a/x/validator-vesting/keeper/keeper_test.go b/x/validator-vesting/keeper/keeper_test.go index 393ffa8d..4f15b003 100644 --- a/x/validator-vesting/keeper/keeper_test.go +++ b/x/validator-vesting/keeper/keeper_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" + tmtime "github.com/tendermint/tendermint/types/time" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/validator-vesting/keeper/test_common.go b/x/validator-vesting/keeper/test_common.go index a9cc1e9b..e3f45882 100644 --- a/x/validator-vesting/keeper/test_common.go +++ b/x/validator-vesting/keeper/test_common.go @@ -9,12 +9,13 @@ import ( "github.com/stretchr/testify/require" + dbm "github.com/tendermint/tm-db" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" tmtime "github.com/tendermint/tendermint/types/time" - dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index c4a3e704..70ed1636 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -6,6 +6,7 @@ import ( "github.com/gorilla/mux" "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/client/context" diff --git a/x/validator-vesting/simulation/decoder.go b/x/validator-vesting/simulation/decoder.go index d0533eb9..9cddbb29 100644 --- a/x/validator-vesting/simulation/decoder.go +++ b/x/validator-vesting/simulation/decoder.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/libs/kv" "github.com/kava-labs/kava/x/validator-vesting/types" diff --git a/x/validator-vesting/simulation/decoder_test.go b/x/validator-vesting/simulation/decoder_test.go index 4451e1b5..e07bdac1 100644 --- a/x/validator-vesting/simulation/decoder_test.go +++ b/x/validator-vesting/simulation/decoder_test.go @@ -5,10 +5,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/kv" diff --git a/x/validator-vesting/types/validator_vesting_account.go b/x/validator-vesting/types/validator_vesting_account.go index a1180e88..297e1082 100644 --- a/x/validator-vesting/types/validator_vesting_account.go +++ b/x/validator-vesting/types/validator_vesting_account.go @@ -12,6 +12,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/tendermint/tendermint/crypto" ) diff --git a/x/validator-vesting/types/validator_vesting_account_test.go b/x/validator-vesting/types/validator_vesting_account_test.go index 4abad811..a2562e3b 100644 --- a/x/validator-vesting/types/validator_vesting_account_test.go +++ b/x/validator-vesting/types/validator_vesting_account_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" + tmtime "github.com/tendermint/tendermint/types/time" sdk "github.com/cosmos/cosmos-sdk/types" From ebb1149c959215b2ae8c0b45b5a6865a5608ce08 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 10:27:28 -0400 Subject: [PATCH 3/7] update format --- Makefile | 2 +- app/app_test.go | 2 +- app/sim_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9bb3f462..0c2f90e1 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ lint: format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/tendermint/tendermint + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/tendermint find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' | xargs goimports -w -local github.com/kava-labs/kava .PHONY: format diff --git a/app/app_test.go b/app/app_test.go index 19801b7b..263c16b7 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,9 +5,9 @@ import ( "testing" "github.com/stretchr/testify/require" - db "github.com/tendermint/tm-db" "github.com/tendermint/tendermint/libs/log" + db "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" diff --git a/app/sim_test.go b/app/sim_test.go index 52741ab5..18d6e4ec 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/stretchr/testify/require" - dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" @@ -26,6 +25,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" "github.com/kava-labs/kava/x/auction" "github.com/kava-labs/kava/x/bep3" From 363c4f61aadb0119e9f4762b9a721758e17a581b Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 11:03:49 -0400 Subject: [PATCH 4/7] update workflow --- .github/{ => .workflows}/lint.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => .workflows}/lint.yml (100%) diff --git a/.github/lint.yml b/.github/.workflows/lint.yml similarity index 100% rename from .github/lint.yml rename to .github/.workflows/lint.yml From 1a04ffe396103d376904b426756292f3d4c35a43 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 11:33:10 -0400 Subject: [PATCH 5/7] fix some lint bugs --- x/bep3/keeper/swap.go | 18 ++++---- x/cdp/keeper/auctions.go | 4 +- x/cdp/keeper/cdp.go | 4 +- x/cdp/keeper/draw.go | 5 ++- x/cdp/keeper/fees.go | 21 +++++++-- x/cdp/keeper/seize.go | 3 +- x/committee/types/committee_test.go | 2 +- x/incentive/simulation/genesis.go | 13 ------ x/incentive/simulation/operations.go | 4 -- x/incentive/simulation/params.go | 5 +-- x/validator-vesting/keeper/keeper.go | 54 ++++++++++++----------- x/validator-vesting/keeper/test_common.go | 21 ++++++--- 12 files changed, 83 insertions(+), 71 deletions(-) diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index 6e94e555..873f0883 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -126,21 +126,23 @@ func (k Keeper) ClaimAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []b case types.Incoming: err := k.DecrementIncomingAssetSupply(ctx, atomicSwap.Amount[0]) if err != nil { - break + return err } err = k.IncrementCurrentAssetSupply(ctx, atomicSwap.Amount[0]) + if err != nil { + return err + } case types.Outgoing: err = k.DecrementOutgoingAssetSupply(ctx, atomicSwap.Amount[0]) if err != nil { - break + return err } err = k.DecrementCurrentAssetSupply(ctx, atomicSwap.Amount[0]) + if err != nil { + return err + } default: - err = fmt.Errorf("invalid swap direction: %s", atomicSwap.Direction.String()) - } - - if err != nil { - return err + return fmt.Errorf("invalid swap direction: %s", atomicSwap.Direction.String()) } // Send intended recipient coins @@ -216,7 +218,7 @@ func (k Keeper) RefundAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID [] ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeRefundAtomicSwap, - sdk.NewAttribute(types.AttributeKeyRefundSender, fmt.Sprintf("%s", from)), + sdk.NewAttribute(types.AttributeKeyRefundSender, from), sdk.NewAttribute(types.AttributeKeySender, fmt.Sprintf("%s", atomicSwap.Sender)), sdk.NewAttribute(types.AttributeKeyAtomicSwapID, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.GetSwapID()))), sdk.NewAttribute(types.AttributeKeyRandomNumberHash, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.RandomNumberHash))), diff --git a/x/cdp/keeper/auctions.go b/x/cdp/keeper/auctions.go index 640a21e7..5228ef08 100644 --- a/x/cdp/keeper/auctions.go +++ b/x/cdp/keeper/auctions.go @@ -210,7 +210,9 @@ func (k Keeper) GetTotalDebt(ctx sdk.Context, accountName string) sdk.Int { // RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { - k.NetSurplusAndDebt(ctx) + if err := k.NetSurplusAndDebt(ctx); err != nil { + return err + } remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc) params := k.GetParams(ctx) if remainingDebt.GTE(params.DebtAuctionThreshold) { diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index 6b2ad8e4..7c9fcc5d 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -199,7 +199,7 @@ func (k Keeper) SetCDP(ctx sdk.Context, cdp types.CDP) error { store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom) if !found { - sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) + return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) } bz := k.cdc.MustMarshalBinaryLengthPrefixed(cdp) store.Set(types.CdpKey(db, cdp.ID), bz) @@ -211,7 +211,7 @@ func (k Keeper) DeleteCDP(ctx sdk.Context, cdp types.CDP) error { store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom) if !found { - sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) + return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom) } store.Delete(types.CdpKey(db, cdp.ID)) return nil diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index e1543a1f..1a0b14bc 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -142,7 +142,10 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, denom stri // and remove the cdp and indexes from the store if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() { k.ReturnCollateral(ctx, cdp) - k.DeleteCDP(ctx, cdp) + if err := k.DeleteCDP(ctx, cdp); err != nil { + return err + } + k.RemoveCdpOwnerIndex(ctx, cdp) // emit cdp close event diff --git a/x/cdp/keeper/fees.go b/x/cdp/keeper/fees.go index ec1e7a4e..1d2c4555 100644 --- a/x/cdp/keeper/fees.go +++ b/x/cdp/keeper/fees.go @@ -56,14 +56,27 @@ func (k Keeper) UpdateFeesForAllCdps(ctx sdk.Context, collateralDenom string) er return false } // mint debt coins to the cdp account - k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), newFees) + err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), newFees) + if err != nil { + iterationErr = err + return true + } previousDebt := k.GetTotalPrincipal(ctx, collateralDenom, dp.Denom) newDebt := previousDebt.Add(newFees.Amount) k.SetTotalPrincipal(ctx, collateralDenom, dp.Denom, newDebt) // mint surplus coins divided between the liquidator and savings module accounts. - k.supplyKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus))) - k.supplyKeeper.MintCoins(ctx, types.SavingsRateMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSavings))) + err = k.supplyKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus))) + if err != nil { + iterationErr = err + return true + } + + err = k.supplyKeeper.MintCoins(ctx, types.SavingsRateMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSavings))) + if err != nil { + iterationErr = err + return true + } // now add the new fees fees to the accumulated fees for the cdp cdp.AccumulatedFees = cdp.AccumulatedFees.Add(newFees) @@ -72,7 +85,7 @@ func (k Keeper) UpdateFeesForAllCdps(ctx sdk.Context, collateralDenom string) er cdp.FeesUpdated = ctx.BlockTime() collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees)) k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio) - err := k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) + err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) if err != nil { iterationErr = err return true diff --git a/x/cdp/keeper/seize.go b/x/cdp/keeper/seize.go index 5a3fa8cf..67075bc7 100644 --- a/x/cdp/keeper/seize.go +++ b/x/cdp/keeper/seize.go @@ -61,8 +61,7 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error { // Delete CDP from state k.RemoveCdpOwnerIndex(ctx, cdp) k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio) - k.DeleteCDP(ctx, cdp) - return nil + return k.DeleteCDP(ctx, cdp) } // LiquidateCdps seizes collateral from all CDPs below the input liquidation ratio diff --git a/x/committee/types/committee_test.go b/x/committee/types/committee_test.go index 8582b447..18df9f30 100644 --- a/x/committee/types/committee_test.go +++ b/x/committee/types/committee_test.go @@ -162,7 +162,7 @@ func (suite *TypesTestSuite) TestCommittee_HasPermissionsFor() { }, }}, }, - pubProposal: UnregisteredPubProposal{govtypes.TextProposal{"A Title", "A description."}}, + pubProposal: UnregisteredPubProposal{govtypes.TextProposal{Title: "A Title", Description: "A description."}}, expectHasPermissions: false, }, } diff --git a/x/incentive/simulation/genesis.go b/x/incentive/simulation/genesis.go index 88a28bd6..cd6513d1 100644 --- a/x/incentive/simulation/genesis.go +++ b/x/incentive/simulation/genesis.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/kava-labs/kava/x/incentive/types" @@ -126,15 +125,3 @@ func genNextClaimPeriodIds(cps types.ClaimPeriods) types.GenesisClaimPeriodIDs { } return claimPeriodIDs } - -// In a list of accounts, replace the first account found with the same address. If not found, append the account. -func replaceOrAppendAccount(accounts []authexported.GenesisAccount, acc authexported.GenesisAccount) []authexported.GenesisAccount { - newAccounts := accounts - for i, a := range accounts { - if a.GetAddress().Equals(acc.GetAddress()) { - newAccounts[i] = acc - return newAccounts - } - } - return append(newAccounts, acc) -} diff --git a/x/incentive/simulation/operations.go b/x/incentive/simulation/operations.go index 03e143d8..40aeb4bc 100644 --- a/x/incentive/simulation/operations.go +++ b/x/incentive/simulation/operations.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -51,15 +50,12 @@ func SimulateMsgClaimReward(ak auth.AccountKeeper, sk types.SupplyKeeper, k keep ) (simulation.OperationMsg, []simulation.FutureOperation, error) { // Load only account types that can claim rewards - var accounts []authexported.Account validAccounts := make(map[string]bool) for _, acc := range accs { account := ak.GetAccount(ctx, acc.Address) switch account.(type) { case *vesting.PeriodicVestingAccount, *auth.BaseAccount: // Valid: BaseAccount, PeriodicVestingAccount - accounts = append(accounts, account) validAccounts[account.GetAddress().String()] = true - break default: // Invalid: ValidatorVestingAccount, DelayedVestingAccount, ContinuousVestingAccount break } diff --git a/x/incentive/simulation/params.go b/x/incentive/simulation/params.go index a8306bf2..19cf0e2a 100644 --- a/x/incentive/simulation/params.go +++ b/x/incentive/simulation/params.go @@ -18,10 +18,7 @@ const ( func genActive(r *rand.Rand) bool { threshold := 80 value := simulation.RandIntBetween(r, 1, 100) - if value > threshold { - return false - } - return true + return value <= threshold } // ParamChanges defines the parameters that can be modified by param change proposals diff --git a/x/validator-vesting/keeper/keeper.go b/x/validator-vesting/keeper/keeper.go index 933d2adc..de51ffdf 100644 --- a/x/validator-vesting/keeper/keeper.go +++ b/x/validator-vesting/keeper/keeper.go @@ -157,34 +157,38 @@ func (k Keeper) ResetCurrentPeriodProgress(ctx sdk.Context, addr sdk.AccAddress) func (k Keeper) HandleVestingDebt(ctx sdk.Context, addr sdk.AccAddress, blockTime time.Time) { vv := k.GetAccountFromAuthKeeper(ctx, addr) - if !vv.DebtAfterFailedVesting.IsZero() { - spendableCoins := vv.SpendableCoins(blockTime) - if spendableCoins.IsAllGTE(vv.DebtAfterFailedVesting) { - if vv.ReturnAddress != nil { - err := k.bk.SendCoins(ctx, addr, vv.ReturnAddress, vv.DebtAfterFailedVesting) - if err != nil { - panic(err) - } - } else { - err := k.supplyKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, vv.DebtAfterFailedVesting) - if err != nil { - panic(err) - } - err = k.supplyKeeper.BurnCoins(ctx, types.ModuleName, vv.DebtAfterFailedVesting) - if err != nil { - panic(err) - } + if vv.DebtAfterFailedVesting.IsZero() { + return + } + spendableCoins := vv.SpendableCoins(blockTime) + if spendableCoins.IsAllGTE(vv.DebtAfterFailedVesting) { + if vv.ReturnAddress != nil { + err := k.bk.SendCoins(ctx, addr, vv.ReturnAddress, vv.DebtAfterFailedVesting) + if err != nil { + panic(err) } - k.ResetDebt(ctx, addr) } else { - // iterate over all delegations made from the validator vesting account and undelegate - // note that we cannot safely undelegate only an amount of shares that covers the debt, - // because the value of those shares could change if a validator gets slashed. - k.stakingKeeper.IterateDelegations(ctx, vv.Address, func(index int64, d stakingexported.DelegationI) (stop bool) { - k.stakingKeeper.Undelegate(ctx, d.GetDelegatorAddr(), d.GetValidatorAddr(), d.GetShares()) - return false - }) + err := k.supplyKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, vv.DebtAfterFailedVesting) + if err != nil { + panic(err) + } + err = k.supplyKeeper.BurnCoins(ctx, types.ModuleName, vv.DebtAfterFailedVesting) + if err != nil { + panic(err) + } } + k.ResetDebt(ctx, addr) + } else { + // iterate over all delegations made from the validator vesting account and undelegate + // note that we cannot safely undelegate only an amount of shares that covers the debt, + // because the value of those shares could change if a validator gets slashed. + k.stakingKeeper.IterateDelegations(ctx, vv.Address, func(index int64, d stakingexported.DelegationI) (stop bool) { + _, err := k.stakingKeeper.Undelegate(ctx, d.GetDelegatorAddr(), d.GetValidatorAddr(), d.GetShares()) + if err != nil { + panic(err) + } + return false + }) } } diff --git a/x/validator-vesting/keeper/test_common.go b/x/validator-vesting/keeper/test_common.go index e3f45882..356013e4 100644 --- a/x/validator-vesting/keeper/test_common.go +++ b/x/validator-vesting/keeper/test_common.go @@ -172,9 +172,12 @@ func ValidatorVestingTestAccount() *types.ValidatorVestingAccount { testConsAddr := sdk.ConsAddress(testPk.Address()) origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := auth.NewBaseAccountWithAddress(testAddr) - bacc.SetCoins(origCoins) + err := bacc.SetCoins(origCoins) + if err != nil { + panic(err) + } vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) - err := vva.Validate() + err = vva.Validate() if err != nil { panic(err) } @@ -196,9 +199,12 @@ func ValidatorVestingTestAccounts(numAccounts int) []*types.ValidatorVestingAcco testConsAddr := sdk.ConsAddress(testPk[i].Address()) origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := auth.NewBaseAccountWithAddress(testAddr[i]) - bacc.SetCoins(origCoins) + err := bacc.SetCoins(origCoins) + if err != nil { + panic(err) + } vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90) - err := vva.Validate() + err = vva.Validate() if err != nil { panic(err) } @@ -218,9 +224,12 @@ func ValidatorVestingDelegatorTestAccount(startTime time.Time) *types.ValidatorV testConsAddr := sdk.ConsAddress(testPk.Address()) origCoins := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 60000000)} bacc := auth.NewBaseAccountWithAddress(testAddr) - bacc.SetCoins(origCoins) + err := bacc.SetCoins(origCoins) + if err != nil { + panic(err) + } vva := types.NewValidatorVestingAccount(&bacc, startTime.Unix(), periods, testConsAddr, nil, 90) - err := vva.Validate() + err = vva.Validate() if err != nil { panic(err) } From d8bbde78cc8b03bed073e596961cfbf1f6dcb9aa Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 12:15:40 -0400 Subject: [PATCH 6/7] build --- x/bep3/keeper/swap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index 873f0883..5f4fc811 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -218,7 +218,7 @@ func (k Keeper) RefundAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID [] ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeRefundAtomicSwap, - sdk.NewAttribute(types.AttributeKeyRefundSender, from), + sdk.NewAttribute(types.AttributeKeyRefundSender, fmt.Sprintf("%s", from)), sdk.NewAttribute(types.AttributeKeySender, fmt.Sprintf("%s", atomicSwap.Sender)), sdk.NewAttribute(types.AttributeKeyAtomicSwapID, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.GetSwapID()))), sdk.NewAttribute(types.AttributeKeyRandomNumberHash, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.RandomNumberHash))), From 6915cec121df1ac0d1ac1ad0c20f3f753f803438 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Thu, 30 Apr 2020 17:10:53 -0400 Subject: [PATCH 7/7] address comments from review --- golangci.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/golangci.yml b/golangci.yml index 307611ef..371e83fa 100644 --- a/golangci.yml +++ b/golangci.yml @@ -43,17 +43,6 @@ issues: - text: "comment on exported var" linters: - golint - - text: "don't use an underscore in package name" - linters: - - golint - - text: "ST1003:" - linters: - - stylecheck - # FIXME: Disabled until golangci-lint updates stylecheck with this fix: - # https://github.com/dominikh/go-tools/issues/389 - - text: "ST1016:" - linters: - - stylecheck linters-settings: dogsled: