Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-zq committed Jun 6, 2024
1 parent 4c8c4c9 commit 7984502
Show file tree
Hide file tree
Showing 67 changed files with 212 additions and 322 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ lint:
go mod verify

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./lite/*/statik.go" -not -path "*.pb.go" | xargs goimports -w -local github.com/bianjieai/irita
goimports-reviser -rm-unused -excludes './vendor/,./lite/statik/statik.go,*.pb.go' -format ./...

benchmark:
@go test -mod=readonly -bench=. ./...
Expand Down
3 changes: 2 additions & 1 deletion app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"runtime/debug"

evmmoduleante "github.com/bianjieai/irita/modules/evm"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand All @@ -15,6 +14,8 @@ import (
tokenkeeper "github.com/irisnet/irismod/modules/token/keeper"
tmlog "github.com/tendermint/tendermint/libs/log"
evmtypes "github.com/tharsis/ethermint/x/evm/types"

evmmoduleante "github.com/bianjieai/irita/modules/evm"
)

type HandlerOptions struct {
Expand Down
3 changes: 2 additions & 1 deletion app/ante/handler_options.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package ante

import (
evmmoduleante "github.com/bianjieai/irita/modules/evm"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
tokenkeeper "github.com/irisnet/irismod/modules/token/keeper"
ethermintante "github.com/tharsis/ethermint/app/ante"

evmmoduleante "github.com/bianjieai/irita/modules/evm"
)

func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
Expand Down
74 changes: 34 additions & 40 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (
"os"
"path/filepath"

appante "github.com/bianjieai/irita/app/ante"
"github.com/bianjieai/irita/modules/evm/crypto"
evmutils "github.com/bianjieai/irita/modules/evm/utils"
"github.com/irisnet/irismod/modules/mt"
"github.com/spf13/cast"
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"

tibcmttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer"
tibcmttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer/keeper"
tibcmttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer/types"
tibcnfttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer"
tibcnfttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/keeper"
tibcnfttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/types"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibcroutingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
tibccorekeeper "github.com/bianjieai/tibc-go/modules/tibc/core/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -32,7 +31,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"

authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -61,7 +59,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
sdkupgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
sdkupgrade "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/irisnet/irismod/modules/mt"
mtkeeper "github.com/irisnet/irismod/modules/mt/keeper"
mttypes "github.com/irisnet/irismod/modules/mt/types"
"github.com/irisnet/irismod/modules/nft"
Expand All @@ -82,7 +80,30 @@ import (
"github.com/irisnet/irismod/modules/token"
tokenkeeper "github.com/irisnet/irismod/modules/token/keeper"
tokentypes "github.com/irisnet/irismod/modules/token/types"
"github.com/spf13/cast"
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"
ethermintante "github.com/tharsis/ethermint/app/ante"
srvflags "github.com/tharsis/ethermint/server/flags"
ethermint "github.com/tharsis/ethermint/types"
"github.com/tharsis/ethermint/x/evm"
evmrest "github.com/tharsis/ethermint/x/evm/client/rest"
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/tharsis/ethermint/x/feemarket"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"

"github.com/bianjieai/irita/address"
appante "github.com/bianjieai/irita/app/ante"
"github.com/bianjieai/irita/lite"
appkeeper "github.com/bianjieai/irita/modules/evm"
"github.com/bianjieai/irita/modules/evm/crypto"
evmutils "github.com/bianjieai/irita/modules/evm/utils"
tibc "github.com/bianjieai/irita/modules/tibc"
tibckeeper "github.com/bianjieai/irita/modules/tibc/keeper"
"github.com/bianjieai/iritamod/modules/genutil"
genutiltypes "github.com/bianjieai/iritamod/modules/genutil"
"github.com/bianjieai/iritamod/modules/identity"
Expand All @@ -96,34 +117,6 @@ import (
"github.com/bianjieai/iritamod/modules/upgrade"
upgradekeeper "github.com/bianjieai/iritamod/modules/upgrade/keeper"
upgradetypes "github.com/bianjieai/iritamod/modules/upgrade/types"

"github.com/bianjieai/irita/address"
"github.com/bianjieai/irita/lite"
appkeeper "github.com/bianjieai/irita/modules/evm"

tibc "github.com/bianjieai/irita/modules/tibc"
tibckeeper "github.com/bianjieai/irita/modules/tibc/keeper"

tibcmttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer"
tibcmttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer/keeper"
tibcmttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer/types"
tibcnfttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer"
tibcnfttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/keeper"
tibcnfttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/types"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibcroutingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
tibccorekeeper "github.com/bianjieai/tibc-go/modules/tibc/core/keeper"

ethermintante "github.com/tharsis/ethermint/app/ante"
srvflags "github.com/tharsis/ethermint/server/flags"
ethermint "github.com/tharsis/ethermint/types"
"github.com/tharsis/ethermint/x/evm"
evmrest "github.com/tharsis/ethermint/x/evm/client/rest"
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/tharsis/ethermint/x/feemarket"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
)

const appName = "IritaApp"
Expand Down Expand Up @@ -155,6 +148,7 @@ var storeKeys = []string{

// DefaultNodeHome default home directories for the application daemon
var DefaultNodeHome string

var (
// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
Expand Down
13 changes: 5 additions & 8 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

tokentypes "github.com/irisnet/irismod/modules/token/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/bianjieai/iritamod/modules/node"
)
Expand Down
4 changes: 1 addition & 3 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package app
import (
"encoding/json"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

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

"github.com/irisnet/irismod/modules/service"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/bianjieai/iritamod/modules/node"
)
Expand Down
3 changes: 1 addition & 2 deletions app/sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"os"
"testing"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/cosmos/cosmos-sdk/simapp"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

// Profile with:
Expand Down
12 changes: 5 additions & 7 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
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"
Expand All @@ -28,6 +21,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/simulation"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"
)

// Get flags every time the simulator is run
Expand Down
8 changes: 3 additions & 5 deletions cmd/irita/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import (
"errors"
"fmt"

evmhd "github.com/tharsis/ethermint/crypto/hd"
evmtypes "github.com/tharsis/ethermint/x/evm/types"

"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 @@ -21,6 +16,9 @@ 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"
evmhd "github.com/tharsis/ethermint/crypto/hd"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
)

const (
Expand Down
6 changes: 2 additions & 4 deletions cmd/irita/cmd/genrootcert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import (
"fmt"
"os"

"github.com/spf13/cobra"

"github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"

"github.com/bianjieai/iritamod/modules/genutil"
"github.com/bianjieai/iritamod/modules/node"
Expand Down
16 changes: 7 additions & 9 deletions cmd/irita/cmd/genvalidators.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ import (
"encoding/json"
"fmt"

"github.com/pkg/errors"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"

cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto/tmhash"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/pkg/errors"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto/tmhash"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/bianjieai/iritamod/modules/genutil"
"github.com/bianjieai/iritamod/modules/node"
Expand Down
32 changes: 12 additions & 20 deletions cmd/irita/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@ import (
"os"
"path/filepath"

evmutils "github.com/bianjieai/irita/modules/evm/utils"

ethermintclient "github.com/tharsis/ethermint/client"
ethermint "github.com/tharsis/ethermint/types"

"github.com/pkg/errors"

"github.com/spf13/cast"
"github.com/spf13/cobra"

tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand All @@ -35,18 +21,24 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"

genutilcli "github.com/bianjieai/iritamod/modules/genutil/client/cli"
"github.com/bianjieai/iritamod/modules/node"

"github.com/bianjieai/irita/app"

"github.com/pkg/errors"
"github.com/spf13/cast"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
ethermintclient "github.com/tharsis/ethermint/client"
"github.com/tharsis/ethermint/crypto/hd"
"github.com/tharsis/ethermint/encoding"
servercfg "github.com/tharsis/ethermint/server/config"
ethermint "github.com/tharsis/ethermint/types"

"github.com/bianjieai/irita/app"
evmclient "github.com/bianjieai/irita/modules/evm/client"
evmserver "github.com/bianjieai/irita/modules/evm/server"
evmutils "github.com/bianjieai/irita/modules/evm/utils"
genutilcli "github.com/bianjieai/iritamod/modules/genutil/client/cli"
"github.com/bianjieai/iritamod/modules/node"
)

// NewRootCmd creates a new root command for simd. It is called once in the main function.
Expand Down
12 changes: 5 additions & 7 deletions cmd/irita/cmd/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"sync"
"time"

"github.com/bianjieai/irita/app"

"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/iavl"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/consensus"
tmcli "github.com/tendermint/tendermint/libs/cli"
tmmath "github.com/tendermint/tendermint/libs/math"
Expand All @@ -21,11 +23,7 @@ import (
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/iavl"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/bianjieai/irita/app"
)

const (
Expand Down
Loading

0 comments on commit 7984502

Please sign in to comment.