fix linters #33

Closed
anilCSE wants to merge 3 commits from anil/lint into anil/update-readme
48 changed files with 62 additions and 108 deletions
Showing only changes of commit 05a3eec1d6 - Show all commits

View File

@ -13,38 +13,30 @@ linters:
- errcheck
- goconst
- gocritic
- gofmt
- goimports
- gofumpt
- revive
- gosec
- gosimple
- govet
- ineffassign
# - lll TODO: enable
- lll
- misspell
- nakedret
- prealloc
- exportloopref
- staticcheck
- structcheck
- stylecheck
# - typecheck #TODO: enable
- typecheck
- unconvert
- unparam
- unused
- varcheck
- nolintlint
- asciicheck
# - exhaustive
- exportloopref
- gofumpt
- gomodguard
# - nestif
# - nlreturn
- noctx
- rowserrcheck
# - whitespace
# - wsl
- whitespace
issues:
exclude-rules:
@ -57,6 +49,8 @@ issues:
max-same-issues: 50
linters-settings:
lll:
line-length: 150
dogsled:
max-blank-identifiers: 3
golint:
@ -71,7 +65,7 @@ linters-settings:
require-explanation: false
require-specific: false
gofumpt:
lang-version: "1.17"
lang-version: "1.18"
gomodguard:
blocked:
versions: # List of blocked module version constraints

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 {
return ctx, sdkerrors.Wrap(err, "failed to check sender balance")
}
}
return next(ctx, tx, simulate)
}

View File

@ -156,8 +156,10 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler},
[]govclient.ProposalHandler{
paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler,
},
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
@ -491,7 +493,6 @@ func NewEthermintApp(
transferModule := transfer.NewAppModule(app.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)
//Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
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.
func Setup(t *testing.T, isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) *EthermintApp {
t.Helper()
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,
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
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)
@ -232,7 +232,6 @@ func genesisStateWithValSet(t *testing.T, app *EthermintApp, genesisState simapp
}
validators = append(validators, validator)
delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
}
// set validators and delegations
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)

View File

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

View File

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

View File

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

View File

@ -38,6 +38,7 @@ func getGQLCoins(coins sdk.Coins) []*Coin {
return gqlCoins
}
func GetGQLNameAuthorityRecord(record *nstypes.NameAuthority) (*AuthorityRecord, error) {
if record == 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 {
return args, fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
}
} else {
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil {
return args, errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")

View File

@ -82,7 +82,6 @@ func MountGRPCWebServices(
logger tmlog.Logger,
) {
for _, res := range grpcResources {
logger.Info("[GRPC Web] HTTP POST mounted", "resource", res)
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()),
sdk.OneInt(),
)
if err != nil {
return nil, err
}

View File

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

View File

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

View File

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

View File

@ -134,7 +134,7 @@ func GetCmdCommitBid() *cobra.Command {
}
// 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())
err = msg.ValidateBasic()

View File

@ -382,7 +382,7 @@ func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Bid,
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) {
if !k.HasAuction(ctx, msg.AuctionId) {
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 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String()))
} 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()))
@ -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 bid %s.", auction.Id, auction.WinningBid.String()))
ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String()))
} else {
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
}
//RevealBid is the command for revealing a bid
func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) {
ctx := sdk.UnwrapSDKContext(c)

View File

@ -56,7 +56,7 @@ func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc
if err != nil {
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)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
var genesisState = s.cfg.GenesisState
genesisState := s.cfg.GenesisState
var nsData nstypes.GenesisState
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData))
@ -222,7 +222,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
func (s *IntegrationTestSuite) TestGetCmdReserveName() {
val := s.network.Validators[0]
sr := s.Require()
var authorityName = "testtest"
authorityName := "testtest"
testCases := []struct {
name string
args []string
@ -289,7 +289,7 @@ func (s *IntegrationTestSuite) TestGetCmdReserveName() {
func (s *IntegrationTestSuite) TestGetCmdSetName() {
val := s.network.Validators[0]
sr := s.Require()
var authorityName = "TestGetCmdSetName"
authorityName := "TestGetCmdSetName"
testCases := []struct {
name string
args []string
@ -307,7 +307,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
},
true,
func(authorityName string) {
},
},
{
@ -394,7 +393,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
val := s.network.Validators[0]
sr := s.Require()
var authorityName = "TestGetCmdSetAuthorityBond"
authorityName := "TestGetCmdSetAuthorityBond"
testCases := []struct {
name string
@ -413,7 +412,6 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
},
true,
func(authorityName string) {
},
},
{
@ -480,7 +478,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
val := s.network.Validators[0]
sr := s.Require()
var authorityName = "TestGetCmdDeleteName"
authorityName := "TestGetCmdDeleteName"
testCasesForDeletingName := []struct {
name string
args []string
@ -498,7 +496,6 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
},
true,
func(authorityName string, s *IntegrationTestSuite) {
},
},
{
@ -564,7 +561,6 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
return ""
},
func(recordId string, s *IntegrationTestSuite) {
},
},
{
@ -807,7 +803,6 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
return "", ""
},
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.
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
@ -33,7 +32,6 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
}
for _, authority := range data.Authorities {
//Only import authorities that are marked active.
if authority.Entry.Status == types.AuthorityActive {
keeper.SetNameAuthority(ctx, authority.Name, authority.Entry)

View File

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

View File

@ -73,7 +73,8 @@ type Keeper struct {
// NewKeeper creates new instances of the nameservice Keeper
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
if !ps.HasKeyTable() {
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.
func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime)
if err != nil {
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.
func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) {
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
@ -344,7 +343,6 @@ func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expir
for ; itr.Valid(); itr.Next() {
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil {
panic(err)
}
@ -426,7 +424,6 @@ func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.
if store.Has(reverseNameIndexKey) {
names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
if err != nil {
panic(err)
}

View File

@ -653,7 +653,6 @@ func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (e
for ; itr.Valid(); itr.Next() {
timeslice := []string{}
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil {
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).
record := k.GetRecord(ctx, msg.RecordId)
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
@ -182,7 +181,6 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
// ProcessAssociateBond associates a record with a bond.
func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error {
if !k.HasRecord(ctx, msg.RecordId) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.")
}

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
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) {
querier := keeper.Querier{Keeper: am.keeper}
types.RegisterQueryServer(cfg.QueryServer(), querier)

View File

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

View File

@ -3,9 +3,10 @@ package types
import (
"bytes"
"fmt"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"time"
)
// Default parameter values.
@ -75,8 +76,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
func NewParams(recordRent sdk.Coin, recordRentDuration time.Duration,
authorityRent sdk.Coin, authorityRentDuration time.Duration, authorityGracePeriod 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{
RecordRent: recordRent,
RecordRentDuration: recordRentDuration,

View File

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