fix linters #33

Closed
anilCSE wants to merge 3 commits from anil/lint into anil/update-readme
49 changed files with 116 additions and 116 deletions

View File

@ -13,18 +13,64 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.0.1 - uses: technote-space/get-diff-action@v6.1.0
with: with:
SUFFIX_FILTER: | PATTERNS: |
.go **/**.go
.mod go.mod
.sum go.sum
- uses: golangci/golangci-lint-action@v2.5.2 - uses: golangci/golangci-lint-action@v3
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.48.0
version: v1.42.1
args: --timeout 10m args: --timeout 10m
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
# Check only if there are differences in the source code # Check only if there are differences in the source code
if: "env.GIT_DIFF" if: "env.GIT_DIFF"
markdown-lint:
name: Run markdown-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
docs/**/*.md
x/**/*.md
README.md
- uses: articulate/actions-markdownlint@v1.1.0
# Check only if there are differences in the source code
if: env.GIT_DIFF
python-lint:
name: Run flake8 on python integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
with:
name: ethermint
- uses: technote-space/get-diff-action@v6.1.0
with:
PATTERNS: |
**/**.py
- run: |
nix-shell -I nixpkgs=./nix -p test-env --run "make lint-py"
if: env.GIT_DIFF
gomod2nix:
name: Check gomod2nix.toml file is up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
with:
name: ethermint
- name: run gomod2nix
run: |
nix run -f ./nix gomod2nix
git diff --no-ext-diff --exit-code

View File

@ -13,38 +13,30 @@ linters:
- errcheck - errcheck
- goconst - goconst
- gocritic - gocritic
- gofmt - gofumpt
- goimports
- revive - revive
- gosec - gosec
- gosimple - gosimple
- govet - govet
- ineffassign - ineffassign
# - lll TODO: enable - lll
- misspell - misspell
- nakedret - nakedret
- prealloc - prealloc
- exportloopref - exportloopref
- staticcheck - staticcheck
- structcheck
- stylecheck - stylecheck
# - typecheck #TODO: enable - typecheck
- unconvert - unconvert
- unparam - unparam
- unused - unused
- varcheck - varcheck
- nolintlint - nolintlint
- asciicheck - asciicheck
# - exhaustive
- exportloopref - exportloopref
- gofumpt - gofumpt
- gomodguard - gomodguard
# - nestif - whitespace
# - nlreturn
- noctx
- rowserrcheck
# - whitespace
# - wsl
issues: issues:
exclude-rules: exclude-rules:
@ -57,6 +49,8 @@ issues:
max-same-issues: 50 max-same-issues: 50
linters-settings: linters-settings:
lll:
line-length: 150
dogsled: dogsled:
max-blank-identifiers: 3 max-blank-identifiers: 3
golint: golint:
@ -71,7 +65,7 @@ linters-settings:
require-explanation: false require-explanation: false
require-specific: false require-specific: false
gofumpt: gofumpt:
lang-version: "1.17" lang-version: "1.18"
gomodguard: gomodguard:
blocked: blocked:
versions: # List of blocked module version constraints versions: # List of blocked module version constraints
@ -80,4 +74,4 @@ linters-settings:
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional) reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint - https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional) reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)

View File

@ -126,7 +126,6 @@ func (avd EthAccountVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx
if err := evmkeeper.CheckSenderBalance(sdk.NewIntFromBigInt(acct.Balance), txData); err != nil { if err := evmkeeper.CheckSenderBalance(sdk.NewIntFromBigInt(acct.Balance), txData); err != nil {
return ctx, sdkerrors.Wrap(err, "failed to check sender balance") return ctx, sdkerrors.Wrap(err, "failed to check sender balance")
} }
} }
return next(ctx, tx, simulate) return next(ctx, tx, simulate)
} }

View File

@ -156,8 +156,10 @@ var (
mint.AppModuleBasic{}, mint.AppModuleBasic{},
distr.AppModuleBasic{}, distr.AppModuleBasic{},
gov.NewAppModuleBasic( gov.NewAppModuleBasic(
[]govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, []govclient.ProposalHandler{
ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler}, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler,
},
), ),
params.AppModuleBasic{}, params.AppModuleBasic{},
crisis.AppModuleBasic{}, crisis.AppModuleBasic{},
@ -491,7 +493,6 @@ func NewEthermintApp(
transferModule := transfer.NewAppModule(app.TransferKeeper) transferModule := transfer.NewAppModule(app.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)
//Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter() ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
app.IBCKeeper.SetRouter(ibcRouter) app.IBCKeeper.SetRouter(ibcRouter)

View File

@ -121,7 +121,6 @@ func NewTestAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOpti
// Setup initializes a new EthermintApp. A Nop logger is set in EthermintApp. // Setup initializes a new EthermintApp. A Nop logger is set in EthermintApp.
func Setup(t *testing.T, isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) *EthermintApp { func Setup(t *testing.T, isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) *EthermintApp {
t.Helper() t.Helper()
privVal := mock.NewPV() privVal := mock.NewPV()
@ -202,7 +201,8 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, patchGen
} }
func genesisStateWithValSet(t *testing.T, app *EthermintApp, genesisState simapp.GenesisState, func genesisStateWithValSet(t *testing.T, app *EthermintApp, genesisState simapp.GenesisState,
valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) simapp.GenesisState { valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance,
) simapp.GenesisState {
// set genesis accounts // set genesis accounts
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
@ -232,7 +232,6 @@ func genesisStateWithValSet(t *testing.T, app *EthermintApp, genesisState simapp
} }
validators = append(validators, validator) validators = append(validators, validator)
delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
} }
// set validators and delegations // set validators and delegations
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)

View File

@ -40,7 +40,7 @@ func SetBech32Prefixes(config *sdk.Config) {
func SetBip44CoinType(config *sdk.Config) { func SetBip44CoinType(config *sdk.Config) {
config.SetCoinType(ethermint.Bip44CoinType) config.SetCoinType(ethermint.Bip44CoinType)
config.SetPurpose(sdk.Purpose) // Shared config.SetPurpose(sdk.Purpose) // Shared
config.SetFullFundraiserPath(ethermint.BIP44HDPath) // nolint: staticcheck config.SetFullFundraiserPath(ethermint.BIP44HDPath) //nolint: staticcheck
} }
// RegisterDenoms registers the base and display denominations to the SDK. // RegisterDenoms registers the base and display denominations to the SDK.

View File

@ -309,7 +309,6 @@ func traverseFields(
} }
if fieldType.Kind() == reflect.Struct { if fieldType.Kind() == reflect.Struct {
var fieldTypedef string var fieldTypedef string
if isCollection { if isCollection {

View File

@ -125,7 +125,6 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
All: (all != nil && *all), All: (all != nil && *all),
}, },
) )
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -142,7 +141,6 @@ func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueI
} }
return gqlResponse, nil return gqlResponse, nil
} }
func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) { func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) {

View File

@ -2,12 +2,13 @@ package gql
import ( import (
"fmt" "fmt"
"net/http"
"github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/playground" "github.com/99designs/gqlgen/graphql/playground"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/spf13/viper" "github.com/spf13/viper"
"net/http"
) )
// Server configures and starts the GQL server. // Server configures and starts the GQL server.

View File

@ -38,6 +38,7 @@ func getGQLCoins(coins sdk.Coins) []*Coin {
return gqlCoins return gqlCoins
} }
func GetGQLNameAuthorityRecord(record *nstypes.NameAuthority) (*AuthorityRecord, error) { func GetGQLNameAuthorityRecord(record *nstypes.NameAuthority) (*AuthorityRecord, error) {
if record == nil { if record == nil {
return nil, nil return nil, nil

View File

@ -55,7 +55,6 @@ func (e *EVMBackend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Tran
if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 { if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {
return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas) return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
} }
} else { } else {
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil { if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil {
return args, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet") return args, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")

View File

@ -284,7 +284,7 @@ func (a *API) BlockProfile(file string, nsec uint) error {
// CpuProfile turns on CPU profiling for nsec seconds and writes // CpuProfile turns on CPU profiling for nsec seconds and writes
// profile data to file. // profile data to file.
func (a *API) CpuProfile(file string, nsec uint) error { // nolint: golint, stylecheck, revive func (a *API) CpuProfile(file string, nsec uint) error { //nolint: golint, stylecheck, revive
a.logger.Debug("debug_cpuProfile", "file", file, "nsec", nsec) a.logger.Debug("debug_cpuProfile", "file", file, "nsec", nsec)
if err := a.StartCPUProfile(file); err != nil { if err := a.StartCPUProfile(file); err != nil {
return err return err

View File

@ -127,7 +127,7 @@ func (e *PublicAPI) ProtocolVersion() hexutil.Uint {
} }
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (e *PublicAPI) ChainId() (*hexutil.Big, error) { // nolint func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint
e.logger.Debug("eth_chainId") e.logger.Debug("eth_chainId")
// if current block is at or past the EIP-155 replay-protection fork block, return chainID from config // if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
bn, err := e.backend.BlockNumber() bn, err := e.backend.BlockNumber()

View File

@ -45,7 +45,7 @@ func NewRangeFilter(logger log.Logger, backend Backend, begin, end int64, addres
// Flatten the address and topic filter clauses into a single bloombits filter // Flatten the address and topic filter clauses into a single bloombits filter
// system. Since the bloombits are not positional, nil topics are permitted, // system. Since the bloombits are not positional, nil topics are permitted,
// which get flattened into a nil byte slice. // which get flattened into a nil byte slice.
var filtersBz [][][]byte // nolint: prealloc var filtersBz [][][]byte //nolint: prealloc
if len(addresses) > 0 { if len(addresses) > 0 {
filter := make([][]byte, len(addresses)) filter := make([][]byte, len(addresses))
for i, address := range addresses { for i, address := range addresses {

View File

@ -82,7 +82,6 @@ func MountGRPCWebServices(
logger tmlog.Logger, logger tmlog.Logger,
) { ) {
for _, res := range grpcResources { for _, res := range grpcResources {
logger.Info("[GRPC Web] HTTP POST mounted", "resource", res) logger.Info("[GRPC Web] HTTP POST mounted", "resource", res)
s := router.Methods("POST").Subrouter() s := router.Methods("POST").Subrouter()

View File

@ -431,7 +431,6 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
stakingtypes.NewCommissionRates(commission, sdk.OneDec(), sdk.OneDec()), stakingtypes.NewCommissionRates(commission, sdk.OneDec(), sdk.OneDec()),
sdk.OneInt(), sdk.OneInt(),
) )
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -253,12 +253,12 @@ func WriteFile(name string, dir string, contents []byte) error {
writePath := filepath.Join(dir) writePath := filepath.Join(dir)
file := filepath.Join(writePath, name) file := filepath.Join(writePath, name)
err := tmos.EnsureDir(writePath, 0755) err := tmos.EnsureDir(writePath, 0o755)
if err != nil { if err != nil {
return err return err
} }
err = ioutil.WriteFile(file, contents, 0644) // nolint: gosec err = ioutil.WriteFile(file, contents, 0o644) //nolint: gosec
if err != nil { if err != nil {
return err return err
} }

View File

@ -36,7 +36,6 @@ func GenerateHash(json map[string]interface{}) (string, []byte, error) {
return "", nil, err return "", nil, err
} }
//cid, err := CIDFromJSONBytes(content)
cidString, err := CIDFromJSONBytesUsingIpldPrime(content) cidString, err := CIDFromJSONBytesUsingIpldPrime(content)
if err != nil { if err != nil {
return "", nil, err return "", nil, err

View File

@ -16,7 +16,7 @@ func GenerateMnemonic() (string, error) {
return "", err return "", err
} }
mnemonic, err := bip39.NewMnemonic(entropySeed[:]) mnemonic, err := bip39.NewMnemonic(entropySeed)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -134,7 +134,7 @@ func GetCmdCommitBid() *cobra.Command {
} }
// Save reveal file. // Save reveal file.
ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0600) ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600)
msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress()) msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress())
err = msg.ValidateBasic() err = msg.ValidateBasic()

View File

@ -382,7 +382,7 @@ func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Bid,
return &bid, nil return &bid, nil
} }
// RevealBid reeals a bid comitted earlier. // RevealBid reeals a bid committed earlier.
func (k Keeper) RevealBid(ctx sdk.Context, msg types.MsgRevealBid) (*types.Auction, error) { func (k Keeper) RevealBid(ctx sdk.Context, msg types.MsgRevealBid) (*types.Auction, error) {
if !k.HasAuction(ctx, msg.AuctionId) { if !k.HasAuction(ctx, msg.AuctionId) {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.")
@ -561,7 +561,6 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) {
ctx.Logger().Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String())) ctx.Logger().Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String()))
ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String()))
} else if secondHighestBid == nil || secondHighestBid.BidAmount.IsLT(bid.BidAmount) { } else if secondHighestBid == nil || secondHighestBid.BidAmount.IsLT(bid.BidAmount) {
ctx.Logger().Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) ctx.Logger().Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String()))
@ -588,7 +587,6 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) {
ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress)) ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress))
ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String())) ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String()))
ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String())) ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String()))
} else { } else {
ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id))
} }

View File

@ -79,7 +79,6 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types
return &types.MsgCommitBidResponse{Bid: resp}, nil return &types.MsgCommitBidResponse{Bid: resp}, nil
} }
//RevealBid is the command for revealing a bid
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) { func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)

View File

@ -56,7 +56,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc
if err != nil { if err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
} }
// Once json successfully marshalled, passes along to genesis.go // Once json successfully marshaled, passes along to genesis.go
return ValidateGenesis(data) return ValidateGenesis(data)
} }

View File

@ -63,7 +63,6 @@ func (msg MsgCreateAuction) GetSigners() []sdk.AccAddress {
// NewMsgCommitBid is the constructor function for MsgCommitBid. // NewMsgCommitBid is the constructor function for MsgCommitBid.
func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid { func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid {
return MsgCommitBid{ return MsgCommitBid{
AuctionId: auctionID, AuctionId: auctionID,
CommitHash: commitHash, CommitHash: commitHash,
@ -107,7 +106,6 @@ func (msg MsgCommitBid) GetSigners() []sdk.AccAddress {
// NewMsgRevealBid is the constructor function for MsgRevealBid. // NewMsgRevealBid is the constructor function for MsgRevealBid.
func NewMsgRevealBid(auctionID string, reveal string, signer sdk.AccAddress) MsgRevealBid { func NewMsgRevealBid(auctionID string, reveal string, signer sdk.AccAddress) MsgRevealBid {
return MsgRevealBid{ return MsgRevealBid{
AuctionId: auctionID, AuctionId: auctionID,
Reveal: reveal, Reveal: reveal,

View File

@ -104,7 +104,7 @@ func WithdrawBondCmd() *cobra.Command {
return cmd return cmd
} }
// CancelBondCmd is the CLI command for cancelling a bond. // CancelBondCmd is the CLI command for canceling a bond.
func CancelBondCmd() *cobra.Command { func CancelBondCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "cancel [bond Id]", Use: "cancel [bond Id]",

View File

@ -28,7 +28,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() {
true, true,
"", "",
func() { func() {
}, },
}, },
{ {
@ -87,7 +86,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() {
fmt.Sprintf(reqUrl, "asdasd"), fmt.Sprintf(reqUrl, "asdasd"),
true, true,
func() { func() {
}, },
}, },
{ {

View File

@ -251,7 +251,6 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
}, },
true, true,
func() { func() {
}, },
}, },
{ {

View File

@ -10,8 +10,8 @@ import (
// InitGenesis initializes genesis state based on exported genesis // InitGenesis initializes genesis state based on exported genesis
func InitGenesis( func InitGenesis(
ctx sdk.Context, ctx sdk.Context,
k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { k keeper.Keeper, data types.GenesisState,
) []abci.ValidatorUpdate {
k.SetParams(ctx, data.Params) k.SetParams(ctx, data.Params)
for _, bond := range data.Bonds { for _, bond := range data.Bonds {

View File

@ -2,6 +2,7 @@ package keeper
import ( import (
"fmt" "fmt"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/bond/types" "github.com/tharsis/ethermint/x/bond/types"
) )

View File

@ -2,6 +2,7 @@ package keeper
import ( import (
"context" "context"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/bond/types" "github.com/tharsis/ethermint/x/bond/types"
) )

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types"

View File

@ -3,6 +3,7 @@ package types
import ( import (
"errors" "errors"
"fmt" "fmt"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
) )

View File

@ -89,7 +89,7 @@ func (log *Log) ToEthereum() *ethtypes.Log {
} }
func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log { func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log {
var logs []*Log // nolint: prealloc var logs []*Log //nolint: prealloc
for _, ethlog := range ethlogs { for _, ethlog := range ethlogs {
logs = append(logs, NewLogFromEth(ethlog)) logs = append(logs, NewLogFromEth(ethlog))
} }
@ -99,7 +99,7 @@ func NewLogsFromEth(ethlogs []*ethtypes.Log) []*Log {
// LogsToEthereum casts the Ethermint Logs to a slice of Ethereum Logs. // LogsToEthereum casts the Ethermint Logs to a slice of Ethereum Logs.
func LogsToEthereum(logs []*Log) []*ethtypes.Log { func LogsToEthereum(logs []*Log) []*ethtypes.Log {
var ethLogs []*ethtypes.Log // nolint: prealloc var ethLogs []*ethtypes.Log //nolint: prealloc
for i := range logs { for i := range logs {
ethLogs = append(ethLogs, logs[i].ToEthereum()) ethLogs = append(ethLogs, logs[i].ToEthereum())
} }

View File

@ -15,7 +15,7 @@ const (
// prefix bytes for the feemarket persistent store // prefix bytes for the feemarket persistent store
const ( const (
prefixBlockGasUsed = iota + 1 prefixBlockGasUsed = iota + 1
deprecatedPrefixBaseFee // nolint deprecatedPrefixBaseFee //nolint
) )
// KVStore key prefixes // KVStore key prefixes

View File

@ -266,7 +266,6 @@ $ %s query %s query-by-bond [bond id]
return err return err
} }
return clientCtx.PrintProto(res) return clientCtx.PrintProto(res)
}, },
} }
flags.AddQueryFlagsToCmd(cmd) flags.AddQueryFlagsToCmd(cmd)

View File

@ -371,7 +371,6 @@ $ %s tx %s delete-name [crn]
return cmd return cmd
} }
//GetPayloadFromFile Load payload object from YAML file.
func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { func GetPayloadFromFile(filePath string) (*types.PayloadType, error) {
var payload types.PayloadType var payload types.PayloadType

View File

@ -64,7 +64,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/whois/%s" reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/whois/%s"
var authorityName = "QueryWhoIS" authorityName := "QueryWhoIS"
testCases := []struct { testCases := []struct {
name string name string
url string url string
@ -78,7 +78,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
true, true,
"", "",
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -132,7 +131,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s" reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s"
var authorityName = "QueryLookUp" authorityName := "QueryLookUp"
testCases := []struct { testCases := []struct {
name string name string
@ -147,7 +146,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
true, true,
"", "",
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -199,7 +197,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
true, true,
"", "",
func(bondId string) { func(bondId string) {
}, },
}, },
{ {
@ -271,7 +268,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
true, true,
"", "",
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -307,7 +303,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
if !tc.expectErr { if !tc.expectErr {
tc.preRun("QueryAuthorityExpiryQueue") tc.preRun("QueryAuthorityExpiryQueue")
} }
// wait 12 seconds to name authorites expires // wait 12 seconds to name authorities expires
time.Sleep(time.Second * 12) time.Sleep(time.Second * 12)
resp, _ := rest.GetRequest(tc.url) resp, _ := rest.GetRequest(tc.url)
@ -343,7 +339,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
true, true,
"", "",
func(bondId string) { func(bondId string) {
}, },
}, },
{ {
@ -483,7 +478,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() {
true, true,
"", "",
func(bondId string) { func(bondId string) {
}, },
}, },
{ {
@ -538,7 +532,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() {
true, true,
"", "",
func(bondId string) { func(bondId string) {
}, },
}, },
{ {
@ -590,7 +583,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() {
true, true,
"", "",
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {

View File

@ -66,7 +66,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() {
true, true,
0, 0,
func() { func() {
}, },
}, },
{ {
@ -235,7 +234,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() {
func (s *IntegrationTestSuite) TestGetCmdWhoIs() { func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "test2" authorityName := "test2"
testCases := []struct { testCases := []struct {
name string name string
args []string args []string
@ -249,7 +248,6 @@ func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
true, true,
1, 1,
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -306,7 +304,7 @@ func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
func (s *IntegrationTestSuite) TestGetCmdLookupCRN() { func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "test1" authorityName := "test1"
testCases := []struct { testCases := []struct {
name string name string
args []string args []string
@ -320,7 +318,6 @@ func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
true, true,
0, 0,
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -400,7 +397,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
func (s *IntegrationTestSuite) GetRecordExpiryQueue() { func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "GetRecordExpiryQueue" authorityName := "GetRecordExpiryQueue"
testCasesForRecordsExpiry := []struct { testCasesForRecordsExpiry := []struct {
name string name string
@ -415,7 +412,6 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
true, true,
0, 0,
func(authorityName string, s *IntegrationTestSuite) { func(authorityName string, s *IntegrationTestSuite) {
}, },
}, },
{ {
@ -451,10 +447,11 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
}) })
} }
} }
func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() { func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "TestGetAuthorityExpiryQueue" authorityName := "TestGetAuthorityExpiryQueue"
testCases := []struct { testCases := []struct {
name string name string
@ -467,7 +464,6 @@ func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() {
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
true, true,
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {

View File

@ -42,7 +42,7 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
func (s *IntegrationTestSuite) SetupSuite() { func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite") s.T().Log("setting up integration test suite")
var genesisState = s.cfg.GenesisState genesisState := s.cfg.GenesisState
var nsData nstypes.GenesisState var nsData nstypes.GenesisState
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData)) s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData))
@ -222,7 +222,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
func (s *IntegrationTestSuite) TestGetCmdReserveName() { func (s *IntegrationTestSuite) TestGetCmdReserveName() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "testtest" authorityName := "testtest"
testCases := []struct { testCases := []struct {
name string name string
args []string args []string
@ -289,7 +289,7 @@ func (s *IntegrationTestSuite) TestGetCmdReserveName() {
func (s *IntegrationTestSuite) TestGetCmdSetName() { func (s *IntegrationTestSuite) TestGetCmdSetName() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "TestGetCmdSetName" authorityName := "TestGetCmdSetName"
testCases := []struct { testCases := []struct {
name string name string
args []string args []string
@ -307,7 +307,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
}, },
true, true,
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -394,7 +393,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() { func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "TestGetCmdSetAuthorityBond" authorityName := "TestGetCmdSetAuthorityBond"
testCases := []struct { testCases := []struct {
name string name string
@ -413,7 +412,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
}, },
true, true,
func(authorityName string) { func(authorityName string) {
}, },
}, },
{ {
@ -480,7 +478,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
func (s *IntegrationTestSuite) TestGetCmdDeleteName() { func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "TestGetCmdDeleteName" authorityName := "TestGetCmdDeleteName"
testCasesForDeletingName := []struct { testCasesForDeletingName := []struct {
name string name string
args []string args []string
@ -498,7 +496,6 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
}, },
true, true,
func(authorityName string, s *IntegrationTestSuite) { func(authorityName string, s *IntegrationTestSuite) {
}, },
}, },
{ {
@ -564,7 +561,6 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
return "" return ""
}, },
func(recordId string, s *IntegrationTestSuite) { func(recordId string, s *IntegrationTestSuite) {
}, },
}, },
{ {
@ -659,7 +655,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
} }
// //
//func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() { // func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() {
// val := s.network.Validators[0] // val := s.network.Validators[0]
// sr := s.Require() // sr := s.Require()
// testCasesForDeletingName := []struct { // testCasesForDeletingName := []struct {
@ -807,7 +803,6 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
return "", "" return "", ""
}, },
func(recordId, bondId string, s *IntegrationTestSuite) { func(recordId, bondId string, s *IntegrationTestSuite) {
}, },
}, },
{ {

View File

@ -17,7 +17,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
// Add to record expiry queue if expiry time is in the future. // Add to record expiry queue if expiry time is in the future.
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -33,7 +32,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
} }
for _, authority := range data.Authorities { for _, authority := range data.Authorities {
//Only import authorities that are marked active.
if authority.Entry.Status == types.AuthorityActive { if authority.Entry.Status == types.AuthorityActive {
keeper.SetNameAuthority(ctx, authority.Name, authority.Entry) keeper.SetNameAuthority(ctx, authority.Name, authority.Entry)

View File

@ -7,11 +7,10 @@ import (
"encoding/gob" "encoding/gob"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"sort"
set "github.com/deckarep/golang-set" set "github.com/deckarep/golang-set"
wnsUtils "github.com/tharsis/ethermint/utils" wnsUtils "github.com/tharsis/ethermint/utils"
"sort"
) )
func StringToBytes(val string) []byte { func StringToBytes(val string) []byte {
@ -62,7 +61,6 @@ func MarshalMapToJSONBytes(val map[string]interface{}) (bytes []byte) {
func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{} { func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{} {
var val map[string]interface{} var val map[string]interface{}
err := json.Unmarshal(bytes, &val) err := json.Unmarshal(bytes, &val)
if err != nil { if err != nil {
panic("Marshal error.") panic("Marshal error.")
} }

View File

@ -15,8 +15,8 @@ func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
// (2) associated bond exists, if bondID is not null. // (2) associated bond exists, if bondID is not null.
func RecordInvariants(k Keeper) sdk.Invariant { func RecordInvariants(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) { return func(ctx sdk.Context) (string, bool) {
//store := ctx.KVStore(k.storeKey) // store := ctx.KVStore(k.storeKey)
//itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) // itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex)
//defer itr.Close() //defer itr.Close()
//for ; itr.Valid(); itr.Next() { //for ; itr.Valid(); itr.Next() {
// bz := store.Get(itr.Key()) // bz := store.Get(itr.Key())

View File

@ -73,7 +73,8 @@ type Keeper struct {
// NewKeeper creates new instances of the nameservice Keeper // NewKeeper creates new instances of the nameservice Keeper
func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, recordKeeper RecordKeeper, func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, recordKeeper RecordKeeper,
bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace) Keeper { bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace,
) Keeper {
// set KeyTable if it has not already been set // set KeyTable if it has not already been set
if !ps.HasKeyTable() { if !ps.HasKeyTable() {
ps = ps.WithKeyTable(types.ParamKeyTable()) ps = ps.WithKeyTable(types.ParamKeyTable())
@ -295,7 +296,6 @@ func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Ti
// InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue. // InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue.
func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) { func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime) expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -308,7 +308,6 @@ func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
// DeleteRecordExpiryQueue deletes a record CID from the record expiry queue. // DeleteRecordExpiryQueue deletes a record CID from the record expiry queue.
func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) { func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) {
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -344,7 +343,6 @@ func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expir
for ; itr.Valid(); itr.Next() { for ; itr.Valid(); itr.Next() {
timeslice, err := helpers.BytesArrToStringArr(itr.Value()) timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -426,7 +424,6 @@ func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.
if store.Has(reverseNameIndexKey) { if store.Has(reverseNameIndexKey) {
names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey)) names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -653,7 +653,6 @@ func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (e
for ; itr.Valid(); itr.Next() { for ; itr.Valid(); itr.Next() {
timeslice := []string{} timeslice := []string{}
timeslice, err := helpers.BytesArrToStringArr(itr.Value()) timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -162,7 +162,6 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
// Check if renewal is required (i.e. expired record marked as deleted). // Check if renewal is required (i.e. expired record marked as deleted).
record := k.GetRecord(ctx, msg.RecordId) record := k.GetRecord(ctx, msg.RecordId)
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -182,7 +181,6 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
// ProcessAssociateBond associates a record with a bond. // ProcessAssociateBond associates a record with a bond.
func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error { func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error {
if !k.HasRecord(ctx, msg.RecordId) { if !k.HasRecord(ctx, msg.RecordId) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.")
} }

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@ -105,7 +106,6 @@ func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier {
} }
func (am AppModule) RegisterServices(cfg module.Configurator) { func (am AppModule) RegisterServices(cfg module.Configurator) {
querier := keeper.Querier{Keeper: am.keeper} querier := keeper.Querier{Keeper: am.keeper}
types.RegisterQueryServer(cfg.QueryServer(), querier) types.RegisterQueryServer(cfg.QueryServer(), querier)

View File

@ -31,7 +31,6 @@ func (msg MsgSetName) Type() string { return "set-name" }
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgSetName) ValidateBasic() error { func (msg MsgSetName) ValidateBasic() error {
if msg.Crn == "" { if msg.Crn == "" {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CRN is required.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CRN is required.")
} }
@ -76,7 +75,6 @@ func (msg MsgReserveAuthority) Type() string { return "reserve-authority" }
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgReserveAuthority) ValidateBasic() error { func (msg MsgReserveAuthority) ValidateBasic() error {
if len(msg.Name) == 0 { if len(msg.Name) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "name is required.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "name is required.")
} }

View File

@ -3,9 +3,10 @@ package types
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"time"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"time"
) )
// Default parameter values. // Default parameter values.
@ -75,8 +76,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
func NewParams(recordRent sdk.Coin, recordRentDuration time.Duration, func NewParams(recordRent sdk.Coin, recordRentDuration time.Duration,
authorityRent sdk.Coin, authorityRentDuration time.Duration, authorityGracePeriod time.Duration, authorityRent sdk.Coin, authorityRentDuration time.Duration, authorityGracePeriod time.Duration,
authorityAuctionEnabled bool, commitsDuration time.Duration, revealsDuration time.Duration, authorityAuctionEnabled bool, commitsDuration time.Duration, revealsDuration time.Duration,
commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params { commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin,
) Params {
return Params{ return Params{
RecordRent: recordRent, RecordRent: recordRent,
RecordRentDuration: recordRentDuration, RecordRentDuration: recordRentDuration,

View File

@ -22,7 +22,7 @@ type PayloadType struct {
// ToPayload converts PayloadType to Payload object. // ToPayload converts PayloadType to Payload object.
// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4. // Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.
func (payloadObj *PayloadType) ToPayload() Payload { func (payloadObj *PayloadType) ToPayload() Payload {
var payload = Payload{ payload := Payload{
Record: &Record{ Record: &Record{
Deleted: false, Deleted: false,
Owners: nil, Owners: nil,