From ec3e8f7ce3c584fa2ed1c768d1b75ddb3ec59c97 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 11:55:19 +0530 Subject: [PATCH 01/14] lint --- app/ante/handler_options.go | 10 +++++----- utils/json.go | 3 +-- utils/mnemonic.go | 2 +- utils/types.go | 9 ++++++--- x/evm/keeper/state_transition.go | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 2a3cf544..5a1b6039 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -31,19 +31,19 @@ type HandlerOptions struct { } func (options HandlerOptions) validate() error { - if options.AccountKeeper == nil { + if options.AccountKeeper == evmtypes.AccountKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") } - if options.BankKeeper == nil { + if options.BankKeeper == evmtypes.BankKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") } - if options.SignModeHandler == nil { + if options.SignModeHandler == authsigning.SignModeHandler(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") } - if options.FeeMarketKeeper == nil { + if options.FeeMarketKeeper == evmtypes.FeeMarketKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "fee market keeper is required for AnteHandler") } - if options.EvmKeeper == nil { + if options.EvmKeeper == EVMKeeper(nil) { return sdkerrors.Wrap(sdkerrors.ErrLogic, "evm keeper is required for AnteHandler") } return nil diff --git a/utils/json.go b/utils/json.go index a1062e73..f43bd75c 100644 --- a/utils/json.go +++ b/utils/json.go @@ -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 @@ -81,7 +80,7 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) { // This gathers together any parameters that might be needed when making a link. // (For CIDs, the version, the codec, and the multihash type are all parameters we'll need.) // Often, you can probably make this a constant for your whole application. - lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ + lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ //nolint:golint Version: 1, // Usually '1'. Codec: 0x71, // 0x71 means "dag-cbor" -- See the multicodecs table: https://github.com/multiformats/multicodec/ MhType: 0x12, // 0x12 means "sha2-256" -- See the multicodecs table: https://github.com/multiformats/multicodec/ diff --git a/utils/mnemonic.go b/utils/mnemonic.go index 80dce1ac..4cb6591f 100644 --- a/utils/mnemonic.go +++ b/utils/mnemonic.go @@ -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 } diff --git a/utils/types.go b/utils/types.go index 51e42acd..aaa03b78 100644 --- a/utils/types.go +++ b/utils/types.go @@ -12,10 +12,13 @@ import ( set "github.com/deckarep/golang-set" ) -func Int64ToBytes(num int64) []byte { +func Int64ToBytes(num int64) ([]byte, error) { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, num) - return buf.Bytes() + if err := binary.Write(buf, binary.BigEndian, num); err != nil { + return nil, err + } + + return buf.Bytes(), nil } func SetToSlice(set set.Set) []string { diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 635e4df2..39ab08e4 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -215,7 +215,7 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*t // snapshot to contain the tx processing and post processing in same scope var commit func() tmpCtx := ctx - if k.hooks != nil { + if k.hooks != types.EvmHooks(nil) { // Create a cache context to revert state when tx hooks fails, // the cache context is only committed when both tx and hooks executed successfully. // Didn't use `Snapshot` because the context stack has exponential complexity on certain operations, From a4f2cb5731730981b3a803ee50c3f63230b824f9 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 12:17:56 +0530 Subject: [PATCH 02/14] gofumpt and ignore duplicates --- app/ante/ante_test.go | 2 +- ethereum/eip712/preprocess_test.go | 8 ++++--- gql/resolver.go | 2 -- gql/util.go | 21 +--------------- tests/rpc/ws_test.go | 5 ++-- x/auction/client/cli/tx.go | 2 +- x/auction/keeper/grpc_query_test.go | 4 +--- x/auction/keeper/msg_server.go | 2 ++ x/auction/types/msgs.go | 2 -- x/bond/client/testutil/grpc.go | 2 -- x/bond/client/testutil/query.go | 1 - x/bond/client/testutil/tx.go | 2 ++ x/bond/genesis.go | 4 ++-- x/bond/keeper/grpc_query_test.go | 4 +--- x/bond/keeper/msg_server.go | 2 ++ x/bond/types/params.go | 1 + x/evm/types/access_list_tx_test.go | 2 +- x/evm/types/tx_args_test.go | 32 ++++++++++++------------- x/nameservice/client/cli/query.go | 1 - x/nameservice/client/cli/tx.go | 2 +- x/nameservice/client/testutil/grpc.go | 16 +++++-------- x/nameservice/client/testutil/query.go | 14 ++++------- x/nameservice/client/testutil/tx.go | 15 ++++-------- x/nameservice/genesis.go | 3 +-- x/nameservice/helpers/helpers.go | 4 +--- x/nameservice/keeper/grpc_query_test.go | 2 +- x/nameservice/keeper/keeper.go | 7 ++---- x/nameservice/keeper/keeper_test.go | 4 +--- x/nameservice/keeper/msg_server.go | 3 +++ x/nameservice/keeper/naming_keeper.go | 1 - x/nameservice/keeper/record_keeper.go | 8 +++---- x/nameservice/module.go | 1 - x/nameservice/types/msg.go | 2 -- x/nameservice/types/params.go | 7 +++--- x/nameservice/types/types.go | 2 +- 35 files changed, 74 insertions(+), 116 deletions(-) diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index d712dbc2..b8415fac 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -344,7 +344,7 @@ func (suite AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) gasAmount := sdk.NewCoins(coinAmount) gas := uint64(200000) - //reusing the gasAmount for deposit + // reusing the gasAmount for deposit deposit := sdk.NewCoins(coinAmount) txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "ethermint_9000-1", gas, gasAmount, deposit) return txBuilder.GetTx() diff --git a/ethereum/eip712/preprocess_test.go b/ethereum/eip712/preprocess_test.go index e8b2c4a6..06aa690b 100644 --- a/ethereum/eip712/preprocess_test.go +++ b/ethereum/eip712/preprocess_test.go @@ -23,9 +23,11 @@ import ( ) // Testing Constants -var chainId = "ethermint_9000-1" -var ctx = client.Context{}.WithTxConfig( - encoding.MakeConfig(app.ModuleBasics).TxConfig, +var ( + chainId = "ethermint_9000-1" + ctx = client.Context{}.WithTxConfig( + encoding.MakeConfig(app.ModuleBasics).TxConfig, + ) ) var feePayerAddress = "ethm17xpfvakm2amg962yls6f84z3kell8c5lthdzgl" diff --git a/gql/resolver.go b/gql/resolver.go index 1ea452aa..cf1facd8 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -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) { diff --git a/gql/util.go b/gql/util.go index 034d1696..7c620bbe 100644 --- a/gql/util.go +++ b/gql/util.go @@ -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 @@ -118,26 +119,6 @@ func getGQLBond(bondObj *bondtypes.Bond) (*Bond, error) { }, nil } -func matchBondOnAttributes(bondObj *bondtypes.Bond, attributes []*KeyValueInput) bool { - for _, attr := range attributes { - switch attr.Key { - case OwnerAttributeName: - { - if attr.Value.String == nil || bondObj.Owner != *attr.Value.String { - return false - } - } - default: - { - // Only attributes explicitly listed in the switch are queryable. - return false - } - } - } - - return true -} - func getAuctionBid(bid *auctiontypes.Bid) *AuctionBid { return &AuctionBid{ BidderAddress: bid.BidderAddress, diff --git a/tests/rpc/ws_test.go b/tests/rpc/ws_test.go index a13668e9..ea591808 100644 --- a/tests/rpc/ws_test.go +++ b/tests/rpc/ws_test.go @@ -3,13 +3,14 @@ package rpc import ( "encoding/json" "fmt" - "github.com/gorilla/websocket" - "github.com/stretchr/testify/require" "net/url" "os" "strings" "testing" "time" + + "github.com/gorilla/websocket" + "github.com/stretchr/testify/require" ) var ( diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index e87bac42..def12836 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -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() diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go index 9a10e5d5..cf81e52d 100644 --- a/x/auction/keeper/grpc_query_test.go +++ b/x/auction/keeper/grpc_query_test.go @@ -13,9 +13,7 @@ import ( const testCommitHash = "71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D" -var ( - seed = int64(233) -) +var seed = int64(233) func (suite *KeeperTestSuite) TestGrpcGetAllAuctions() { client, ctx, k := suite.queryClient, suite.ctx, suite.app.AuctionKeeper diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go index e336cb4e..75a97ab6 100644 --- a/x/auction/keeper/msg_server.go +++ b/x/auction/keeper/msg_server.go @@ -50,6 +50,7 @@ func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) } // CommitBid is the command for committing a bid +//nolint: all func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -80,6 +81,7 @@ func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types } //RevealBid is the command for revealing a bid +//nolint: all func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/auction/types/msgs.go b/x/auction/types/msgs.go index 7b2069d8..fa5f916f 100644 --- a/x/auction/types/msgs.go +++ b/x/auction/types/msgs.go @@ -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, diff --git a/x/bond/client/testutil/grpc.go b/x/bond/client/testutil/grpc.go index d397e1be..658f3d28 100644 --- a/x/bond/client/testutil/grpc.go +++ b/x/bond/client/testutil/grpc.go @@ -28,7 +28,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() { true, "", func() { - }, }, { @@ -87,7 +86,6 @@ func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() { fmt.Sprintf(reqUrl, "asdasd"), true, func() { - }, }, { diff --git a/x/bond/client/testutil/query.go b/x/bond/client/testutil/query.go index cd83a4d6..85a77680 100644 --- a/x/bond/client/testutil/query.go +++ b/x/bond/client/testutil/query.go @@ -251,7 +251,6 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() { }, true, func() { - }, }, { diff --git a/x/bond/client/testutil/tx.go b/x/bond/client/testutil/tx.go index 37006594..5cff1071 100644 --- a/x/bond/client/testutil/tx.go +++ b/x/bond/client/testutil/tx.go @@ -63,6 +63,7 @@ func (s *IntegrationTestSuite) TestTxCreateBond() { } } +//nolint: all func (s *IntegrationTestSuite) TestTxRefillBond() { val := s.network.Validators[0] sr := s.Require() @@ -148,6 +149,7 @@ func (s *IntegrationTestSuite) TestTxRefillBond() { } } +//nolint: all func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() { val := s.network.Validators[0] sr := s.Require() diff --git a/x/bond/genesis.go b/x/bond/genesis.go index cc6c884a..c144af86 100644 --- a/x/bond/genesis.go +++ b/x/bond/genesis.go @@ -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 { diff --git a/x/bond/keeper/grpc_query_test.go b/x/bond/keeper/grpc_query_test.go index c0a22dd3..519db248 100644 --- a/x/bond/keeper/grpc_query_test.go +++ b/x/bond/keeper/grpc_query_test.go @@ -11,9 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/testutil" ) -var ( - seed = int64(233) -) +var seed = int64(233) func (suite *KeeperTestSuite) TestGrpcQueryBondsList() { grpcClient, ctx, k := suite.queryClient, suite.ctx, suite.app.BondKeeper diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go index 818d3aab..ab7f9884 100644 --- a/x/bond/keeper/msg_server.go +++ b/x/bond/keeper/msg_server.go @@ -45,6 +45,7 @@ func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*typ return &types.MsgCreateBondResponse{}, nil } +//nolint: all func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) @@ -74,6 +75,7 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ return &types.MsgRefillBondResponse{}, nil } +//nolint: all func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) diff --git a/x/bond/types/params.go b/x/bond/types/params.go index 587f8c6f..c5933c3f 100644 --- a/x/bond/types/params.go +++ b/x/bond/types/params.go @@ -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" ) diff --git a/x/evm/types/access_list_tx_test.go b/x/evm/types/access_list_tx_test.go index 7ccef3ee..88a171da 100644 --- a/x/evm/types/access_list_tx_test.go +++ b/x/evm/types/access_list_tx_test.go @@ -60,7 +60,7 @@ func (suite *TxDataTestSuite) TestAccessListTxGetGasFeeCap() { func (suite *TxDataTestSuite) TestEmptyAccessList() { testCases := []struct { name string - tx AccessListTx + tx AccessListTx }{ { "empty access list tx", diff --git a/x/evm/types/tx_args_test.go b/x/evm/types/tx_args_test.go index 5ebc4d7c..9e8c20aa 100644 --- a/x/evm/types/tx_args_test.go +++ b/x/evm/types/tx_args_test.go @@ -11,9 +11,9 @@ import ( func (suite *TxDataTestSuite) TestTxArgsString() { testCases := []struct { - name string - txArgs TransactionArgs - expectedString string + name string + txArgs TransactionArgs + expectedString string }{ { "empty tx args", @@ -32,25 +32,25 @@ func (suite *TxDataTestSuite) TestTxArgsString() { AccessList: ðtypes.AccessList{}, }, fmt.Sprintf("TransactionArgs{From:%v, To:%v, Gas:%v, Nonce:%v, Data:%v, Input:%v, AccessList:%v}", - &suite.addr, - &suite.addr, - &suite.hexUint64, - &suite.hexUint64, - &suite.hexDataBytes, - &suite.hexInputBytes, - ðtypes.AccessList{}), + &suite.addr, + &suite.addr, + &suite.hexUint64, + &suite.hexUint64, + &suite.hexDataBytes, + &suite.hexInputBytes, + ðtypes.AccessList{}), }, } for _, tc := range testCases { outputString := tc.txArgs.String() - suite.Require().Equal(outputString, tc.expectedString) + suite.Require().Equal(outputString, tc.expectedString) } } func (suite *TxDataTestSuite) TestConvertTxArgsEthTx() { testCases := []struct { - name string - txArgs TransactionArgs + name string + txArgs TransactionArgs }{ { "empty tx args", @@ -227,9 +227,9 @@ func (suite *TxDataTestSuite) TestToMessageEVM() { func (suite *TxDataTestSuite) TestGetFrom() { testCases := []struct { - name string - txArgs TransactionArgs - expAddress common.Address + name string + txArgs TransactionArgs + expAddress common.Address }{ { "empty from field", diff --git a/x/nameservice/client/cli/query.go b/x/nameservice/client/cli/query.go index 627cd716..95427ba2 100644 --- a/x/nameservice/client/cli/query.go +++ b/x/nameservice/client/cli/query.go @@ -266,7 +266,6 @@ $ %s query %s query-by-bond [bond id] return err } return clientCtx.PrintProto(res) - }, } flags.AddQueryFlagsToCmd(cmd) diff --git a/x/nameservice/client/cli/tx.go b/x/nameservice/client/cli/tx.go index f181ae3c..1c9a6f5b 100644 --- a/x/nameservice/client/cli/tx.go +++ b/x/nameservice/client/cli/tx.go @@ -371,7 +371,7 @@ $ %s tx %s delete-name [crn] return cmd } -//GetPayloadFromFile Load payload object from YAML file. +// GetPayloadFromFile Load payload object from YAML file. func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { var payload types.PayloadType diff --git a/x/nameservice/client/testutil/grpc.go b/x/nameservice/client/testutil/grpc.go index 138a0c56..cbe35d48 100644 --- a/x/nameservice/client/testutil/grpc.go +++ b/x/nameservice/client/testutil/grpc.go @@ -60,11 +60,12 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() { } } +//nolint: all 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 +79,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() { true, "", func(authorityName string) { - }, }, { @@ -132,7 +132,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 +147,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() { true, "", func(authorityName string) { - }, }, { @@ -181,6 +180,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() { } } +//nolint: all func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { val := s.network.Validators[0] sr := s.Require() @@ -199,7 +199,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { true, "", func(bondId string) { - }, }, { @@ -253,6 +252,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { } } +//nolint: all func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { val := s.network.Validators[0] sr := s.Require() @@ -271,7 +271,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { true, "", func(authorityName string) { - }, }, { @@ -325,6 +324,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { } } +//nolint: all func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { val := s.network.Validators[0] sr := s.Require() @@ -343,7 +343,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { true, "", func(bondId string) { - }, }, { @@ -483,7 +482,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { true, "", func(bondId string) { - }, }, { @@ -538,7 +536,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { true, "", func(bondId string) { - }, }, { @@ -590,7 +587,6 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { true, "", func(authorityName string) { - }, }, { diff --git a/x/nameservice/client/testutil/query.go b/x/nameservice/client/testutil/query.go index 6fdd3733..ee7026bd 100644 --- a/x/nameservice/client/testutil/query.go +++ b/x/nameservice/client/testutil/query.go @@ -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) { - }, }, { diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go index eff742d7..02a45b03 100644 --- a/x/nameservice/client/testutil/tx.go +++ b/x/nameservice/client/testutil/tx.go @@ -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) { - }, }, { diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index fc082834..3abc6f49 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -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,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState) } for _, authority := range data.Authorities { - //Only import authorities that are marked active. + // Only import authorities that are marked active. if authority.Entry.Status == types.AuthorityActive { keeper.SetNameAuthority(ctx, authority.Name, authority.Entry) diff --git a/x/nameservice/helpers/helpers.go b/x/nameservice/helpers/helpers.go index 3f28c9af..59776690 100644 --- a/x/nameservice/helpers/helpers.go +++ b/x/nameservice/helpers/helpers.go @@ -7,11 +7,10 @@ import ( "encoding/gob" "encoding/hex" "encoding/json" + "sort" wnsUtils "github.com/cerc-io/laconicd/utils" set "github.com/deckarep/golang-set" - - "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.") } diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go index 06e94827..a166a033 100644 --- a/x/nameservice/keeper/grpc_query_test.go +++ b/x/nameservice/keeper/grpc_query_test.go @@ -220,7 +220,7 @@ func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() { func (suite *KeeperTestSuite) TestGrpcQueryWhoIS() { grpcClient, ctx := suite.queryClient, suite.ctx sr := suite.Require() - var authorityName = "TestGrpcQueryWhoIS" + authorityName := "TestGrpcQueryWhoIS" testCases := []struct { msg string diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go index fa81433d..48df9d2f 100644 --- a/x/nameservice/keeper/keeper.go +++ b/x/nameservice/keeper/keeper.go @@ -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) } diff --git a/x/nameservice/keeper/keeper_test.go b/x/nameservice/keeper/keeper_test.go index 66fda3af..307a72a3 100644 --- a/x/nameservice/keeper/keeper_test.go +++ b/x/nameservice/keeper/keeper_test.go @@ -17,9 +17,7 @@ import ( tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) -var ( - seed = int64(233) -) +var seed = int64(233) type KeeperTestSuite struct { suite.Suite diff --git a/x/nameservice/keeper/msg_server.go b/x/nameservice/keeper/msg_server.go index 3bef7bbe..c9a36708 100644 --- a/x/nameservice/keeper/msg_server.go +++ b/x/nameservice/keeper/msg_server.go @@ -51,6 +51,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types return &types.MsgSetRecordResponse{Id: record.Id}, nil } +//nolint: all func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) { ctx := sdk.UnwrapSDKContext(c) _, err := sdk.AccAddressFromBech32(msg.Signer) @@ -107,6 +108,7 @@ func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority return &types.MsgReserveAuthorityResponse{}, nil } +//nolint: all func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) _, err := sdk.AccAddressFromBech32(msg.Signer) @@ -180,6 +182,7 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t return &types.MsgRenewRecordResponse{}, nil } +//nolint: all func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) { ctx := sdk.UnwrapSDKContext(c) _, err := sdk.AccAddressFromBech32(msg.Signer) diff --git a/x/nameservice/keeper/naming_keeper.go b/x/nameservice/keeper/naming_keeper.go index 4ab6e16e..bac988b8 100644 --- a/x/nameservice/keeper/naming_keeper.go +++ b/x/nameservice/keeper/naming_keeper.go @@ -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) } diff --git a/x/nameservice/keeper/record_keeper.go b/x/nameservice/keeper/record_keeper.go index f3e65f7e..4d88ef80 100644 --- a/x/nameservice/keeper/record_keeper.go +++ b/x/nameservice/keeper/record_keeper.go @@ -89,8 +89,10 @@ func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string) } // Record keeper implements the bond usage keeper interface. -var _ bondtypes.BondUsageKeeper = (*RecordKeeper)(nil) -var _ auctiontypes.AuctionUsageKeeper = (*RecordKeeper)(nil) +var ( + _ bondtypes.BondUsageKeeper = (*RecordKeeper)(nil) + _ auctiontypes.AuctionUsageKeeper = (*RecordKeeper)(nil) +) // ModuleName returns the module name. func (k RecordKeeper) ModuleName() string { @@ -162,7 +164,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 +183,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.") } diff --git a/x/nameservice/module.go b/x/nameservice/module.go index 246ce1ce..a835a97b 100644 --- a/x/nameservice/module.go +++ b/x/nameservice/module.go @@ -106,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) diff --git a/x/nameservice/types/msg.go b/x/nameservice/types/msg.go index 309ab017..72e58653 100644 --- a/x/nameservice/types/msg.go +++ b/x/nameservice/types/msg.go @@ -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.") } diff --git a/x/nameservice/types/params.go b/x/nameservice/types/params.go index a6aa6b80..b32fbdd0 100644 --- a/x/nameservice/types/params.go +++ b/x/nameservice/types/params.go @@ -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, diff --git a/x/nameservice/types/types.go b/x/nameservice/types/types.go index 86a2109c..f97c033f 100644 --- a/x/nameservice/types/types.go +++ b/x/nameservice/types/types.go @@ -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, From 74ed0f7e0f04b26630fb524aa7f5afcd45339a7a Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 12:45:01 +0530 Subject: [PATCH 03/14] lint --- gql/resolver.go | 2 +- gql/util.go | 6 +- x/auction/client/cli/tx.go | 5 +- x/auction/client/testutil/common.go | 2 +- x/auction/client/testutil/query.go | 2 +- x/auction/genesis.go | 2 +- x/auction/keeper/keeper.go | 17 +- x/auction/module.go | 2 +- x/bond/client/cli/tx.go | 11 +- x/bond/client/testutil/tx.go | 4 +- x/bond/keeper/keeper.go | 20 +-- x/nameservice/client/cli/tx.go | 20 +-- x/nameservice/client/testutil/tx.go | 246 +++++++++++++------------- x/nameservice/genesis.go | 2 +- x/nameservice/helpers/helpers.go | 2 +- x/nameservice/keeper/invariants.go | 30 ++-- x/nameservice/keeper/keeper.go | 6 +- x/nameservice/keeper/record_keeper.go | 6 +- 18 files changed, 193 insertions(+), 192 deletions(-) diff --git a/gql/resolver.go b/gql/resolver.go index cf1facd8..aa17fc24 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -34,7 +34,7 @@ type queryResolver struct{ *Resolver } func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) { nsQueryClient := nstypes.NewQueryClient(q.ctx) auctionQueryClient := auctiontypes.NewQueryClient(q.ctx) - var gqlResponse []*AuthorityRecord + gqlResponse := []*AuthorityRecord{} for _, name := range names { res, err := nsQueryClient.Whois(context.Background(), &nstypes.QueryWhoisRequest{Name: name}) diff --git a/gql/util.go b/gql/util.go index 7c620bbe..f510b511 100644 --- a/gql/util.go +++ b/gql/util.go @@ -3,6 +3,7 @@ package gql import ( "context" "encoding/json" + "fmt" "reflect" "strconv" @@ -85,7 +86,7 @@ func getGQLRecord(ctx context.Context, resolver QueryResolver, record nstypes.Re func getGQLNameRecord(record *nstypes.NameRecord) (*NameRecord, error) { if record == nil { - return nil, nil + return nil, fmt.Errorf("got nil record") } records := make([]*NameRecordEntry, len(record.History)) @@ -166,6 +167,7 @@ func getReferences(ctx context.Context, resolver QueryResolver, r *nstypes.Recor var ids []string for _, value := range r.Attributes { + //nolint: all switch value.(type) { case interface{}: if obj, ok := value.(map[string]interface{}); ok { @@ -186,7 +188,7 @@ func getAttributes(r *nstypes.RecordType) ([]*KeyValue, error) { } func mapToKeyValuePairs(attrs map[string]interface{}) ([]*KeyValue, error) { - var kvPairs []*KeyValue + kvPairs := []*KeyValue{} trueVal := true falseVal := false diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index def12836..9218c9ea 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -134,7 +134,10 @@ func GetCmdCommitBid() *cobra.Command { } // Save reveal file. - ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600) + err = ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0o600) + if err != nil { + return err + } msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress()) err = msg.ValidateBasic() diff --git a/x/auction/client/testutil/common.go b/x/auction/client/testutil/common.go index 54ca27bb..cf4a2520 100644 --- a/x/auction/client/testutil/common.go +++ b/x/auction/client/testutil/common.go @@ -32,7 +32,7 @@ func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { return &IntegrationTestSuite{cfg: cfg} } -func (s *IntegrationTestSuite) SetupSuite() { +func (s *IntegrationTestSuite) SetupSuite() { //nolint: all s.T().Log("setting up integration test suite") var err error diff --git a/x/auction/client/testutil/query.go b/x/auction/client/testutil/query.go index 1a39077a..49fc18a3 100644 --- a/x/auction/client/testutil/query.go +++ b/x/auction/client/testutil/query.go @@ -274,7 +274,7 @@ func (suite *IntegrationTestSuite) TestGetCmdAuctionsByBidder() { } } -func (suite IntegrationTestSuite) createAuctionAndBid(createAuction, createBid bool) string { +func (suite *IntegrationTestSuite) createAuctionAndBid(createAuction, createBid bool) string { val := suite.network.Validators[0] sr := suite.Require() auctionID := "" diff --git a/x/auction/genesis.go b/x/auction/genesis.go index 384d76d9..41bb1f0e 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -27,7 +27,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { params := keeper.GetParams(ctx) auctions := keeper.ListAuctions(ctx) - var genesisAuctions []*types.Auction + genesisAuctions := []*types.Auction{} for _, auction := range auctions { genesisAuctions = append(genesisAuctions, &auction) } diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index d6f30bb3..794309e0 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -99,7 +99,7 @@ func GetBidIndexKey(auctionID string, bidder string) []byte { } func GetAuctionBidsIndexPrefix(auctionID string) []byte { - return append(append(PrefixAuctionBidsIndex, []byte(auctionID)...)) + return append(PrefixAuctionBidsIndex, []byte(auctionID)...) } // SaveAuction - saves a auction to the store. @@ -226,7 +226,7 @@ func (k Keeper) ListAuctions(ctx sdk.Context) []types.Auction { func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []types.Auction { auctions := []types.Auction{} - ownerPrefix := append(prefixOwnerToAuctionsIndex, []byte(ownerAddress)...) + ownerPrefix := append(prefixOwnerToAuctionsIndex, []byte(ownerAddress)...) //nolint: all store := ctx.KVStore(k.storeKey) itr := sdk.KVStorePrefixIterator(store, ownerPrefix) defer itr.Close() @@ -247,9 +247,9 @@ func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []typ func (k Keeper) QueryAuctionsByBidder(ctx sdk.Context, bidderAddress string) []types.Auction { auctions := []types.Auction{} - bidderPrefix := append(PrefixBidderToAuctionsIndex, []byte(bidderAddress)...) + bidderPrefix := append(PrefixBidderToAuctionsIndex, []byte(bidderAddress)...) //nolint: all store := ctx.KVStore(k.storeKey) - itr := sdk.KVStorePrefixIterator(store, []byte(bidderPrefix)) + itr := sdk.KVStorePrefixIterator(store, bidderPrefix) defer itr.Close() for ; itr.Valid(); itr.Next() { auctionID := itr.Key()[len(bidderPrefix):] @@ -312,8 +312,8 @@ func (k Keeper) CreateAuction(ctx sdk.Context, msg types.MsgCreateAuction) (*typ // Compute timestamps. now := ctx.BlockTime() - commitsEndTime := now.Add(time.Duration(msg.CommitsDuration)) - revealsEndTime := now.Add(time.Duration(msg.CommitsDuration + msg.RevealsDuration)) + commitsEndTime := now.Add(msg.CommitsDuration) + revealsEndTime := now.Add(msg.CommitsDuration + msg.RevealsDuration) auction := types.Auction{ Id: auctionID, @@ -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.") @@ -553,6 +553,7 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) { continue } + //nolint: all if highestBid.BidAmount.IsLT(bid.BidAmount) { ctx.Logger().Info(fmt.Sprintf("New highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) @@ -637,7 +638,7 @@ func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) { // Burn anything over the min. bid amount. amountToBurn := auction.WinningPrice.Sub(auction.MinimumBid) if amountToBurn.IsNegative() { - ctx.Logger().Error(fmt.Sprintf("Auction coins to burn cannot be negative.")) + ctx.Logger().Error("Auction coins to burn cannot be negative.") panic("Auction coins to burn cannot be negative.") } diff --git a/x/auction/module.go b/x/auction/module.go index 357d90e5..048ec140 100644 --- a/x/auction/module.go +++ b/x/auction/module.go @@ -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) } diff --git a/x/bond/client/cli/tx.go b/x/bond/client/cli/tx.go index de122f4a..3136ffb0 100644 --- a/x/bond/client/cli/tx.go +++ b/x/bond/client/cli/tx.go @@ -50,7 +50,7 @@ func NewCreateBondCmd() *cobra.Command { }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -75,8 +75,8 @@ func RefillBondCmd() *cobra.Command { return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -101,12 +101,12 @@ func WithdrawBondCmd() *cobra.Command { return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(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 { cmd := &cobra.Command{ Use: "cancel [bond Id]", @@ -122,6 +122,7 @@ func CancelBondCmd() *cobra.Command { return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } - flags.AddTxFlags(cmd) + + cmd, _ = flags.AddTxFlags(cmd) return cmd } diff --git a/x/bond/client/testutil/tx.go b/x/bond/client/testutil/tx.go index 5cff1071..a423a217 100644 --- a/x/bond/client/testutil/tx.go +++ b/x/bond/client/testutil/tx.go @@ -242,7 +242,7 @@ func (s *IntegrationTestSuite) TestTxCancelBond() { testCases := []struct { name string args []string - getBondId bool + getBondID bool err bool }{ { @@ -275,7 +275,7 @@ func (s *IntegrationTestSuite) TestTxCancelBond() { s.Run(fmt.Sprintf("Case %s", tc.name), func() { clientCtx := val.ClientCtx cmd := cli.CancelBondCmd() - if tc.getBondId { + if tc.getBondID { cmd := cli.GetQueryBondLists() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ diff --git a/x/bond/keeper/keeper.go b/x/bond/keeper/keeper.go index af04edfa..9854e833 100644 --- a/x/bond/keeper/keeper.go +++ b/x/bond/keeper/keeper.go @@ -119,10 +119,7 @@ func (k Keeper) CreateBond(ctx sdk.Context, ownerAddress sdk.AccAddress, coins s Sequence: account.GetSequence(), }.Generate() - maxBondAmount, err := k.getMaxBondAmount(ctx) - if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid max bond amount.") - } + maxBondAmount := k.getMaxBondAmount(ctx) bond := types.Bond{Id: bondID, Owner: ownerAddress.String(), Balance: coins} if bond.Balance.IsAnyGT(maxBondAmount) { @@ -130,7 +127,7 @@ func (k Keeper) CreateBond(ctx sdk.Context, ownerAddress sdk.AccAddress, coins s } // Move funds into the bond account module. - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, bond.Balance) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, bond.Balance) if err != nil { return nil, err } @@ -198,7 +195,7 @@ func (k Keeper) ListBonds(ctx sdk.Context) []*types.Bond { func (k Keeper) QueryBondsByOwner(ctx sdk.Context, ownerAddress string) []types.Bond { var bonds []types.Bond - ownerPrefix := append(prefixOwnerToBondsIndex, []byte(ownerAddress)...) + ownerPrefix := append(prefixOwnerToBondsIndex, []byte(ownerAddress)...) //nolint: all store := ctx.KVStore(k.storeKey) itr := sdk.KVStorePrefixIterator(store, ownerPrefix) defer itr.Close() @@ -233,10 +230,7 @@ func (k Keeper) RefillBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre } } - maxBondAmount, err := k.getMaxBondAmount(ctx) - if err != nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid max bond amount.") - } + maxBondAmount := k.getMaxBondAmount(ctx) updatedBalance := bond.Balance.Add(coins...) if updatedBalance.IsAnyGT(maxBondAmount) { @@ -244,7 +238,7 @@ func (k Keeper) RefillBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre } // Move funds into the bond account module. - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, coins) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, coins) if err != nil { return nil, err } @@ -314,10 +308,10 @@ func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddre return &bond, nil } -func (k Keeper) getMaxBondAmount(ctx sdk.Context) (sdk.Coins, error) { +func (k Keeper) getMaxBondAmount(ctx sdk.Context) sdk.Coins { params := k.GetParams(ctx) maxBondAmount := params.MaxBondAmount - return sdk.NewCoins(maxBondAmount), nil + return sdk.NewCoins(maxBondAmount) } // GetBondModuleBalances gets the bond module account(s) balances. diff --git a/x/nameservice/client/cli/tx.go b/x/nameservice/client/cli/tx.go index 1c9a6f5b..711bf400 100644 --- a/x/nameservice/client/cli/tx.go +++ b/x/nameservice/client/cli/tx.go @@ -75,7 +75,7 @@ $ %s tx %s set [payload file path] [bond-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -107,7 +107,7 @@ $ %s tx %s renew-record [record-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -139,7 +139,7 @@ $ %s tx %s associate-bond [record-id] [bond-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -171,7 +171,7 @@ $ %s tx %s dissociate-bond [record-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -203,7 +203,7 @@ $ %s tx %s dissociate-bond [record-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -235,7 +235,7 @@ $ %s tx %s reassociate-records [old-bond-id] [new-bond-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -268,7 +268,7 @@ $ %s tx %s set-name [crn] [cid] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -312,7 +312,7 @@ $ %s tx %s reserve-name [name] --owner [ownerAddress] cmd.Flags().String("owner", "", "Owner address, if creating a sub-authority.") - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -340,7 +340,7 @@ $ %s tx %s authority-bond [name] [bond-id] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } @@ -367,7 +367,7 @@ $ %s tx %s delete-name [crn] }, } - flags.AddTxFlags(cmd) + cmd, _ = flags.AddTxFlags(cmd) return cmd } diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go index 02a45b03..dea768e3 100644 --- a/x/nameservice/client/testutil/tx.go +++ b/x/nameservice/client/testutil/tx.go @@ -655,129 +655,129 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { } // -//func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() { -// val := s.network.Validators[0] -// sr := s.Require() -// testCasesForDeletingName := []struct { -// name string -// args []string -// err bool -// preRun func(s *IntegrationTestSuite) (string, string) -// postRun func(recordId string, s *IntegrationTestSuite) -// }{ -// { -// "invalid request without crn", -// []string{ -// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), -// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), -// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), -// }, -// true, -// func(s *IntegrationTestSuite) (string, string) { -// return "", "" -// }, -// func(recordId string, s *IntegrationTestSuite) { -// -// }, -// }, -// { -// "successfully dissociate records from bond-id", -// []string{ -// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), -// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), -// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), -// }, -// false, -// func(s *IntegrationTestSuite) (string, string) { -// // create the bond -// CreateBond(s) -// // get the bond id from bond list -// bondId := GetBondId(s) -// dir, err := os.Getwd() -// sr.NoError(err) -// payloadPath := dir + "/example1.yml" -// -// args := []string{ -// payloadPath, bondId, -// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), -// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), -// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), -// } -// -// clientCtx := val.ClientCtx -// cmd := cli.GetCmdSetRecord() -// -// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) -// sr.NoError(err) -// var d sdk.TxResponse -// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) -// sr.NoError(err) -// sr.Zero(d.Code) -// -// // retrieving the record-id -// args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} -// cmd = cli.GetCmdList() -// out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) -// sr.NoError(err) -// var records []nstypes.RecordType -// err = json.Unmarshal(out.Bytes(), &records) -// sr.NoError(err) -// for _, record := range records { -// if len(record.BondId) != 0 { -// return record.Id, record.BondId -// } -// } -// return records[0].Id, records[0].BondId -// }, -// func(recordId string, s *IntegrationTestSuite) { -// // checking the bond-id removed or not -// clientCtx := val.ClientCtx -// args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} -// cmd := cli.GetCmdGetResource() -// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) -// sr.NoError(err) -// var response nstypes.QueryRecordByIdResponse -// err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) -// sr.NoError(err) -// record := response.GetRecord() -// sr.NotNil(record) -// sr.Zero(len(record.GetBondId())) -// }, -// }, -// } -// -// for _, tc := range testCasesForDeletingName { -// s.Run(fmt.Sprintf("Case %s", tc.name), func() { -// var bondId string -// var recordId string -// if !tc.err { -// recordId, bondId = tc.preRun(s) -// tc.args = append([]string{bondId}, tc.args...) -// } -// clientCtx := val.ClientCtx -// cmd := cli.GetCmdDissociateRecords() -// -// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) -// if tc.err { -// sr.Error(err) -// } else { -// sr.NoError(err) -// var d sdk.TxResponse -// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) -// sr.NoError(err) -// sr.Zero(d.Code) -// // post-run -// tc.postRun(recordId, s) -// } -// }) -// } -//} +// func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() { +// val := s.network.Validators[0] +// sr := s.Require() +// testCasesForDeletingName := []struct { +// name string +// args []string +// err bool +// preRun func(s *IntegrationTestSuite) (string, string) +// postRun func(recordId string, s *IntegrationTestSuite) +// }{ +// { +// "invalid request without crn", +// []string{ +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// }, +// true, +// func(s *IntegrationTestSuite) (string, string) { +// return "", "" +// }, +// func(recordId string, s *IntegrationTestSuite) { + +// }, +// }, +// { +// "successfully dissociate records from bond-id", +// []string{ +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// }, +// false, +// func(s *IntegrationTestSuite) (string, string) { +// // create the bond +// CreateBond(s) +// // get the bond id from bond list +// bondId := GetBondId(s) +// dir, err := os.Getwd() +// sr.NoError(err) +// payloadPath := dir + "/example1.yml" + +// args := []string{ +// payloadPath, bondId, +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// } + +// clientCtx := val.ClientCtx +// cmd := cli.GetCmdSetRecord() + +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var d sdk.TxResponse +// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) +// sr.NoError(err) +// sr.Zero(d.Code) + +// // retrieving the record-id +// args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} +// cmd = cli.GetCmdList() +// out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var records []nstypes.RecordType +// err = json.Unmarshal(out.Bytes(), &records) +// sr.NoError(err) +// for _, record := range records { +// if len(record.BondId) != 0 { +// return record.Id, record.BondId +// } +// } +// return records[0].Id, records[0].BondId +// }, +// func(recordId string, s *IntegrationTestSuite) { +// // checking the bond-id removed or not +// clientCtx := val.ClientCtx +// args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} +// cmd := cli.GetCmdGetResource() +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var response nstypes.QueryRecordByIdResponse +// err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) +// sr.NoError(err) +// record := response.GetRecord() +// sr.NotNil(record) +// sr.Zero(len(record.GetBondId())) +// }, +// }, +// } + +// for _, tc := range testCasesForDeletingName { +// s.Run(fmt.Sprintf("Case %s", tc.name), func() { +// var bondId string +// var recordId string +// if !tc.err { +// recordId, bondId = tc.preRun(s) +// tc.args = append([]string{bondId}, tc.args...) +// } +// clientCtx := val.ClientCtx +// cmd := cli.GetCmdDissociateRecords() + +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) +// if tc.err { +// sr.Error(err) +// } else { +// sr.NoError(err) +// var d sdk.TxResponse +// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) +// sr.NoError(err) +// sr.Zero(d.Code) +// // post-run +// tc.postRun(recordId, s) +// } +// }) +// } +// } func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { val := s.network.Validators[0] diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index 3abc6f49..b3a70a38 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -59,7 +59,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { records := keeper.ListRecords(ctx) authorities := keeper.ListNameAuthorityRecords(ctx) - var authorityEntries []types.AuthorityEntry + authorityEntries := []types.AuthorityEntry{} for name, record := range authorities { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, diff --git a/x/nameservice/helpers/helpers.go b/x/nameservice/helpers/helpers.go index 59776690..582374ac 100644 --- a/x/nameservice/helpers/helpers.go +++ b/x/nameservice/helpers/helpers.go @@ -43,7 +43,7 @@ func BytesArrToStringArr(val []byte) ([]string, error) { func Int64ToBytes(num int64) []byte { buf := new(bytes.Buffer) - binary.Write(buf, binary.BigEndian, num) + _ = binary.Write(buf, binary.BigEndian, num) return buf.Bytes() } diff --git a/x/nameservice/keeper/invariants.go b/x/nameservice/keeper/invariants.go index 0f52d82a..cb1b5a85 100644 --- a/x/nameservice/keeper/invariants.go +++ b/x/nameservice/keeper/invariants.go @@ -15,21 +15,21 @@ func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { // (2) associated bond exists, if bondID is not null. func RecordInvariants(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - //store := ctx.KVStore(k.storeKey) - //itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) - //defer itr.Close() - //for ; itr.Valid(); itr.Next() { - // bz := store.Get(itr.Key()) - // if bz != nil { - // var obj types.RecordObj - // k.cdc.MustUnmarshalBinaryBare(bz, &obj) - // record := obj.ToRecord() - // - // if record.BondID != "" && !k.bondKeeper.HasBond(ctx, record.BondID) { - // return sdk.FormatInvariant(types.ModuleName, "record-bond", fmt.Sprintf("Bond not found for record ID: '%s'.", record.ID)), true - // } - // } - //} + // store := ctx.KVStore(k.storeKey) + // itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) + // defer itr.Close() + // for ; itr.Valid(); itr.Next() { + // bz := store.Get(itr.Key()) + // if bz != nil { + // var obj types.RecordObj + // k.cdc.MustUnmarshalBinaryBare(bz, &obj) + // record := obj.ToRecord() + + // if record.BondID != "" && !k.bondKeeper.HasBond(ctx, record.BondID) { + // return sdk.FormatInvariant(types.ModuleName, "record-bond", fmt.Sprintf("Bond not found for record ID: '%s'.", record.ID)), true + // } + // } + // } return "", false } diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go index 48df9d2f..31d5c047 100644 --- a/x/nameservice/keeper/keeper.go +++ b/x/nameservice/keeper/keeper.go @@ -122,7 +122,7 @@ func (k Keeper) ListRecords(ctx sdk.Context) []types.Record { if bz != nil { var obj types.Record k.cdc.MustUnmarshal(bz, &obj) - records = append(records, recordObjToRecord(store, k.cdc, obj)) + records = append(records, recordObjToRecord(store, obj)) } } @@ -141,7 +141,7 @@ func (k Keeper) MatchRecords(ctx sdk.Context, matchFn func(*types.RecordType) bo if bz != nil { var obj types.Record k.cdc.MustUnmarshal(bz, &obj) - obj = recordObjToRecord(store, k.cdc, obj) + obj = recordObjToRecord(store, obj) record := obj.ToRecordType() if matchFn(&record) { records = append(records, obj) @@ -419,7 +419,7 @@ func (k Keeper) GetModuleBalances(ctx sdk.Context) []*types.AccountBalance { return balances } -func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.Record) types.Record { +func recordObjToRecord(store sdk.KVStore, record types.Record) types.Record { reverseNameIndexKey := GetCIDToNamesIndexKey(record.Id) if store.Has(reverseNameIndexKey) { diff --git a/x/nameservice/keeper/record_keeper.go b/x/nameservice/keeper/record_keeper.go index 4d88ef80..83f6f881 100644 --- a/x/nameservice/keeper/record_keeper.go +++ b/x/nameservice/keeper/record_keeper.go @@ -112,7 +112,7 @@ func (k RecordKeeper) GetAuctionToAuthorityMapping(ctx sdk.Context, auctionID st // UsesBond returns true if the bond has associated records. func (k RecordKeeper) UsesBond(ctx sdk.Context, bondId string) bool { - bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondId)...) + bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondId)...) //nolint: all store := ctx.KVStore(k.storeKey) itr := sdk.KVStorePrefixIterator(store, bondIDPrefix) defer itr.Close() @@ -138,7 +138,7 @@ func NewRecordKeeper(auctionKeeper auctionkeeper.Keeper, storeKey storetypes.Sto func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types.Record { var records []types.Record - bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondID)...) + bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondID)...) //nolint: all store := ctx.KVStore(k.storeKey) itr := sdk.KVStorePrefixIterator(store, bondIDPrefix) defer itr.Close() @@ -148,7 +148,7 @@ func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types if bz != nil { var obj types.Record k.cdc.MustUnmarshal(bz, &obj) - records = append(records, recordObjToRecord(store, k.cdc, obj)) + records = append(records, recordObjToRecord(store, obj)) } } From 482d597318b0b084054757e223630fbdb7892f1b Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 16:33:31 +0530 Subject: [PATCH 04/14] lint --- docs/api/proto-docs.md | 50 +-- go.mod | 4 +- go.sum | 8 +- gql/resolver.go | 10 +- gql/server.go | 2 +- proto/vulcanize/bond/v1beta1/query.proto | 10 +- .../vulcanize/nameservice/v1beta1/query.proto | 16 +- x/auction/client/testutil/grpc.go | 39 +- x/auction/genesis.go | 2 +- x/bond/client/cli/query.go | 6 +- x/bond/client/cli/tx.go | 12 +- x/bond/client/testutil/grpc.go | 44 +- x/bond/client/testutil/query.go | 16 +- x/bond/client/testutil/tx.go | 20 +- x/bond/keeper/grpc_query.go | 10 +- x/bond/keeper/grpc_query_test.go | 10 +- x/bond/keeper/msg_server.go | 6 +- x/bond/types/bond.pb.go | 2 +- x/bond/types/events.go | 2 +- x/bond/types/expected_keeper.go | 2 +- x/bond/types/query.pb.go | 222 +++++----- x/bond/types/query.pb.gw.go | 28 +- x/nameservice/client/cli/query.go | 4 +- x/nameservice/client/testutil/grpc.go | 72 ++-- x/nameservice/client/testutil/query.go | 20 +- x/nameservice/client/testutil/tx.go | 56 +-- x/nameservice/genesis.go | 2 +- x/nameservice/keeper/grpc_query.go | 13 +- x/nameservice/keeper/grpc_query_test.go | 32 +- x/nameservice/keeper/keeper.go | 10 +- x/nameservice/keeper/msg_server.go | 29 +- x/nameservice/keeper/naming_keeper.go | 1 - x/nameservice/keeper/record_keeper.go | 8 +- x/nameservice/types/events.go | 8 +- x/nameservice/types/msg.go | 4 +- x/nameservice/types/nameservice.pb.go | 2 +- x/nameservice/types/query.pb.go | 408 +++++++++--------- x/nameservice/types/query.pb.gw.go | 38 +- x/nameservice/types/record_msg.go | 24 +- x/nameservice/types/types.go | 12 +- 40 files changed, 636 insertions(+), 628 deletions(-) diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 06982b9c..85edef18 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -135,8 +135,8 @@ - [GenesisState](#vulcanize.bond.v1beta1.GenesisState) - [vulcanize/bond/v1beta1/query.proto](#vulcanize/bond/v1beta1/query.proto) - - [QueryGetBondByIdRequest](#vulcanize.bond.v1beta1.QueryGetBondByIdRequest) - - [QueryGetBondByIdResponse](#vulcanize.bond.v1beta1.QueryGetBondByIdResponse) + - [QueryGetBondByIDRequest](#vulcanize.bond.v1beta1.QueryGetBondByIDRequest) + - [QueryGetBondByIDResponse](#vulcanize.bond.v1beta1.QueryGetBondByIDResponse) - [QueryGetBondModuleBalanceRequest](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest) - [QueryGetBondModuleBalanceResponse](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse) - [QueryGetBondsByOwnerRequest](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest) @@ -195,10 +195,10 @@ - [QueryLookupCrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupCrnResponse) - [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) - [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) - - [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) - - [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) - - [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) - - [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) + - [QueryRecordByBondIDRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIDRequest) + - [QueryRecordByBondIDResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIDResponse) + - [QueryRecordByIDRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIDRequest) + - [QueryRecordByIDResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIDResponse) - [QueryResolveCrn](#vulcanize.nameservice.v1beta1.QueryResolveCrn) - [QueryResolveCrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveCrnResponse) - [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) @@ -2004,10 +2004,10 @@ GenesisState defines the bond module's genesis state. - + -### QueryGetBondByIdRequest -QueryGetBondById +### QueryGetBondByIDRequest +QueryGetBondByID | Field | Type | Label | Description | @@ -2019,10 +2019,10 @@ QueryGetBondById - + -### QueryGetBondByIdResponse -QueryGetBondByIdResponse returns QueryGetBondById query response +### QueryGetBondByIDResponse +QueryGetBondByIDResponse returns QueryGetBondByID query response | Field | Type | Label | Description | @@ -2162,7 +2162,7 @@ Query defines the gRPC querier service for bond module | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `Params` | [QueryParamsRequest](#vulcanize.bond.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.bond.v1beta1.QueryParamsResponse) | Params queries bonds module params. | GET|/vulcanize/bond/v1beta1/params| | `Bonds` | [QueryGetBondsRequest](#vulcanize.bond.v1beta1.QueryGetBondsRequest) | [QueryGetBondsResponse](#vulcanize.bond.v1beta1.QueryGetBondsResponse) | Bonds queries bonds list. | GET|/vulcanize/bond/v1beta1/bonds| -| `GetBondById` | [QueryGetBondByIdRequest](#vulcanize.bond.v1beta1.QueryGetBondByIdRequest) | [QueryGetBondByIdResponse](#vulcanize.bond.v1beta1.QueryGetBondByIdResponse) | GetBondById | GET|/vulcanize/bond/v1beta1/bonds/{id}| +| `GetBondByID` | [QueryGetBondByIDRequest](#vulcanize.bond.v1beta1.QueryGetBondByIDRequest) | [QueryGetBondByIDResponse](#vulcanize.bond.v1beta1.QueryGetBondByIDResponse) | GetBondById | GET|/vulcanize/bond/v1beta1/bonds/{id}| | `GetBondsByOwner` | [QueryGetBondsByOwnerRequest](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest) | [QueryGetBondsByOwnerResponse](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse) | Get Bonds List by Owner | GET|/vulcanize/bond/v1beta1/by-owner/{owner}| | `GetBondsModuleBalance` | [QueryGetBondModuleBalanceRequest](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest) | [QueryGetBondModuleBalanceResponse](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse) | Get Bonds module balance | GET|/vulcanize/bond/v1beta1/balance| @@ -2841,9 +2841,9 @@ QueryParamsResponse is response type for nameservice params - + -### QueryRecordByBondIdRequest +### QueryRecordByBondIDRequest QueryRecordByBondIdRequest is request type for get the records by bond-id @@ -2857,9 +2857,9 @@ QueryRecordByBondIdRequest is request type for get the records by bond-id - + -### QueryRecordByBondIdResponse +### QueryRecordByBondIDResponse QueryRecordByBondIdResponse is response type for records list by bond-id @@ -2873,10 +2873,10 @@ QueryRecordByBondIdResponse is response type for records list by bond-id - + -### QueryRecordByIdRequest -QueryRecordByIdRequest is request type for nameservice records by id +### QueryRecordByIDRequest +QueryRecordByIDRequest is request type for nameservice records by id | Field | Type | Label | Description | @@ -2888,10 +2888,10 @@ QueryRecordByIdRequest is request type for nameservice records by id - + -### QueryRecordByIdResponse -QueryRecordByIdResponse is response type for nameservice records by id +### QueryRecordByIDResponse +QueryRecordByIDResponse is response type for nameservice records by id | Field | Type | Label | Description | @@ -2978,8 +2978,8 @@ Query defines the gRPC querier service for nameservice module | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `Params` | [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) | Params queries the nameservice module params. | GET|/vulcanize/nameservice/v1beta1/params| | `ListRecords` | [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) | [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) | List records | GET|/vulcanize/nameservice/v1beta1/records| -| `GetRecord` | [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) | [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) | Get record by id | GET|/vulcanize/nameservice/v1beta1/records/{id}| -| `GetRecordByBondId` | [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) | [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) | Get records by bond id | GET|/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}| +| `GetRecord` | [QueryRecordByIDRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIDRequest) | [QueryRecordByIDResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIDResponse) | Get record by id | GET|/vulcanize/nameservice/v1beta1/records/{id}| +| `GetRecordByBondID` | [QueryRecordByBondIDRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIDRequest) | [QueryRecordByBondIDResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIDResponse) | Get records by bond id | GET|/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}| | `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/vulcanize/nameservice/v1beta1/balance| | `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/vulcanize/nameservice/v1beta1/names| | `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/vulcanize/nameservice/v1beta1/whois/{name}| diff --git a/go.mod b/go.mod index 46e04ab9..5d5827c1 100644 --- a/go.mod +++ b/go.mod @@ -44,8 +44,8 @@ require ( github.com/vektah/gqlparser/v2 v2.5.1 golang.org/x/net v0.0.0-20220909164309-bea034e7d591 golang.org/x/text v0.3.7 - google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e - google.golang.org/grpc v1.49.0 + google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a + google.golang.org/grpc v1.50.0 google.golang.org/protobuf v1.28.1 gopkg.in/yaml.v3 v3.0.1 sigs.k8s.io/yaml v1.3.0 diff --git a/go.sum b/go.sum index ca7d7e80..40152fef 100644 --- a/go.sum +++ b/go.sum @@ -1700,8 +1700,8 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e h1:halCgTFuLWDRD61piiNSxPsARANGD3Xl16hPrLgLiIg= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a h1:GH6UPn3ixhWcKDhpnEC55S75cerLPdpp3hrhfKYjZgw= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1740,8 +1740,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/gql/resolver.go b/gql/resolver.go index aa17fc24..23eaf10c 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -148,7 +148,7 @@ func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Re gqlResponse := make([]*Record, len(ids)) for i, id := range ids { - res, err := nsQueryClient.GetRecord(context.Background(), &nstypes.QueryRecordByIdRequest{Id: id}) + res, err := nsQueryClient.GetRecord(context.Background(), &nstypes.QueryRecordByIDRequest{Id: id}) if err != nil { // Return nil for record not found. gqlResponse[i] = nil @@ -229,7 +229,9 @@ func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account // Get the account balance bankQueryClient := banktypes.NewQueryClient(q.ctx) balance, err := bankQueryClient.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{Address: address}) - + if err != nil { + return nil, err + } accNum := strconv.FormatUint(account.GetAccountNumber(), 10) seq := strconv.FormatUint(account.GetSequence(), 10) @@ -257,7 +259,7 @@ func (q queryResolver) GetBondsByIds(ctx context.Context, ids []string) ([]*Bond func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) { bondQueryClient := bondtypes.NewQueryClient(q.ctx) - bondResp, err := bondQueryClient.GetBondById(context.Background(), &bondtypes.QueryGetBondByIdRequest{Id: id}) + bondResp, err := bondQueryClient.GetBondByID(context.Background(), &bondtypes.QueryGetBondByIDRequest{Id: id}) if err != nil { return nil, err } @@ -311,7 +313,7 @@ func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*Ow ownerBonds := make([]*Bond, len(bondResp.GetBonds())) for i, bond := range bondResp.GetBonds() { - bondObj, err := getGQLBond(&bond) + bondObj, err := getGQLBond(&bond) //nolint: all if err != nil { return nil, err } diff --git a/gql/server.go b/gql/server.go index fd75f702..dd5fe5a7 100644 --- a/gql/server.go +++ b/gql/server.go @@ -38,7 +38,7 @@ func Server(ctx client.Context) { http.Handle("/graphql", srv) log.Info("Connect to GraphQL playground", "url", fmt.Sprintf("http://localhost:%s", port)) - err := http.ListenAndServe(":"+port, nil) + err := http.ListenAndServe(":"+port, nil) //nolint: all if err != nil { panic(err) } diff --git a/proto/vulcanize/bond/v1beta1/query.proto b/proto/vulcanize/bond/v1beta1/query.proto index d2ba0ed1..cfd115a1 100644 --- a/proto/vulcanize/bond/v1beta1/query.proto +++ b/proto/vulcanize/bond/v1beta1/query.proto @@ -22,7 +22,7 @@ service Query { } // GetBondById - rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse) { + rpc GetBondByID(QueryGetBondByIDRequest) returns (QueryGetBondByIDResponse) { option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds/{id}"; } @@ -58,13 +58,13 @@ message QueryGetBondsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryGetBondById -message QueryGetBondByIdRequest { +// QueryGetBondByID +message QueryGetBondByIDRequest { string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""]; } -// QueryGetBondByIdResponse returns QueryGetBondById query response -message QueryGetBondByIdResponse { +// QueryGetBondByIDResponse returns QueryGetBondByID query response +message QueryGetBondByIDResponse { Bond bond = 1 [(gogoproto.moretags) = "json:\"bond\" yaml:\"bond\""]; } diff --git a/proto/vulcanize/nameservice/v1beta1/query.proto b/proto/vulcanize/nameservice/v1beta1/query.proto index 8164e062..229581f5 100644 --- a/proto/vulcanize/nameservice/v1beta1/query.proto +++ b/proto/vulcanize/nameservice/v1beta1/query.proto @@ -20,11 +20,11 @@ service Query { option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records"; } // Get record by id - rpc GetRecord(QueryRecordByIdRequest) returns (QueryRecordByIdResponse) { + rpc GetRecord(QueryRecordByIDRequest) returns (QueryRecordByIDResponse) { option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records/{id}"; } // Get records by bond id - rpc GetRecordByBondId(QueryRecordByBondIdRequest) returns (QueryRecordByBondIdResponse) { + rpc GetRecordByBondID(QueryRecordByBondIDRequest) returns (QueryRecordByBondIDResponse) { option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}"; } // Get nameservice module balance @@ -98,25 +98,25 @@ message QueryListRecordsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryRecordByIdRequest is request type for nameservice records by id -message QueryRecordByIdRequest { +// QueryRecordByIDRequest is request type for nameservice records by id +message QueryRecordByIDRequest { string id = 1; } -// QueryRecordByIdResponse is response type for nameservice records by id -message QueryRecordByIdResponse { +// QueryRecordByIDResponse is response type for nameservice records by id +message QueryRecordByIDResponse { Record record = 1 [(gogoproto.nullable) = false]; } // QueryRecordByBondIdRequest is request type for get the records by bond-id -message QueryRecordByBondIdRequest { +message QueryRecordByBondIDRequest { string id = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } // QueryRecordByBondIdResponse is response type for records list by bond-id -message QueryRecordByBondIdResponse { +message QueryRecordByBondIDResponse { repeated Record records = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/x/auction/client/testutil/grpc.go b/x/auction/client/testutil/grpc.go index ccacf185..38447e33 100644 --- a/x/auction/client/testutil/grpc.go +++ b/x/auction/client/testutil/grpc.go @@ -16,7 +16,7 @@ const ( func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions", val.APIAddress) testCases := []struct { msg string @@ -26,13 +26,13 @@ func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { }{ { "invalid request to get all auctions", - reqUrl + randomAuctionID, + reqURL + randomAuctionID, "", true, }, { "valid request to get all auctions", - reqUrl, + reqURL, "", false, }, @@ -46,6 +46,7 @@ func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { sr.NoError(err) var auctions auctiontypes.AuctionsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auctions) + sr.NoError(err) sr.NotZero(len(auctions.Auctions.Auctions)) } }) @@ -55,10 +56,10 @@ func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { func (suite *IntegrationTestSuite) TestQueryParamsGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/params", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/params", val.APIAddress) suite.Run("valid request to get auction params", func() { - resp, err := rest.GetRequest(reqUrl) + resp, err := rest.GetRequest(reqURL) suite.Require().NoError(err) var params auctiontypes.QueryParamsResponse @@ -72,7 +73,7 @@ func (suite *IntegrationTestSuite) TestQueryParamsGrpc() { func (suite *IntegrationTestSuite) TestGetAuctionGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions/", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions/", val.APIAddress) testCases := []struct { msg string @@ -83,14 +84,14 @@ func (suite *IntegrationTestSuite) TestGetAuctionGrpc() { }{ { "invalid request to get an auction", - reqUrl + randomAuctionID, + reqURL + randomAuctionID, "", true, func() string { return "" }, }, { "valid request to get an auction", - reqUrl, + reqURL, "", false, func() string { return suite.defaultAuctionID }, @@ -116,7 +117,7 @@ func (suite *IntegrationTestSuite) TestGetAuctionGrpc() { func (suite *IntegrationTestSuite) TestGetBidsGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) testCases := []struct { msg string url string @@ -126,14 +127,14 @@ func (suite *IntegrationTestSuite) TestGetBidsGrpc() { }{ { "invalid request to get all bids", - reqUrl, + reqURL, "", true, func() string { return "" }, }, { "valid request to get all bids", - reqUrl, + reqURL, "", false, func() string { return suite.createAuctionAndBid(false, true) }, @@ -161,7 +162,7 @@ func (suite *IntegrationTestSuite) TestGetBidsGrpc() { func (suite *IntegrationTestSuite) TestGetBidGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) testCases := []struct { msg string url string @@ -170,13 +171,13 @@ func (suite *IntegrationTestSuite) TestGetBidGrpc() { }{ { "invalid request to get bid", - fmt.Sprintf("%s/%s/", reqUrl, randomAuctionID), + fmt.Sprintf("%s/%s/", reqURL, randomAuctionID), "", true, }, { "valid request to get bid", - fmt.Sprintf("%s/%s/%s", reqUrl, randomAuctionID, randomBidderAddress), + fmt.Sprintf("%s/%s/%s", reqURL, randomAuctionID, randomBidderAddress), "", false, }, @@ -199,7 +200,7 @@ func (suite *IntegrationTestSuite) TestGetBidGrpc() { func (suite *IntegrationTestSuite) TestGetAuctionsByOwnerGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/by-owner/", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/by-owner/", val.APIAddress) testCases := []struct { msg string url string @@ -208,13 +209,13 @@ func (suite *IntegrationTestSuite) TestGetAuctionsByOwnerGrpc() { }{ { "invalid request to get auctions by owner", - reqUrl, + reqURL, "", true, }, { "valid request to get auctions by owner", - fmt.Sprintf("%s/%s", reqUrl, randomOwnerAddress), + fmt.Sprintf("%s/%s", reqURL, randomOwnerAddress), "", false, }, @@ -237,13 +238,13 @@ func (suite *IntegrationTestSuite) TestGetAuctionsByOwnerGrpc() { func (suite *IntegrationTestSuite) TestQueryBalanceGrpc() { val := suite.network.Validators[0] sr := suite.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/balance", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/auction/v1beta1/balance", val.APIAddress) msg := "valid request to get the auction module balance" suite.createAuctionAndBid(false, true) suite.Run(msg, func() { - resp, err := rest.GetRequest(reqUrl) + resp, err := rest.GetRequest(reqURL) sr.NoError(err) var response auctiontypes.BalanceResponse diff --git a/x/auction/genesis.go b/x/auction/genesis.go index 41bb1f0e..44b1fc6f 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -29,7 +29,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { genesisAuctions := []*types.Auction{} for _, auction := range auctions { - genesisAuctions = append(genesisAuctions, &auction) + genesisAuctions = append(genesisAuctions, &auction) //nolint: all } return types.GenesisState{Params: params, Auctions: genesisAuctions} } diff --git a/x/bond/client/cli/query.go b/x/bond/client/cli/query.go index 03fe3c5e..11d87070 100644 --- a/x/bond/client/cli/query.go +++ b/x/bond/client/cli/query.go @@ -24,7 +24,7 @@ func GetQueryCmd() *cobra.Command { bondQueryCmd.AddCommand( GetQueryParamsCmd(), GetQueryBondLists(), - GetBondByIdCmd(), + GetBondByIDCmd(), GetBondListByOwnerCmd(), GetBondModuleBalanceCmd(), ) @@ -99,7 +99,7 @@ $ %s query %s list } // GetBondByIdCmd implements the bond info by id query command. -func GetBondByIdCmd() *cobra.Command { +func GetBondByIDCmd() *cobra.Command { cmd := &cobra.Command{ Use: "get [bond Id]", Short: "Get bond.", @@ -122,7 +122,7 @@ $ %s query bond get {BOND ID} id := args[0] - res, err := queryClient.GetBondById(cmd.Context(), &types.QueryGetBondByIdRequest{Id: id}) + res, err := queryClient.GetBondByID(cmd.Context(), &types.QueryGetBondByIDRequest{Id: id}) if err != nil { return err } diff --git a/x/bond/client/cli/tx.go b/x/bond/client/cli/tx.go index 3136ffb0..0ea49cbd 100644 --- a/x/bond/client/cli/tx.go +++ b/x/bond/client/cli/tx.go @@ -65,13 +65,13 @@ func RefillBondCmd() *cobra.Command { if err != nil { return err } - bondId := args[0] + bondID := args[0] coin, err := sdk.ParseCoinNormalized(args[1]) if err != nil { return err } - msg := types.NewMsgRefillBond(bondId, coin, clientCtx.GetFromAddress()) + msg := types.NewMsgRefillBond(bondID, coin, clientCtx.GetFromAddress()) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } @@ -91,13 +91,13 @@ func WithdrawBondCmd() *cobra.Command { if err != nil { return err } - bondId := args[0] + bondID := args[0] coin, err := sdk.ParseCoinNormalized(args[1]) if err != nil { return err } - msg := types.NewMsgWithdrawBond(bondId, coin, clientCtx.GetFromAddress()) + msg := types.NewMsgWithdrawBond(bondID, coin, clientCtx.GetFromAddress()) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } @@ -117,8 +117,8 @@ func CancelBondCmd() *cobra.Command { if err != nil { return err } - bondId := args[0] - msg := types.NewMsgCancelBond(bondId, clientCtx.GetFromAddress()) + bondID := args[0] + msg := types.NewMsgCancelBond(bondID, clientCtx.GetFromAddress()) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) }, } diff --git a/x/bond/client/testutil/grpc.go b/x/bond/client/testutil/grpc.go index 658f3d28..df0e20d9 100644 --- a/x/bond/client/testutil/grpc.go +++ b/x/bond/client/testutil/grpc.go @@ -13,7 +13,7 @@ import ( func (s *IntegrationTestSuite) TestGRPCGetBonds() { val := s.network.Validators[0] sr := s.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress) testCases := []struct { name string @@ -24,7 +24,7 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() { }{ { "invalid request with headers", - reqUrl + "asdasdas", + reqURL + "asdasdas", true, "", func() { @@ -32,7 +32,7 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() { }, { "valid request", - reqUrl, + reqURL, false, "", func() { @@ -58,9 +58,9 @@ func (s *IntegrationTestSuite) TestGRPCGetBonds() { func (s *IntegrationTestSuite) TestGRPCGetParams() { val := s.network.Validators[0] sr := s.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress) - resp, err := rest.GetRequest(reqUrl) + resp, err := rest.GetRequest(reqURL) s.Require().NoError(err) var params bondtypes.QueryParamsResponse @@ -73,7 +73,7 @@ func (s *IntegrationTestSuite) TestGRPCGetParams() { func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/by-owner/%s" + reqURL := val.APIAddress + "/vulcanize/bond/v1beta1/by-owner/%s" testCases := []struct { name string @@ -83,14 +83,14 @@ func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() { }{ { "empty list", - fmt.Sprintf(reqUrl, "asdasd"), + fmt.Sprintf(reqURL, "asdasd"), true, func() { }, }, { "valid request", - fmt.Sprintf(reqUrl, s.accountAddress), + fmt.Sprintf(reqURL, s.accountAddress), false, func() { s.createBond() @@ -121,10 +121,10 @@ func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() { } } -func (s *IntegrationTestSuite) TestGRPCGetBondById() { +func (s *IntegrationTestSuite) TestGRPCGetBondByID() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/bonds/%s" + reqURL := val.APIAddress + "/vulcanize/bond/v1beta1/bonds/%s" testCases := []struct { name string @@ -134,7 +134,7 @@ func (s *IntegrationTestSuite) TestGRPCGetBondById() { }{ { "invalid request", - fmt.Sprintf(reqUrl, "asdadad"), + fmt.Sprintf(reqURL, "asdadad"), true, func() string { return "" @@ -142,7 +142,7 @@ func (s *IntegrationTestSuite) TestGRPCGetBondById() { }, { "valid request", - reqUrl, + reqURL, false, func() string { // creating the bond @@ -162,30 +162,30 @@ func (s *IntegrationTestSuite) TestGRPCGetBondById() { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - return bond.GetId() + return bond.GetID() }, }, } for _, tc := range testCases { s.Run(tc.name, func() { - var bondId string + var bondID string if !tc.expErr { - bondId = tc.preRun() - tc.url = fmt.Sprintf(reqUrl, bondId) + bondID = tc.preRun() + tc.url = fmt.Sprintf(reqURL, bondID) } resp, err := rest.GetRequest(tc.url) s.Require().NoError(err) - var bonds bondtypes.QueryGetBondByIdResponse + var bonds bondtypes.QueryGetBondByIDResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) if tc.expErr { - sr.Empty(bonds.GetBond().GetId()) + sr.Empty(bonds.GetBond().GetID()) } else { sr.NoError(err) - sr.NotZero(bonds.GetBond().GetId()) - sr.Equal(bonds.GetBond().GetId(), bondId) + sr.NotZero(bonds.GetBond().GetID()) + sr.Equal(bonds.GetBond().GetID(), bondID) } }) } @@ -194,13 +194,13 @@ func (s *IntegrationTestSuite) TestGRPCGetBondById() { func (s *IntegrationTestSuite) TestGRPCGetBondModuleBalance() { val := s.network.Validators[0] sr := s.Require() - reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress) + reqURL := fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress) // creating the bond s.createBond() s.Run("valid request", func() { - resp, err := rest.GetRequest(reqUrl) + resp, err := rest.GetRequest(reqURL) sr.NoError(err) var response bondtypes.QueryGetBondModuleBalanceResponse diff --git a/x/bond/client/testutil/query.go b/x/bond/client/testutil/query.go index 85a77680..c726a309 100644 --- a/x/bond/client/testutil/query.go +++ b/x/bond/client/testutil/query.go @@ -163,7 +163,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondLists() { } } -func (s *IntegrationTestSuite) TestGetQueryBondById() { +func (s *IntegrationTestSuite) TestGetQueryBondByID() { val := s.network.Validators[0] sr := s.Require() testCases := []struct { @@ -205,7 +205,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - return bond.GetId() + return bond.GetID() }, }, } @@ -214,20 +214,20 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() { s.Run(fmt.Sprintf("Case %s", tc.name), func() { clientCtx := val.ClientCtx if !tc.err { - bondId := tc.preRun() - tc.args = append([]string{bondId}, tc.args...) + bondID := tc.preRun() + tc.args = append([]string{bondID}, tc.args...) } - cmd := cli.GetBondByIdCmd() + cmd := cli.GetBondByIDCmd() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) sr.NoError(err) - var queryResponse types.QueryGetBondByIdResponse + var queryResponse types.QueryGetBondByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) sr.NoError(err) if tc.err { - sr.Zero(len(queryResponse.GetBond().GetId())) + sr.Zero(len(queryResponse.GetBond().GetID())) } else { - sr.NotZero(len(queryResponse.GetBond().GetId())) + sr.NotZero(len(queryResponse.GetBond().GetID())) sr.Equal(s.accountAddress, queryResponse.GetBond().GetOwner()) } }) diff --git a/x/bond/client/testutil/tx.go b/x/bond/client/testutil/tx.go index a423a217..a43c34b9 100644 --- a/x/bond/client/testutil/tx.go +++ b/x/bond/client/testutil/tx.go @@ -118,7 +118,7 @@ func (s *IntegrationTestSuite) TestTxRefillBond() { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - tc.args = append([]string{bond.GetId()}, tc.args...) + tc.args = append([]string{bond.GetID()}, tc.args...) } out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.err { @@ -131,14 +131,14 @@ func (s *IntegrationTestSuite) TestTxRefillBond() { sr.Zero(d.Code) // checking the balance of bond - cmd := cli.GetBondByIdCmd() + cmd := cli.GetBondByIDCmd() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ fmt.Sprintf(tc.args[0]), fmt.Sprintf("--%s=json", tmcli.OutputFlag), }) sr.NoError(err) - var queryResponse types.QueryGetBondByIdResponse + var queryResponse types.QueryGetBondByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) sr.NoError(err) @@ -204,7 +204,7 @@ func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - tc.args = append([]string{bond.GetId()}, tc.args...) + tc.args = append([]string{bond.GetID()}, tc.args...) } out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.err { @@ -217,14 +217,14 @@ func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() { sr.Zero(d.Code) // checking the balance of bond - cmd := cli.GetBondByIdCmd() + cmd := cli.GetBondByIDCmd() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ fmt.Sprintf(tc.args[0]), fmt.Sprintf("--%s=json", tmcli.OutputFlag), }) sr.NoError(err) - var queryResponse types.QueryGetBondByIdResponse + var queryResponse types.QueryGetBondByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) sr.NoError(err) @@ -288,7 +288,7 @@ func (s *IntegrationTestSuite) TestTxCancelBond() { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - tc.args = append([]string{bond.GetId()}, tc.args...) + tc.args = append([]string{bond.GetID()}, tc.args...) } out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) if tc.err { @@ -301,18 +301,18 @@ func (s *IntegrationTestSuite) TestTxCancelBond() { sr.Zero(d.Code) // checking the bond exists or not after cancel - cmd := cli.GetBondByIdCmd() + cmd := cli.GetBondByIDCmd() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ fmt.Sprintf(tc.args[0]), fmt.Sprintf("--%s=json", tmcli.OutputFlag), }) sr.NoError(err) - var queryResponse types.QueryGetBondByIdResponse + var queryResponse types.QueryGetBondByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) sr.NoError(err) - sr.Zero(queryResponse.GetBond().GetId()) + sr.Zero(queryResponse.GetBond().GetID()) } }) } diff --git a/x/bond/keeper/grpc_query.go b/x/bond/keeper/grpc_query.go index b7fad21f..dba329af 100644 --- a/x/bond/keeper/grpc_query.go +++ b/x/bond/keeper/grpc_query.go @@ -26,14 +26,14 @@ func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types. return &types.QueryParamsResponse{Params: ¶ms}, nil } -func (q Querier) GetBondById(c context.Context, req *types.QueryGetBondByIdRequest) (*types.QueryGetBondByIdResponse, error) { +func (q Querier) GetBondByID(c context.Context, req *types.QueryGetBondByIDRequest) (*types.QueryGetBondByIDResponse, error) { ctx := sdk.UnwrapSDKContext(c) - bondId := req.GetId() - if len(bondId) == 0 { + bondID := req.GetID() + if len(bondID) == 0 { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bond id required") } - bond := q.Keeper.GetBond(ctx, req.GetId()) - return &types.QueryGetBondByIdResponse{Bond: &bond}, nil + bond := q.Keeper.GetBond(ctx, req.GetID()) + return &types.QueryGetBondByIDResponse{Bond: &bond}, nil } func (q Querier) GetBondsByOwner(c context.Context, req *types.QueryGetBondsByOwnerRequest) (*types.QueryGetBondsByOwnerResponse, error) { diff --git a/x/bond/keeper/grpc_query_test.go b/x/bond/keeper/grpc_query_test.go index 519db248..56d51ead 100644 --- a/x/bond/keeper/grpc_query_test.go +++ b/x/bond/keeper/grpc_query_test.go @@ -84,21 +84,21 @@ func (suite *KeeperTestSuite) TestGrpcQueryBondBondId() { testCases := []struct { msg string - req *types.QueryGetBondByIdRequest + req *types.QueryGetBondByIDRequest createBonds bool errResponse bool bondId string }{ { "empty request", - &types.QueryGetBondByIdRequest{}, + &types.QueryGetBondByIDRequest{}, false, true, "", }, { "Get Bond By ID", - &types.QueryGetBondByIdRequest{}, + &types.QueryGetBondByIDRequest{}, true, false, "", @@ -120,11 +120,11 @@ func (suite *KeeperTestSuite) TestGrpcQueryBondBondId() { suiteRequire.NoError(err) test.req.Id = bond.Id } - resp, err := grpcClient.GetBondById(context.Background(), test.req) + resp, err := grpcClient.GetBondByID(context.Background(), test.req) if !test.errResponse { suiteRequire.Nil(err) suiteRequire.NotNil(resp.GetBond()) - suiteRequire.Equal(test.req.Id, resp.GetBond().GetId()) + suiteRequire.Equal(test.req.Id, resp.GetBond().GetID()) } else { suiteRequire.NotNil(err) suiteRequire.Error(err) diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go index ab7f9884..7db7394f 100644 --- a/x/bond/keeper/msg_server.go +++ b/x/bond/keeper/msg_server.go @@ -62,7 +62,7 @@ func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*typ sdk.NewEvent( types.EventTypeRefillBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + sdk.NewAttribute(types.AttributeKeyBondID, msg.Id), sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), ), sdk.NewEvent( @@ -92,7 +92,7 @@ func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) ( sdk.NewEvent( types.EventTypeWithdrawBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + sdk.NewAttribute(types.AttributeKeyBondID, msg.Id), sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), ), sdk.NewEvent( @@ -120,7 +120,7 @@ func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*typ sdk.NewEvent( types.EventTypeCancelBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + sdk.NewAttribute(types.AttributeKeyBondID, msg.Id), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/x/bond/types/bond.pb.go b/x/bond/types/bond.pb.go index f078d51c..3fc0ae62 100644 --- a/x/bond/types/bond.pb.go +++ b/x/bond/types/bond.pb.go @@ -114,7 +114,7 @@ func (m *Bond) XXX_DiscardUnknown() { var xxx_messageInfo_Bond proto.InternalMessageInfo -func (m *Bond) GetId() string { +func (m *Bond) GetID() string { if m != nil { return m.Id } diff --git a/x/bond/types/events.go b/x/bond/types/events.go index 11a7fd42..c1f8a203 100644 --- a/x/bond/types/events.go +++ b/x/bond/types/events.go @@ -10,6 +10,6 @@ const ( AttributeKeySigner = "signer" AttributeKeyAmount = "amount" - AttributeKeyBondId = "bond_id" + AttributeKeyBondID = "bond_id" AttributeValueCategory = ModuleName ) diff --git a/x/bond/types/expected_keeper.go b/x/bond/types/expected_keeper.go index a17e8931..5282a005 100644 --- a/x/bond/types/expected_keeper.go +++ b/x/bond/types/expected_keeper.go @@ -8,5 +8,5 @@ import ( // Used to, for example, prevent deletion of a bond that's in use. type BondUsageKeeper interface { ModuleName() string - UsesBond(ctx sdk.Context, bondId string) bool + UsesBond(ctx sdk.Context, bondID string) bool } diff --git a/x/bond/types/query.pb.go b/x/bond/types/query.pb.go index 6cd479d9..2a075f04 100644 --- a/x/bond/types/query.pb.go +++ b/x/bond/types/query.pb.go @@ -214,23 +214,23 @@ func (m *QueryGetBondsResponse) GetPagination() *query.PageResponse { return nil } -// QueryGetBondById -type QueryGetBondByIdRequest struct { +// QueryGetBondByID +type QueryGetBondByIDRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` } -func (m *QueryGetBondByIdRequest) Reset() { *m = QueryGetBondByIdRequest{} } -func (m *QueryGetBondByIdRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetBondByIdRequest) ProtoMessage() {} -func (*QueryGetBondByIdRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetBondByIDRequest) Reset() { *m = QueryGetBondByIDRequest{} } +func (m *QueryGetBondByIDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondByIDRequest) ProtoMessage() {} +func (*QueryGetBondByIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_2f225717b20da431, []int{4} } -func (m *QueryGetBondByIdRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetBondByIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBondByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetBondByIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBondByIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetBondByIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -240,42 +240,42 @@ func (m *QueryGetBondByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryGetBondByIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBondByIdRequest.Merge(m, src) +func (m *QueryGetBondByIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondByIDRequest.Merge(m, src) } -func (m *QueryGetBondByIdRequest) XXX_Size() int { +func (m *QueryGetBondByIDRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetBondByIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBondByIdRequest.DiscardUnknown(m) +func (m *QueryGetBondByIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondByIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBondByIdRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetBondByIDRequest proto.InternalMessageInfo -func (m *QueryGetBondByIdRequest) GetId() string { +func (m *QueryGetBondByIDRequest) GetID() string { if m != nil { return m.Id } return "" } -// QueryGetBondByIdResponse returns QueryGetBondById query response -type QueryGetBondByIdResponse struct { +// QueryGetBondByIDResponse returns QueryGetBondByID query response +type QueryGetBondByIDResponse struct { Bond *Bond `protobuf:"bytes,1,opt,name=bond,proto3" json:"bond,omitempty" json:"bond" yaml:"bond"` } -func (m *QueryGetBondByIdResponse) Reset() { *m = QueryGetBondByIdResponse{} } -func (m *QueryGetBondByIdResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetBondByIdResponse) ProtoMessage() {} -func (*QueryGetBondByIdResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetBondByIDResponse) Reset() { *m = QueryGetBondByIDResponse{} } +func (m *QueryGetBondByIDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondByIDResponse) ProtoMessage() {} +func (*QueryGetBondByIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_2f225717b20da431, []int{5} } -func (m *QueryGetBondByIdResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetBondByIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBondByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetBondByIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBondByIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetBondByIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,19 +285,19 @@ func (m *QueryGetBondByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryGetBondByIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBondByIdResponse.Merge(m, src) +func (m *QueryGetBondByIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondByIDResponse.Merge(m, src) } -func (m *QueryGetBondByIdResponse) XXX_Size() int { +func (m *QueryGetBondByIDResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetBondByIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBondByIdResponse.DiscardUnknown(m) +func (m *QueryGetBondByIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondByIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBondByIdResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetBondByIDResponse proto.InternalMessageInfo -func (m *QueryGetBondByIdResponse) GetBond() *Bond { +func (m *QueryGetBondByIDResponse) GetBond() *Bond { if m != nil { return m.Bond } @@ -499,8 +499,8 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.bond.v1beta1.QueryParamsResponse") proto.RegisterType((*QueryGetBondsRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondsRequest") proto.RegisterType((*QueryGetBondsResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondsResponse") - proto.RegisterType((*QueryGetBondByIdRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIdRequest") - proto.RegisterType((*QueryGetBondByIdResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIdResponse") + proto.RegisterType((*QueryGetBondByIDRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIDRequest") + proto.RegisterType((*QueryGetBondByIDResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIDResponse") proto.RegisterType((*QueryGetBondsByOwnerRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest") proto.RegisterType((*QueryGetBondsByOwnerResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse") proto.RegisterType((*QueryGetBondModuleBalanceRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest") @@ -512,55 +512,55 @@ func init() { } var fileDescriptor_2f225717b20da431 = []byte{ - // 759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0x40, 0x82, 0xb8, 0x0e, 0x48, 0xd7, 0x94, 0xb6, 0x69, 0x6b, 0x27, 0x27, 0x68, - 0xa3, 0x40, 0x7c, 0xfd, 0xc1, 0x00, 0x8c, 0x46, 0xa2, 0x62, 0xa8, 0xa0, 0x96, 0x10, 0x12, 0x03, - 0x92, 0x63, 0x9f, 0xc2, 0x41, 0x72, 0x97, 0xc6, 0x4e, 0x21, 0x94, 0x2e, 0xdd, 0x10,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0xc1, - 0x84, 0x78, 0x94, 0x2a, 0xb1, 0x35, 0x90, 0x5f, 0x1c, 0x3d, 0x40, 0x91, 0x95, 0x05, 0xd9, 0x25, - 0x88, 0x86, 0x92, 0xe1, 0x2d, 0xea, 0x6d, 0xc3, 0x4f, 0x1a, 0xb8, 0x70, 0x64, 0x9a, 0xe0, 0xca, - 0x48, 0x8d, 0x48, 0x8e, 0x7e, 0xfe, 0xda, 0xe9, 0x82, 0x14, 0xea, 0xa2, 0x40, 0x2d, 0xc3, 0xd2, - 0x40, 0xd4, 0x4e, 0x45, 0x2c, 0x11, 0xbc, 0x25, 0x2e, 0xdb, 0xf0, 0x8b, 0x06, 0x26, 0xa2, 0x6c, - 0x89, 0xd1, 0x80, 0xd7, 0x47, 0x21, 0x38, 0x69, 0xe4, 0xf2, 0x37, 0xfe, 0x22, 0x52, 0x19, 0x58, - 0x10, 0x06, 0x8a, 0xd0, 0x18, 0x68, 0x40, 0x06, 0x58, 0xd6, 0xee, 0xbe, 0xae, 0xed, 0xed, 0xeb, - 0xda, 0xcf, 0x7d, 0x5d, 0x7b, 0x73, 0xa0, 0xa7, 0xf6, 0x0e, 0xf4, 0xd4, 0xf7, 0x03, 0x3d, 0xf5, - 0x30, 0x31, 0x78, 0xa4, 0xe5, 0x56, 0x28, 0xc7, 0x75, 0xc7, 0xe5, 0x8c, 0xba, 0x1e, 0x7e, 0x2e, - 0xb3, 0x89, 0xf1, 0xab, 0x66, 0xc5, 0xff, 0xf9, 0xca, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, - 0x62, 0x7c, 0x63, 0xb0, 0x08, 0x00, 0x00, + // 761 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x3f, 0x6f, 0xd3, 0x4e, + 0x18, 0xc7, 0xe3, 0xfc, 0x7e, 0x09, 0xe2, 0x3a, 0x20, 0x5d, 0x53, 0xda, 0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x22, 0xb0, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -580,7 +580,7 @@ type QueryClient interface { // Bonds queries bonds list. Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) // GetBondById - GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) + GetBondByID(ctx context.Context, in *QueryGetBondByIDRequest, opts ...grpc.CallOption) (*QueryGetBondByIDResponse, error) // Get Bonds List by Owner GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOwnerRequest, opts ...grpc.CallOption) (*QueryGetBondsByOwnerResponse, error) // Get Bonds module balance @@ -613,9 +613,9 @@ func (c *queryClient) Bonds(ctx context.Context, in *QueryGetBondsRequest, opts return out, nil } -func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) { - out := new(QueryGetBondByIdResponse) - err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/GetBondById", in, out, opts...) +func (c *queryClient) GetBondByID(ctx context.Context, in *QueryGetBondByIDRequest, opts ...grpc.CallOption) (*QueryGetBondByIDResponse, error) { + out := new(QueryGetBondByIDResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/GetBondByID", in, out, opts...) if err != nil { return nil, err } @@ -647,7 +647,7 @@ type QueryServer interface { // Bonds queries bonds list. Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) // GetBondById - GetBondById(context.Context, *QueryGetBondByIdRequest) (*QueryGetBondByIdResponse, error) + GetBondByID(context.Context, *QueryGetBondByIDRequest) (*QueryGetBondByIDResponse, error) // Get Bonds List by Owner GetBondsByOwner(context.Context, *QueryGetBondsByOwnerRequest) (*QueryGetBondsByOwnerResponse, error) // Get Bonds module balance @@ -664,8 +664,8 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) Bonds(ctx context.Context, req *QueryGetBondsRequest) (*QueryGetBondsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Bonds not implemented") } -func (*UnimplementedQueryServer) GetBondById(ctx context.Context, req *QueryGetBondByIdRequest) (*QueryGetBondByIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBondById not implemented") +func (*UnimplementedQueryServer) GetBondByID(ctx context.Context, req *QueryGetBondByIDRequest) (*QueryGetBondByIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBondByID not implemented") } func (*UnimplementedQueryServer) GetBondsByOwner(ctx context.Context, req *QueryGetBondsByOwnerRequest) (*QueryGetBondsByOwnerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBondsByOwner not implemented") @@ -714,20 +714,20 @@ func _Query_Bonds_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -func _Query_GetBondById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetBondByIdRequest) +func _Query_GetBondByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondByIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetBondById(ctx, in) + return srv.(QueryServer).GetBondByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/vulcanize.bond.v1beta1.Query/GetBondById", + FullMethod: "/vulcanize.bond.v1beta1.Query/GetBondByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetBondById(ctx, req.(*QueryGetBondByIdRequest)) + return srv.(QueryServer).GetBondByID(ctx, req.(*QueryGetBondByIDRequest)) } return interceptor(ctx, in, info, handler) } @@ -781,8 +781,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Bonds_Handler, }, { - MethodName: "GetBondById", - Handler: _Query_GetBondById_Handler, + MethodName: "GetBondByID", + Handler: _Query_GetBondByID_Handler, }, { MethodName: "GetBondsByOwner", @@ -939,7 +939,7 @@ func (m *QueryGetBondsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryGetBondByIdRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetBondByIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -949,12 +949,12 @@ func (m *QueryGetBondByIdRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetBondByIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetBondByIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetBondByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetBondByIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -969,7 +969,7 @@ func (m *QueryGetBondByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryGetBondByIdResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetBondByIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -979,12 +979,12 @@ func (m *QueryGetBondByIdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetBondByIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetBondByIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetBondByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetBondByIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1220,7 +1220,7 @@ func (m *QueryGetBondsResponse) Size() (n int) { return n } -func (m *QueryGetBondByIdRequest) Size() (n int) { +func (m *QueryGetBondByIDRequest) Size() (n int) { if m == nil { return 0 } @@ -1233,7 +1233,7 @@ func (m *QueryGetBondByIdRequest) Size() (n int) { return n } -func (m *QueryGetBondByIdResponse) Size() (n int) { +func (m *QueryGetBondByIDResponse) Size() (n int) { if m == nil { return 0 } @@ -1654,7 +1654,7 @@ func (m *QueryGetBondsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetBondByIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetBondByIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1677,10 +1677,10 @@ func (m *QueryGetBondByIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetBondByIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetBondByIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetBondByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetBondByIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1736,7 +1736,7 @@ func (m *QueryGetBondByIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetBondByIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetBondByIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1759,10 +1759,10 @@ func (m *QueryGetBondByIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetBondByIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetBondByIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetBondByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetBondByIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/bond/types/query.pb.gw.go b/x/bond/types/query.pb.gw.go index cdb30933..e11ed2c6 100644 --- a/x/bond/types/query.pb.gw.go +++ b/x/bond/types/query.pb.gw.go @@ -85,8 +85,8 @@ func local_request_Query_Bonds_0(ctx context.Context, marshaler runtime.Marshale } -func request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetBondByIdRequest +func request_Query_GetBondByID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondByIDRequest var metadata runtime.ServerMetadata var ( @@ -107,13 +107,13 @@ func request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - msg, err := client.GetBondById(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetBondByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetBondByIdRequest +func local_request_Query_GetBondByID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondByIDRequest var metadata runtime.ServerMetadata var ( @@ -134,7 +134,7 @@ func local_request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } - msg, err := server.GetBondById(ctx, &protoReq) + msg, err := server.GetBondByID(ctx, &protoReq) return msg, metadata, err } @@ -275,7 +275,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetBondById_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetBondByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -284,14 +284,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetBondById_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetBondByID_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetBondById_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetBondByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -416,7 +416,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetBondById_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetBondByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -425,14 +425,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetBondById_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetBondByID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetBondById_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetBondByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -484,7 +484,7 @@ var ( pattern_Query_Bonds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "bonds"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetBondById_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "bond", "v1beta1", "bonds", "id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetBondByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "bond", "v1beta1", "bonds", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetBondsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "bond", "v1beta1", "by-owner", "owner"}, "", runtime.AssumeColonVerbOpt(true))) @@ -496,7 +496,7 @@ var ( forward_Query_Bonds_0 = runtime.ForwardResponseMessage - forward_Query_GetBondById_0 = runtime.ForwardResponseMessage + forward_Query_GetBondByID_0 = runtime.ForwardResponseMessage forward_Query_GetBondsByOwner_0 = runtime.ForwardResponseMessage diff --git a/x/nameservice/client/cli/query.go b/x/nameservice/client/cli/query.go index 95427ba2..fc7eb427 100644 --- a/x/nameservice/client/cli/query.go +++ b/x/nameservice/client/cli/query.go @@ -197,7 +197,7 @@ $ %s query %s get [ID] return err } queryClient := types.NewQueryClient(clientCtx) - record, err := queryClient.GetRecord(cmd.Context(), &types.QueryRecordByIdRequest{Id: args[0]}) + record, err := queryClient.GetRecord(cmd.Context(), &types.QueryRecordByIDRequest{Id: args[0]}) if err != nil { return err } @@ -261,7 +261,7 @@ $ %s query %s query-by-bond [bond id] queryClient := types.NewQueryClient(clientCtx) bondID := args[0] - res, err := queryClient.GetRecordByBondId(cmd.Context(), &types.QueryRecordByBondIdRequest{Id: bondID}) + res, err := queryClient.GetRecordByBondID(cmd.Context(), &types.QueryRecordByBondIDRequest{Id: bondID}) if err != nil { return err } diff --git a/x/nameservice/client/testutil/grpc.go b/x/nameservice/client/testutil/grpc.go index cbe35d48..485e6329 100644 --- a/x/nameservice/client/testutil/grpc.go +++ b/x/nameservice/client/testutil/grpc.go @@ -18,7 +18,7 @@ import ( func (s *IntegrationTestSuite) TestGRPCQueryParams() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/params" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/params" testCases := []struct { name string @@ -28,13 +28,13 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", }, { "Success", - reqUrl, + reqURL, false, "", }, @@ -131,7 +131,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() { func (s *IntegrationTestSuite) TestGRPCQueryLookup() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s" authorityName := "QueryLookUp" testCases := []struct { @@ -143,7 +143,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", func(authorityName string) { @@ -151,7 +151,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() { }, { "Success", - reqUrl, + reqURL, false, "", func(authorityName string) { @@ -165,7 +165,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() { s.Run(tc.name, func() { if !tc.expectErr { tc.preRun(authorityName) - tc.url = fmt.Sprintf(reqUrl, fmt.Sprintf("crn://%s/", authorityName)) + tc.url = fmt.Sprintf(reqURL, fmt.Sprintf("crn://%s/", authorityName)) } resp, _ := rest.GetRequest(tc.url) if tc.expectErr { @@ -234,7 +234,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { for _, tc := range testCases { s.Run(tc.name, func() { if !tc.expectErr { - tc.preRun(s.bondId) + tc.preRun(s.bondID) } // wait 12 seconds for records expires time.Sleep(time.Second * 12) @@ -378,7 +378,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { for _, tc := range testCases { s.Run(tc.name, func() { if !tc.expectErr { - tc.preRun(s.bondId) + tc.preRun(s.bondID) } resp, _ := rest.GetRequest(tc.url) require := s.Require() @@ -389,7 +389,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) sr.NoError(err) sr.NotZero(len(response.GetRecords())) - sr.Equal(s.bondId, response.GetRecords()[0].GetBondId()) + sr.Equal(s.bondID, response.GetRecords()[0].GetBondId()) } }) } @@ -398,7 +398,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records/%s" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/records/%s" testCases := []struct { name string @@ -409,7 +409,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", func(bondId string) string { @@ -418,7 +418,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { }, { "Success", - reqUrl, + reqURL, false, "", func(bondId string) string { @@ -436,29 +436,29 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { var records []nstypes.RecordType err = json.Unmarshal(out.Bytes(), &records) sr.NoError(err) - return records[0].Id + return records[0].ID }, }, } for _, tc := range testCases { s.Run(tc.name, func() { - var recordId string + var recordID string if !tc.expectErr { - recordId = tc.preRun(s.bondId) - tc.url = fmt.Sprintf(reqUrl, recordId) + recordID = tc.preRun(s.bondID) + tc.url = fmt.Sprintf(reqURL, recordID) } resp, _ := rest.GetRequest(tc.url) require := s.Require() if tc.expectErr { require.Contains(string(resp), tc.errorMsg) } else { - var response nstypes.QueryRecordByIdResponse + var response nstypes.QueryRecordByIDResponse err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) sr.NoError(err) record := response.GetRecord() - sr.NotZero(len(record.GetId())) - sr.Equal(record.GetId(), recordId) + sr.NotZero(len(record.GetID())) + sr.Equal(record.GetID(), recordID) } }) } @@ -467,7 +467,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records-by-bond-id/%s" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/records-by-bond-id/%s" testCases := []struct { name string @@ -478,7 +478,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", func(bondId string) { @@ -486,7 +486,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { }, { "Success", - reqUrl, + reqURL, false, "", func(bondId string) { @@ -499,20 +499,20 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { for _, tc := range testCases { s.Run(tc.name, func() { if !tc.expectErr { - tc.preRun(s.bondId) - tc.url = fmt.Sprintf(reqUrl, s.bondId) + tc.preRun(s.bondID) + tc.url = fmt.Sprintf(reqURL, s.bondID) } resp, _ := rest.GetRequest(tc.url) require := s.Require() if tc.expectErr { require.Contains(string(resp), tc.errorMsg) } else { - var response nstypes.QueryRecordByBondIdResponse + var response nstypes.QueryRecordByBondIDResponse err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) sr.NoError(err) records := response.GetRecords() sr.NotZero(len(records)) - sr.Equal(records[0].GetBondId(), s.bondId) + sr.Equal(records[0].GetBondId(), s.bondID) } }) } @@ -521,7 +521,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/balance" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/balance" testCases := []struct { name string @@ -532,7 +532,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", func(bondId string) { @@ -540,7 +540,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { }, { "Success", - reqUrl, + reqURL, false, "", func(bondId string) { @@ -553,7 +553,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { for _, tc := range testCases { s.Run(tc.name, func() { if !tc.expectErr { - tc.preRun(s.bondId) + tc.preRun(s.bondID) } resp, _ := rest.GetRequest(tc.url) require := s.Require() @@ -572,7 +572,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { val := s.network.Validators[0] sr := s.Require() - reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/names" + reqURL := val.APIAddress + "/vulcanize/nameservice/v1beta1/names" testCases := []struct { name string @@ -583,7 +583,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { }{ { "invalid url", - reqUrl + "/asdasd", + reqURL + "/asdasd", true, "", func(authorityName string) { @@ -591,7 +591,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { }, { "Success", - reqUrl, + reqURL, false, "", func(authorityName string) { @@ -620,7 +620,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { } } -func createRecord(bondId string, s *IntegrationTestSuite) { +func createRecord(bondID string, s *IntegrationTestSuite) { val := s.network.Validators[0] sr := s.Require() @@ -634,7 +634,7 @@ func createRecord(bondId string, s *IntegrationTestSuite) { fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), } - args = append([]string{payloadPath, bondId}, args...) + args = append([]string{payloadPath, bondID}, args...) clientCtx := val.ClientCtx cmd := cli.GetCmdSetRecord() diff --git a/x/nameservice/client/testutil/query.go b/x/nameservice/client/testutil/query.go index ee7026bd..08461a9e 100644 --- a/x/nameservice/client/testutil/query.go +++ b/x/nameservice/client/testutil/query.go @@ -51,7 +51,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { val := s.network.Validators[0] sr := s.Require() var recordID string - var bondId string + var bondID string testCases := []struct { name string @@ -76,12 +76,12 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { func() { CreateBond(s) // get the bond id from bond list - bondId := GetBondId(s) + bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) payloadPath := dir + "/example1.yml" args := []string{ - payloadPath, bondId, + payloadPath, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -118,8 +118,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { err := json.Unmarshal(out.Bytes(), &records) sr.NoError(err) sr.Equal(tc.noOfRecords, len(records)) - recordID = records[0].Id - bondId = GetBondId(s) + recordID = records[0].ID + bondID = GetBondID(s) } }) } @@ -152,7 +152,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { sr.Error(err) } else { sr.NoError(err) - var response types.QueryRecordByIdResponse + var response types.QueryRecordByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) sr.NoError(err) sr.NotNil(response.GetRecord()) @@ -173,7 +173,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { }, { "get records by bond-id", - []string{bondId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + []string{bondID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, false, }, } @@ -188,7 +188,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { sr.Error(err) } else { sr.NoError(err) - var response types.QueryRecordByBondIdResponse + var response types.QueryRecordByBondIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) sr.NoError(err) } @@ -542,11 +542,11 @@ func createNameRecord(authorityName string, s *IntegrationTestSuite) { CreateBond(s) // Get the bond-id - bondId := GetBondId(s) + bondID := GetBondID(s) // adding bond-id to name authority args = []string{ - authorityName, bondId, + authorityName, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=json", tmcli.OutputFlag), diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go index dea768e3..1baafa16 100644 --- a/x/nameservice/client/testutil/tx.go +++ b/x/nameservice/client/testutil/tx.go @@ -32,7 +32,7 @@ type IntegrationTestSuite struct { cfg network.Config network *network.Network - bondId string + bondID string } func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { @@ -63,7 +63,7 @@ func (s *IntegrationTestSuite) SetupSuite() { // setting up random account s.createAccountWithBalance(accountName) CreateBond(s) - s.bondId = GetBondId(s) + s.bondID = GetBondID(s) } func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) { @@ -139,7 +139,7 @@ func CreateBond(s *IntegrationTestSuite) { } } -func GetBondId(s *IntegrationTestSuite) string { +func GetBondID(s *IntegrationTestSuite) string { cmd := bondcli.GetQueryBondLists() val := s.network.Validators[0] sr := s.Require() @@ -153,7 +153,7 @@ func GetBondId(s *IntegrationTestSuite) string { // extract bond id from bonds list bond := queryResponse.GetBonds()[0] - return bond.GetId() + return bond.GetID() } func (s *IntegrationTestSuite) TestGetCmdSetRecord() { @@ -195,12 +195,12 @@ func (s *IntegrationTestSuite) TestGetCmdSetRecord() { // create the bond CreateBond(s) // get the bond id from bond list - bondId := GetBondId(s) + bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) payloadPath := dir + "/example1.yml" - tc.args = append([]string{payloadPath, bondId}, tc.args...) + tc.args = append([]string{payloadPath, bondID}, tc.args...) } clientCtx := val.ClientCtx cmd := cli.GetCmdSetRecord() @@ -345,11 +345,11 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() { CreateBond(s) // Get the bond-id - bondId := GetBondId(s) + bondID := GetBondID(s) // adding bond-id to name authority args = []string{ - authorityName, bondId, + authorityName, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -455,8 +455,8 @@ func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() { // creating the bond CreateBond(s) // getting the bond-id - bondId := GetBondId(s) - tc.args = append([]string{authorityName, bondId}, tc.args...) + bondID := GetBondID(s) + tc.args = append([]string{authorityName, bondID}, tc.args...) } clientCtx := val.ClientCtx cmd := cli.GetCmdSetAuthorityBond() @@ -577,13 +577,13 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { // create the bond CreateBond(s) // get the bond id from bond list - bondId := GetBondId(s) + bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) payloadPath := dir + "/example1.yml" args := []string{ - payloadPath, bondId, + payloadPath, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -609,7 +609,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { var records []nstypes.RecordType err = json.Unmarshal(out.Bytes(), &records) sr.NoError(err) - return records[0].Id + return records[0].ID }, func(recordId string, s *IntegrationTestSuite) { // checking the bond-id removed or not @@ -618,7 +618,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { cmd := cli.GetCmdGetResource() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) sr.NoError(err) - var response nstypes.QueryRecordByIdResponse + var response nstypes.QueryRecordByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) sr.NoError(err) record := response.GetRecord() @@ -630,10 +630,10 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { for _, tc := range testCasesForDeletingName { s.Run(fmt.Sprintf("Case %s", tc.name), func() { - var recordId string + var recordID string if !tc.err { - recordId = tc.preRun(s) - tc.args = append([]string{recordId}, tc.args...) + recordID = tc.preRun(s) + tc.args = append([]string{recordID}, tc.args...) } clientCtx := val.ClientCtx cmd := cli.GetCmdDissociateBond() @@ -648,7 +648,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { sr.NoError(err) sr.Zero(d.Code) // post-run - tc.postRun(recordId, s) + tc.postRun(recordID, s) } }) } @@ -819,13 +819,13 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { // create the bond CreateBond(s) // get the bond id from bond list - bondId := GetBondId(s) + bondID := GetBondID(s) dir, err := os.Getwd() sr.NoError(err) payloadPath := dir + "/example1.yml" txArgs := []string{ - payloadPath, bondId, + payloadPath, bondID, fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -854,14 +854,14 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { // GetCmdDissociateBond bond cmd = cli.GetCmdDissociateBond() - txArgs = append([]string{records[0].Id}, txArgs[2:]...) + txArgs = append([]string{records[0].ID}, txArgs[2:]...) out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, txArgs) sr.NoError(err) err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) sr.NoError(err) sr.Zero(d.Code) - return records[0].Id, records[0].BondId + return records[0].ID, records[0].BondID }, func(recordId, bondId string, s *IntegrationTestSuite) { // checking the bond-id removed or not @@ -870,7 +870,7 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { cmd := cli.GetCmdGetResource() out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) sr.NoError(err) - var response nstypes.QueryRecordByIdResponse + var response nstypes.QueryRecordByIDResponse err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) sr.NoError(err) record := response.GetRecord() @@ -882,11 +882,11 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { for _, tc := range testCasesForDeletingName { s.Run(fmt.Sprintf("Case %s", tc.name), func() { - var recordId string - var bondId string + var recordID string + var bondID string if !tc.err { - recordId, bondId = tc.preRun(s) - tc.args = append([]string{recordId, bondId}, tc.args...) + recordID, bondID = tc.preRun(s) + tc.args = append([]string{recordID, bondID}, tc.args...) } clientCtx := val.ClientCtx cmd := cli.GetCmdAssociateBond() @@ -901,7 +901,7 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { sr.NoError(err) sr.Zero(d.Code) // post-run - tc.postRun(recordId, bondId, s) + tc.postRun(recordID, bondID, s) } }) } diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index b3a70a38..262e82e1 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -63,7 +63,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { for name, record := range authorities { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, - Entry: &record, + Entry: &record, //nolint: all }) } diff --git a/x/nameservice/keeper/grpc_query.go b/x/nameservice/keeper/grpc_query.go index 1586ffa5..7ec073d6 100644 --- a/x/nameservice/keeper/grpc_query.go +++ b/x/nameservice/keeper/grpc_query.go @@ -30,8 +30,7 @@ func (q Querier) ListRecords(c context.Context, req *types.QueryListRecordsReque ctx := sdk.UnwrapSDKContext(c) attributes := req.GetAttributes() all := req.GetAll() - records := []types.Record{} - + var records []types.Record if len(attributes) > 0 { records = q.Keeper.MatchRecords(ctx, func(record *types.RecordType) bool { return MatchOnAttributes(record, attributes, all) @@ -43,20 +42,20 @@ func (q Querier) ListRecords(c context.Context, req *types.QueryListRecordsReque return &types.QueryListRecordsResponse{Records: records}, nil } -func (q Querier) GetRecord(c context.Context, req *types.QueryRecordByIdRequest) (*types.QueryRecordByIdResponse, error) { +func (q Querier) GetRecord(c context.Context, req *types.QueryRecordByIDRequest) (*types.QueryRecordByIDResponse, error) { ctx := sdk.UnwrapSDKContext(c) id := req.GetId() if !q.Keeper.HasRecord(ctx, id) { return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Record not found.") } record := q.Keeper.GetRecord(ctx, id) - return &types.QueryRecordByIdResponse{Record: record}, nil + return &types.QueryRecordByIDResponse{Record: record}, nil } -func (q Querier) GetRecordByBondId(c context.Context, req *types.QueryRecordByBondIdRequest) (*types.QueryRecordByBondIdResponse, error) { +func (q Querier) GetRecordByBondID(c context.Context, req *types.QueryRecordByBondIDRequest) (*types.QueryRecordByBondIDResponse, error) { ctx := sdk.UnwrapSDKContext(c) records := q.recordKeeper.QueryRecordsByBond(ctx, req.GetId()) - return &types.QueryRecordByBondIdResponse{Records: records}, nil + return &types.QueryRecordByBondIDResponse{Records: records}, nil } func (q Querier) GetNameServiceModuleBalance(c context.Context, _ *types.GetNameServiceModuleBalanceRequest) (*types.GetNameServiceModuleBalanceResponse, error) { @@ -122,7 +121,7 @@ func matchOnRecordField(record *types.RecordType, attr *types.QueryListRecordsRe case BondIDAttributeName: { fieldFound = true - if record.BondId != attr.Value.GetString_() { + if record.BondID != attr.Value.GetString_() { matched = false return } diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go index a166a033..8702b7b4 100644 --- a/x/nameservice/keeper/grpc_query_test.go +++ b/x/nameservice/keeper/grpc_query_test.go @@ -64,12 +64,12 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") sr.NoError(err) record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ - BondId: suite.bond.GetId(), + BondId: suite.bond.GetID(), Signer: suite.accounts[0].String(), Payload: payload.ToPayload(), }) sr.NoError(err) - sr.NotNil(record.Id) + sr.NotNil(record.ID) } resp, err := grpcClient.ListRecords(context.Background(), test.req) if test.expErr { @@ -78,9 +78,9 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.NoError(err) sr.Equal(test.noOfRecords, len(resp.GetRecords())) if test.createRecord { - recordId = resp.GetRecords()[0].GetId() + recordId = resp.GetRecords()[0].GetID() sr.NotZero(resp.GetRecords()) - sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) + sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetID()) } } }) @@ -89,21 +89,21 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { // Get the records by record id testCases1 := []struct { msg string - req *nameservicetypes.QueryRecordByIdRequest + req *nameservicetypes.QueryRecordByIDRequest createRecord bool expErr bool noOfRecords int }{ { "Invalid Request without record id", - &nameservicetypes.QueryRecordByIdRequest{}, + &nameservicetypes.QueryRecordByIDRequest{}, false, true, 0, }, { "With Record ID", - &nameservicetypes.QueryRecordByIdRequest{ + &nameservicetypes.QueryRecordByIDRequest{ Id: recordId, }, true, @@ -120,7 +120,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.NoError(err) sr.NotNil(resp.GetRecord()) if test.createRecord { - sr.Equal(resp.GetRecord().BondId, suite.bond.GetId()) + sr.Equal(resp.GetRecord().BondId, suite.bond.GetID()) sr.Equal(resp.GetRecord().Id, recordId) } } @@ -130,22 +130,22 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { // Get the records by record id testCasesByBondID := []struct { msg string - req *nameservicetypes.QueryRecordByBondIdRequest + req *nameservicetypes.QueryRecordByBondIDRequest createRecord bool expErr bool noOfRecords int }{ { "Invalid Request without bond id", - &nameservicetypes.QueryRecordByBondIdRequest{}, + &nameservicetypes.QueryRecordByBondIDRequest{}, false, true, 0, }, { "With Bond ID", - &nameservicetypes.QueryRecordByBondIdRequest{ - Id: suite.bond.GetId(), + &nameservicetypes.QueryRecordByBondIDRequest{ + Id: suite.bond.GetID(), }, true, false, @@ -154,7 +154,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { } for _, test := range testCasesByBondID { suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { - resp, err := grpcClient.GetRecordByBondId(context.Background(), test.req) + resp, err := grpcClient.GetRecordByBondID(context.Background(), test.req) if test.expErr { sr.Zero(resp.GetRecords()) } else { @@ -162,7 +162,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.NotNil(resp.GetRecords()) if test.createRecord { sr.NotZero(resp.GetRecords()) - sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) + sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetID()) } } }) @@ -195,12 +195,12 @@ func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() { payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") sr.NoError(err) record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ - BondId: suite.bond.GetId(), + BondId: suite.bond.GetID(), Signer: suite.accounts[0].String(), Payload: payload.ToPayload(), }) sr.NoError(err) - sr.NotNil(record.Id) + sr.NotNil(record.ID) } resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req) if test.expErr { diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go index 31d5c047..be86d0b4 100644 --- a/x/nameservice/keeper/keeper.go +++ b/x/nameservice/keeper/keeper.go @@ -175,7 +175,7 @@ func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord // ProcessSetRecord creates a record. func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordType, error) { payload := msg.Payload.ToReadablePayload() - record := types.RecordType{Attributes: payload.Record, BondId: msg.BondId} + record := types.RecordType{Attributes: payload.Record, BondID: msg.BondId} // Check signatures. resourceSignBytes, _ := record.GetSignBytes() @@ -184,9 +184,9 @@ func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*type return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid record JSON") } - record.Id = cid + record.ID = cid - if exists := k.HasRecord(ctx, record.Id); exists { + if exists := k.HasRecord(ctx, record.ID); exists { // Immutable record already exists. No-op. return &record, nil } @@ -220,7 +220,7 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenew params := k.GetParams(ctx) rent := params.RecordRent - err := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondId, types.RecordRentModuleAccountName, sdk.NewCoins(rent)) + err := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondID, types.RecordRentModuleAccountName, sdk.NewCoins(rent)) if err != nil { return err } @@ -234,7 +234,7 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenew // Renewal doesn't change the name and bond indexes. if !isRenewal { - k.AddBondToRecordIndexEntry(ctx, record.BondId, record.Id) + k.AddBondToRecordIndexEntry(ctx, record.BondID, record.ID) } return nil diff --git a/x/nameservice/keeper/msg_server.go b/x/nameservice/keeper/msg_server.go index c9a36708..d68fcc10 100644 --- a/x/nameservice/keeper/msg_server.go +++ b/x/nameservice/keeper/msg_server.go @@ -38,7 +38,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types sdk.NewEvent( types.EventTypeSetRecord, sdk.NewAttribute(types.AttributeKeySigner, msg.GetSigner()), - sdk.NewAttribute(types.AttributeKeyBondId, msg.GetBondId()), + sdk.NewAttribute(types.AttributeKeyBondID, msg.GetBondId()), sdk.NewAttribute(types.AttributeKeyPayload, msg.Payload.String()), ), sdk.NewEvent( @@ -48,7 +48,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types ), }) - return &types.MsgSetRecordResponse{Id: record.Id}, nil + return &types.MsgSetRecordResponse{Id: record.ID}, nil } //nolint: all @@ -124,7 +124,7 @@ func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorit types.EventTypeAuthorityBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), sdk.NewAttribute(types.AttributeKeyName, msg.Name), - sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + sdk.NewAttribute(types.AttributeKeyBondID, msg.BondId), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -163,6 +163,9 @@ func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthori func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*types.MsgRenewRecordResponse, error) { ctx := sdk.UnwrapSDKContext(c) _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } err = m.Keeper.ProcessRenewRecord(ctx, *msg) if err != nil { return nil, err @@ -171,7 +174,7 @@ func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*t sdk.NewEvent( types.EventTypeRenewRecord, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), + sdk.NewAttribute(types.AttributeKeyRecordID, msg.RecordId), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -198,8 +201,8 @@ func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) sdk.NewEvent( types.EventTypeAssociateBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), - sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + sdk.NewAttribute(types.AttributeKeyRecordID, msg.RecordId), + sdk.NewAttribute(types.AttributeKeyBondID, msg.BondId), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -224,7 +227,7 @@ func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBon sdk.NewEvent( types.EventTypeDissociateBond, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), + sdk.NewAttribute(types.AttributeKeyRecordID, msg.RecordId), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -249,7 +252,7 @@ func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociate sdk.NewEvent( types.EventTypeDissociateRecords, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + sdk.NewAttribute(types.AttributeKeyBondID, msg.BondId), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -260,19 +263,23 @@ func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociate return &types.MsgDissociateRecordsResponse{}, nil } -func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { +func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { //nolint: all ctx := sdk.UnwrapSDKContext(c) _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return nil, err } err = m.Keeper.ProcessReAssociateRecords(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeReAssociateRecords, sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), - sdk.NewAttribute(types.AttributeKeyOldBondId, msg.OldBondId), - sdk.NewAttribute(types.AttributeKeyNewBondId, msg.NewBondId), + sdk.NewAttribute(types.AttributeKeyOldBondID, msg.OldBondId), + sdk.NewAttribute(types.AttributeKeyNewBondID, msg.NewBondId), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/x/nameservice/keeper/naming_keeper.go b/x/nameservice/keeper/naming_keeper.go index bac988b8..341ede61 100644 --- a/x/nameservice/keeper/naming_keeper.go +++ b/x/nameservice/keeper/naming_keeper.go @@ -651,7 +651,6 @@ func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (e defer itr.Close() for ; itr.Valid(); itr.Next() { - timeslice := []string{} timeslice, err := helpers.BytesArrToStringArr(itr.Value()) if err != nil { panic(err) diff --git a/x/nameservice/keeper/record_keeper.go b/x/nameservice/keeper/record_keeper.go index 83f6f881..14562a59 100644 --- a/x/nameservice/keeper/record_keeper.go +++ b/x/nameservice/keeper/record_keeper.go @@ -25,8 +25,8 @@ func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionID string) bool { return k.GetAuctionToAuthorityMapping(ctx, auctionID) != "" } -func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionId string) { - updateBlockChangeSetForAuction(ctx, k, auctionId) +func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionID string) { + updateBlockChangeSetForAuction(ctx, k, auctionID) } func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string) { @@ -111,8 +111,8 @@ func (k RecordKeeper) GetAuctionToAuthorityMapping(ctx sdk.Context, auctionID st } // UsesBond returns true if the bond has associated records. -func (k RecordKeeper) UsesBond(ctx sdk.Context, bondId string) bool { - bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondId)...) //nolint: all +func (k RecordKeeper) UsesBond(ctx sdk.Context, bondID string) bool { + bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondID)...) //nolint: all store := ctx.KVStore(k.storeKey) itr := sdk.KVStorePrefixIterator(store, bondIDPrefix) defer itr.Close() diff --git a/x/nameservice/types/events.go b/x/nameservice/types/events.go index d376f131..7fbe585d 100644 --- a/x/nameservice/types/events.go +++ b/x/nameservice/types/events.go @@ -13,13 +13,13 @@ const ( AttributeKeySigner = "signer" AttributeKeyOwner = "owner" - AttributeKeyBondId = "bond-id" + AttributeKeyBondID = "bond-id" AttributeKeyPayload = "payload" - AttributeKeyOldBondId = "old-bond-id" - AttributeKeyNewBondId = "new-bond-id" + AttributeKeyOldBondID = "old-bond-id" + AttributeKeyNewBondID = "new-bond-id" AttributeKeyCID = "cid" AttributeKeyName = "name" AttributeKeyCRN = "crn" - AttributeKeyRecordId = "record-id" + AttributeKeyRecordID = "record-id" AttributeValueCategory = ModuleName ) diff --git a/x/nameservice/types/msg.go b/x/nameservice/types/msg.go index 72e58653..b919f177 100644 --- a/x/nameservice/types/msg.go +++ b/x/nameservice/types/msg.go @@ -99,11 +99,11 @@ func (msg MsgReserveAuthority) GetSigners() []sdk.AccAddress { } // NewMsgSetAuthorityBond is the constructor function for MsgSetAuthorityBond. -func NewMsgSetAuthorityBond(name string, bondId string, signer sdk.AccAddress) MsgSetAuthorityBond { +func NewMsgSetAuthorityBond(name string, bondID string, signer sdk.AccAddress) MsgSetAuthorityBond { return MsgSetAuthorityBond{ Name: name, Signer: signer.String(), - BondId: bondId, + BondId: bondID, } } diff --git a/x/nameservice/types/nameservice.pb.go b/x/nameservice/types/nameservice.pb.go index 19b2e22a..a9c1cfba 100644 --- a/x/nameservice/types/nameservice.pb.go +++ b/x/nameservice/types/nameservice.pb.go @@ -199,7 +199,7 @@ func (m *Record) XXX_DiscardUnknown() { var xxx_messageInfo_Record proto.InternalMessageInfo -func (m *Record) GetId() string { +func (m *Record) GetID() string { if m != nil { return m.Id } diff --git a/x/nameservice/types/query.pb.go b/x/nameservice/types/query.pb.go index 3d6c10aa..0fc272f6 100644 --- a/x/nameservice/types/query.pb.go +++ b/x/nameservice/types/query.pb.go @@ -421,23 +421,23 @@ func (m *QueryListRecordsResponse) GetPagination() *query.PageResponse { return nil } -// QueryRecordByIdRequest is request type for nameservice records by id -type QueryRecordByIdRequest struct { +// QueryRecordByIDRequest is request type for nameservice records by id +type QueryRecordByIDRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } -func (m *QueryRecordByIdRequest) Reset() { *m = QueryRecordByIdRequest{} } -func (m *QueryRecordByIdRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecordByIdRequest) ProtoMessage() {} -func (*QueryRecordByIdRequest) Descriptor() ([]byte, []int) { +func (m *QueryRecordByIDRequest) Reset() { *m = QueryRecordByIDRequest{} } +func (m *QueryRecordByIDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByIDRequest) ProtoMessage() {} +func (*QueryRecordByIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_73d2465766c8f876, []int{4} } -func (m *QueryRecordByIdRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryRecordByIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecordByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecordByIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecordByIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecordByIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -447,42 +447,42 @@ func (m *QueryRecordByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryRecordByIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordByIdRequest.Merge(m, src) +func (m *QueryRecordByIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByIDRequest.Merge(m, src) } -func (m *QueryRecordByIdRequest) XXX_Size() int { +func (m *QueryRecordByIDRequest) XXX_Size() int { return m.Size() } -func (m *QueryRecordByIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordByIdRequest.DiscardUnknown(m) +func (m *QueryRecordByIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecordByIdRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryRecordByIDRequest proto.InternalMessageInfo -func (m *QueryRecordByIdRequest) GetId() string { +func (m *QueryRecordByIDRequest) GetId() string { if m != nil { return m.Id } return "" } -// QueryRecordByIdResponse is response type for nameservice records by id -type QueryRecordByIdResponse struct { +// QueryRecordByIDResponse is response type for nameservice records by id +type QueryRecordByIDResponse struct { Record Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` } -func (m *QueryRecordByIdResponse) Reset() { *m = QueryRecordByIdResponse{} } -func (m *QueryRecordByIdResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRecordByIdResponse) ProtoMessage() {} -func (*QueryRecordByIdResponse) Descriptor() ([]byte, []int) { +func (m *QueryRecordByIDResponse) Reset() { *m = QueryRecordByIDResponse{} } +func (m *QueryRecordByIDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByIDResponse) ProtoMessage() {} +func (*QueryRecordByIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_73d2465766c8f876, []int{5} } -func (m *QueryRecordByIdResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryRecordByIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecordByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecordByIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecordByIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecordByIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -492,19 +492,19 @@ func (m *QueryRecordByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryRecordByIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordByIdResponse.Merge(m, src) +func (m *QueryRecordByIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByIDResponse.Merge(m, src) } -func (m *QueryRecordByIdResponse) XXX_Size() int { +func (m *QueryRecordByIDResponse) XXX_Size() int { return m.Size() } -func (m *QueryRecordByIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordByIdResponse.DiscardUnknown(m) +func (m *QueryRecordByIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecordByIdResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryRecordByIDResponse proto.InternalMessageInfo -func (m *QueryRecordByIdResponse) GetRecord() Record { +func (m *QueryRecordByIDResponse) GetRecord() Record { if m != nil { return m.Record } @@ -512,24 +512,24 @@ func (m *QueryRecordByIdResponse) GetRecord() Record { } // QueryRecordByBondIdRequest is request type for get the records by bond-id -type QueryRecordByBondIdRequest struct { +type QueryRecordByBondIDRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRecordByBondIdRequest) Reset() { *m = QueryRecordByBondIdRequest{} } -func (m *QueryRecordByBondIdRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecordByBondIdRequest) ProtoMessage() {} -func (*QueryRecordByBondIdRequest) Descriptor() ([]byte, []int) { +func (m *QueryRecordByBondIDRequest) Reset() { *m = QueryRecordByBondIDRequest{} } +func (m *QueryRecordByBondIDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByBondIDRequest) ProtoMessage() {} +func (*QueryRecordByBondIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_73d2465766c8f876, []int{6} } -func (m *QueryRecordByBondIdRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryRecordByBondIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecordByBondIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecordByBondIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecordByBondIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecordByBondIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -539,26 +539,26 @@ func (m *QueryRecordByBondIdRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryRecordByBondIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordByBondIdRequest.Merge(m, src) +func (m *QueryRecordByBondIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByBondIDRequest.Merge(m, src) } -func (m *QueryRecordByBondIdRequest) XXX_Size() int { +func (m *QueryRecordByBondIDRequest) XXX_Size() int { return m.Size() } -func (m *QueryRecordByBondIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordByBondIdRequest.DiscardUnknown(m) +func (m *QueryRecordByBondIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByBondIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecordByBondIdRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryRecordByBondIDRequest proto.InternalMessageInfo -func (m *QueryRecordByBondIdRequest) GetId() string { +func (m *QueryRecordByBondIDRequest) GetId() string { if m != nil { return m.Id } return "" } -func (m *QueryRecordByBondIdRequest) GetPagination() *query.PageRequest { +func (m *QueryRecordByBondIDRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } @@ -566,24 +566,24 @@ func (m *QueryRecordByBondIdRequest) GetPagination() *query.PageRequest { } // QueryRecordByBondIdResponse is response type for records list by bond-id -type QueryRecordByBondIdResponse struct { +type QueryRecordByBondIDResponse struct { Records []Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRecordByBondIdResponse) Reset() { *m = QueryRecordByBondIdResponse{} } -func (m *QueryRecordByBondIdResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRecordByBondIdResponse) ProtoMessage() {} -func (*QueryRecordByBondIdResponse) Descriptor() ([]byte, []int) { +func (m *QueryRecordByBondIDResponse) Reset() { *m = QueryRecordByBondIDResponse{} } +func (m *QueryRecordByBondIDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByBondIDResponse) ProtoMessage() {} +func (*QueryRecordByBondIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_73d2465766c8f876, []int{7} } -func (m *QueryRecordByBondIdResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryRecordByBondIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecordByBondIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecordByBondIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecordByBondIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecordByBondIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -593,26 +593,26 @@ func (m *QueryRecordByBondIdResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryRecordByBondIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordByBondIdResponse.Merge(m, src) +func (m *QueryRecordByBondIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByBondIDResponse.Merge(m, src) } -func (m *QueryRecordByBondIdResponse) XXX_Size() int { +func (m *QueryRecordByBondIDResponse) XXX_Size() int { return m.Size() } -func (m *QueryRecordByBondIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordByBondIdResponse.DiscardUnknown(m) +func (m *QueryRecordByBondIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByBondIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecordByBondIdResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryRecordByBondIDResponse proto.InternalMessageInfo -func (m *QueryRecordByBondIdResponse) GetRecords() []Record { +func (m *QueryRecordByBondIDResponse) GetRecords() []Record { if m != nil { return m.Records } return nil } -func (m *QueryRecordByBondIdResponse) GetPagination() *query.PageResponse { +func (m *QueryRecordByBondIDResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -1385,10 +1385,10 @@ func init() { proto.RegisterType((*QueryListRecordsRequest_ValueInput)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput") proto.RegisterType((*QueryListRecordsRequest_KeyValueInput)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput") proto.RegisterType((*QueryListRecordsResponse)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsResponse") - proto.RegisterType((*QueryRecordByIdRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIdRequest") - proto.RegisterType((*QueryRecordByIdResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIdResponse") - proto.RegisterType((*QueryRecordByBondIdRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest") - proto.RegisterType((*QueryRecordByBondIdResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse") + proto.RegisterType((*QueryRecordByIDRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIDRequest") + proto.RegisterType((*QueryRecordByIDResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIDResponse") + proto.RegisterType((*QueryRecordByBondIDRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIDRequest") + proto.RegisterType((*QueryRecordByBondIDResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIDResponse") proto.RegisterType((*GetNameServiceModuleBalanceRequest)(nil), "vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest") proto.RegisterType((*GetNameServiceModuleBalanceResponse)(nil), "vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse") proto.RegisterType((*AccountBalance)(nil), "vulcanize.nameservice.v1beta1.AccountBalance") @@ -1414,93 +1414,93 @@ func init() { var fileDescriptor_73d2465766c8f876 = []byte{ // 1411 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4b, 0x6c, 0x1b, 0xc5, - 0x1b, 0xcf, 0x24, 0xb1, 0xd3, 0x7c, 0xf9, 0x37, 0xfd, 0x77, 0x88, 0x5a, 0x77, 0xdb, 0x3a, 0x61, - 0xfb, 0x72, 0xa0, 0xde, 0x6d, 0x52, 0xfa, 0x16, 0x88, 0x3a, 0x0d, 0x51, 0xa0, 0x20, 0xba, 0x20, - 0x0a, 0x1c, 0xa8, 0xd6, 0xbb, 0x53, 0x77, 0xe9, 0x7a, 0xc6, 0xdd, 0x47, 0xa8, 0x5b, 0xf5, 0xc2, - 0xa1, 0x67, 0x24, 0xce, 0x20, 0x90, 0x38, 0x55, 0x02, 0x2e, 0x1c, 0x2a, 0xae, 0x5c, 0x2a, 0x4e, - 0x95, 0xe0, 0xc0, 0xa9, 0xa0, 0x16, 0x89, 0x7b, 0x8f, 0x9c, 0xd0, 0xce, 0xcc, 0xae, 0x77, 0x1d, - 0x27, 0x5e, 0xbb, 0x41, 0xe2, 0xe4, 0xd9, 0xd9, 0xef, 0xf1, 0xfb, 0x7d, 0x8f, 0xd9, 0x6f, 0x0c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0, 0x8b, 0x7f, - 0xef, 0x80, 0x02, 0x67, 0x81, 0xbf, 0x44, 0x50, 0x14, 0xf7, 0x02, 0xbc, 0x90, 0x67, 0x44, 0xcb, - 0x5c, 0x4c, 0x94, 0xc5, 0x41, 0x54, 0x04, 0x0e, 0xb5, 0xfa, 0xe9, 0x2f, 0x7f, 0x7e, 0x3e, 0x7a, - 0x04, 0x1f, 0xea, 0x73, 0x39, 0x13, 0xb7, 0x14, 0xfc, 0x1d, 0x82, 0xa9, 0xd4, 0xa4, 0x87, 0x4f, - 0x0e, 0x37, 0x48, 0x2a, 0xa7, 0x06, 0xd6, 0x93, 0x78, 0x35, 0x8e, 0xb7, 0x82, 0x0f, 0xf7, 0xc1, - 0x1b, 0x77, 0xc3, 0xf7, 0x08, 0x26, 0x93, 0xd6, 0xc3, 0x27, 0xf2, 0xb8, 0x5d, 0x37, 0x1d, 0x2a, - 0x27, 0x07, 0x55, 0x93, 0x60, 0x8f, 0x73, 0xb0, 0x55, 0xfc, 0x62, 0x3e, 0xb0, 0xfa, 0x6d, 0xc7, - 0xbe, 0x83, 0x7f, 0x46, 0xb0, 0x33, 0x41, 0x1c, 0x8f, 0x68, 0xf8, 0xcc, 0x20, 0x10, 0x32, 0xd3, - 0xa4, 0x72, 0x76, 0x18, 0x55, 0xc9, 0xe0, 0x15, 0xce, 0xe0, 0x34, 0x3e, 0x99, 0x8f, 0x41, 0xb5, - 0xde, 0xae, 0xd6, 0x19, 0xb5, 0xab, 0x8e, 0x2d, 0xc8, 0xfc, 0x8a, 0x60, 0xef, 0x26, 0xc3, 0x19, - 0xee, 0x77, 0x11, 0xe9, 0x3f, 0xfe, 0x29, 0xb5, 0x67, 0x31, 0x31, 0x60, 0x55, 0xc9, 0xb1, 0x08, - 0xdf, 0x47, 0xb0, 0xa3, 0x6b, 0x54, 0xc1, 0x67, 0xf3, 0x96, 0xf4, 0xfa, 0x39, 0x4a, 0x39, 0x37, - 0x94, 0xae, 0x04, 0x7f, 0x94, 0x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55, 0xe2, 0x12, 0x6a, 0x09, 0xbf, 0x78, 0x06, + 0xc6, 0xed, 0x06, 0x0f, 0xd4, 0xb4, 0x31, 0x6e, 0x37, 0x94, 0x1f, 0xc7, 0x01, 0xba, 0xb0, 0x30, + 0x86, 0x49, 0xbf, 0xd3, 0x26, 0x52, 0x80, 0xaf, 0xf1, 0x2e, 0xc8, 0x7b, 0xbe, 0x6b, 0xd3, 0x26, + 0x47, 0x38, 0x6d, 0xc8, 0xa7, 0x10, 0xb6, 0x4d, 0x7d, 0x8e, 0x6e, 0xc2, 0x08, 0x97, 0x78, 0x16, + 0x72, 0x57, 0x1d, 0x66, 0xfa, 0xc5, 0xc9, 0x79, 0x54, 0x46, 0x86, 0x78, 0xc0, 0x45, 0x98, 0xaa, + 0x33, 0xe6, 0x10, 0x93, 0x16, 0x73, 0x9c, 0x62, 0xf4, 0x88, 0x2d, 0x98, 0x76, 0x23, 0x78, 0xc5, + 0x3c, 0x67, 0xb9, 0x3c, 0x62, 0x74, 0xd3, 0x34, 0x8d, 0xae, 0x5d, 0xfc, 0x01, 0xe4, 0xd7, 0x42, + 0x82, 0x5e, 0x71, 0x8a, 0xe7, 0xef, 0xfc, 0x88, 0x1e, 0x12, 0xc9, 0x93, 0x06, 0x95, 0x5b, 0xb0, + 0x3d, 0x95, 0xd5, 0x30, 0x24, 0xd7, 0x49, 0x47, 0x46, 0x2f, 0x5c, 0xe2, 0xcb, 0x90, 0xe3, 0xc2, + 0x3c, 0x76, 0x5b, 0xe2, 0x5c, 0xd8, 0x53, 0xef, 0x21, 0x28, 0xae, 0x97, 0x96, 0x2d, 0xb1, 0x0c, + 0x53, 0xae, 0xd8, 0x92, 0x45, 0x3b, 0xa8, 0x27, 0x84, 0x81, 0xda, 0xe4, 0x83, 0x47, 0x73, 0x63, + 0x46, 0xa4, 0x8b, 0x57, 0x52, 0x65, 0x28, 0x18, 0x1c, 0x19, 0x58, 0x86, 0x02, 0x43, 0xb2, 0x0e, + 0xd5, 0x32,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 0xe4, 0x19, 0xe2, + 0xf8, 0xe3, 0xaa, 0xf8, 0x01, 0x82, 0xd9, 0xbe, 0xf3, 0xcd, 0xe9, 0x2c, 0x00, 0xfa, 0x69, 0x2a, + 0xaf, 0x8e, 0xaa, 0x19, 0x93, 0x78, 0x89, 0x93, 0xd0, 0xf0, 0xd1, 0x4c, 0x87, 0x4a, 0x85, 0x70, + 0x13, 0xe1, 0x51, 0xb2, 0x7b, 0xa3, 0x79, 0xe2, 0x5c, 0x46, 0x4c, 0xfd, 0x94, 0x95, 0xa5, 0x67, + 0x50, 0x8e, 0x39, 0x9d, 0xe2, 0x9c, 0xaa, 0x58, 0x1f, 0xc0, 0x29, 0x1e, 0xf8, 0x25, 0xad, 0xda, + 0xea, 0x83, 0xc7, 0x25, 0xf4, 0xf0, 0x71, 0x09, 0xfd, 0xf1, 0xb8, 0x84, 0x3e, 0x7b, 0x52, 0x1a, + 0x7b, 0xf8, 0xa4, 0x34, 0xf6, 0xdb, 0x93, 0xd2, 0xd8, 0x87, 0x7a, 0xf2, 0xba, 0x46, 0x5c, 0xab, + 0x62, 0x33, 0xdd, 0x31, 0x2d, 0x46, 0x6d, 0xab, 0xa1, 0xdf, 0x4c, 0x59, 0xe7, 0x77, 0xb7, 0x7a, + 0x9e, 0xff, 0x6b, 0x79, 0xfc, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xee, 0x3b, 0x4b, 0xb2, 0x15, 0x00, 0x00, } @@ -1521,9 +1521,9 @@ type QueryClient interface { // List records ListRecords(ctx context.Context, in *QueryListRecordsRequest, opts ...grpc.CallOption) (*QueryListRecordsResponse, error) // Get record by id - GetRecord(ctx context.Context, in *QueryRecordByIdRequest, opts ...grpc.CallOption) (*QueryRecordByIdResponse, error) + GetRecord(ctx context.Context, in *QueryRecordByIDRequest, opts ...grpc.CallOption) (*QueryRecordByIDResponse, error) // Get records by bond id - GetRecordByBondId(ctx context.Context, in *QueryRecordByBondIdRequest, opts ...grpc.CallOption) (*QueryRecordByBondIdResponse, error) + GetRecordByBondID(ctx context.Context, in *QueryRecordByBondIDRequest, opts ...grpc.CallOption) (*QueryRecordByBondIDResponse, error) // Get nameservice module balance GetNameServiceModuleBalance(ctx context.Context, in *GetNameServiceModuleBalanceRequest, opts ...grpc.CallOption) (*GetNameServiceModuleBalanceResponse, error) // List name records @@ -1566,8 +1566,8 @@ func (c *queryClient) ListRecords(ctx context.Context, in *QueryListRecordsReque return out, nil } -func (c *queryClient) GetRecord(ctx context.Context, in *QueryRecordByIdRequest, opts ...grpc.CallOption) (*QueryRecordByIdResponse, error) { - out := new(QueryRecordByIdResponse) +func (c *queryClient) GetRecord(ctx context.Context, in *QueryRecordByIDRequest, opts ...grpc.CallOption) (*QueryRecordByIDResponse, error) { + out := new(QueryRecordByIDResponse) err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecord", in, out, opts...) if err != nil { return nil, err @@ -1575,9 +1575,9 @@ func (c *queryClient) GetRecord(ctx context.Context, in *QueryRecordByIdRequest, return out, nil } -func (c *queryClient) GetRecordByBondId(ctx context.Context, in *QueryRecordByBondIdRequest, opts ...grpc.CallOption) (*QueryRecordByBondIdResponse, error) { - out := new(QueryRecordByBondIdResponse) - err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondId", in, out, opts...) +func (c *queryClient) GetRecordByBondID(ctx context.Context, in *QueryRecordByBondIDRequest, opts ...grpc.CallOption) (*QueryRecordByBondIDResponse, error) { + out := new(QueryRecordByBondIDResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondID", in, out, opts...) if err != nil { return nil, err } @@ -1654,9 +1654,9 @@ type QueryServer interface { // List records ListRecords(context.Context, *QueryListRecordsRequest) (*QueryListRecordsResponse, error) // Get record by id - GetRecord(context.Context, *QueryRecordByIdRequest) (*QueryRecordByIdResponse, error) + GetRecord(context.Context, *QueryRecordByIDRequest) (*QueryRecordByIDResponse, error) // Get records by bond id - GetRecordByBondId(context.Context, *QueryRecordByBondIdRequest) (*QueryRecordByBondIdResponse, error) + GetRecordByBondID(context.Context, *QueryRecordByBondIDRequest) (*QueryRecordByBondIDResponse, error) // Get nameservice module balance GetNameServiceModuleBalance(context.Context, *GetNameServiceModuleBalanceRequest) (*GetNameServiceModuleBalanceResponse, error) // List name records @@ -1683,11 +1683,11 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) ListRecords(ctx context.Context, req *QueryListRecordsRequest) (*QueryListRecordsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListRecords not implemented") } -func (*UnimplementedQueryServer) GetRecord(ctx context.Context, req *QueryRecordByIdRequest) (*QueryRecordByIdResponse, error) { +func (*UnimplementedQueryServer) GetRecord(ctx context.Context, req *QueryRecordByIDRequest) (*QueryRecordByIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRecord not implemented") } -func (*UnimplementedQueryServer) GetRecordByBondId(ctx context.Context, req *QueryRecordByBondIdRequest) (*QueryRecordByBondIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRecordByBondId not implemented") +func (*UnimplementedQueryServer) GetRecordByBondID(ctx context.Context, req *QueryRecordByBondIDRequest) (*QueryRecordByBondIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRecordByBondID not implemented") } func (*UnimplementedQueryServer) GetNameServiceModuleBalance(ctx context.Context, req *GetNameServiceModuleBalanceRequest) (*GetNameServiceModuleBalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetNameServiceModuleBalance not implemented") @@ -1752,7 +1752,7 @@ func _Query_ListRecords_Handler(srv interface{}, ctx context.Context, dec func(i } func _Query_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecordByIdRequest) + in := new(QueryRecordByIDRequest) if err := dec(in); err != nil { return nil, err } @@ -1764,25 +1764,25 @@ func _Query_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(int FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecord", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetRecord(ctx, req.(*QueryRecordByIdRequest)) + return srv.(QueryServer).GetRecord(ctx, req.(*QueryRecordByIDRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_GetRecordByBondId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecordByBondIdRequest) +func _Query_GetRecordByBondID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecordByBondIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetRecordByBondId(ctx, in) + return srv.(QueryServer).GetRecordByBondID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondId", + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetRecordByBondId(ctx, req.(*QueryRecordByBondIdRequest)) + return srv.(QueryServer).GetRecordByBondID(ctx, req.(*QueryRecordByBondIDRequest)) } return interceptor(ctx, in, info, handler) } @@ -1930,8 +1930,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_GetRecord_Handler, }, { - MethodName: "GetRecordByBondId", - Handler: _Query_GetRecordByBondId_Handler, + MethodName: "GetRecordByBondID", + Handler: _Query_GetRecordByBondID_Handler, }, { MethodName: "GetNameServiceModuleBalance", @@ -2288,7 +2288,7 @@ func (m *QueryListRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryRecordByIdRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRecordByIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2298,12 +2298,12 @@ func (m *QueryRecordByIdRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecordByIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecordByIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecordByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecordByIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2318,7 +2318,7 @@ func (m *QueryRecordByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryRecordByIdResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRecordByIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2328,12 +2328,12 @@ func (m *QueryRecordByIdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecordByIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecordByIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecordByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecordByIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2351,7 +2351,7 @@ func (m *QueryRecordByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryRecordByBondIdRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRecordByBondIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2361,12 +2361,12 @@ func (m *QueryRecordByBondIdRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecordByBondIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecordByBondIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecordByBondIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecordByBondIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2393,7 +2393,7 @@ func (m *QueryRecordByBondIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryRecordByBondIdResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRecordByBondIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2403,12 +2403,12 @@ func (m *QueryRecordByBondIdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecordByBondIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecordByBondIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecordByBondIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecordByBondIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3170,7 +3170,7 @@ func (m *QueryListRecordsResponse) Size() (n int) { return n } -func (m *QueryRecordByIdRequest) Size() (n int) { +func (m *QueryRecordByIDRequest) Size() (n int) { if m == nil { return 0 } @@ -3183,7 +3183,7 @@ func (m *QueryRecordByIdRequest) Size() (n int) { return n } -func (m *QueryRecordByIdResponse) Size() (n int) { +func (m *QueryRecordByIDResponse) Size() (n int) { if m == nil { return 0 } @@ -3194,7 +3194,7 @@ func (m *QueryRecordByIdResponse) Size() (n int) { return n } -func (m *QueryRecordByBondIdRequest) Size() (n int) { +func (m *QueryRecordByBondIDRequest) Size() (n int) { if m == nil { return 0 } @@ -3211,7 +3211,7 @@ func (m *QueryRecordByBondIdRequest) Size() (n int) { return n } -func (m *QueryRecordByBondIdResponse) Size() (n int) { +func (m *QueryRecordByBondIDResponse) Size() (n int) { if m == nil { return 0 } @@ -4300,7 +4300,7 @@ func (m *QueryListRecordsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecordByIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRecordByIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4323,10 +4323,10 @@ func (m *QueryRecordByIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecordByIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecordByIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecordByIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4382,7 +4382,7 @@ func (m *QueryRecordByIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecordByIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRecordByIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4405,10 +4405,10 @@ func (m *QueryRecordByIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecordByIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecordByIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecordByIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4465,7 +4465,7 @@ func (m *QueryRecordByIdResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecordByBondIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRecordByBondIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4488,10 +4488,10 @@ func (m *QueryRecordByBondIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecordByBondIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecordByBondIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordByBondIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecordByBondIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4583,7 +4583,7 @@ func (m *QueryRecordByBondIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecordByBondIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRecordByBondIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4606,10 +4606,10 @@ func (m *QueryRecordByBondIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecordByBondIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecordByBondIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordByBondIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecordByBondIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/nameservice/types/query.pb.gw.go b/x/nameservice/types/query.pb.gw.go index a6094b92..cdb4d59c 100644 --- a/x/nameservice/types/query.pb.gw.go +++ b/x/nameservice/types/query.pb.gw.go @@ -86,7 +86,7 @@ func local_request_Query_ListRecords_0(ctx context.Context, marshaler runtime.Ma } func request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordByIdRequest + var protoReq QueryRecordByIDRequest var metadata runtime.ServerMetadata var ( @@ -113,7 +113,7 @@ func request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, } func local_request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordByIdRequest + var protoReq QueryRecordByIDRequest var metadata runtime.ServerMetadata var ( @@ -140,11 +140,11 @@ func local_request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Mars } var ( - filter_Query_GetRecordByBondId_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_GetRecordByBondID_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordByBondIdRequest +func request_Query_GetRecordByBondID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByBondIDRequest var metadata runtime.ServerMetadata var ( @@ -168,17 +168,17 @@ func request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runtime.Ma if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondId_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondID_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetRecordByBondId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetRecordByBondID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecordByBondIdRequest +func local_request_Query_GetRecordByBondID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByBondIDRequest var metadata runtime.ServerMetadata var ( @@ -202,11 +202,11 @@ func local_request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runt if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondId_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondID_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetRecordByBondId(ctx, &protoReq) + msg, err := server.GetRecordByBondID(ctx, &protoReq) return msg, metadata, err } @@ -529,7 +529,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetRecordByBondId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetRecordByBondID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -538,14 +538,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetRecordByBondId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetRecordByBondID_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetRecordByBondId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetRecordByBondID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -790,7 +790,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetRecordByBondId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetRecordByBondID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -799,14 +799,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetRecordByBondId_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetRecordByBondID_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetRecordByBondId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetRecordByBondID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -960,7 +960,7 @@ var ( pattern_Query_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records", "id"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetRecordByBondId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records-by-bond-id", "id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetRecordByBondID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records-by-bond-id", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetNameServiceModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) @@ -984,7 +984,7 @@ var ( forward_Query_GetRecord_0 = runtime.ForwardResponseMessage - forward_Query_GetRecordByBondId_0 = runtime.ForwardResponseMessage + forward_Query_GetRecordByBondID_0 = runtime.ForwardResponseMessage forward_Query_GetNameServiceModuleBalance_0 = runtime.ForwardResponseMessage diff --git a/x/nameservice/types/record_msg.go b/x/nameservice/types/record_msg.go index c0dd6963..a7678f2a 100644 --- a/x/nameservice/types/record_msg.go +++ b/x/nameservice/types/record_msg.go @@ -58,9 +58,9 @@ func (msg MsgSetRecord) GetSignBytes() []byte { } // NewMsgRenewRecord is the constructor function for MsgRenewRecord. -func NewMsgRenewRecord(recordId string, signer sdk.AccAddress) MsgRenewRecord { +func NewMsgRenewRecord(recordID string, signer sdk.AccAddress) MsgRenewRecord { return MsgRenewRecord{ - RecordId: recordId, + RecordId: recordID, Signer: signer.String(), } } @@ -97,10 +97,10 @@ func (msg MsgRenewRecord) GetSigners() []sdk.AccAddress { } // NewMsgAssociateBond is the constructor function for MsgAssociateBond. -func NewMsgAssociateBond(recordId, bondId string, signer sdk.AccAddress) MsgAssociateBond { +func NewMsgAssociateBond(recordID, bondID string, signer sdk.AccAddress) MsgAssociateBond { return MsgAssociateBond{ - BondId: bondId, - RecordId: recordId, + BondId: bondID, + RecordId: recordID, Signer: signer.String(), } } @@ -139,9 +139,9 @@ func (msg MsgAssociateBond) GetSigners() []sdk.AccAddress { } // NewMsgDissociateBond is the constructor function for MsgDissociateBond. -func NewMsgDissociateBond(recordId string, signer sdk.AccAddress) MsgDissociateBond { +func NewMsgDissociateBond(recordID string, signer sdk.AccAddress) MsgDissociateBond { return MsgDissociateBond{ - RecordId: recordId, + RecordId: recordID, Signer: signer.String(), } } @@ -177,9 +177,9 @@ func (msg MsgDissociateBond) GetSigners() []sdk.AccAddress { } // NewMsgDissociateRecords is the constructor function for MsgDissociateRecords. -func NewMsgDissociateRecords(bondId string, signer sdk.AccAddress) MsgDissociateRecords { +func NewMsgDissociateRecords(bondID string, signer sdk.AccAddress) MsgDissociateRecords { return MsgDissociateRecords{ - BondId: bondId, + BondId: bondID, Signer: signer.String(), } } @@ -215,10 +215,10 @@ func (msg MsgDissociateRecords) GetSigners() []sdk.AccAddress { } // NewMsgReAssociateRecords is the constructor function for MsgReAssociateRecords. -func NewMsgReAssociateRecords(oldBondId, newBondId string, signer sdk.AccAddress) MsgReAssociateRecords { +func NewMsgReAssociateRecords(oldBondID, newBondID string, signer sdk.AccAddress) MsgReAssociateRecords { return MsgReAssociateRecords{ - OldBondId: oldBondId, - NewBondId: newBondId, + OldBondId: oldBondID, + NewBondId: newBondID, Signer: signer.String(), } } diff --git a/x/nameservice/types/types.go b/x/nameservice/types/types.go index f97c033f..187b9fb2 100644 --- a/x/nameservice/types/types.go +++ b/x/nameservice/types/types.go @@ -50,8 +50,8 @@ func (payload Payload) ToReadablePayload() PayloadType { func (r *Record) ToRecordType() RecordType { var resourceObj RecordType - resourceObj.Id = r.Id - resourceObj.BondId = r.BondId + resourceObj.ID = r.Id + resourceObj.BondID = r.BondId resourceObj.CreateTime = r.CreateTime resourceObj.ExpiryTime = r.ExpiryTime resourceObj.Deleted = r.Deleted @@ -64,9 +64,9 @@ func (r *Record) ToRecordType() RecordType { // RecordType represents a WNS record. type RecordType struct { - Id string `json:"id,omitempty"` + ID string `json:"id,omitempty"` Names []string `json:"names,omitempty"` - BondId string `json:"bondId,omitempty"` + BondID string `json:"bondId,omitempty"` CreateTime string `json:"createTime,omitempty"` ExpiryTime string `json:"expiryTime,omitempty"` Deleted bool `json:"deleted,omitempty"` @@ -79,8 +79,8 @@ type RecordType struct { func (r *RecordType) ToRecordObj() Record { var resourceObj Record - resourceObj.Id = r.Id - resourceObj.BondId = r.BondId + resourceObj.Id = r.ID + resourceObj.BondId = r.BondID resourceObj.CreateTime = r.CreateTime resourceObj.ExpiryTime = r.ExpiryTime resourceObj.Deleted = r.Deleted From f8ca5ba9db33c0f1d975f14fb609bfba6342de7c Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 16:55:25 +0530 Subject: [PATCH 05/14] update linter --- .github/workflows/lint.yml | 4 ++-- utils/json.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ca4509ea..801bcff7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,10 +20,10 @@ jobs: .go .mod .sum - - uses: golangci/golangci-lint-action@v2.5.2 + - uses: golangci/golangci-lint-action@v3 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.42.1 + version: v1.48.0 args: --timeout 10m github-token: ${{ secrets.github_token }} # Check only if there are differences in the source code diff --git a/utils/json.go b/utils/json.go index f43bd75c..8adc6a9f 100644 --- a/utils/json.go +++ b/utils/json.go @@ -8,7 +8,6 @@ import ( "bytes" "errors" - "github.com/ipfs/go-cid" "github.com/ipld/go-ipld-prime/codec/dagcbor" "github.com/ipld/go-ipld-prime/fluent" "github.com/ipld/go-ipld-prime/linking" @@ -17,6 +16,7 @@ import ( "github.com/ipld/go-ipld-prime/storage/memstore" canonicalJson "github.com/gibson042/canonicaljson-go" + "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" basicnode "github.com/ipld/go-ipld-prime/node/basic" mh "github.com/multiformats/go-multihash" From e0df2b674942eb897e14f1fe3ed374d48eb64f94 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 17:03:11 +0530 Subject: [PATCH 06/14] update linter --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 801bcff7..c04629a9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: - uses: golangci/golangci-lint-action@v3 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.50.0 args: --timeout 10m github-token: ${{ secrets.github_token }} # Check only if there are differences in the source code From d965f6fbb9f988a60a411f43d699e7504a4e17fe Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 17 Oct 2022 17:14:21 +0530 Subject: [PATCH 07/14] lint --- app/ante/eth.go | 2 +- app/app.go | 1 + types/account.go | 8 ++++---- x/evm/keeper/keeper.go | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/ante/eth.go b/app/ante/eth.go index c8501690..2ae2622b 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -125,7 +125,7 @@ func (avd EthAccountVerificationDecorator) AnteHandle( // check whether the sender address is EOA fromAddr := common.BytesToAddress(from) - acct := avd.evmKeeper.GetAccount(ctx, fromAddr) + acct := avd.evmKeeper.GetAccount(ctx, fromAddr) //nolint: all if acct == nil { acc := avd.ak.NewAccountWithAddress(ctx, from) diff --git a/app/app.go b/app/app.go index 14957358..ce0caca0 100644 --- a/app/app.go +++ b/app/app.go @@ -1,3 +1,4 @@ +//nolint: all package app import ( diff --git a/types/account.go b/types/account.go index 08c51279..685e4535 100644 --- a/types/account.go +++ b/types/account.go @@ -11,10 +11,10 @@ import ( ) var ( - _ authtypes.AccountI = (*EthAccount)(nil) - _ EthAccountI = (*EthAccount)(nil) - _ authtypes.GenesisAccount = (*EthAccount)(nil) - _ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil) + _ authtypes.AccountI = (*EthAccount)(nil) //nolint: all + _ EthAccountI = (*EthAccount)(nil) //nolint: all + _ authtypes.GenesisAccount = (*EthAccount)(nil) //nolint: all + _ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil) //nolint: all ) var emptyCodeHash = crypto.Keccak256(nil) diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index 09a521fe..e287836c 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -227,7 +227,7 @@ func (k Keeper) GetAccountStorage(ctx sdk.Context, address common.Address) types // SetHooks sets the hooks for the EVM module // It should be called only once during initialization, it panic if called more than once. func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper { - if k.hooks != nil { + if k.hooks != types.EvmHooks(nil) { panic("cannot set evm hooks twice") } @@ -237,7 +237,7 @@ func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper { // PostTxProcessing delegate the call to the hooks. If no hook has been registered, this function returns with a `nil` error func (k *Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { - if k.hooks == nil { + if k.hooks == types.EvmHooks(nil) { return nil } return k.hooks.PostTxProcessing(ctx, msg, receipt) From f55c304930798a11a63fc9c06309e685772390e7 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 10:51:25 +0530 Subject: [PATCH 08/14] disable typecheck linter --- .golangci.yml | 2 ++ app/app.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index e5e9ae6e..ee468bb2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,6 +45,8 @@ linters: - rowserrcheck # - whitespace # - wsl + disable: + - typecheck issues: exclude-rules: diff --git a/app/app.go b/app/app.go index ce0caca0..14957358 100644 --- a/app/app.go +++ b/app/app.go @@ -1,4 +1,3 @@ -//nolint: all package app import ( From b503d311d20cd6368fbf2ab7f2dc8cbba41fb93d Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 11:00:35 +0530 Subject: [PATCH 09/14] update lint workflow --- .github/workflows/lint.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c04629a9..63620eee 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,17 +13,19 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.0.1 + - uses: actions/setup-go@v3 with: - SUFFIX_FILTER: | - .go - .mod - .sum + go-version: 1.18 + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.0 + with: + PATTERNS: | + **/**.go + go.mod + go.sum - uses: golangci/golangci-lint-action@v3 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.50.0 + version: v1.48.0 args: --timeout 10m github-token: ${{ secrets.github_token }} # Check only if there are differences in the source code From 906ec2a06c621531b75a10cddc90a789f954c27d Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 11:40:03 +0530 Subject: [PATCH 10/14] use cosmos/goces --- .github/workflows/security.yml | 2 +- x/nameservice/genesis.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 43b1376f..3b760477 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -21,7 +21,7 @@ jobs: go.mod go.sum - name: Run Gosec Security Scanner - uses: informalsystems/gosec@master + uses: cosmos/gosec@master with: # we let the report trigger content trigger a failure using the GitHub Security features. args: '-no-fail -fmt sarif -out results.sarif ./...' diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index 262e82e1..ccd198a5 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -60,6 +60,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { authorities := keeper.ListNameAuthorityRecords(ctx) authorityEntries := []types.AuthorityEntry{} + // #nosec for name, record := range authorities { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, From 670dc398e4d0ca5824b0c4b15b643b49a2a93bc1 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 12:14:29 +0530 Subject: [PATCH 11/14] nosec G705 --- app/app.go | 2 ++ go.mod | 2 +- go.sum | 4 ++-- gql/util.go | 1 + rpc/ethereum/pubsub/pubsub.go | 2 ++ rpc/namespaces/ethereum/eth/filters/api.go | 1 + rpc/namespaces/ethereum/eth/filters/filter_system.go | 1 + rpc/websockets.go | 1 + tests/rpc/rpc_test.go | 3 --- x/evm/simulation/operations.go | 6 ++---- x/evm/statedb/journal.go | 1 + x/evm/statedb/state_object.go | 1 + x/nameservice/genesis.go | 2 +- 13 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/app.go b/app/app.go index 14957358..c5153a40 100644 --- a/app/app.go +++ b/app/app.go @@ -768,6 +768,7 @@ func (app *EthermintApp) LoadHeight(height int64) error { // ModuleAccountAddrs returns all the app's module account addresses. func (app *EthermintApp) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) + // #nosec G705 for acc := range maccPerms { modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true } @@ -779,6 +780,7 @@ func (app *EthermintApp) ModuleAccountAddrs() map[string]bool { // allowed to receive external tokens. func (app *EthermintApp) BlockedAddrs() map[string]bool { blockedAddrs := make(map[string]bool) + // #nosec G705 for acc := range maccPerms { blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] } diff --git a/go.mod b/go.mod index 5d5827c1..7d6be002 100644 --- a/go.mod +++ b/go.mod @@ -198,7 +198,7 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d // indirect + golang.org/x/sys v0.0.0-20220913175220-63ea55921009 // indirect golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.93.0 // indirect diff --git a/go.sum b/go.sum index 40152fef..6b4c5a8e 100644 --- a/go.sum +++ b/go.sum @@ -1456,8 +1456,8 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d h1:RoyzQTK76Rktm3p4xyZslc8T8I1tBz4UEjZCzeh57mM= -golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw= +golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/gql/util.go b/gql/util.go index f510b511..4cfe9578 100644 --- a/gql/util.go +++ b/gql/util.go @@ -193,6 +193,7 @@ func mapToKeyValuePairs(attrs map[string]interface{}) ([]*KeyValue, error) { trueVal := true falseVal := false + // #nosec G705 for key, value := range attrs { kvPair := &KeyValue{ Key: key, diff --git a/rpc/ethereum/pubsub/pubsub.go b/rpc/ethereum/pubsub/pubsub.go index 4ac7f34c..176bbec9 100644 --- a/rpc/ethereum/pubsub/pubsub.go +++ b/rpc/ethereum/pubsub/pubsub.go @@ -124,6 +124,7 @@ func (m *memEventBus) closeAllSubscribers(name string) { subsribers := m.subscribers[name] delete(m.subscribers, name) + // #nosec G705 for _, sub := range subsribers { close(sub) } @@ -134,6 +135,7 @@ func (m *memEventBus) publishAllSubscribers(name string, msg coretypes.ResultEve subsribers := m.subscribers[name] m.subscribersMux.RUnlock() + // #nosec G705 for _, sub := range subsribers { select { case sub <- msg: diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index 1e0461cc..2d598ff7 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -102,6 +102,7 @@ func (api *PublicFilterAPI) timeoutLoop() { for { <-ticker.C api.filtersMu.Lock() + // #nosec G705 for id, f := range api.filters { select { case <-f.deadline.C: diff --git a/rpc/namespaces/ethereum/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go index 9b756685..b16b2cbb 100644 --- a/rpc/namespaces/ethereum/eth/filters/filter_system.go +++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go @@ -240,6 +240,7 @@ func (es *EventSystem) eventLoop() { delete(es.index[f.typ], f.id) var channelInUse bool + // #nosec G705 for _, sub := range es.index[f.typ] { if sub.event == f.event { channelInUse = true diff --git a/rpc/websockets.go b/rpc/websockets.go index 181bb3a3..179c996d 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -173,6 +173,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { subscriptions := make(map[rpc.ID]pubsub.UnsubscribeFunc) defer func() { // cancel all subscriptions when connection closed + // #nosec G705 for _, unsubFn := range subscriptions { unsubFn() } diff --git a/tests/rpc/rpc_test.go b/tests/rpc/rpc_test.go index 83d9fd73..95c46a8f 100644 --- a/tests/rpc/rpc_test.go +++ b/tests/rpc/rpc_test.go @@ -87,7 +87,6 @@ func call(t *testing.T, method string, params interface{}) *Response { require.NoError(t, err) time.Sleep(1 * time.Second) - /* #nosec */ res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req)) require.NoError(t, err) @@ -110,7 +109,6 @@ func callWithError(method string, params interface{}) (*Response, error) { } time.Sleep(1 * time.Second) - /* #nosec */ res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req)) if err != nil { return nil, err @@ -246,7 +244,6 @@ func TestEth_GetFilterChanges_WrongID(t *testing.T) { req, err := json.Marshal(createRequest("eth_getFilterChanges", []string{"0x1122334400000077"})) require.NoError(t, err) - /* #nosec */ res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req)) require.NoError(t, err) diff --git a/x/evm/simulation/operations.go b/x/evm/simulation/operations.go index 9f4e8bbe..7f8960ca 100644 --- a/x/evm/simulation/operations.go +++ b/x/evm/simulation/operations.go @@ -32,13 +32,11 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) +// #nosec 101 const ( - /* #nosec */ OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer" - /* #nosec */ OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract" - /* #nosec */ - OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" + OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract" ) const ( diff --git a/x/evm/statedb/journal.go b/x/evm/statedb/journal.go index 49f61c00..5e96cf1b 100644 --- a/x/evm/statedb/journal.go +++ b/x/evm/statedb/journal.go @@ -53,6 +53,7 @@ func newJournal() *journal { func (j *journal) sortedDirties() []common.Address { keys := make([]common.Address, len(j.dirties)) i := 0 + // #nosec G705 for k := range j.dirties { keys[i] = k i++ diff --git a/x/evm/statedb/state_object.go b/x/evm/statedb/state_object.go index 3ebb800c..3717b4bd 100644 --- a/x/evm/statedb/state_object.go +++ b/x/evm/statedb/state_object.go @@ -39,6 +39,7 @@ type Storage map[common.Hash]common.Hash func (s Storage) SortedKeys() []common.Hash { keys := make([]common.Hash, len(s)) i := 0 + // #nosec G705 for k := range s { keys[i] = k i++ diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index ccd198a5..ae6413b5 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -60,7 +60,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { authorities := keeper.ListNameAuthorityRecords(ctx) authorityEntries := []types.AuthorityEntry{} - // #nosec + // #nosec G705 for name, record := range authorities { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, From 944d2702b23e85dd54358d4e14693ab0ebbcccb9 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 15:09:55 +0530 Subject: [PATCH 12/14] exclude G701 --- .github/workflows/security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 3b760477..28059733 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -24,7 +24,7 @@ jobs: uses: cosmos/gosec@master with: # we let the report trigger content trigger a failure using the GitHub Security features. - args: '-no-fail -fmt sarif -out results.sarif ./...' + args: '-no-fail -fmt sarif -out results.sarif -exclude=G701 ./...' if: "env.GIT_DIFF_FILTERED != ''" - name: Upload SARIF file uses: github/codeql-action/upload-sarif@v1 From 24fad163b2dabed737d882773829685612f12070 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 15:36:34 +0530 Subject: [PATCH 13/14] ignore gosec --- app/utils.go | 2 +- ethereum/eip712/eip712.go | 2 +- gql/resolver.go | 1 + gql/status.go | 2 +- gql/util.go | 8 ++++---- rpc/namespaces/ethereum/debug/api.go | 2 +- version/version.go | 2 +- x/auction/client/cli/tx.go | 2 +- x/auction/genesis.go | 1 + x/evm/module.go | 2 +- x/feemarket/module.go | 2 +- x/nameservice/client/cli/tx.go | 2 +- x/nameservice/genesis.go | 2 +- 13 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/utils.go b/app/utils.go index 235041c3..4774bce9 100644 --- a/app/utils.go +++ b/app/utils.go @@ -2,7 +2,7 @@ package app import ( "encoding/json" - "math/rand" + "math/rand" // #nosec G702 "time" "github.com/cosmos/cosmos-sdk/codec" diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index 50860093..c7f67384 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" "math/big" - "reflect" + "reflect" // #nosec G702 "strings" "time" diff --git a/gql/resolver.go b/gql/resolver.go index 23eaf10c..75d75710 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -313,6 +313,7 @@ func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*Ow ownerBonds := make([]*Bond, len(bondResp.GetBonds())) for i, bond := range bondResp.GetBonds() { + // #nosec G601 bondObj, err := getGQLBond(&bond) //nolint: all if err != nil { return nil, err diff --git a/gql/status.go b/gql/status.go index 0a8822ad..0ed0d7ae 100644 --- a/gql/status.go +++ b/gql/status.go @@ -91,7 +91,7 @@ func getValidatorSet(client client.Context) ([]*ValidatorInfo, error) { // GetDiskUsage returns disk usage for the given path. func GetDiskUsage(dirPath string) (string, error) { - out, err := exec.Command("du", "-sh", dirPath).Output() + out, err := exec.Command("du", "-sh", dirPath).Output() // #nosec G204 if err != nil { return "", err } diff --git a/gql/util.go b/gql/util.go index 4cfe9578..a2747f80 100644 --- a/gql/util.go +++ b/gql/util.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "reflect" + "reflect" // #nosec G702 "strconv" auctiontypes "github.com/cerc-io/laconicd/x/auction/types" @@ -166,11 +166,11 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au func getReferences(ctx context.Context, resolver QueryResolver, r *nstypes.RecordType) ([]*Record, error) { var ids []string - for _, value := range r.Attributes { + for key := range r.Attributes { //nolint: all - switch value.(type) { + switch r.Attributes[key].(type) { case interface{}: - if obj, ok := value.(map[string]interface{}); ok { + if obj, ok := r.Attributes[key].(map[string]interface{}); ok { if _, ok := obj["/"]; ok && len(obj) == 1 { if _, ok := obj["/"].(string); ok { ids = append(ids, obj["/"].(string)) diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 2bba5bab..e86e45c2 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -6,7 +6,7 @@ import ( "fmt" "io" "os" - "runtime" + "runtime" // #nosec G702 "runtime/debug" "runtime/pprof" "sync" diff --git a/version/version.go b/version/version.go index fa16dc85..abc1177e 100755 --- a/version/version.go +++ b/version/version.go @@ -2,7 +2,7 @@ package version import ( "fmt" - "runtime" + "runtime" // #nosec G702 ) var ( diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index 9218c9ea..f8df85b7 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -169,7 +169,7 @@ func GetCmdRevealBid() *cobra.Command { auctionID := args[0] revealFilePath := args[1] - revealBytes, err := ioutil.ReadFile(revealFilePath) + revealBytes, err := ioutil.ReadFile(revealFilePath) // #nosec G304 if err != nil { return err } diff --git a/x/auction/genesis.go b/x/auction/genesis.go index 44b1fc6f..d07ef47c 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -29,6 +29,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { genesisAuctions := []*types.Auction{} for _, auction := range auctions { + // #nosec G601 genesisAuctions = append(genesisAuctions, &auction) //nolint: all } return types.GenesisState{Params: params, Auctions: genesisAuctions} diff --git a/x/evm/module.go b/x/evm/module.go index 73885f2a..ae6fe869 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "math/rand" + "math/rand" // #nosec G702 "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/x/feemarket/module.go b/x/feemarket/module.go index c8cdd710..cae68c83 100644 --- a/x/feemarket/module.go +++ b/x/feemarket/module.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "math/rand" + "math/rand" // #nosec G702 "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/x/nameservice/client/cli/tx.go b/x/nameservice/client/cli/tx.go index 711bf400..b4f4f74e 100644 --- a/x/nameservice/client/cli/tx.go +++ b/x/nameservice/client/cli/tx.go @@ -375,7 +375,7 @@ $ %s tx %s delete-name [crn] func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { var payload types.PayloadType - data, err := ioutil.ReadFile(filePath) + data, err := ioutil.ReadFile(filePath) // #nosec G304 if err != nil { return nil, err } diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index ae6413b5..83c887f6 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -65,7 +65,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, Entry: &record, //nolint: all - }) + }) // #nosec G601 } names := keeper.ListNameRecords(ctx) From 5ae3bc8d23d6dc83578d1988ef8fbbe6de8f8815 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 15:44:39 +0530 Subject: [PATCH 14/14] ignore gosec --- gql/util.go | 1 + 1 file changed, 1 insertion(+) diff --git a/gql/util.go b/gql/util.go index a2747f80..b080b662 100644 --- a/gql/util.go +++ b/gql/util.go @@ -166,6 +166,7 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au func getReferences(ctx context.Context, resolver QueryResolver, r *nstypes.RecordType) ([]*Record, error) { var ids []string + // #nosec G705 for key := range r.Attributes { //nolint: all switch r.Attributes[key].(type) {