This commit is contained in:
parent
17bb4fa58e
commit
53d0cc919f
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,8 @@ type QueryClient interface {
|
|||
Accounts(ctx context.Context, in *QueryAccountsRequest, opts ...grpc.CallOption) (*QueryAccountsResponse, error)
|
||||
// Account returns account details based on address.
|
||||
Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error)
|
||||
// AccountAddressByID returns account address based on account id
|
||||
AccountAddressByID(ctx context.Context, in *QueryAccountAddressByIDRequest, opts ...grpc.CallOption) (*QueryAccountAddressByIDResponse, error)
|
||||
// Params queries all parameters.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// ModuleAccounts returns all the existing module accounts.
|
||||
|
@ -74,6 +76,15 @@ func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) AccountAddressByID(ctx context.Context, in *QueryAccountAddressByIDRequest, opts ...grpc.CallOption) (*QueryAccountAddressByIDResponse, error) {
|
||||
out := new(QueryAccountAddressByIDResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/AccountAddressByID", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
|
||||
out := new(QueryParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Params", in, out, opts...)
|
||||
|
@ -129,6 +140,8 @@ type QueryServer interface {
|
|||
Accounts(context.Context, *QueryAccountsRequest) (*QueryAccountsResponse, error)
|
||||
// Account returns account details based on address.
|
||||
Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error)
|
||||
// AccountAddressByID returns account address based on account id
|
||||
AccountAddressByID(context.Context, *QueryAccountAddressByIDRequest) (*QueryAccountAddressByIDResponse, error)
|
||||
// Params queries all parameters.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
// ModuleAccounts returns all the existing module accounts.
|
||||
|
@ -160,6 +173,9 @@ func (UnimplementedQueryServer) Accounts(context.Context, *QueryAccountsRequest)
|
|||
func (UnimplementedQueryServer) Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Account not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) AccountAddressByID(context.Context, *QueryAccountAddressByIDRequest) (*QueryAccountAddressByIDResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AccountAddressByID not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
|
@ -224,6 +240,24 @@ func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_AccountAddressByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryAccountAddressByIDRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).AccountAddressByID(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.auth.v1beta1.Query/AccountAddressByID",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).AccountAddressByID(ctx, req.(*QueryAccountAddressByIDRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryParamsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -329,6 +363,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Account",
|
||||
Handler: _Query_Account_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AccountAddressByID",
|
||||
Handler: _Query_AccountAddressByID_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
|
|
|
@ -123,7 +123,7 @@ func TestBaseApp_BlockGas(t *testing.T) {
|
|||
require.Equal(t, []byte("ok"), okValue)
|
||||
}
|
||||
// check block gas is always consumed
|
||||
baseGas := uint64(63724) // baseGas is the gas consumed before tx msg
|
||||
baseGas := uint64(70184) // baseGas is the gas consumed before tx msg
|
||||
expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas)
|
||||
if expGasConsumed > txtypes.MaxGasWanted {
|
||||
// capped by gasLimit
|
||||
|
|
|
@ -24,6 +24,11 @@ service Query {
|
|||
option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}";
|
||||
}
|
||||
|
||||
// AccountAddressByID returns account address based on account id
|
||||
rpc AccountAddressByID(QueryAccountAddressByIDRequest) returns (QueryAccountAddressByIDResponse) {
|
||||
option (google.api.http).get = "/cosmos/auth/v1beta1/address_by_id/{id}";
|
||||
}
|
||||
|
||||
// Params queries all parameters.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/cosmos/auth/v1beta1/params";
|
||||
|
@ -152,3 +157,13 @@ message AddressStringToBytesRequest {
|
|||
message AddressStringToBytesResponse {
|
||||
bytes address_bytes = 1;
|
||||
}
|
||||
|
||||
// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method
|
||||
message QueryAccountAddressByIDRequest{
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method
|
||||
message QueryAccountAddressByIDResponse {
|
||||
string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
|
|
@ -572,7 +572,7 @@ func (suite *AnteTestSuite) TestAnteHandlerMemoGas() {
|
|||
"tx with memo has enough gas",
|
||||
func() {
|
||||
feeAmount = sdk.NewCoins(sdk.NewInt64Coin("atom", 0))
|
||||
gasLimit = 50000
|
||||
gasLimit = 60000
|
||||
suite.txBuilder.SetMemo(strings.Repeat("0123456789", 10))
|
||||
},
|
||||
false,
|
||||
|
|
|
@ -3,6 +3,7 @@ package cli
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -41,6 +42,7 @@ func GetQueryCmd() *cobra.Command {
|
|||
|
||||
cmd.AddCommand(
|
||||
GetAccountCmd(),
|
||||
GetAccountAddressByIDCmd(),
|
||||
GetAccountsCmd(),
|
||||
QueryParamsCmd(),
|
||||
QueryModuleAccountsCmd(),
|
||||
|
@ -124,6 +126,39 @@ func GetAccountCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// GetAccountAddressByIDCmd returns a query account that will display the account address of a given account id.
|
||||
func GetAccountAddressByIDCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "address-by-id [id]",
|
||||
Short: "Query for account address by account id",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Example: fmt.Sprintf("%s q auth address-by-id 1", version.AppName),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
id, err := strconv.ParseInt(args[0], 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
res, err := queryClient.AccountAddressByID(cmd.Context(), &types.QueryAccountAddressByIDRequest{Id: id})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// GetAccountsCmd returns a query command that will display a list of accounts
|
||||
func GetAccountsCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
||||
bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/testutil"
|
||||
|
@ -280,6 +281,50 @@ func (s *IntegrationTestSuite) TestCLISignBatch() {
|
|||
s.Require().Error(err)
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestCliGetAccountAddressByID() {
|
||||
require := s.Require()
|
||||
val1 := s.network.Validators[0]
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expectErr bool
|
||||
}{
|
||||
{
|
||||
"not enough args",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"invalid account id",
|
||||
[]string{fmt.Sprint(-1), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid account id",
|
||||
[]string{fmt.Sprint(0), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.GetAccountAddressByIDCmd()
|
||||
clientCtx := val1.ClientCtx
|
||||
|
||||
queryResJSON, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
s.Require().Error(err)
|
||||
} else {
|
||||
s.Require().NoError(err)
|
||||
var res types.QueryAccountAddressByIDResponse
|
||||
require.NoError(val1.ClientCtx.Codec.UnmarshalJSON(queryResJSON.Bytes(), &res))
|
||||
require.NotNil(res.GetAccountAddress())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestCLISignAminoJSON() {
|
||||
require := s.Require()
|
||||
val1 := s.network.Validators[0]
|
||||
|
|
|
@ -31,6 +31,12 @@ func (ak AccountKeeper) HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
|
|||
return store.Has(types.AddressStoreKey(addr))
|
||||
}
|
||||
|
||||
// HasAccountAddressByID checks account address exists by id.
|
||||
func (ak AccountKeeper) HasAccountAddressByID(ctx sdk.Context, id uint64) bool {
|
||||
store := ctx.KVStore(ak.key)
|
||||
return store.Has(types.AccountNumberStoreKey(id))
|
||||
}
|
||||
|
||||
// GetAccount implements AccountKeeperI.
|
||||
func (ak AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI {
|
||||
store := ctx.KVStore(ak.key)
|
||||
|
@ -42,6 +48,16 @@ func (ak AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.A
|
|||
return ak.decodeAccount(bz)
|
||||
}
|
||||
|
||||
// GetAccountAddressById returns account address by id.
|
||||
func (ak AccountKeeper) GetAccountAddressByID(ctx sdk.Context, id uint64) string {
|
||||
store := ctx.KVStore(ak.key)
|
||||
bz := store.Get(types.AccountNumberStoreKey(id))
|
||||
if bz == nil {
|
||||
return ""
|
||||
}
|
||||
return sdk.AccAddress(bz).String()
|
||||
}
|
||||
|
||||
// GetAllAccounts returns all accounts in the accountKeeper.
|
||||
func (ak AccountKeeper) GetAllAccounts(ctx sdk.Context) (accounts []types.AccountI) {
|
||||
ak.IterateAccounts(ctx, func(acc types.AccountI) (stop bool) {
|
||||
|
@ -63,6 +79,7 @@ func (ak AccountKeeper) SetAccount(ctx sdk.Context, acc types.AccountI) {
|
|||
}
|
||||
|
||||
store.Set(types.AddressStoreKey(addr), bz)
|
||||
store.Set(types.AccountNumberStoreKey(acc.GetAccountNumber()), addr.Bytes())
|
||||
}
|
||||
|
||||
// RemoveAccount removes an account for the account mapper store.
|
||||
|
@ -71,6 +88,7 @@ func (ak AccountKeeper) RemoveAccount(ctx sdk.Context, acc types.AccountI) {
|
|||
addr := acc.GetAddress()
|
||||
store := ctx.KVStore(ak.key)
|
||||
store.Delete(types.AddressStoreKey(addr))
|
||||
store.Delete(types.AccountNumberStoreKey(acc.GetAccountNumber()))
|
||||
}
|
||||
|
||||
// IterateAccounts iterates over all the stored accounts and performs a callback function.
|
||||
|
|
|
@ -19,6 +19,24 @@ import (
|
|||
|
||||
var _ types.QueryServer = AccountKeeper{}
|
||||
|
||||
func (ak AccountKeeper) AccountAddressByID(c context.Context, req *types.QueryAccountAddressByIDRequest) (*types.QueryAccountAddressByIDResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "empty request")
|
||||
}
|
||||
|
||||
if req.Id < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "Invalid account id")
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
address := ak.GetAccountAddressByID(ctx, uint64(req.GetId()))
|
||||
if len(address) == 0 {
|
||||
return nil, status.Errorf(codes.NotFound, "account address not found with id %d", req.Id)
|
||||
}
|
||||
|
||||
return &types.QueryAccountAddressByIDResponse{AccountAddress: address}, nil
|
||||
}
|
||||
|
||||
func (ak AccountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequest) (*types.QueryAccountsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
|
@ -153,6 +154,68 @@ func (suite *KeeperTestSuite) TestGRPCQueryAccount() {
|
|||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGRPCQueryAccountAddressByID() {
|
||||
var req *types.QueryAccountAddressByIDRequest
|
||||
_, _, addr := testdata.KeyTestPubAddr()
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func()
|
||||
expPass bool
|
||||
posttests func(res *types.QueryAccountAddressByIDResponse)
|
||||
}{
|
||||
{
|
||||
"invalid request",
|
||||
func() {
|
||||
req = &types.QueryAccountAddressByIDRequest{Id: -1}
|
||||
},
|
||||
false,
|
||||
func(res *types.QueryAccountAddressByIDResponse) {},
|
||||
},
|
||||
{
|
||||
"account address not found",
|
||||
func() {
|
||||
req = &types.QueryAccountAddressByIDRequest{Id: math.MaxInt64}
|
||||
},
|
||||
false,
|
||||
func(res *types.QueryAccountAddressByIDResponse) {},
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
func() {
|
||||
account := suite.app.AccountKeeper.NewAccountWithAddress(suite.ctx, addr)
|
||||
suite.app.AccountKeeper.SetAccount(suite.ctx, account)
|
||||
req = &types.QueryAccountAddressByIDRequest{Id: int64(account.GetAccountNumber())}
|
||||
},
|
||||
true,
|
||||
func(res *types.QueryAccountAddressByIDResponse) {
|
||||
suite.Require().NotNil(res.AccountAddress)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
tc.malleate()
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
|
||||
res, err := suite.queryClient.AccountAddressByID(ctx, req)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
suite.Require().Nil(res)
|
||||
}
|
||||
|
||||
tc.posttests(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGRPCQueryParameters() {
|
||||
var (
|
||||
req *types.QueryParamsRequest
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"github.com/gogo/protobuf/grpc"
|
||||
|
||||
v043 "github.com/cosmos/cosmos-sdk/x/auth/migrations/v043"
|
||||
v046 "github.com/cosmos/cosmos-sdk/x/auth/migrations/v046"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -41,3 +43,26 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error {
|
|||
|
||||
return iterErr
|
||||
}
|
||||
|
||||
// Migrate2to3 migrates from consensus version 2 to version 3. Specifically, for each account
|
||||
// we index the account's ID to their address.
|
||||
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
|
||||
return v046.MigrateStore(ctx, m.keeper.key, m.keeper.cdc)
|
||||
}
|
||||
|
||||
// V45_SetAccount implements V45_SetAccount
|
||||
// set the account without map to accAddr to accNumber.
|
||||
//
|
||||
// NOTE: This is used for testing purposes only.
|
||||
func (m Migrator) V45_SetAccount(ctx sdk.Context, acc types.AccountI) error {
|
||||
addr := acc.GetAddress()
|
||||
store := ctx.KVStore(m.keeper.key)
|
||||
|
||||
bz, err := m.keeper.MarshalAccount(acc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
store.Set(types.AddressStoreKey(addr), bz)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package v046
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
)
|
||||
|
||||
func mapAccountAddressToAccountID(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
|
||||
store := ctx.KVStore(storeKey)
|
||||
iterator := sdk.KVStorePrefixIterator(store, types.AddressStoreKeyPrefix)
|
||||
|
||||
defer iterator.Close()
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
var acc types.AccountI
|
||||
if err := cdc.UnmarshalInterface(iterator.Value(), &acc); err != nil {
|
||||
return err
|
||||
}
|
||||
store.Set(types.AccountNumberStoreKey(acc.GetAccountNumber()), acc.GetAddress().Bytes())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MigrateStore performs in-place store migrations from v0.45 to v0.46. The
|
||||
// migration includes:
|
||||
// - Add an Account number as an index to get the account address
|
||||
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
|
||||
return mapAccountAddressToAccountID(ctx, storeKey, cdc)
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package v046_test
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
)
|
||||
|
||||
// TestMigrateMapAccAddressToAccNumberKey test cases for state migration of map to accAddr to accNum
|
||||
func TestMigrateMapAccAddressToAccNumberKey(t *testing.T) {
|
||||
app := simapp.Setup(t, false)
|
||||
|
||||
// new base account
|
||||
senderPrivKey := secp256k1.GenPrivKey()
|
||||
randAccNumber := uint64(rand.Intn(100000-10000) + 10000)
|
||||
acc := types.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), randAccNumber, 0)
|
||||
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{
|
||||
Time: time.Now(),
|
||||
})
|
||||
|
||||
m := keeper.NewMigrator(app.AccountKeeper, app.GRPCQueryRouter())
|
||||
|
||||
// set the account to store with map acc addr to acc number
|
||||
require.NoError(t, m.V45_SetAccount(ctx, acc))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
doMigration bool
|
||||
accNum uint64
|
||||
}{
|
||||
{
|
||||
name: "without state migration",
|
||||
doMigration: false,
|
||||
accNum: acc.AccountNumber,
|
||||
},
|
||||
{
|
||||
name: "with state migration",
|
||||
doMigration: true,
|
||||
accNum: acc.AccountNumber,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if tc.doMigration {
|
||||
require.NoError(t, m.Migrate2to3(ctx))
|
||||
}
|
||||
|
||||
// get the account address by acc id
|
||||
accAddr := app.AccountKeeper.GetAccountAddressByID(ctx, tc.accNum)
|
||||
|
||||
if tc.doMigration {
|
||||
require.Equal(t, accAddr, acc.Address)
|
||||
} else {
|
||||
require.Equal(t, len(accAddr), 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -129,6 +129,11 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// InitGenesis performs genesis initialization for the auth module. It returns
|
||||
|
@ -148,7 +153,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
|||
}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
func (AppModule) ConsensusVersion() uint64 { return 2 }
|
||||
func (AppModule) ConsensusVersion() uint64 { return 3 }
|
||||
|
||||
// BeginBlock returns the begin blocker for the auth module.
|
||||
func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}
|
||||
|
|
|
@ -24,9 +24,17 @@ var (
|
|||
|
||||
// param key for global account number
|
||||
GlobalAccountNumberKey = []byte("globalAccountNumber")
|
||||
|
||||
// AccountNumberStoreKeyPrefix prefix for account-by-id store
|
||||
AccountNumberStoreKeyPrefix = []byte("accountNumber")
|
||||
)
|
||||
|
||||
// AddressStoreKey turn an address to key used to get it from the account store
|
||||
func AddressStoreKey(addr sdk.AccAddress) []byte {
|
||||
return append(AddressStoreKeyPrefix, addr.Bytes()...)
|
||||
}
|
||||
|
||||
// AccountNumberStoreKey turn an account number to key used to get the account address from account store
|
||||
func AccountNumberStoreKey(accountNumber uint64) []byte {
|
||||
return append(AccountNumberStoreKeyPrefix, sdk.Uint64ToBigEndian(accountNumber)...)
|
||||
}
|
||||
|
|
|
@ -665,6 +665,96 @@ func (m *AddressStringToBytesResponse) GetAddressBytes() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryAccountAddressByIDRequest is the request type for AccountAddressById rpc method
|
||||
type QueryAccountAddressByIDRequest struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) Reset() { *m = QueryAccountAddressByIDRequest{} }
|
||||
func (m *QueryAccountAddressByIDRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAccountAddressByIDRequest) ProtoMessage() {}
|
||||
func (*QueryAccountAddressByIDRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c451370b3929a27c, []int{14}
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryAccountAddressByIDRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryAccountAddressByIDRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryAccountAddressByIDRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryAccountAddressByIDRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) GetId() int64 {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// QueryAccountAddressByIDResponse is the response type for AccountAddressById rpc method
|
||||
type QueryAccountAddressByIDResponse struct {
|
||||
AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) Reset() { *m = QueryAccountAddressByIDResponse{} }
|
||||
func (m *QueryAccountAddressByIDResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAccountAddressByIDResponse) ProtoMessage() {}
|
||||
func (*QueryAccountAddressByIDResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_c451370b3929a27c, []int{15}
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryAccountAddressByIDResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryAccountAddressByIDResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryAccountAddressByIDResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryAccountAddressByIDResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) GetAccountAddress() string {
|
||||
if m != nil {
|
||||
return m.AccountAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*QueryAccountsRequest)(nil), "cosmos.auth.v1beta1.QueryAccountsRequest")
|
||||
proto.RegisterType((*QueryAccountsResponse)(nil), "cosmos.auth.v1beta1.QueryAccountsResponse")
|
||||
|
@ -680,63 +770,70 @@ func init() {
|
|||
proto.RegisterType((*AddressBytesToStringResponse)(nil), "cosmos.auth.v1beta1.AddressBytesToStringResponse")
|
||||
proto.RegisterType((*AddressStringToBytesRequest)(nil), "cosmos.auth.v1beta1.AddressStringToBytesRequest")
|
||||
proto.RegisterType((*AddressStringToBytesResponse)(nil), "cosmos.auth.v1beta1.AddressStringToBytesResponse")
|
||||
proto.RegisterType((*QueryAccountAddressByIDRequest)(nil), "cosmos.auth.v1beta1.QueryAccountAddressByIDRequest")
|
||||
proto.RegisterType((*QueryAccountAddressByIDResponse)(nil), "cosmos.auth.v1beta1.QueryAccountAddressByIDResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/auth/v1beta1/query.proto", fileDescriptor_c451370b3929a27c) }
|
||||
|
||||
var fileDescriptor_c451370b3929a27c = []byte{
|
||||
// 814 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcf, 0x4f, 0x13, 0x4d,
|
||||
0x18, 0xc7, 0xbb, 0xbc, 0xef, 0x0b, 0x7d, 0x87, 0xc2, 0x61, 0x28, 0x09, 0xef, 0x16, 0x5a, 0xb2,
|
||||
0xbc, 0x40, 0x8b, 0x74, 0x57, 0x8a, 0x17, 0x7f, 0xc4, 0x84, 0x82, 0x1a, 0x0f, 0x26, 0xb5, 0x70,
|
||||
0xf2, 0x60, 0x33, 0xdb, 0x0e, 0x4b, 0x23, 0xdd, 0x29, 0x9d, 0xad, 0xa1, 0x31, 0x24, 0xc6, 0x13,
|
||||
0x37, 0x4d, 0xfc, 0x07, 0xf0, 0x3f, 0xd0, 0x84, 0xab, 0x77, 0xc2, 0x89, 0xe8, 0xc5, 0x93, 0x31,
|
||||
0xe0, 0xc1, 0x3f, 0xc3, 0x74, 0xe6, 0xd9, 0xb6, 0x4b, 0xa6, 0xed, 0x7a, 0xa2, 0x3b, 0xf3, 0x7c,
|
||||
0xbf, 0xcf, 0x67, 0x9e, 0x67, 0x9e, 0x01, 0xa5, 0xca, 0x8c, 0xd7, 0x18, 0xb7, 0x48, 0xd3, 0xdb,
|
||||
0xb3, 0x5e, 0xae, 0xd9, 0xd4, 0x23, 0x6b, 0xd6, 0x41, 0x93, 0x36, 0x5a, 0x66, 0xbd, 0xc1, 0x3c,
|
||||
0x86, 0xa7, 0x64, 0x80, 0xd9, 0x0e, 0x30, 0x21, 0x40, 0x5f, 0x01, 0x95, 0x4d, 0x38, 0x95, 0xd1,
|
||||
0x1d, 0x6d, 0x9d, 0x38, 0x55, 0x97, 0x78, 0x55, 0xe6, 0x4a, 0x03, 0x3d, 0xee, 0x30, 0x87, 0x89,
|
||||
0x9f, 0x56, 0xfb, 0x17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 0x0e,
|
||||
0x3d, 0xfe, 0xa8, 0xa1, 0xb8, 0x6a, 0x56, 0xb1, 0xba, 0x06, 0x03, 0x9e, 0x06, 0x7d, 0xed, 0x0f,
|
||||
0x14, 0x80, 0xb8, 0x2e, 0x10, 0xb3, 0xf8, 0xc6, 0x00, 0xc4, 0xce, 0xf5, 0x92, 0xe3, 0x79, 0x84,
|
||||
0x3f, 0x75, 0x91, 0x03, 0x13, 0x3d, 0x18, 0x59, 0xf5, 0x84, 0x0c, 0x46, 0x56, 0x3e, 0x17, 0xc6,
|
||||
0x2d, 0x81, 0x6c, 0xe2, 0xd5, 0x50, 0xc8, 0xf2, 0x61, 0x3a, 0xca, 0x6f, 0x9e, 0x5d, 0x26, 0xb5,
|
||||
0x8b, 0xcb, 0xa4, 0xf6, 0xe3, 0x32, 0xa9, 0xbd, 0xbb, 0x4a, 0x46, 0x2e, 0xae, 0x92, 0x91, 0x6f,
|
||||
0x57, 0xc9, 0xc8, 0xb3, 0x8c, 0x53, 0xf5, 0xf6, 0x9a, 0xb6, 0x59, 0x66, 0x35, 0xdf, 0x51, 0xfe,
|
||||
0xc9, 0xf2, 0xca, 0x0b, 0xeb, 0x50, 0xda, 0x7b, 0xad, 0x3a, 0xe5, 0xf6, 0xa8, 0xf8, 0xd7, 0xb0,
|
||||
0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x15, 0x47, 0x58, 0x91, 0x7c, 0x09, 0x00, 0x00,
|
||||
// 886 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcf, 0x4e, 0xeb, 0x46,
|
||||
0x14, 0xc6, 0xe3, 0xdc, 0x16, 0xb8, 0x73, 0x73, 0x53, 0x69, 0xc8, 0x95, 0xa8, 0xc3, 0x75, 0xae,
|
||||
0x4c, 0x81, 0x84, 0x12, 0x1b, 0x12, 0x36, 0xfd, 0xa3, 0x4a, 0x09, 0xb4, 0x15, 0x8b, 0x4a, 0xa9,
|
||||
0x61, 0xd5, 0x45, 0x23, 0x3b, 0x36, 0xc6, 0x2a, 0xf1, 0x84, 0x8c, 0x53, 0x11, 0xa1, 0x48, 0x55,
|
||||
0x57, 0xec, 0x5a, 0xa9, 0x2f, 0x40, 0xdf, 0xa0, 0x95, 0x78, 0x08, 0xc4, 0x0a, 0xb5, 0x9b, 0xae,
|
||||
0xaa, 0x0a, 0xba, 0xe8, 0xb2, 0x8f, 0x70, 0x95, 0x99, 0x63, 0x27, 0x86, 0x49, 0x62, 0x56, 0xb1,
|
||||
0x67, 0xce, 0xf9, 0xce, 0x6f, 0xce, 0x19, 0x7f, 0x41, 0x85, 0x16, 0xa1, 0x6d, 0x42, 0x75, 0xb3,
|
||||
0x17, 0x1c, 0xeb, 0xdf, 0x6f, 0x5b, 0x4e, 0x60, 0x6e, 0xeb, 0xa7, 0x3d, 0xa7, 0xdb, 0xd7, 0x3a,
|
||||
0x5d, 0x12, 0x10, 0xbc, 0xc8, 0x03, 0xb4, 0x61, 0x80, 0x06, 0x01, 0xf2, 0x06, 0x64, 0x59, 0x26,
|
||||
0x75, 0x78, 0x74, 0x94, 0xdb, 0x31, 0x5d, 0xcf, 0x37, 0x03, 0x8f, 0xf8, 0x5c, 0x40, 0xce, 0xb9,
|
||||
0xc4, 0x25, 0xec, 0x51, 0x1f, 0x3e, 0xc1, 0xea, 0xfb, 0x2e, 0x21, 0xee, 0x89, 0xa3, 0xb3, 0x37,
|
||||
0xab, 0x77, 0xa4, 0x9b, 0x3e, 0x54, 0x94, 0x97, 0x61, 0xcb, 0xec, 0x78, 0xba, 0xe9, 0xfb, 0x24,
|
||||
0x60, 0x6a, 0x14, 0x76, 0x15, 0x11, 0x30, 0x83, 0x03, 0x61, 0xbe, 0xdf, 0xe4, 0x15, 0x01, 0x9e,
|
||||
0xbd, 0xa8, 0xdf, 0xa2, 0xdc, 0xd7, 0x43, 0xd6, 0x5a, 0xab, 0x45, 0x7a,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0x54, 0x7f, 0xe7, 0xfa, 0xef, 0x42,
|
||||
0xca, 0x80, 0x04, 0xf5, 0x30, 0x3e, 0xc7, 0x48, 0xf2, 0x53, 0x34, 0x0f, 0x1d, 0x03, 0xcd, 0x24,
|
||||
0x4d, 0x0e, 0x53, 0xd4, 0x1c, 0xc2, 0x31, 0x4e, 0x4e, 0xdf, 0x42, 0x79, 0xe1, 0xd9, 0xa0, 0xe4,
|
||||
0x5e, 0xc2, 0xc1, 0xe2, 0x9b, 0xab, 0x72, 0x36, 0xa6, 0x31, 0x36, 0x5e, 0xf5, 0x15, 0x5a, 0xac,
|
||||
0x3b, 0xad, 0xe3, 0x6a, 0xa5, 0xd1, 0x75, 0x8e, 0xbc, 0xb3, 0xb0, 0xf6, 0x27, 0x28, 0x17, 0x5f,
|
||||
0x86, 0xa2, 0x2b, 0xe8, 0xa5, 0xc5, 0xd6, 0x9b, 0x1d, 0xb6, 0xc1, 0x67, 0x66, 0x64, 0xac, 0xb1,
|
||||
0x60, 0xb5, 0x8e, 0xf2, 0x30, 0xb8, 0x7a, 0x3f, 0x70, 0xe8, 0x21, 0x81, 0xf9, 0xc1, 0xc4, 0x57,
|
||||
0xd0, 0x4b, 0x18, 0x64, 0xd3, 0x1a, 0xee, 0x33, 0x8d, 0x8c, 0x91, 0x31, 0xc7, 0x72, 0xd4, 0xcf,
|
||||
0xd1, 0xb2, 0x58, 0x03, 0x40, 0x56, 0x51, 0x36, 0x14, 0xa1, 0x6c, 0x07, 0x48, 0x42, 0x69, 0x1e,
|
||||
0xae, 0xee, 0x45, 0x28, 0x7c, 0xe1, 0x90, 0x30, 0xb9, 0x10, 0x25, 0xa1, 0xca, 0x6e, 0x04, 0xf3,
|
||||
0x40, 0x65, 0xd4, 0x95, 0xd9, 0x27, 0xda, 0x42, 0xca, 0xf8, 0xd5, 0x89, 0x4e, 0xb7, 0xbf, 0x17,
|
||||
0xd2, 0x64, 0x51, 0xda, 0xb3, 0x59, 0xee, 0x33, 0x23, 0x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, 0x09, 0x65, 0xc6, 0xcd, 0x6e, 0xc2, 0x85, 0x13, 0xd8,
|
||||
0xe4, 0x84, 0x0b, 0x27, 0x72, 0xce, 0x19, 0xed, 0xe2, 0xfe, 0x39, 0xbc, 0x64, 0x39, 0x91, 0xed,
|
||||
0x61, 0x71, 0x0f, 0xa6, 0xb8, 0xac, 0xbc, 0xfd, 0x84, 0x0c, 0x40, 0xac, 0x32, 0xc4, 0x32, 0xfe,
|
||||
0x70, 0x0a, 0x62, 0xf4, 0x45, 0x70, 0xa7, 0x1b, 0xe0, 0xdf, 0x47, 0xc8, 0x31, 0x73, 0x9c, 0x8e,
|
||||
0x2c, 0x72, 0xe3, 0xe9, 0xc8, 0x42, 0xe7, 0x55, 0x77, 0x18, 0xb2, 0x86, 0x37, 0x13, 0x21, 0x73,
|
||||
0x8f, 0x1f, 0xd4, 0x77, 0xaf, 0xef, 0x14, 0xe9, 0xf6, 0x4e, 0x91, 0xfe, 0xb9, 0x53, 0xa4, 0x9f,
|
||||
0xef, 0x95, 0xd4, 0xed, 0xbd, 0x92, 0xfa, 0xeb, 0x5e, 0x49, 0x7d, 0x53, 0x72, 0xbd, 0xe0, 0xb8,
|
||||
0x67, 0x69, 0x2d, 0xd2, 0x0e, 0x15, 0xf9, 0x4f, 0x99, 0xda, 0xdf, 0xe9, 0x67, 0x5c, 0x3e, 0xe8,
|
||||
0x77, 0x1c, 0x6a, 0xcd, 0xb1, 0x7f, 0xd9, 0xea, 0xdb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x78,
|
||||
0xb2, 0xf3, 0xc7, 0x0a, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -757,6 +854,8 @@ type QueryClient interface {
|
|||
Accounts(ctx context.Context, in *QueryAccountsRequest, opts ...grpc.CallOption) (*QueryAccountsResponse, error)
|
||||
// Account returns account details based on address.
|
||||
Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error)
|
||||
// AccountAddressByID returns account address based on account id
|
||||
AccountAddressByID(ctx context.Context, in *QueryAccountAddressByIDRequest, opts ...grpc.CallOption) (*QueryAccountAddressByIDResponse, error)
|
||||
// Params queries all parameters.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// ModuleAccounts returns all the existing module accounts.
|
||||
|
@ -803,6 +902,15 @@ func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) AccountAddressByID(ctx context.Context, in *QueryAccountAddressByIDRequest, opts ...grpc.CallOption) (*QueryAccountAddressByIDResponse, error) {
|
||||
out := new(QueryAccountAddressByIDResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/AccountAddressByID", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
|
||||
out := new(QueryParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Params", in, out, opts...)
|
||||
|
@ -856,6 +964,8 @@ type QueryServer interface {
|
|||
Accounts(context.Context, *QueryAccountsRequest) (*QueryAccountsResponse, error)
|
||||
// Account returns account details based on address.
|
||||
Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error)
|
||||
// AccountAddressByID returns account address based on account id
|
||||
AccountAddressByID(context.Context, *QueryAccountAddressByIDRequest) (*QueryAccountAddressByIDResponse, error)
|
||||
// Params queries all parameters.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
// ModuleAccounts returns all the existing module accounts.
|
||||
|
@ -886,6 +996,9 @@ func (*UnimplementedQueryServer) Accounts(ctx context.Context, req *QueryAccount
|
|||
func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Account not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) AccountAddressByID(ctx context.Context, req *QueryAccountAddressByIDRequest) (*QueryAccountAddressByIDResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AccountAddressByID not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
|
@ -942,6 +1055,24 @@ func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_AccountAddressByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryAccountAddressByIDRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).AccountAddressByID(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.auth.v1beta1.Query/AccountAddressByID",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).AccountAddressByID(ctx, req.(*QueryAccountAddressByIDRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryParamsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -1044,6 +1175,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Account",
|
||||
Handler: _Query_Account_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AccountAddressByID",
|
||||
Handler: _Query_AccountAddressByID_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
|
@ -1507,6 +1642,64 @@ func (m *AddressStringToBytesResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Id != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.Id))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.AccountAddress) > 0 {
|
||||
i -= len(m.AccountAddress)
|
||||
copy(dAtA[i:], m.AccountAddress)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.AccountAddress)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovQuery(v)
|
||||
base := offset
|
||||
|
@ -1694,6 +1887,31 @@ func (m *AddressStringToBytesResponse) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Id != 0 {
|
||||
n += 1 + sovQuery(uint64(m.Id))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryAccountAddressByIDResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.AccountAddress)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovQuery(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
|
@ -2805,6 +3023,157 @@ func (m *AddressStringToBytesResponse) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryAccountAddressByIDRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryAccountAddressByIDRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryAccountAddressByIDRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
|
||||
}
|
||||
m.Id = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Id |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryAccountAddressByIDResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryAccountAddressByIDResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryAccountAddressByIDResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AccountAddress", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AccountAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipQuery(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -123,6 +123,60 @@ func local_request_Query_Account_0(ctx context.Context, marshaler runtime.Marsha
|
|||
|
||||
}
|
||||
|
||||
func request_Query_AccountAddressByID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAccountAddressByIDRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := client.AccountAddressByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_AccountAddressByID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAccountAddressByIDRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := server.AccountAddressByID(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
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 QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
@ -337,6 +391,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AccountAddressByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_AccountAddressByID_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_AccountAddressByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
|
@ -533,6 +610,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AccountAddressByID_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_AccountAddressByID_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_AccountAddressByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
|
@ -641,6 +738,8 @@ var (
|
|||
|
||||
pattern_Query_Account_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "auth", "v1beta1", "accounts", "address"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_AccountAddressByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "auth", "v1beta1", "address_by_id", "id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "auth", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_ModuleAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "auth", "v1beta1", "module_accounts"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
@ -657,6 +756,8 @@ var (
|
|||
|
||||
forward_Query_Account_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_AccountAddressByID_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ModuleAccounts_0 = runtime.ForwardResponseMessage
|
||||
|
|
Loading…
Reference in New Issue