Skip to content

Commit

Permalink
Make format (#1694)
Browse files Browse the repository at this point in the history
* Tidy up imports as per #1527

* make format and update make format in makefile

* merge Anmol's work then run make format agasinst it

Co-authored-by: Anmol1696 <[email protected]>
  • Loading branch information
faddat and Anmol1696 authored Sep 14, 2022
1 parent 20c340c commit 6430d6f
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 49 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ run:
linters:
disable-all: true
enable:
- deadcode
- depguard
- dogsled
- exportloopref
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ lint:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/cosmos/cosmos-sdk
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l
golangci-lint run --fix
.PHONY: format

###############################################################################
### Localnet ###
Expand Down
5 changes: 3 additions & 2 deletions ante/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"

"github.com/cosmos/gaia/v8/ante"
gaiaapp "github.com/cosmos/gaia/v8/app"
globfeetypes "github.com/cosmos/gaia/v8/x/globalfee/types"
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"
)

// test global fees and min_gas_price with bypass msg types.
Expand Down
3 changes: 2 additions & 1 deletion ante/fee_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"math"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gaia/v8/x/globalfee/types"
tmstrings "github.com/tendermint/tendermint/libs/strings"

"github.com/cosmos/gaia/v8/x/globalfee/types"
)

// ParamStoreKeyMinGasPrices type require coins sorted. getGlobalFee will also return sorted coins (might return 0denom if globalMinGasPrice is 0)
Expand Down
1 change: 0 additions & 1 deletion ante/fee_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/stretchr/testify/suite"
)

Expand Down
4 changes: 2 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package gaia

import (
"github.com/cosmos/gaia/v8/app/params"

"github.com/cosmos/cosmos-sdk/std"

"github.com/cosmos/gaia/v8/app/params"
)

// MakeTestEncodingConfig creates an EncodingConfig for testing. This function
Expand Down
19 changes: 9 additions & 10 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ import (
"os"
"testing"

gaia "github.com/cosmos/gaia/v8/app"
"github.com/cosmos/gaia/v8/app/params"

"github.com/cosmos/gaia/v8/app/helpers"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store"
simulation2 "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

gaia "github.com/cosmos/gaia/v8/app"
"github.com/cosmos/gaia/v8/app/helpers"
"github.com/cosmos/gaia/v8/app/params"
)

func init() {
Expand Down Expand Up @@ -77,8 +76,8 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) {
return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
}

//// TODO: Make another test for the fuzzer itself, which just has noOp txs
//// and doesn't depend on the application.
// // TODO: Make another test for the fuzzer itself, which just has noOp txs
// // and doesn't depend on the application.
func TestAppStateDeterminism(t *testing.T) {
if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation")
Expand Down
3 changes: 1 addition & 2 deletions cmd/gaiad/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"errors"
"fmt"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand All @@ -18,6 +16,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/spf13/cobra"
)

const (
Expand Down
4 changes: 1 addition & 3 deletions cmd/gaiad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
tmcfg "github.com/tendermint/tendermint/config"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
Expand All @@ -27,9 +25,9 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
Expand Down
14 changes: 6 additions & 8 deletions cmd/gaiad/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ import (
"os"
"path/filepath"

"github.com/spf13/cobra"
tmconfig "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
Expand All @@ -33,7 +26,12 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/spf13/cobra"
tmconfig "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
// ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
// ibcchanneltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"

Expand Down
31 changes: 16 additions & 15 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,27 +405,28 @@ global fee e2e tests:
0. initial globalfee = 0.00001uatom, min_gas_price = 0.00001uatom
test1. gov proposal globalfee = [], min_gas_price=0.00001uatom, query globalfee still get empty
- tx with fee denom photon, fail
- tx with zero fee denom photon, fail
- tx with fee denom uatom, pass
- tx with fee empty, fail
- tx with fee denom photon, fail
- tx with zero fee denom photon, fail
- tx with fee denom uatom, pass
- tx with fee empty, fail
test2. gov propose globalfee = 0.000001uatom(lower than min_gas_price)
- tx with fee higher than 0.000001uatom but lower than 0.00001uatom, fail
- tx with fee higher than/equal to 0.00001uatom, pass
- tx with fee photon fail
- tx with fee higher than 0.000001uatom but lower than 0.00001uatom, fail
- tx with fee higher than/equal to 0.00001uatom, pass
- tx with fee photon fail
test3. gov propose globalfee = 0.0001uatom (higher than min_gas_price)
- tx with fee equal to 0.0001uatom, pass
- tx with fee equal to 0.00001uatom, fail
- tx with fee equal to 0.0001uatom, pass
- tx with fee equal to 0.00001uatom, fail
test4. gov propose globalfee = 0.000001uatom (lower than min_gas_price), 0photon
- tx with fee 0.0000001photon, fail
- tx with fee 0.000001photon, pass
- tx with empty fee, pass
- tx with fee photon pass
- tx with fee 0photon, 0.000005uatom fail
- tx with fee 0photon, 0.00001uatom pass
- tx with fee 0.0000001photon, fail
- tx with fee 0.000001photon, pass
- tx with empty fee, pass
- tx with fee photon pass
- tx with fee 0photon, 0.000005uatom fail
- tx with fee 0photon, 0.00001uatom pass
5. check balance correct: all the sucessful tx sent token amt is received
6. gov propose change back to initial globalfee = 0.00001photon, This is for not influence other e2e tests.
*/
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/go-bip39"
)

Expand Down
1 change: 1 addition & 0 deletions x/globalfee/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/gaia/v8/x/globalfee/types"
)

Expand Down

0 comments on commit 6430d6f

Please sign in to comment.