From d28ef888ff0a378acef83a2d636bd543d5c3ec99 Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Wed, 29 Sep 2021 18:18:30 +0530 Subject: [PATCH] dxns bond module test (#4) * WIP : added bond module tx and query cli commands * added bond module invariant * update the go.mod * addressed the pr changes * update to proto files * refactor: move the proto package version from `v1` to `v1beta1` for vulcanize modules * WIP : addin the unit test scripts to bond module * refactor: refactored the test cases for bond module * refactor: refactored the bond module test cases 1. refactored grpc gateway endpoints of bond module 2. added test cases to cli query , cli tx and grpc end points * addressed the pr comments 1. changed query-by-owner to by-owner in cli cmd 2. changed bonds-by-owner route to by-owner in bond module --- app/test_helpers.go | 14 + docs/api/proto-docs.md | 30 +- go.mod | 2 +- go.sum | 4 + proto/vulcanize/bond/v1beta1/query.proto | 10 +- server/flags/flags.go | 1 + x/bond/README.md | 2 +- x/bond/client/cli/query.go | 4 +- x/bond/client/testutil/cli_test.go | 13 + x/bond/client/testutil/grpc_gateway_test.go | 225 ++++++++++++++ x/bond/client/testutil/query_test.go | 319 ++++++++++++++++++++ x/bond/client/testutil/tx_test.go | 309 +++++++++++++++++++ x/bond/keeper/grpc_query.go | 2 +- x/bond/keeper/grpc_query_test.go | 221 ++++++++++++++ x/bond/keeper/keeper_test.go | 46 +++ x/bond/keeper/params.go | 2 +- x/bond/module_test.go | 23 ++ x/bond/types/query.pb.go | 168 +++++------ x/bond/types/query.pb.gw.go | 52 +++- x/bond/types/tx.pb.go | 67 ++-- 20 files changed, 1362 insertions(+), 152 deletions(-) create mode 100644 x/bond/client/testutil/cli_test.go create mode 100644 x/bond/client/testutil/grpc_gateway_test.go create mode 100644 x/bond/client/testutil/query_test.go create mode 100644 x/bond/client/testutil/tx_test.go create mode 100644 x/bond/keeper/grpc_query_test.go create mode 100644 x/bond/keeper/keeper_test.go create mode 100644 x/bond/module_test.go diff --git a/app/test_helpers.go b/app/test_helpers.go index 6b80157a..6db90637 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -2,6 +2,8 @@ package app import ( "encoding/json" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" "time" "github.com/cosmos/cosmos-sdk/simapp" @@ -58,3 +60,15 @@ func Setup(isCheckTx bool) *EthermintApp { return app } + +// CreateRandomAccounts will generate random accounts +func CreateRandomAccounts(accNum int) []sdk.AccAddress { + // createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order. + testAddrs := make([]sdk.AccAddress, accNum) + for i := 0; i < accNum; i++ { + pk := ed25519.GenPrivKey().PubKey() + testAddrs[i] = sdk.AccAddress(pk.Address()) + } + + return testAddrs +} diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 30604611..c9983d0c 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -96,7 +96,7 @@ - [QueryGetBondsByOwnerResponse](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse) - [QueryGetBondsRequest](#vulcanize.bond.v1beta1.QueryGetBondsRequest) - [QueryGetBondsResponse](#vulcanize.bond.v1beta1.QueryGetBondsResponse) - - [QueryParamRequest](#vulcanize.bond.v1beta1.QueryParamRequest) + - [QueryParamsRequest](#vulcanize.bond.v1beta1.QueryParamsRequest) - [QueryParamsResponse](#vulcanize.bond.v1beta1.QueryParamsResponse) - [Query](#vulcanize.bond.v1beta1.Query) @@ -1297,7 +1297,7 @@ QueryGetBondModuleBalanceRequest is request type for bond module balance rpc met ### QueryGetBondModuleBalanceResponse -QueryGetBondModuleBalanceResponse is response type for bond module balance rpc method +QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method | Field | Type | Label | Description | @@ -1312,7 +1312,7 @@ QueryGetBondModuleBalanceResponse is response type for bond module balance rpc m ### QueryGetBondsByOwnerRequest -QueryGetBondsByOwnerRequest is request tyep for Query/GetBondsByOwner RPC Method +QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method | Field | Type | Label | Description | @@ -1344,7 +1344,7 @@ QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Meth ### QueryGetBondsRequest -QueryGetBonds +QueryGetBondById queries a bond by bond-id. | Field | Type | Label | Description | @@ -1359,7 +1359,7 @@ QueryGetBonds ### QueryGetBondsResponse -QueryGetBondsResponse +QueryGetBondsResponse is response type for get the bonds by bond-id | Field | Type | Label | Description | @@ -1372,10 +1372,10 @@ QueryGetBondsResponse - + -### QueryParamRequest -QueryParamRequest is request for query the bond module params +### QueryParamsRequest +QueryParamsRequest is request for query the bond module params @@ -1410,11 +1410,11 @@ Query defines the gRPC querier service for bond module | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamRequest](#vulcanize.bond.v1beta1.QueryParamRequest) | [QueryParamsResponse](#vulcanize.bond.v1beta1.QueryParamsResponse) | Bonds queries bonds list. | GET|/ethermint/bond/v1/params| -| `Bonds` | [QueryGetBondsRequest](#vulcanize.bond.v1beta1.QueryGetBondsRequest) | [QueryGetBondsResponse](#vulcanize.bond.v1beta1.QueryGetBondsResponse) | Bonds queries bonds list. | GET|/ethermint/bond/v1/bonds| -| `GetBondById` | [QueryGetBondByIdRequest](#vulcanize.bond.v1beta1.QueryGetBondByIdRequest) | [QueryGetBondByIdResponse](#vulcanize.bond.v1beta1.QueryGetBondByIdResponse) | GetBondById | GET|/ethermint/bond/v1/bonds/{id}| -| `GetBondsByOwner` | [QueryGetBondsByOwnerRequest](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest) | [QueryGetBondsByOwnerResponse](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse) | Get Bonds List by Owner | GET|/ethermint/bond/v1/bonds_by_owner| -| `GetBondsModuleBalance` | [QueryGetBondModuleBalanceRequest](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest) | [QueryGetBondModuleBalanceResponse](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse) | Get Bonds module balance | GET|/ethermint/bond/v1/balance| +| `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}| +| `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| @@ -1446,7 +1446,7 @@ MsgCancelBond defines a SDK message for the cancel the bond. ### MsgCancelBondResponse -MsgCancelBondResponse defines the MsgCancelBond response type. +MsgCancelBondResponse defines the Msg/CancelBond response type. @@ -1531,7 +1531,7 @@ MsgWithdrawBond defines a SDK message for withdrawing amount from bond. ### MsgWithdrawBondResponse -MsgWithdrawBondResponse defines the MsgWithdrawBond response type. +MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. diff --git a/go.mod b/go.mod index afe28a5b..1ece54d8 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect - google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 + google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 google.golang.org/grpc v1.40.0 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index cc7d219b..f5562c55 100644 --- a/go.sum +++ b/go.sum @@ -1519,6 +1519,10 @@ google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 h1:ysnBoUyeL/H6RCv google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6 h1:2ncG/LajxmrclaZH+ppVi02rQxz4eXYJzGHdFN4Y9UA= google.golang.org/genproto v0.0.0-20210921142501-181ce0d877f6/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20210927142257-433400c27d05 h1:6/1QShroBaS9sY9NbPquolxRETG6PZhfv8ohdbLieBg= +google.golang.org/genproto v0.0.0-20210927142257-433400c27d05/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y= +google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/proto/vulcanize/bond/v1beta1/query.proto b/proto/vulcanize/bond/v1beta1/query.proto index 283e7891..866c3c09 100644 --- a/proto/vulcanize/bond/v1beta1/query.proto +++ b/proto/vulcanize/bond/v1beta1/query.proto @@ -13,27 +13,27 @@ option go_package = "github.com/tharsis/ethermint/x/bond/types"; service Query { // Params queries bonds module params. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ethermint/bond/v1/params"; + option (google.api.http).get = "/vulcanize/bond/v1beta1/params"; } // Bonds queries bonds list. rpc Bonds(QueryGetBondsRequest) returns (QueryGetBondsResponse) { - option (google.api.http).get = "/ethermint/bond/v1/bonds"; + option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds"; } // GetBondById rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse){ - option (google.api.http).get = "/ethermint/bond/v1/bonds/{id}"; + option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds/{id}"; } // Get Bonds List by Owner rpc GetBondsByOwner(QueryGetBondsByOwnerRequest) returns (QueryGetBondsByOwnerResponse){ - option (google.api.http).get = "/ethermint/bond/v1/bonds_by_owner"; + option (google.api.http).get = "/vulcanize/bond/v1beta1/by-owner/{owner}"; } // Get Bonds module balance rpc GetBondsModuleBalance(QueryGetBondModuleBalanceRequest) returns (QueryGetBondModuleBalanceResponse){ - option (google.api.http).get = "/ethermint/bond/v1/balance"; + option (google.api.http).get = "/vulcanize/bond/v1beta1/balance"; } } diff --git a/server/flags/flags.go b/server/flags/flags.go index 89205f60..e2151a7c 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -48,6 +48,7 @@ func AddTxFlags(cmd *cobra.Command) *cobra.Command { cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") cmd.PersistentFlags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async|block)") cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendOS, "Select keyring's backend") + cmd.PersistentFlags().BoolP(flags.FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation") // --gas can accept integers and "simulate" // cmd.PersistentFlags().Var(&flags.GasFlagVar, "gas", fmt.Sprintf( diff --git a/x/bond/README.md b/x/bond/README.md index 8e549c73..50e0af36 100644 --- a/x/bond/README.md +++ b/x/bond/README.md @@ -139,7 +139,7 @@ $ ./build/ethermintd q bond balance -o json | jq . # Get Bonds By Owner ``` -$ ./build/ethermintd q bond query-by-owner ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk -o json | jq . +$ ./build/ethermintd q bond by-owner ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk -o json | jq . { "bonds": [ { diff --git a/x/bond/client/cli/query.go b/x/bond/client/cli/query.go index 86a969bf..dd4d2a93 100644 --- a/x/bond/client/cli/query.go +++ b/x/bond/client/cli/query.go @@ -52,7 +52,7 @@ $ %s query %s params return err } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Params(cmd.Context(), &types.QueryParamRequest{}) + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) if err != nil { return err } @@ -136,7 +136,7 @@ $ %s query bond get {BOND ID} // GetBondListByOwnerCmd queries the bond list by owner. func GetBondListByOwnerCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "query-by-owner [address]", + Use: "by-owner [address]", Short: "Query bonds by owner.", Long: strings.TrimSpace( fmt.Sprintf(`Get bond list by owner. diff --git a/x/bond/client/testutil/cli_test.go b/x/bond/client/testutil/cli_test.go new file mode 100644 index 00000000..69069bc5 --- /dev/null +++ b/x/bond/client/testutil/cli_test.go @@ -0,0 +1,13 @@ +package testutil + +import ( + "github.com/stretchr/testify/suite" + "github.com/tharsis/ethermint/testutil/network" + "testing" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/bond/client/testutil/grpc_gateway_test.go b/x/bond/client/testutil/grpc_gateway_test.go new file mode 100644 index 00000000..38b9735c --- /dev/null +++ b/x/bond/client/testutil/grpc_gateway_test.go @@ -0,0 +1,225 @@ +package testutil + +import ( + "fmt" + "github.com/cosmos/cosmos-sdk/testutil" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/cosmos/cosmos-sdk/types/rest" + bondtypes "github.com/tharsis/ethermint/x/bond/types" +) + +func (s *IntegrationTestSuite) TestGetBondsGRPC() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + url string + headers map[string]string + noOfBonds int + expErr bool + }{ + { + "invalid request with headers", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + 0, + true, + }, + { + "valid request", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress), + map[string]string{}, + 0, + false, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + sr.NoError(err) + + var bonds bondtypes.QueryGetBondsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + + if tc.expErr { + sr.Empty(bonds.GetBonds()) + } else { + sr.NoError(err) + sr.Len(bonds.GetBonds(), tc.noOfBonds) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetParamsGRPC() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + url string + headers map[string]string + noOfBonds int + expErr bool + }{ + { + "valid request", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress), + map[string]string{}, + 0, + false, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + + var params bondtypes.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms) + + if tc.expErr { + sr.Empty(params.GetParams()) + } else { + sr.NoError(err) + sr.Equal(params.GetParams().MaxBondAmount, bondtypes.DefaultParams().MaxBondAmount) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetBondsByOwnerGRPC() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + url string + headers map[string]string + noOfBonds int + expErr bool + }{ + { + "invalid request with headers", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/by-owner", val.APIAddress), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + 0, + true, + }, + { + "valid request", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/by-owner/%s,", val.APIAddress, val.Address.String()), + map[string]string{}, + 0, + false, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + sr.NoError(err) + + var bonds bondtypes.QueryGetBondsByOwnerResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + + if tc.expErr { + sr.Empty(bonds.GetBonds()) + } else { + sr.NoError(err) + sr.Len(bonds.GetBonds(), tc.noOfBonds) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetBondByIdGRPC() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + url string + headers map[string]string + noOfBonds int + expErr bool + }{ + { + "invalid request with headers", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds/%s", val.APIAddress, "asdadad"), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + 0, + true, + }, + { + "valid request", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds/%s,", val.APIAddress, "asdadad"), + map[string]string{}, + 0, + false, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + sr.NoError(err) + + var bonds bondtypes.QueryGetBondByIdResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + + if tc.expErr { + sr.Empty(bonds.GetBond().GetId()) + } else { + sr.NoError(err) + sr.Len(bonds.GetBond().GetId(), tc.noOfBonds) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetBondModuleBalanceGRPC() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + url string + headers map[string]string + noOfBonds int + expErr bool + }{ + { + "invalid request with headers", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + 0, + true, + }, + { + "valid request", + fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress), + map[string]string{}, + 0, + false, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + sr.NoError(err) + + var bonds bondtypes.QueryGetBondModuleBalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + + if tc.expErr { + sr.Empty(bonds.GetBalance()) + } else { + sr.NoError(err) + sr.True(bonds.GetBalance().IsZero()) + } + }) + } +} diff --git a/x/bond/client/testutil/query_test.go b/x/bond/client/testutil/query_test.go new file mode 100644 index 00000000..e14477d5 --- /dev/null +++ b/x/bond/client/testutil/query_test.go @@ -0,0 +1,319 @@ +package testutil + +import ( + "fmt" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/testutil/network" + "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/types" + "gopkg.in/yaml.v2" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +var ( + accountName = "accountName" + accountAddress string +) + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + s.network = network.New(s.T(), s.cfg) + + _, err := s.network.WaitForHeight(1) + s.Require().NoError(err) + + // setting up random account + s.createAccountWithBalance(accountName) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +func (s *IntegrationTestSuite) TestGetCmdQueryParams() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + outputType string + }{ + { + "json output", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + "json", + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + cmd := cli.GetQueryParamsCmd() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + s.Require().NoError(err) + var param types.QueryParamsResponse + if tc.outputType == "json" { + err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶m) + s.Require().NoError(err) + } else { + err := yaml.Unmarshal(out.Bytes(), ¶m) + s.Require().NoError(err) + } + s.Require().Equal(param.Params.MaxBondAmount, types.DefaultParams().MaxBondAmount) + }) + } +} + +func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) { + val := s.network.Validators[0] + sr := s.Require() + consPrivKey := ed25519.GenPrivKey() + consPubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(consPrivKey.PubKey()) + sr.NoError(err) + sr.NotNil(consPubKeyBz) + + info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + sr.NoError(err) + + newAddr := sdk.AccAddress(info.GetPubKey().Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + sr.NoError(err) + accountAddress = newAddr.String() +} + +func (s *IntegrationTestSuite) createBond() { + val := s.network.Validators[0] + sr := s.Require() + createBondCmd := cli.NewCreateBondCmd() + args := []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, createBondCmd, args) + sr.NoError(err) + var d sdk.TxResponse + val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.Zero(d.Code) + err = s.network.WaitForNextBlock() + sr.NoError(err) +} + +func (s *IntegrationTestSuite) TestGetQueryBondLists() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + outputType string + createBond bool + }{ + { + "create and get bond lists", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + "json", + true, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if tc.createBond { + s.createBond() + } + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + if tc.outputType == "json" { + err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + } else { + err := yaml.Unmarshal(out.Bytes(), &queryResponse) + sr.NoError(err) + } + sr.NotZero(len(queryResponse.GetBonds())) + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondById() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + createBond bool + err bool + }{ + { + "invalid bond id", + []string{ + fmt.Sprint("not_found_bond_id"), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, + true, + }, + { + "create and get bond by id", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if tc.createBond { + s.createBond() + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + + } + cmd := cli.GetBondByIdCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + if tc.err { + sr.Zero(len(queryResponse.GetBond().GetId())) + } else { + sr.NotZero(len(queryResponse.GetBond().GetId())) + sr.Equal(accountAddress, queryResponse.GetBond().GetOwner()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + createBond bool + err bool + }{ + { + "invalid owner address", + []string{ + fmt.Sprint("not_found_bond_id"), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, + true, + }, + { + "get bond lists by owner address", + []string{ + fmt.Sprint(accountAddress), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if tc.createBond { + s.createBond() + } + cmd := cli.GetBondListByOwnerCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondsByOwnerResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + if tc.err { + sr.Zero(len(queryResponse.GetBonds())) + } else { + sr.NotZero(len(queryResponse.GetBonds())) + sr.Equal(accountAddress, queryResponse.GetBonds()[0].GetOwner()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondModuleBalance() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + createBond bool + }{ + { + "get bond module balance", + []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if tc.createBond { + s.createBond() + } + cmd := cli.GetBondModuleBalanceCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondModuleBalanceResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + sr.False(queryResponse.GetBalance().IsZero()) + }) + } +} diff --git a/x/bond/client/testutil/tx_test.go b/x/bond/client/testutil/tx_test.go new file mode 100644 index 00000000..b8740a47 --- /dev/null +++ b/x/bond/client/testutil/tx_test.go @@ -0,0 +1,309 @@ +package testutil + +import ( + "fmt" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/types" +) + +func (s *IntegrationTestSuite) TestTxCreateBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + err bool + }{ + { + "without deposit", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + }, + { + "create bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.NewCreateBondCmd() + + 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) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxRefillBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without refill amount and bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "refill bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.RefillBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + 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) + + // checking the balance of bond + 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 + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.True(queryResponse.GetBond().GetBalance().IsEqual( + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))))) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without withdraw amount and bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "withdraw amount from bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.WithdrawBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + 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) + + // checking the balance of bond + 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 + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.True(queryResponse.GetBond().GetBalance().IsEqual( + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))))) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxCancelBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "cancel bond", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.CancelBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + 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) + + // checking the bond exists or not after cancel + 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 + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.Zero(queryResponse.GetBond().GetId()) + } + }) + } +} diff --git a/x/bond/keeper/grpc_query.go b/x/bond/keeper/grpc_query.go index 6ed101d0..9019d3ed 100644 --- a/x/bond/keeper/grpc_query.go +++ b/x/bond/keeper/grpc_query.go @@ -19,7 +19,7 @@ func (q Querier) Bonds(c context.Context, _ *types.QueryGetBondsRequest) (*types return &types.QueryGetBondsResponse{Bonds: resp}, nil } -func (q Querier) Params(c context.Context, _ *types.QueryParamRequest) (*types.QueryParamsResponse, error) { +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) params := q.Keeper.GetParams(ctx) return &types.QueryParamsResponse{Params: ¶ms}, nil diff --git a/x/bond/keeper/grpc_query_test.go b/x/bond/keeper/grpc_query_test.go new file mode 100644 index 00000000..bb443b2c --- /dev/null +++ b/x/bond/keeper/grpc_query_test.go @@ -0,0 +1,221 @@ +package keeper_test + +import ( + "context" + "fmt" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/app" + "github.com/tharsis/ethermint/x/bond/types" +) + +func (suite *KeeperTestSuite) TestGrpcQueryBondsList() { + grpcClient, ctx, k := suite.queryClient, suite.ctx, suite.app.BondKeeper + + testCases := []struct { + msg string + req *types.QueryGetBondsRequest + resp *types.QueryGetBondsResponse + noOfBonds int + createBonds bool + }{ + { + "empty request", + &types.QueryGetBondsRequest{}, + &types.QueryGetBondsResponse{}, + 0, + false, + }, + { + "Get Bonds", + &types.QueryGetBondsRequest{}, + &types.QueryGetBondsResponse{}, + 1, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err = k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suite.Require().NoError(err) + } + resp, _ := grpcClient.Bonds(context.Background(), test.req) + suite.Require().Equal(test.noOfBonds, len(resp.GetBonds())) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryParams() { + grpcClient := suite.queryClient + + testCases := []struct { + msg string + req *types.QueryParamsRequest + }{ + { + "Get Params", + &types.QueryParamsRequest{}, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + resp, _ := grpcClient.Params(context.Background(), test.req) + suite.Require().Equal(resp.GetParams().MaxBondAmount, types.DefaultParams().MaxBondAmount) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryBondBondId() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondByIdRequest + createBonds bool + errResponse bool + bondId string + }{ + { + "empty request", + &types.QueryGetBondByIdRequest{}, + false, + true, + "", + }, + { + "Get Bond By ID", + &types.QueryGetBondByIdRequest{}, + true, + false, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + bond, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + test.req.Id = bond.Id + } + 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()) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBondsByOwner() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondsByOwnerRequest + noOfBonds int + createBonds bool + errResponse bool + bondId string + }{ + { + "empty request", + &types.QueryGetBondsByOwnerRequest{}, + 0, + false, + true, + "", + }, + { + "Get Bond By Owner", + &types.QueryGetBondsByOwnerRequest{}, + 1, + true, + false, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + _ = simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + test.req.Owner = account.String() + } + resp, err := grpcClient.GetBondsByOwner(context.Background(), test.req) + if !test.errResponse { + suiteRequire.Nil(err) + suiteRequire.NotNil(resp.GetBonds()) + suiteRequire.Equal(test.noOfBonds, len(resp.GetBonds())) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetModuleBalance() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondModuleBalanceRequest + noOfBonds int + createBonds bool + errResponse bool + }{ + { + "empty request", + &types.QueryGetBondModuleBalanceRequest{}, + 0, + true, + false, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + _ = simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + } + resp, err := grpcClient.GetBondsModuleBalance(context.Background(), test.req) + if !test.errResponse { + suiteRequire.Nil(err) + suiteRequire.NotNil(resp.GetBalance()) + suiteRequire.Equal(resp.GetBalance(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} diff --git a/x/bond/keeper/keeper_test.go b/x/bond/keeper/keeper_test.go new file mode 100644 index 00000000..72065b09 --- /dev/null +++ b/x/bond/keeper/keeper_test.go @@ -0,0 +1,46 @@ +package keeper_test + +import ( + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tharsis/ethermint/app" + bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" + "github.com/tharsis/ethermint/x/bond/types" + "testing" +) + +type KeeperTestSuite struct { + suite.Suite + app *app.EthermintApp + ctx sdk.Context + queryClient types.QueryClient +} + +func (suite *KeeperTestSuite) SetupTest() { + testApp := app.Setup(false) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + querier := bondkeeper.Querier{Keeper: testApp.BondKeeper} + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, querier) + queryClient := types.NewQueryClient(queryHelper) + + suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient +} + +func TestParams(t *testing.T) { + testApp := app.Setup(false) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + expParams := types.DefaultParams() + params := testApp.BondKeeper.GetParams(ctx) + require.Equal(t, expParams.MaxBondAmount, params.MaxBondAmount) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/bond/keeper/params.go b/x/bond/keeper/params.go index 3942a2ac..d2a484cf 100644 --- a/x/bond/keeper/params.go +++ b/x/bond/keeper/params.go @@ -11,7 +11,7 @@ func (k Keeper) GetMaxBondAmount(ctx sdk.Context) (res sdk.Coin) { return } -// GetParams - Get all parameter as as types.Params. +// GetParams - Get all parameter as types.Params. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { getMaxBondAmount := k.GetMaxBondAmount(ctx) return types.Params{MaxBondAmount: getMaxBondAmount} diff --git a/x/bond/module_test.go b/x/bond/module_test.go new file mode 100644 index 00000000..faabd413 --- /dev/null +++ b/x/bond/module_test.go @@ -0,0 +1,23 @@ +package bond_test + +import ( + "github.com/stretchr/testify/require" + abcitypes "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + app2 "github.com/tharsis/ethermint/app" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + "testing" +) + +func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { + app := app2.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + app.InitChain(abcitypes.RequestInitChain{ + AppStateBytes: []byte("{}"), + ChainId: "test-chain-id", + }) + + acc := app.AccountKeeper.GetModuleAccount(ctx, bondtypes.ModuleName) + require.NotNil(t, acc) +} diff --git a/x/bond/types/query.pb.go b/x/bond/types/query.pb.go index 80c7e0ec..56b259e8 100644 --- a/x/bond/types/query.pb.go +++ b/x/bond/types/query.pb.go @@ -32,22 +32,22 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamRequest is request for query the bond module params -type QueryParamRequest struct { +// QueryParamsRequest is request for query the bond module params +type QueryParamsRequest struct { } -func (m *QueryParamRequest) Reset() { *m = QueryParamRequest{} } -func (m *QueryParamRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamRequest) ProtoMessage() {} -func (*QueryParamRequest) Descriptor() ([]byte, []int) { +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_2f225717b20da431, []int{0} } -func (m *QueryParamRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -57,17 +57,17 @@ func (m *QueryParamRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *QueryParamRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamRequest.Merge(m, src) +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) } -func (m *QueryParamRequest) XXX_Size() int { +func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryParamRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamRequest.DiscardUnknown(m) +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse returns response type of bond module params type QueryParamsResponse struct { @@ -114,7 +114,7 @@ func (m *QueryParamsResponse) GetParams() *Params { return nil } -// QueryGetBonds +// QueryGetBondById queries a bond by bond-id. type QueryGetBondsRequest struct { // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -160,7 +160,7 @@ func (m *QueryGetBondsRequest) GetPagination() *query.PageRequest { return nil } -// QueryGetBondsResponse +// QueryGetBondsResponse is response type for get the bonds by bond-id type QueryGetBondsResponse struct { Bonds []*Bond `protobuf:"bytes,1,rep,name=bonds,proto3" json:"bonds,omitempty" json:"bonds" yaml:"bonds"` // pagination defines the pagination in the response. @@ -304,7 +304,7 @@ func (m *QueryGetBondByIdResponse) GetBond() *Bond { return nil } -// QueryGetBondsByOwnerRequest is request tyep for Query/GetBondsByOwner RPC Method +// QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method type QueryGetBondsByOwnerRequest struct { Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` // pagination defines the pagination in the response. @@ -449,7 +449,7 @@ func (m *QueryGetBondModuleBalanceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryGetBondModuleBalanceRequest proto.InternalMessageInfo -// QueryGetBondModuleBalanceResponse is response type for bond module balance rpc method +// QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method type QueryGetBondModuleBalanceResponse struct { Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance" json:"coins" yaml:"coins"` } @@ -495,7 +495,7 @@ func (m *QueryGetBondModuleBalanceResponse) GetBalance() github_com_cosmos_cosmo } func init() { - proto.RegisterType((*QueryParamRequest)(nil), "vulcanize.bond.v1beta1.QueryParamRequest") + proto.RegisterType((*QueryParamsRequest)(nil), "vulcanize.bond.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.bond.v1beta1.QueryParamsResponse") proto.RegisterType((*QueryGetBondsRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondsRequest") proto.RegisterType((*QueryGetBondsResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondsResponse") @@ -512,55 +512,55 @@ func init() { } var fileDescriptor_2f225717b20da431 = []byte{ - // 766 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0xcf, 0x6e, 0xd3, 0x4a, - 0x14, 0xc6, 0xe3, 0xdc, 0x9b, 0x5c, 0xdd, 0xe9, 0xe2, 0xea, 0x4e, 0x5b, 0x9a, 0x3a, 0xa9, 0x9d, - 0x0c, 0x82, 0xb6, 0x40, 0x6d, 0xda, 0xb2, 0x00, 0x96, 0xae, 0x44, 0xc5, 0xa2, 0x82, 0x5a, 0x42, - 0x48, 0x2c, 0xa8, 0x9c, 0x78, 0x94, 0x0e, 0x24, 0x33, 0x69, 0xc6, 0x29, 0x84, 0x3f, 0x9b, 0x22, - 0xb1, 0x43, 0x42, 0x62, 0xc1, 0x23, 0x80, 0x58, 0x21, 0xb1, 0x67, 0xdd, 0x65, 0x25, 0x36, 0xac, - 0x02, 0x6a, 0x79, 0x82, 0x3c, 0x01, 0xf2, 0xcc, 0x38, 0xb1, 0xdb, 0xa4, 0x4d, 0x11, 0x62, 0xd5, - 0x8e, 0xfd, 0x9d, 0x73, 0x7e, 0xdf, 0xf1, 0x9c, 0x13, 0x80, 0xb6, 0x5b, 0xb5, 0x8a, 0x47, 0xc9, - 0x13, 0x6c, 0x97, 0x19, 0xf5, 0xed, 0xed, 0xc5, 0x32, 0x0e, 0xbc, 0x45, 0x7b, 0xab, 0x85, 0x9b, - 0x6d, 0xab, 0xd1, 0x64, 0x01, 0x83, 0x67, 0x7a, 0x1a, 0x2b, 0xd4, 0x58, 0x4a, 0xa3, 0x4f, 0x54, - 0x59, 0x95, 0x09, 0x89, 0x1d, 0xfe, 0x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 0x1c, 0x09, 0xf2, 0x02, 0xd4, 0x07, - 0x91, 0x4b, 0xad, 0xb3, 0xb2, 0xbb, 0x6f, 0x68, 0x7b, 0xfb, 0x86, 0xf6, 0x7d, 0xdf, 0xd0, 0x5e, - 0x1f, 0x18, 0xa9, 0xbd, 0x03, 0x23, 0xf5, 0xf5, 0xc0, 0x48, 0xdd, 0x9b, 0x8f, 0x0d, 0x57, 0xb0, - 0xe9, 0x35, 0x39, 0xe1, 0xb1, 0x3c, 0x8f, 0x65, 0x26, 0x31, 0x63, 0xe5, 0xac, 0xf8, 0xcd, 0x5e, - 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0x75, 0x49, 0xed, 0xbe, 0x94, 0x08, 0x00, 0x00, + // 764 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, 0xa6, 0xad, 0x9d, 0x9c, + 0xa0, 0x0d, 0x81, 0xfa, 0xfa, 0x87, 0x01, 0x18, 0x5d, 0x89, 0x8a, 0xa1, 0x82, 0x5a, 0x42, 0x48, + 0x0c, 0x48, 0x4e, 0x7c, 0x72, 0x0f, 0x12, 0x5f, 0x9a, 0x73, 0x0a, 0xa1, 0x74, 0xe9, 0x86, 0x58, + 0x90, 0x58, 0x79, 0x01, 0xc0, 0xc0, 0x82, 0x58, 0x99, 0x3b, 0x56, 0x62, 0x61, 0x0a, 0xa8, 0xe5, + 0x15, 0xe4, 0x15, 0x20, 0xdf, 0x9d, 0x53, 0xbb, 0x6d, 0x42, 0x8a, 0x10, 0x93, 0x73, 0xf6, 0xf7, + 0x79, 0x9e, 0xcf, 0xf7, 0xb1, 0x9f, 0x27, 0x00, 0x6d, 0xb5, 0x6a, 0x55, 0xc7, 0xa7, 0xcf, 0x09, + 0xae, 0x30, 0xdf, 0xc5, 0x5b, 0x8b, 0x15, 0x12, 0x38, 0x8b, 0x78, 0xb3, 0x45, 0x9a, 0x6d, 0xb3, + 0xd1, 0x64, 0x01, 0x83, 0x17, 0x7b, 0x1a, 0x33, 0xd4, 0x98, 0x4a, 0x93, 0xcf, 0x79, 0xcc, 0x63, + 0x42, 0x82, 0xc3, 0x5f, 0x52, 0x9d, 0x2f, 0xf6, 0xc9, 0x28, 0x42, 0xa5, 0x64, 0xda, 0x63, 0xcc, + 0xab, 0x11, 0xec, 0x34, 0x28, 0x76, 0x7c, 0x9f, 0x05, 0x4e, 0x40, 0x99, 0xcf, 0xd5, 0xd3, 0x72, + 0x95, 0xf1, 0x3a, 0xe3, 0xb8, 0xe2, 0x70, 0x22, 0x39, 0x7a, 0x39, 0x1a, 0x8e, 0x47, 0x7d, 0x21, + 0x56, 0x5a, 0x3d, 0xae, 0x8d, 0x54, 0x55, 0x46, 0xd5, 0x73, 0x94, 0x03, 0x70, 0x3d, 0xcc, 0x70, + 0xcf, 0x69, 0x3a, 0x75, 0x6e, 0x93, 0xcd, 0x16, 0xe1, 0x01, 0xf2, 0xc1, 0x68, 0xe2, 0x2e, 0x6f, + 0x30, 0x9f, 0x13, 0xf8, 0x00, 0x64, 0x1b, 0xe2, 0xce, 0x84, 0x56, 0xd0, 0x4a, 0x23, 0x4b, 0xba, + 0x79, 0xba, 0x71, 0x53, 0xc6, 0x59, 0x46, 0xb7, 0x63, 0x4c, 0x3d, 0xe6, 0xcc, 0xbf, 0x85, 0x64, + 0x1c, 0x2a, 0xb4, 0x9d, 0x7a, 0xad, 0x77, 0xb2, 0x55, 0x3a, 0xf4, 0x08, 0xe4, 0x44, 0xbd, 0x55, + 0x12, 0x58, 0xcc, 0x77, 0x23, 0x0e, 0x78, 0x1b, 0x80, 0x23, 0x47, 0xaa, 0xe8, 0xac, 0x29, 0x2d, + 0x99, 0xa1, 0x25, 0x53, 0xbe, 0x86, 0xa3, 0x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x17, 0xb5, 0x3d, 0x2f, 0x96, 0x08, 0xde, 0x16, 0x97, 0x1d, 0xf8, 0x59, 0x03, 0x63, + 0x51, 0xb6, 0xc4, 0x68, 0xc0, 0x1b, 0xc3, 0x10, 0x9c, 0x36, 0x72, 0xf9, 0x9b, 0x7f, 0x10, 0xa9, + 0x0c, 0xcc, 0x09, 0x03, 0x45, 0x68, 0xf4, 0x35, 0x20, 0x03, 0xac, 0x95, 0xbd, 0x03, 0x5d, 0xdb, + 0x3f, 0xd0, 0xb5, 0x1f, 0x07, 0xba, 0xf6, 0xfa, 0x50, 0x4f, 0xed, 0x1f, 0xea, 0xa9, 0x6f, 0x87, + 0x7a, 0xea, 0xe1, 0x95, 0xd8, 0xe0, 0x05, 0x1b, 0x4e, 0x93, 0x53, 0x8e, 0x49, 0xb0, 0x41, 0x9a, + 0x75, 0xea, 0x07, 0xf8, 0x99, 0x4c, 0x27, 0xe6, 0xaf, 0x92, 0x15, 0x7f, 0xe8, 0xcb, 0xbf, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x0f, 0x7a, 0x69, 0x08, 0xb1, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -575,8 +575,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Bonds queries bonds list. - Params(ctx context.Context, in *QueryParamRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Params queries bonds module params. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Bonds queries bonds list. Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) // GetBondById @@ -595,7 +595,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/Params", in, out, opts...) if err != nil { @@ -642,8 +642,8 @@ func (c *queryClient) GetBondsModuleBalance(ctx context.Context, in *QueryGetBon // QueryServer is the server API for Query service. type QueryServer interface { - // Bonds queries bonds list. - Params(context.Context, *QueryParamRequest) (*QueryParamsResponse, error) + // Params queries bonds module params. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Bonds queries bonds list. Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) // GetBondById @@ -658,7 +658,7 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamRequest) (*QueryParamsResponse, error) { +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func (*UnimplementedQueryServer) Bonds(ctx context.Context, req *QueryGetBondsRequest) (*QueryGetBondsResponse, error) { @@ -679,7 +679,7 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { } func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamRequest) + in := new(QueryParamsRequest) if err := dec(in); err != nil { return nil, err } @@ -691,7 +691,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf FullMethod: "/vulcanize.bond.v1beta1.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamRequest)) + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } return interceptor(ctx, in, info, handler) } @@ -797,7 +797,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "vulcanize/bond/v1beta1/query.proto", } -func (m *QueryParamRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -807,12 +807,12 @@ func (m *QueryParamRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1166,7 +1166,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamRequest) Size() (n int) { +func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 } @@ -1312,7 +1312,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1335,10 +1335,10 @@ func (m *QueryParamRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/bond/types/query.pb.gw.go b/x/bond/types/query.pb.gw.go index 4bdcf081..cdb30933 100644 --- a/x/bond/types/query.pb.gw.go +++ b/x/bond/types/query.pb.gw.go @@ -32,7 +32,7 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamRequest + var protoReq QueryParamsRequest var metadata runtime.ServerMetadata msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -41,7 +41,7 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamRequest + var protoReq QueryParamsRequest var metadata runtime.ServerMetadata msg, err := server.Params(ctx, &protoReq) @@ -140,13 +140,31 @@ func local_request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Ma } var ( - filter_Query_GetBondsByOwner_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_GetBondsByOwner_0 = &utilities.DoubleArray{Encoding: map[string]int{"owner": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_GetBondsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetBondsByOwnerRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + } + + protoReq.Owner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -163,6 +181,24 @@ func local_request_Query_GetBondsByOwner_0(ctx context.Context, marshaler runtim var protoReq QueryGetBondsByOwnerRequest var metadata runtime.ServerMetadata + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + } + + protoReq.Owner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + } + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -444,15 +480,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "bond", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Bonds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "bond", "v1", "bonds"}, "", runtime.AssumeColonVerbOpt(true))) + 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{"ethermint", "bond", "v1", "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}, []string{"ethermint", "bond", "v1", "bonds_by_owner"}, "", 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))) - pattern_Query_GetBondsModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "bond", "v1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetBondsModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/x/bond/types/tx.pb.go b/x/bond/types/tx.pb.go index 2344f1bd..fea4beaf 100644 --- a/x/bond/types/tx.pb.go +++ b/x/bond/types/tx.pb.go @@ -85,7 +85,7 @@ func (m *MsgCreateBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { // MsgCreateBondResponse defines the Msg/CreateBond response type. type MsgCreateBondResponse struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (m *MsgCreateBondResponse) Reset() { *m = MsgCreateBondResponse{} } @@ -287,7 +287,7 @@ func (m *MsgWithdrawBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { return nil } -// MsgWithdrawBondResponse defines the MsgWithdrawBond response type. +// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. type MsgWithdrawBondResponse struct { } @@ -377,7 +377,7 @@ func (m *MsgCancelBond) GetSigner() string { return "" } -// MsgCancelBondResponse defines the MsgCancelBond response type. +// MsgCancelBondResponse defines the Msg/CancelBond response type. type MsgCancelBondResponse struct { } @@ -428,37 +428,36 @@ func init() { func init() { proto.RegisterFile("vulcanize/bond/v1beta1/tx.proto", fileDescriptor_4a1095dfb30dc368) } var fileDescriptor_4a1095dfb30dc368 = []byte{ - // 478 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0x4d, 0x6e, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0x44, 0x54, 0x62, 0xf8, 0x92, 0x0c, 0x34, 0x4d, 0x16, 0x76, 0x64, 0x09, 0x35, - 0x2c, 0x3a, 0xa3, 0x96, 0x05, 0x12, 0x2b, 0x94, 0xac, 0xb3, 0xf1, 0x06, 0x89, 0xdd, 0xd8, 0x33, - 0xd8, 0x03, 0xf6, 0x4c, 0xe4, 0x37, 0x2d, 0x2d, 0x0b, 0xce, 0xc0, 0x9e, 0x03, 0x20, 0x71, 0x01, - 0xc4, 0x0d, 0xba, 0xec, 0x92, 0x55, 0x40, 0xc9, 0x0d, 0x7a, 0x02, 0x64, 0x8f, 0xbf, 0x42, 0x2b, - 0xab, 0xac, 0x10, 0x2b, 0x7b, 0xe4, 0xdf, 0xfb, 0xf8, 0xbf, 0xf7, 0xf7, 0x20, 0xf7, 0xe4, 0x38, - 0x09, 0xa9, 0x14, 0x1f, 0x38, 0x09, 0x94, 0x64, 0xe4, 0xe4, 0x30, 0xe0, 0x9a, 0x1e, 0x12, 0x7d, - 0x8a, 0x97, 0x99, 0xd2, 0xca, 0xde, 0xad, 0x01, 0x9c, 0x03, 0xb8, 0x04, 0xc6, 0x8f, 0x22, 0x15, - 0xa9, 0x02, 0x21, 0xf9, 0x9b, 0xa1, 0xc7, 0x4e, 0xa8, 0x20, 0x55, 0x40, 0x02, 0x0a, 0xbc, 0xce, - 0x15, 0x2a,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x5f, 0x89, 0x1a, 0xa1, 0xe1, 0x1f, 0xad, 0xd7, 0xb2, 0x9e, - 0x1b, 0x53, 0x52, 0x19, 0xf2, 0xbf, 0x5a, 0x54, 0x39, 0xa8, 0x26, 0xb0, 0xca, 0x78, 0xf4, 0x79, - 0x80, 0x06, 0x0b, 0x88, 0xec, 0x00, 0xa1, 0x96, 0xd7, 0x9f, 0xe0, 0xeb, 0x7f, 0x26, 0xbc, 0xe5, - 0xb4, 0xf1, 0xc1, 0x8d, 0xb0, 0xda, 0x90, 0x01, 0x42, 0x2d, 0x8f, 0x75, 0xd5, 0x68, 0xb0, 0xce, - 0x1a, 0x57, 0x17, 0x6f, 0xc7, 0xe8, 0xee, 0xd6, 0xd2, 0xf7, 0x3b, 0xc2, 0xdb, 0xe0, 0x98, 0xdc, - 0x10, 0x6c, 0xab, 0x69, 0x2d, 0xa2, 0x73, 0x62, 0x35, 0xd6, 0x3d, 0xb1, 0x2b, 0xdb, 0x99, 0xcd, - 0xcf, 0xd7, 0x8e, 0x75, 0xb1, 0x76, 0xac, 0x5f, 0x6b, 0xc7, 0xfa, 0xb4, 0x71, 0x7a, 0x17, 0x1b, - 0xa7, 0xf7, 0x63, 0xe3, 0xf4, 0x5e, 0x3f, 0x6d, 0xb9, 0x4a, 0xc7, 0x34, 0x03, 0x01, 0x84, 0xeb, - 0x98, 0x67, 0xa9, 0x90, 0x9a, 0x9c, 0x9a, 0x3b, 0xb2, 0x30, 0x57, 0xb0, 0x53, 0xdc, 0x68, 0xcf, - 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa4, 0xac, 0xaf, 0xbb, 0x42, 0x05, 0x00, 0x00, + // 462 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0x3f, 0x6e, 0xd4, 0x40, + 0x14, 0xc6, 0xd7, 0xb6, 0x88, 0xc4, 0xf0, 0x4f, 0xb2, 0x20,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1, 0x0e, 0x1b, 0x3e, 0xb1, 0x1b, 0xd3, 0x99, 0xcd, + 0x2f, 0x96, 0xae, 0x71, 0xb9, 0x74, 0x8d, 0x5f, 0x4b, 0xd7, 0xf8, 0xb4, 0x72, 0x47, 0x97, 0x2b, + 0x77, 0xf4, 0x63, 0xe5, 0x8e, 0x5e, 0x3f, 0xeb, 0xa5, 0x4a, 0x65, 0xb4, 0x04, 0x0e, 0x84, 0xa9, + 0x8c, 0x95, 0x05, 0x17, 0x8a, 0x9c, 0xe9, 0xab, 0xb0, 0x0e, 0x57, 0xb4, 0x53, 0x5f, 0x5c, 0xcf, + 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xd8, 0x87, 0xb6, 0x29, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.