From 20aa35d19bae23e8d5f373221ba2e0837f3a3a1f Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Thu, 7 Nov 2024 16:39:47 -0800 Subject: [PATCH 01/16] add genesis init/export tests --- x/confidentialtransfers/keeper/genesis.go | 8 +-- .../keeper/genesis_test.go | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/x/confidentialtransfers/keeper/genesis.go b/x/confidentialtransfers/keeper/genesis.go index 1fc82c97a4..d52f708260 100644 --- a/x/confidentialtransfers/keeper/genesis.go +++ b/x/confidentialtransfers/keeper/genesis.go @@ -2,8 +2,6 @@ package keeper import ( "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" @@ -11,9 +9,10 @@ import ( func (k BaseKeeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) { k.SetParams(ctx, gs.Params) + store := ctx.KVStore(k.storeKey) for i := range gs.Accounts { genesisCtAccount := gs.Accounts[i] - store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&genesisCtAccount.Account) // Marshal the Account object into bytes store.Set(genesisCtAccount.Key, bz) } @@ -32,10 +31,9 @@ func (k BaseKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { func (k BaseKeeper) GetPaginatedAccounts(ctx sdk.Context, pagination *query.PageRequest) ([]types.GenesisCtAccount, *query.PageResponse, error) { store := ctx.KVStore(k.storeKey) - supplyStore := prefix.NewStore(store, types.AccountsKey) genesisAccounts := make([]types.GenesisCtAccount, 0) - pageRes, err := query.Paginate(supplyStore, pagination, func(key, value []byte) error { + pageRes, err := query.Paginate(store, pagination, func(key, value []byte) error { var ctAccount types.CtAccount err := ctAccount.Unmarshal(value) if err != nil { diff --git a/x/confidentialtransfers/keeper/genesis_test.go b/x/confidentialtransfers/keeper/genesis_test.go index fbe328e42d..79de9dc6e6 100644 --- a/x/confidentialtransfers/keeper/genesis_test.go +++ b/x/confidentialtransfers/keeper/genesis_test.go @@ -1,7 +1,12 @@ package keeper_test import ( + "crypto/ecdsa" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" + "github.com/sei-protocol/sei-cryptography/pkg/encryption" + "github.com/sei-protocol/sei-cryptography/pkg/encryption/elgamal" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) @@ -16,3 +21,62 @@ func (suite *KeeperTestSuite) TestDefaultGenesisState() { suite.Require().NotNil(exportedGenesis) suite.Require().Equal(genesisState, exportedGenesis) } + +func (suite *KeeperTestSuite) TestGenesisExportImportState() { + pk1, _ := encryption.GenerateKey() + pk2, _ := encryption.GenerateKey() + addr1 := sdk.AccAddress("addr1") + addr2 := sdk.AccAddress("addr2") + testDenom1 := fmt.Sprintf("factory/%s/TEST1", addr1.String()) + testDenom2 := fmt.Sprintf("factory/%s/TEST2", addr2.String()) + + ctAcc1 := generateCtAccount(pk1, testDenom1, 1000) + ctAcc2 := generateCtAccount(pk2, testDenom2, 2000) + + accounts := []types.GenesisCtAccount{ + { + Key: types.GetAccountKey(addr1, testDenom1), + Account: ctAcc1, + }, + { + Key: types.GetAccountKey(addr2, testDenom2), + Account: ctAcc2, + }, + } + genesisState := types.NewGenesisState(types.DefaultParams(), accounts) + app := suite.App + suite.Ctx = app.BaseApp.NewContext(false, tmproto.Header{}) + + suite.App.ConfidentialTransfersKeeper.InitGenesis(suite.Ctx, genesisState) + exportedGenesis := suite.App.ConfidentialTransfersKeeper.ExportGenesis(suite.Ctx) + suite.Require().NotNil(exportedGenesis) + suite.Require().Equal(genesisState, exportedGenesis) +} + +func generateCtAccount(pk *ecdsa.PrivateKey, testDenom string, balance uint64) types.CtAccount { + eg := elgamal.NewTwistedElgamal() + keyPair, _ := eg.KeyGen(*pk, testDenom) + + aesPK1, _ := encryption.GetAESKey(*pk, testDenom) + + amountLo := uint64(100) + amountHi := uint64(0) + + decryptableBalance, _ := encryption.EncryptAESGCM(balance, aesPK1) + + ciphertextLo, _, _ := eg.Encrypt(keyPair.PublicKey, amountLo) + ciphertextHi, _, _ := eg.Encrypt(keyPair.PublicKey, amountHi) + + zeroCiphertextAvailable, _, _ := eg.Encrypt(keyPair.PublicKey, amountLo) + + account := &types.Account{ + PublicKey: keyPair.PublicKey, + PendingBalanceLo: ciphertextLo, + PendingBalanceHi: ciphertextHi, + PendingBalanceCreditCounter: 1, + AvailableBalance: zeroCiphertextAvailable, + DecryptableAvailableBalance: decryptableBalance, + } + + return *types.NewCtAccount(account) +} From b0b975213ce1b67c1f3442783f73f235615eeaab Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Fri, 8 Nov 2024 11:36:17 -0800 Subject: [PATCH 02/16] refactor store --- x/confidentialtransfers/keeper/genesis.go | 4 +-- .../keeper/genesis_test.go | 5 ++-- x/confidentialtransfers/keeper/keeper.go | 26 ++++++++++++------- x/confidentialtransfers/types/keys.go | 7 ----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/x/confidentialtransfers/keeper/genesis.go b/x/confidentialtransfers/keeper/genesis.go index d52f708260..ac0f7b663a 100644 --- a/x/confidentialtransfers/keeper/genesis.go +++ b/x/confidentialtransfers/keeper/genesis.go @@ -9,7 +9,7 @@ import ( func (k BaseKeeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) { k.SetParams(ctx, gs.Params) - store := ctx.KVStore(k.storeKey) + store := k.getAccountStore(ctx) for i := range gs.Accounts { genesisCtAccount := gs.Accounts[i] @@ -30,7 +30,7 @@ func (k BaseKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { } func (k BaseKeeper) GetPaginatedAccounts(ctx sdk.Context, pagination *query.PageRequest) ([]types.GenesisCtAccount, *query.PageResponse, error) { - store := ctx.KVStore(k.storeKey) + store := k.getAccountStore(ctx) genesisAccounts := make([]types.GenesisCtAccount, 0) pageRes, err := query.Paginate(store, pagination, func(key, value []byte) error { diff --git a/x/confidentialtransfers/keeper/genesis_test.go b/x/confidentialtransfers/keeper/genesis_test.go index 79de9dc6e6..23d11c1a6f 100644 --- a/x/confidentialtransfers/keeper/genesis_test.go +++ b/x/confidentialtransfers/keeper/genesis_test.go @@ -35,11 +35,11 @@ func (suite *KeeperTestSuite) TestGenesisExportImportState() { accounts := []types.GenesisCtAccount{ { - Key: types.GetAccountKey(addr1, testDenom1), + Key: []byte(addr1.String() + testDenom1), Account: ctAcc1, }, { - Key: types.GetAccountKey(addr2, testDenom2), + Key: []byte(addr2.String() + testDenom2), Account: ctAcc2, }, } @@ -48,6 +48,7 @@ func (suite *KeeperTestSuite) TestGenesisExportImportState() { suite.Ctx = app.BaseApp.NewContext(false, tmproto.Header{}) suite.App.ConfidentialTransfersKeeper.InitGenesis(suite.Ctx, genesisState) + exportedGenesis := suite.App.ConfidentialTransfersKeeper.ExportGenesis(suite.Ctx) suite.Require().NotNil(exportedGenesis) suite.Require().Equal(genesisState, exportedGenesis) diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 3843d3a801..bc31a65622 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -1,7 +1,6 @@ package keeper import ( - "bytes" "context" "fmt" @@ -65,8 +64,8 @@ func NewKeeper( } func (k BaseKeeper) GetAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) { - store := ctx.KVStore(k.storeKey) - key := types.GetAccountKey(address, denom) + store := k.getAccountStoreForAddress(ctx, address) + key := []byte(denom) if !store.Has(key) { return types.Account{}, false } @@ -82,11 +81,10 @@ func (k BaseKeeper) GetAccount(ctx sdk.Context, address sdk.AccAddress, denom st } func (k BaseKeeper) SetAccount(ctx sdk.Context, address sdk.AccAddress, denom string, account types.Account) { - store := ctx.KVStore(k.storeKey) - key := types.GetAccountKey(address, denom) + store := k.getAccountStoreForAddress(ctx, address) ctAccount := types.NewCtAccount(&account) bz := k.cdc.MustMarshal(ctAccount) // Marshal the Account object into bytes - store.Set(key, bz) // Store the serialized account under the key + store.Set([]byte(denom), bz) // Store the serialized account under denom name as key } // Logger returns a logger for the x/confidentialtransfers module @@ -98,7 +96,7 @@ func (k BaseKeeper) Logger(ctx sdk.Context) log.Logger { // and returns a mapping of denom:account func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddress) (map[string]*types.Account, error) { // Create a prefix store scoped to the address - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetAddressPrefix(address)) + store := k.getAccountStoreForAddress(ctx, address) // Iterate over all keys in the prefix store iterator := sdk.KVStorePrefixIterator(store, []byte{}) @@ -115,10 +113,8 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres // Extract the denom from the key key := iterator.Key() - // Key format: account||, so denom starts after "account||" - denom := string(bytes.TrimPrefix(key, types.GetAddressPrefix(address))) - accounts[denom] = account + accounts[string(key)] = account } return accounts, nil @@ -138,3 +134,13 @@ func (k BaseKeeper) CreateModuleAccount(ctx sdk.Context) { moduleAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter, authtypes.Burner) k.accountKeeper.SetModuleAccount(ctx, moduleAcc) } + +func (k BaseKeeper) getAccountStore(ctx sdk.Context) prefix.Store { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.AccountsKey) +} + +func (k BaseKeeper) getAccountStoreForAddress(ctx sdk.Context, addr sdk.AccAddress) prefix.Store { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, types.GetAddressPrefix(addr)) +} diff --git a/x/confidentialtransfers/types/keys.go b/x/confidentialtransfers/types/keys.go index cfde6f9ce5..30d0db5223 100644 --- a/x/confidentialtransfers/types/keys.go +++ b/x/confidentialtransfers/types/keys.go @@ -22,18 +22,11 @@ const ( // MemStoreKey defines the in-memory store key MemStoreKey = "mem_confidential" ) -const KeySeparator = "|" var ( AccountsKey = []byte{0x01} - DenomKey = []byte{0x02} ) -// GetAccountKey generates the key for storing Account information based on address and denom -func GetAccountKey(addr sdk.AccAddress, denom string) []byte { - return append(GetAddressPrefix(addr), []byte(denom)...) -} - // GetAddressPrefix generates the prefix for all accounts under a specific address func GetAddressPrefix(addr sdk.AccAddress) []byte { return append(AccountsKey, address.MustLengthPrefix(addr)...) From 81e4a0280d0f80d76ff482831c8d98529b4615d8 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 13:58:41 -0800 Subject: [PATCH 03/16] confidential transfers queries --- app/app.go | 7 + proto/confidentialtransfers/query.proto | 32 +- x/confidentialtransfers/keeper/grpc_query.go | 43 ++ .../keeper/grpc_query_test.go | 26 + x/confidentialtransfers/keeper/keeper.go | 33 +- x/confidentialtransfers/keeper/keeper_test.go | 1 + x/confidentialtransfers/module.go | 7 +- x/confidentialtransfers/types/query.pb.go | 642 +++++++++++++++--- x/confidentialtransfers/types/query.pb.gw.go | 191 +++++- 9 files changed, 834 insertions(+), 148 deletions(-) create mode 100644 x/confidentialtransfers/keeper/grpc_query.go create mode 100644 x/confidentialtransfers/keeper/grpc_query_test.go diff --git a/app/app.go b/app/app.go index ad26d5fc3f..ac33fda599 100644 --- a/app/app.go +++ b/app/app.go @@ -116,6 +116,7 @@ import ( "github.com/sei-protocol/sei-chain/utils" "github.com/sei-protocol/sei-chain/utils/metrics" "github.com/sei-protocol/sei-chain/wasmbinding" + ctmodule "github.com/sei-protocol/sei-chain/x/confidentialtransfers" ctkeeper "github.com/sei-protocol/sei-chain/x/confidentialtransfers/keeper" cttypes "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" epochmodule "github.com/sei-protocol/sei-chain/x/epoch" @@ -226,6 +227,7 @@ var ( wasm.ModuleName: {authtypes.Burner}, evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + cttypes.ModuleName: {}, // this line is used by starport scaffolding # stargate/app/maccPerms } @@ -757,6 +759,7 @@ func New( epochModule, tokenfactorymodule.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ctmodule.NewAppModule(nil), // this line is used by starport scaffolding # stargate/app/appModule ) @@ -788,6 +791,7 @@ func New( evmtypes.ModuleName, wasm.ModuleName, tokenfactorytypes.ModuleName, + cttypes.ModuleName, acltypes.ModuleName, ) @@ -819,6 +823,7 @@ func New( evmtypes.ModuleName, wasm.ModuleName, tokenfactorytypes.ModuleName, + cttypes.ModuleName, acltypes.ModuleName, ) @@ -848,6 +853,7 @@ func New( feegrant.ModuleName, oracletypes.ModuleName, tokenfactorytypes.ModuleName, + cttypes.ModuleName, epochmoduletypes.ModuleName, wasm.ModuleName, evmtypes.ModuleName, @@ -879,6 +885,7 @@ func New( transferModule, epochModule, tokenfactorymodule.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), + ctmodule.NewAppModule(nil), // this line is used by starport scaffolding # stargate/app/appModule ) app.sm.RegisterStoreDecoders() diff --git a/proto/confidentialtransfers/query.proto b/proto/confidentialtransfers/query.proto index a9535ab83c..ec2c94c191 100644 --- a/proto/confidentialtransfers/query.proto +++ b/proto/confidentialtransfers/query.proto @@ -3,26 +3,38 @@ package seiprotocol.seichain.confidentialtransfers; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "confidentialtransfers/confidential.proto"; option go_package = "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"; -// TODO: Define any query messages here // Query defines the gRPC querier service. service Query { - // TODO: This is a mock method. Remove when we add real queries - rpc TestQuery (TestQueryRequest) returns (TestQueryResponse) { + rpc GetAccount (GetAccountRequest) returns (GetAccountResponse) { option (google.api.http) = { - get: "/seichain/confidentialtransfers/test_query" + get: "/seichain/confidentialtransfers/account/{address}/{denom}" }; } + + rpc GetAllAccounts (GetAllAccountsRequest) returns (GetAllAccountsResponse) { + option (google.api.http) = { + get: "/seichain/confidentialtransfers/account/{address}" + }; + } +} + +message GetAccountRequest { + string address = 1; + string denom = 2; +} + +message GetAccountResponse { + CtAccount account = 1; } -// TODO: This is a mock method. Remove when we add real queries -message TestQueryRequest { - string test_field = 1; +message GetAllAccountsRequest { + string address = 1; } -// TODO: This is a mock method. Remove when we add real queries -message TestQueryResponse { - string test_field = 1; +message GetAllAccountsResponse { + repeated CtAccount accounts = 1; } \ No newline at end of file diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go new file mode 100644 index 0000000000..2494605a1c --- /dev/null +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var _ types.QueryServer = BaseKeeper{} + +func (k BaseKeeper) GetAccount(ctx context.Context, req *types.GetAccountRequest) (*types.GetAccountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.Address == "" { + return nil, status.Error(codes.InvalidArgument, "address cannot be empty") + } + + address, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) + } + + if req.Denom == "" { + return nil, status.Error(codes.InvalidArgument, "invalid denom") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + ctAccount, found := k.getCtAccount(sdkCtx, address, req.Denom) + if !found { + return nil, status.Errorf(codes.NotFound, "account %s not found", req.Address) + } + + return &types.GetAccountResponse{Account: &ctAccount}, nil +} + +func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccountsRequest) (*types.GetAllAccountsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllAccounts not implemented") +} diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go new file mode 100644 index 0000000000..698c4ea8ce --- /dev/null +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -0,0 +1,26 @@ +package keeper_test + +import ( + gocontext "context" + "fmt" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" + "github.com/sei-protocol/sei-cryptography/pkg/encryption" +) + +func (suite *KeeperTestSuite) TestAccountQuery() { + app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient + _, _, addr := testdata.KeyTestPubAddr() + pk1, _ := encryption.GenerateKey() + testDenom := fmt.Sprintf("factory/%s/TEST", addr.String()) + ctAccount := generateCtAccount(pk1, testDenom, 1000) + account, _ := ctAccount.FromProto() + + app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom, *account) + + result, err := queryClient.GetAccount(gocontext.Background(), + &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}) + suite.Require().NoError(err) + + suite.Require().Equal(account, result.Account) +} diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index bc31a65622..deb732f74d 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -1,7 +1,6 @@ package keeper import ( - "context" "fmt" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -16,17 +15,20 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) +var _ Keeper = (*BaseKeeper)(nil) + type Keeper interface { InitGenesis(sdk.Context, *types.GenesisState) ExportGenesis(sdk.Context) *types.GenesisState - GetAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) SetAccount(ctx sdk.Context, address sdk.AccAddress, denom string, account types.Account) GetParams(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) CreateModuleAccount(ctx sdk.Context) + + types.QueryServer } type BaseKeeper struct { @@ -38,11 +40,6 @@ type BaseKeeper struct { accountKeeper types.AccountKeeper } -func (k BaseKeeper) TestQuery(ctx context.Context, request *types.TestQueryRequest) (*types.TestQueryResponse, error) { - //TODO: This is not a real gRPC query. This was added to the query.proto file as a placeholder. We should remove this and add the real queries once we better define query.proto. - panic("implement me") -} - // NewKeeper returns a new instance of the x/confidentialtransfers keeper func NewKeeper( codec codec.Codec, @@ -63,21 +60,29 @@ func NewKeeper( } } -func (k BaseKeeper) GetAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) { +func (k BaseKeeper) getAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) { + ctAccount, found := k.getCtAccount(ctx, address, denom) + if !found { + return types.Account{}, false + } + account, err := ctAccount.FromProto() + if err != nil { + return types.Account{}, false + } + return *account, true +} + +func (k BaseKeeper) getCtAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.CtAccount, bool) { store := k.getAccountStoreForAddress(ctx, address) key := []byte(denom) if !store.Has(key) { - return types.Account{}, false + return types.CtAccount{}, false } var ctAccount types.CtAccount bz := store.Get(key) k.cdc.MustUnmarshal(bz, &ctAccount) // Unmarshal the bytes back into the CtAccount object - account, err := ctAccount.FromProto() - if err != nil { - return types.Account{}, false - } - return *account, true + return ctAccount, true } func (k BaseKeeper) SetAccount(ctx sdk.Context, address sdk.AccAddress, denom string, account types.Account) { diff --git a/x/confidentialtransfers/keeper/keeper_test.go b/x/confidentialtransfers/keeper/keeper_test.go index 14b9065a84..b5f694741e 100644 --- a/x/confidentialtransfers/keeper/keeper_test.go +++ b/x/confidentialtransfers/keeper/keeper_test.go @@ -32,4 +32,5 @@ func (suite *KeeperTestSuite) SetupTest() { suite.App.GetSubspace(types.ModuleName), suite.App.AccountKeeper) suite.msgServer = keeper.NewMsgServerImpl(suite.App.ConfidentialTransfersKeeper) + } diff --git a/x/confidentialtransfers/module.go b/x/confidentialtransfers/module.go index 89f15ca498..d1da0f9710 100644 --- a/x/confidentialtransfers/module.go +++ b/x/confidentialtransfers/module.go @@ -92,7 +92,8 @@ func (am AppModuleBasic) ValidateGenesisStream(cdc codec.JSONCodec, config clien // TODO: Look into whether we require REST endpoints // RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, _ *mux.Router) { + //rest.RegisterHandlers(clientCtx, rtr) } // TODO: Look into whether we require gRPC Gateway support @@ -158,8 +159,8 @@ func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - // types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + //types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) // TODO: Confirm that we don't need to define any Migrator here //m := keeper.NewMigrator(am.keeper) diff --git a/x/confidentialtransfers/types/query.pb.go b/x/confidentialtransfers/types/query.pb.go index a3c20c6baf..71bfa57465 100644 --- a/x/confidentialtransfers/types/query.pb.go +++ b/x/confidentialtransfers/types/query.pb.go @@ -29,23 +29,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// TODO: This is a mock method. Remove when we add real queries -type TestQueryRequest struct { - TestField string `protobuf:"bytes,1,opt,name=test_field,json=testField,proto3" json:"test_field,omitempty"` +type GetAccountRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *TestQueryRequest) Reset() { *m = TestQueryRequest{} } -func (m *TestQueryRequest) String() string { return proto.CompactTextString(m) } -func (*TestQueryRequest) ProtoMessage() {} -func (*TestQueryRequest) Descriptor() ([]byte, []int) { +func (m *GetAccountRequest) Reset() { *m = GetAccountRequest{} } +func (m *GetAccountRequest) String() string { return proto.CompactTextString(m) } +func (*GetAccountRequest) ProtoMessage() {} +func (*GetAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{0} } -func (m *TestQueryRequest) XXX_Unmarshal(b []byte) error { +func (m *GetAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TestQueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TestQueryRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_GetAccountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,42 +55,92 @@ func (m *TestQueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *TestQueryRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestQueryRequest.Merge(m, src) +func (m *GetAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAccountRequest.Merge(m, src) } -func (m *TestQueryRequest) XXX_Size() int { +func (m *GetAccountRequest) XXX_Size() int { return m.Size() } -func (m *TestQueryRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TestQueryRequest.DiscardUnknown(m) +func (m *GetAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAccountRequest.DiscardUnknown(m) } -var xxx_messageInfo_TestQueryRequest proto.InternalMessageInfo +var xxx_messageInfo_GetAccountRequest proto.InternalMessageInfo -func (m *TestQueryRequest) GetTestField() string { +func (m *GetAccountRequest) GetAddress() string { if m != nil { - return m.TestField + return m.Address } return "" } -// TODO: This is a mock method. Remove when we add real queries -type TestQueryResponse struct { - TestField string `protobuf:"bytes,1,opt,name=test_field,json=testField,proto3" json:"test_field,omitempty"` +func (m *GetAccountRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" } -func (m *TestQueryResponse) Reset() { *m = TestQueryResponse{} } -func (m *TestQueryResponse) String() string { return proto.CompactTextString(m) } -func (*TestQueryResponse) ProtoMessage() {} -func (*TestQueryResponse) Descriptor() ([]byte, []int) { +type GetAccountResponse struct { + Account *CtAccount `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *GetAccountResponse) Reset() { *m = GetAccountResponse{} } +func (m *GetAccountResponse) String() string { return proto.CompactTextString(m) } +func (*GetAccountResponse) ProtoMessage() {} +func (*GetAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{1} } -func (m *TestQueryResponse) XXX_Unmarshal(b []byte) error { +func (m *GetAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAccountResponse.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 *GetAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAccountResponse.Merge(m, src) +} +func (m *GetAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAccountResponse proto.InternalMessageInfo + +func (m *GetAccountResponse) GetAccount() *CtAccount { + if m != nil { + return m.Account + } + return nil +} + +type GetAllAccountsRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *GetAllAccountsRequest) Reset() { *m = GetAllAccountsRequest{} } +func (m *GetAllAccountsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllAccountsRequest) ProtoMessage() {} +func (*GetAllAccountsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_35280e71e5f6c1ab, []int{2} +} +func (m *GetAllAccountsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *TestQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetAllAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_TestQueryResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_GetAllAccountsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -100,53 +150,106 @@ func (m *TestQueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *TestQueryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestQueryResponse.Merge(m, src) +func (m *GetAllAccountsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllAccountsRequest.Merge(m, src) } -func (m *TestQueryResponse) XXX_Size() int { +func (m *GetAllAccountsRequest) XXX_Size() int { return m.Size() } -func (m *TestQueryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TestQueryResponse.DiscardUnknown(m) +func (m *GetAllAccountsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllAccountsRequest.DiscardUnknown(m) } -var xxx_messageInfo_TestQueryResponse proto.InternalMessageInfo +var xxx_messageInfo_GetAllAccountsRequest proto.InternalMessageInfo -func (m *TestQueryResponse) GetTestField() string { +func (m *GetAllAccountsRequest) GetAddress() string { if m != nil { - return m.TestField + return m.Address } return "" } +type GetAllAccountsResponse struct { + Accounts []*CtAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` +} + +func (m *GetAllAccountsResponse) Reset() { *m = GetAllAccountsResponse{} } +func (m *GetAllAccountsResponse) String() string { return proto.CompactTextString(m) } +func (*GetAllAccountsResponse) ProtoMessage() {} +func (*GetAllAccountsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_35280e71e5f6c1ab, []int{3} +} +func (m *GetAllAccountsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAllAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAllAccountsResponse.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 *GetAllAccountsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllAccountsResponse.Merge(m, src) +} +func (m *GetAllAccountsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAllAccountsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllAccountsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAllAccountsResponse proto.InternalMessageInfo + +func (m *GetAllAccountsResponse) GetAccounts() []*CtAccount { + if m != nil { + return m.Accounts + } + return nil +} + func init() { - proto.RegisterType((*TestQueryRequest)(nil), "seiprotocol.seichain.confidentialtransfers.TestQueryRequest") - proto.RegisterType((*TestQueryResponse)(nil), "seiprotocol.seichain.confidentialtransfers.TestQueryResponse") + proto.RegisterType((*GetAccountRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountRequest") + proto.RegisterType((*GetAccountResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountResponse") + proto.RegisterType((*GetAllAccountsRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllAccountsRequest") + proto.RegisterType((*GetAllAccountsResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllAccountsResponse") } func init() { proto.RegisterFile("confidentialtransfers/query.proto", fileDescriptor_35280e71e5f6c1ab) } var fileDescriptor_35280e71e5f6c1ab = []byte{ - // 292 bytes of a gzipped FileDescriptorProto + // 404 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0xcf, 0x4b, 0xcb, 0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x4c, 0xcc, 0x29, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 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 0x8e, 0x15, 0xa7, 0xc8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, - 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, - 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, - 0x05, 0x99, 0xa7, 0x0b, 0x73, 0x17, 0x98, 0x03, 0x31, 0xbd, 0x02, 0x97, 0xf9, 0x95, 0x05, 0xa9, - 0xc5, 0x49, 0x6c, 0x60, 0x1d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x17, 0x87, 0x5b, - 0x16, 0x02, 0x00, 0x00, + 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0x35, 0xb0, 0x3b, 0x01, 0x59, 0x14, + 0xa2, 0x52, 0xc9, 0x99, 0x4b, 0xd0, 0x3d, 0xb5, 0xc4, 0x31, 0x39, 0x39, 0xbf, 0x34, 0xaf, 0x24, + 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, 0x8b, 0x3d, 0x31, 0x25, 0xa5, 0x28, 0xb5, + 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x12, 0xe1, 0x62, 0x4d, 0x49, + 0xcd, 0xcb, 0xcf, 0x95, 0x60, 0x02, 0x8b, 0x43, 0x38, 0x4a, 0xa9, 0x5c, 0x42, 0xc8, 0x86, 0x14, + 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0xf9, 0x73, 0xb1, 0x27, 0x42, 0x84, 0xc0, 0xa6, 0x70, 0x1b, + 0x99, 0xea, 0x11, 0xef, 0x6d, 0x3d, 0x67, 0xb8, 0x79, 0x30, 0x53, 0x94, 0x0c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0x3a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xd8, 0xbe, 0xaf, + 0x0c, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -161,8 +264,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 { - // TODO: This is a mock method. Remove when we add real queries - TestQuery(ctx context.Context, in *TestQueryRequest, opts ...grpc.CallOption) (*TestQueryResponse, error) + GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) + GetAllAccounts(ctx context.Context, in *GetAllAccountsRequest, opts ...grpc.CallOption) (*GetAllAccountsResponse, error) } type queryClient struct { @@ -173,9 +276,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) TestQuery(ctx context.Context, in *TestQueryRequest, opts ...grpc.CallOption) (*TestQueryResponse, error) { - out := new(TestQueryResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/TestQuery", in, out, opts...) +func (c *queryClient) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) { + out := new(GetAccountResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAllAccounts(ctx context.Context, in *GetAllAccountsRequest, opts ...grpc.CallOption) (*GetAllAccountsResponse, error) { + out := new(GetAllAccountsResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetAllAccounts", in, out, opts...) if err != nil { return nil, err } @@ -184,36 +296,57 @@ func (c *queryClient) TestQuery(ctx context.Context, in *TestQueryRequest, opts // QueryServer is the server API for Query service. type QueryServer interface { - // TODO: This is a mock method. Remove when we add real queries - TestQuery(context.Context, *TestQueryRequest) (*TestQueryResponse, error) + GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) + GetAllAccounts(context.Context, *GetAllAccountsRequest) (*GetAllAccountsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) TestQuery(ctx context.Context, req *TestQueryRequest) (*TestQueryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TestQuery not implemented") +func (*UnimplementedQueryServer) GetAccount(ctx context.Context, req *GetAccountRequest) (*GetAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented") +} +func (*UnimplementedQueryServer) GetAllAccounts(ctx context.Context, req *GetAllAccountsRequest) (*GetAllAccountsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllAccounts not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_TestQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TestQueryRequest) +func _Query_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).TestQuery(ctx, in) + return srv.(QueryServer).GetAccount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/TestQuery", + FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetAccount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TestQuery(ctx, req.(*TestQueryRequest)) + return srv.(QueryServer).GetAccount(ctx, req.(*GetAccountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAllAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllAccountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAllAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetAllAccounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllAccounts(ctx, req.(*GetAllAccountsRequest)) } return interceptor(ctx, in, info, handler) } @@ -223,15 +356,19 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "TestQuery", - Handler: _Query_TestQuery_Handler, + MethodName: "GetAccount", + Handler: _Query_GetAccount_Handler, + }, + { + MethodName: "GetAllAccounts", + Handler: _Query_GetAllAccounts_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "confidentialtransfers/query.proto", } -func (m *TestQueryRequest) Marshal() (dAtA []byte, err error) { +func (m *GetAccountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -241,27 +378,34 @@ func (m *TestQueryRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TestQueryRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetAccountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TestQueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TestField) > 0 { - i -= len(m.TestField) - copy(dAtA[i:], m.TestField) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TestField))) + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *TestQueryResponse) Marshal() (dAtA []byte, err error) { +func (m *GetAccountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -271,26 +415,98 @@ func (m *TestQueryResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TestQueryResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetAccountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TestQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TestField) > 0 { - i -= len(m.TestField) - copy(dAtA[i:], m.TestField) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TestField))) + if m.Account != nil { + { + size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAllAccountsRequest) 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 *GetAllAccountsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAllAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } +func (m *GetAllAccountsResponse) 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 *GetAllAccountsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAllAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Accounts) > 0 { + for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Accounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -302,39 +518,71 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TestQueryRequest) Size() (n int) { +func (m *GetAccountRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.TestField) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Denom) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *TestQueryResponse) Size() (n int) { +func (m *GetAccountResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.TestField) + if m.Account != nil { + l = m.Account.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *GetAllAccountsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } +func (m *GetAllAccountsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Accounts) > 0 { + for _, e := range m.Accounts { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TestQueryRequest) Unmarshal(dAtA []byte) error { +func (m *GetAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -357,15 +605,47 @@ func (m *TestQueryRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TestQueryRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetAccountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TestQueryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TestField", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -393,7 +673,7 @@ func (m *TestQueryRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TestField = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -416,7 +696,7 @@ func (m *TestQueryRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *TestQueryResponse) Unmarshal(dAtA []byte) error { +func (m *GetAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -439,15 +719,101 @@ func (m *TestQueryResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TestQueryResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TestQueryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TestField", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Account == nil { + m.Account = &CtAccount{} + } + if err := m.Account.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 (m *GetAllAccountsRequest) 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: GetAllAccountsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAllAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -475,7 +841,91 @@ func (m *TestQueryResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TestField = string(dAtA[iNdEx:postIndex]) + m.Address = 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 (m *GetAllAccountsResponse) 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: GetAllAccountsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAllAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Accounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Accounts = append(m.Accounts, &CtAccount{}) + if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/confidentialtransfers/types/query.pb.gw.go b/x/confidentialtransfers/types/query.pb.gw.go index 5618232dc0..5a7a2f318a 100644 --- a/x/confidentialtransfers/types/query.pb.gw.go +++ b/x/confidentialtransfers/types/query.pb.gw.go @@ -33,38 +33,132 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -var ( - filter_Query_TestQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +func request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAccountRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } -func request_Query_TestQuery_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TestQueryRequest + msg, err := client.GetAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAccountRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TestQuery_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.GetAccount(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllAccountsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := client.TestQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetAllAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_TestQuery_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TestQueryRequest +func local_request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllAccountsRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TestQuery_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } - msg, err := server.TestQuery(ctx, &protoReq) + msg, err := server.GetAllAccounts(ctx, &protoReq) return msg, metadata, err } @@ -75,7 +169,7 @@ func local_request_Query_TestQuery_0(ctx context.Context, marshaler runtime.Mars // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_TestQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -86,7 +180,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_TestQuery_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetAccount_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 { @@ -94,7 +188,30 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_TestQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAllAccounts_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_GetAllAccounts_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_GetAllAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -139,7 +256,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_TestQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAccount_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) @@ -148,14 +265,34 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_TestQuery_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetAccount_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_TestQuery_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAllAccounts_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_GetAllAccounts_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_GetAllAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -163,9 +300,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_TestQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"seichain", "confidentialtransfers", "test_query"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"seichain", "confidentialtransfers", "account", "address", "denom"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetAllAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seichain", "confidentialtransfers", "account", "address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Query_TestQuery_0 = runtime.ForwardResponseMessage + forward_Query_GetAccount_0 = runtime.ForwardResponseMessage + + forward_Query_GetAllAccounts_0 = runtime.ForwardResponseMessage ) From 4832cb6139bfeaa8681e0ba4304059ee7777026a Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 15:45:49 -0800 Subject: [PATCH 04/16] working draft test --- app/app.go | 11 +++++++++-- x/confidentialtransfers/keeper/grpc_query_test.go | 2 +- x/confidentialtransfers/keeper/keeper_test.go | 12 ++++++------ x/confidentialtransfers/module.go | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/app.go b/app/app.go index ac33fda599..ce5143035c 100644 --- a/app/app.go +++ b/app/app.go @@ -210,6 +210,7 @@ var ( wasm.AppModuleBasic{}, epochmodule.AppModuleBasic{}, tokenfactorymodule.AppModuleBasic{}, + ctmodule.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -557,6 +558,12 @@ func New( tokenFactoryConfig, ) + app.ConfidentialTransfersKeeper = ctkeeper.NewKeeper( + appCodec, + app.keys[(cttypes.StoreKey)], + app.GetSubspace(cttypes.ModuleName), + app.AccountKeeper) + // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks supportedFeatures := "iterator,staking,stargate,sei" @@ -759,7 +766,7 @@ func New( epochModule, tokenfactorymodule.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - ctmodule.NewAppModule(nil), + ctmodule.NewAppModule(app.ConfidentialTransfersKeeper), // this line is used by starport scaffolding # stargate/app/appModule ) @@ -885,7 +892,7 @@ func New( transferModule, epochModule, tokenfactorymodule.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), - ctmodule.NewAppModule(nil), + ctmodule.NewAppModule(app.ConfidentialTransfersKeeper), // this line is used by starport scaffolding # stargate/app/appModule ) app.sm.RegisterStoreDecoders() diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 698c4ea8ce..56a438f833 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -22,5 +22,5 @@ func (suite *KeeperTestSuite) TestAccountQuery() { &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}) suite.Require().NoError(err) - suite.Require().Equal(account, result.Account) + suite.Require().Equal(&ctAccount, result.Account) } diff --git a/x/confidentialtransfers/keeper/keeper_test.go b/x/confidentialtransfers/keeper/keeper_test.go index b5f694741e..a2a24ee4b7 100644 --- a/x/confidentialtransfers/keeper/keeper_test.go +++ b/x/confidentialtransfers/keeper/keeper_test.go @@ -25,12 +25,12 @@ func (suite *KeeperTestSuite) SetupTest() { suite.Setup() suite.queryClient = types.NewQueryClient(suite.QueryHelper) - // TODO: remove this once the app initializes confidentialtransfers keeper - suite.App.ConfidentialTransfersKeeper = keeper.NewKeeper( - suite.App.AppCodec(), - suite.App.GetKey(types.StoreKey), - suite.App.GetSubspace(types.ModuleName), - suite.App.AccountKeeper) + //// TODO: remove this once the app initializes confidentialtransfers keeper + //suite.App.ConfidentialTransfersKeeper = keeper.NewKeeper( + // suite.App.AppCodec(), + // suite.App.GetKey(types.StoreKey), + // suite.App.GetSubspace(types.ModuleName), + // suite.App.AccountKeeper) suite.msgServer = keeper.NewMsgServerImpl(suite.App.ConfidentialTransfersKeeper) } diff --git a/x/confidentialtransfers/module.go b/x/confidentialtransfers/module.go index d1da0f9710..033952c9f5 100644 --- a/x/confidentialtransfers/module.go +++ b/x/confidentialtransfers/module.go @@ -159,7 +159,7 @@ func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - //types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) // TODO: Confirm that we don't need to define any Migrator here From 821ef7e07749889630aaf7064b12083f71e754b0 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 16:23:49 -0800 Subject: [PATCH 05/16] more tests --- x/confidentialtransfers/keeper/grpc_query.go | 3 +- .../keeper/grpc_query_test.go | 73 ++++++++++++++++--- 2 files changed, 65 insertions(+), 11 deletions(-) diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index 2494605a1c..00b6c51858 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -32,7 +32,8 @@ func (k BaseKeeper) GetAccount(ctx context.Context, req *types.GetAccountRequest ctAccount, found := k.getCtAccount(sdkCtx, address, req.Denom) if !found { - return nil, status.Errorf(codes.NotFound, "account %s not found", req.Address) + return nil, status.Errorf(codes.NotFound, "account not found for account %s and denom %s", + req.Address, req.Denom) } return &types.GetAccountResponse{Account: &ctAccount}, nil diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 56a438f833..0df04f12fe 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - gocontext "context" "fmt" "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" @@ -9,18 +8,72 @@ import ( ) func (suite *KeeperTestSuite) TestAccountQuery() { - app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - pk1, _ := encryption.GenerateKey() + _, _, nonExistingAddr := testdata.KeyTestPubAddr() testDenom := fmt.Sprintf("factory/%s/TEST", addr.String()) - ctAccount := generateCtAccount(pk1, testDenom, 1000) - account, _ := ctAccount.FromProto() + nonExistingDenom := fmt.Sprintf("factory/%s/NONEXISTING", addr.String()) - app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom, *account) + testCases := []struct { + name string + req *types.GetAccountRequest + expFail bool + expErrorMessage string + }{ + { + name: "empty address", + req: &types.GetAccountRequest{}, + expFail: true, + expErrorMessage: "rpc error: code = InvalidArgument desc = address cannot be empty", + }, + { + name: "empty denom", + req: &types.GetAccountRequest{Address: addr.String()}, + expFail: true, + expErrorMessage: "rpc error: code = InvalidArgument desc = invalid denom", + }, + { + name: "account for address does not exist", + req: &types.GetAccountRequest{Address: nonExistingAddr.String(), Denom: testDenom}, + expFail: true, + expErrorMessage: fmt.Sprintf("rpc error: code = NotFound desc = account not found for account %s "+ + "and denom %s", nonExistingAddr, testDenom), + }, + { + name: "account for the denom does not exist", + req: &types.GetAccountRequest{Address: addr.String(), Denom: nonExistingDenom}, + expFail: true, + expErrorMessage: fmt.Sprintf("rpc error: code = NotFound desc = account not found for account %s "+ + "and denom %s", addr.String(), nonExistingDenom), + }, + { + name: "existing denom can be found", + req: &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}, + }, + } - result, err := queryClient.GetAccount(gocontext.Background(), - &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}) - suite.Require().NoError(err) + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient - suite.Require().Equal(&ctAccount, result.Account) + pk1, _ := encryption.GenerateKey() + + ctAccount := generateCtAccount(pk1, testDenom, 1000) + account, _ := ctAccount.FromProto() + + app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom, *account) + + result, err := queryClient.GetAccount(ctx.Context(), tc.req) + + if tc.expFail { + suite.Require().Error(err) + suite.Require().EqualError(err, tc.expErrorMessage) + } else { + suite.Require().NoError(err) + suite.Require().NotNil(result) + suite.Require().Equal(&ctAccount, result.Account) + + } + }) + } } From 16c70b8833642c3e61be2c815acaa0ffd2dd51ef Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 16:28:20 -0800 Subject: [PATCH 06/16] refactor tests --- x/confidentialtransfers/keeper/grpc_query_test.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 0df04f12fe..6ef3e6e1cb 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -13,6 +13,10 @@ func (suite *KeeperTestSuite) TestAccountQuery() { testDenom := fmt.Sprintf("factory/%s/TEST", addr.String()) nonExistingDenom := fmt.Sprintf("factory/%s/NONEXISTING", addr.String()) + pk1, _ := encryption.GenerateKey() + ctAccount := generateCtAccount(pk1, testDenom, 1000) + account, _ := ctAccount.FromProto() + testCases := []struct { name string req *types.GetAccountRequest @@ -20,7 +24,7 @@ func (suite *KeeperTestSuite) TestAccountQuery() { expErrorMessage string }{ { - name: "empty address", + name: "empty request", req: &types.GetAccountRequest{}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = address cannot be empty", @@ -56,11 +60,6 @@ func (suite *KeeperTestSuite) TestAccountQuery() { suite.SetupTest() // reset app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient - pk1, _ := encryption.GenerateKey() - - ctAccount := generateCtAccount(pk1, testDenom, 1000) - account, _ := ctAccount.FromProto() - app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom, *account) result, err := queryClient.GetAccount(ctx.Context(), tc.req) @@ -72,7 +71,6 @@ func (suite *KeeperTestSuite) TestAccountQuery() { suite.Require().NoError(err) suite.Require().NotNil(result) suite.Require().Equal(&ctAccount, result.Account) - } }) } From c36af29436ab9cbfecfa1b79375abe70b4198d4c Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 17:12:08 -0800 Subject: [PATCH 07/16] all accounts query --- x/confidentialtransfers/keeper/grpc_query.go | 24 +++++- .../keeper/grpc_query_test.go | 76 ++++++++++++++++++- x/confidentialtransfers/keeper/keeper.go | 31 +++++++- 3 files changed, 125 insertions(+), 6 deletions(-) diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index 00b6c51858..a7ad0c8640 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -40,5 +40,27 @@ func (k BaseKeeper) GetAccount(ctx context.Context, req *types.GetAccountRequest } func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccountsRequest) (*types.GetAllAccountsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllAccounts not implemented") + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.Address == "" { + return nil, status.Error(codes.InvalidArgument, "address cannot be empty") + } + + address, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid address: %s", err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + accounts, err := k.getCtAccountsForAddress(sdkCtx, address) + + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to fetch accounts: %s", err.Error()) + } + + return &types.GetAllAccountsResponse{Accounts: accounts}, nil + } diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 6ef3e6e1cb..13989de76f 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -35,6 +35,13 @@ func (suite *KeeperTestSuite) TestAccountQuery() { expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = invalid denom", }, + { + name: "invalid address", + req: &types.GetAccountRequest{Address: "INVALID"}, + expFail: true, + expErrorMessage: "rpc error: code = InvalidArgument desc = invalid address: decoding bech32 failed: " + + "invalid bech32 string length 7", + }, { name: "account for address does not exist", req: &types.GetAccountRequest{Address: nonExistingAddr.String(), Denom: testDenom}, @@ -50,7 +57,7 @@ func (suite *KeeperTestSuite) TestAccountQuery() { "and denom %s", addr.String(), nonExistingDenom), }, { - name: "existing denom can be found", + name: "existing account for address and denom", req: &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}, }, } @@ -75,3 +82,70 @@ func (suite *KeeperTestSuite) TestAccountQuery() { }) } } + +func (suite *KeeperTestSuite) TestAllAccountsQuery() { + _, _, addr := testdata.KeyTestPubAddr() + _, _, nonExistingAddr := testdata.KeyTestPubAddr() + testDenom1 := fmt.Sprintf("factory/%s/FIRST", addr.String()) + testDenom2 := fmt.Sprintf("factory/%s/SECOND", addr.String()) + + pk1, _ := encryption.GenerateKey() + pk2, _ := encryption.GenerateKey() + ctAccount1 := generateCtAccount(pk1, testDenom1, 1000) + ctAccount2 := generateCtAccount(pk2, testDenom2, 2000) + account1, _ := ctAccount1.FromProto() + account2, _ := ctAccount2.FromProto() + + testCases := []struct { + name string + req *types.GetAllAccountsRequest + expResponse []*types.CtAccount + expFail bool + expErrorMessage string + }{ + { + name: "empty request", + req: &types.GetAllAccountsRequest{}, + expFail: true, + expErrorMessage: "rpc error: code = InvalidArgument desc = address cannot be empty", + }, + { + name: "invalid address", + req: &types.GetAllAccountsRequest{Address: "INVALID"}, + expFail: true, + expErrorMessage: "rpc error: code = InvalidArgument desc = invalid address: decoding bech32 failed: " + + "invalid bech32 string length 7", + }, + { + name: "account for address does not exist", + req: &types.GetAllAccountsRequest{Address: nonExistingAddr.String()}, + expResponse: []*types.CtAccount(nil), + }, + { + name: "accounts for address exist", + req: &types.GetAllAccountsRequest{Address: addr.String()}, + expResponse: []*types.CtAccount{&ctAccount1, &ctAccount2}, + }, + } + + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.name), func() { + suite.SetupTest() // reset + app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient + + app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom1, *account1) + app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom2, *account2) + + result, err := queryClient.GetAllAccounts(ctx.Context(), tc.req) + + if tc.expFail { + suite.Require().Error(err) + suite.Require().EqualError(err, tc.expErrorMessage) + } else { + suite.Require().NoError(err) + suite.Require().NotNil(result) + suite.Require().Equal(tc.expResponse, result.Accounts) + } + }) + } +} diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index deb732f74d..7cc3af389f 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -109,14 +109,13 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres accounts := make(map[string]*types.Account) for ; iterator.Valid(); iterator.Next() { - var ctaccount types.CtAccount - k.cdc.MustUnmarshal(iterator.Value(), &ctaccount) - account, err := ctaccount.FromProto() + var ctAccount types.CtAccount + k.cdc.MustUnmarshal(iterator.Value(), &ctAccount) + account, err := ctAccount.FromProto() if err != nil { return nil, err } - // Extract the denom from the key key := iterator.Key() accounts[string(key)] = account @@ -125,6 +124,30 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres return accounts, nil } +// getCtAccountsForAddress gets all accounts associated with a given address +func (k BaseKeeper) getCtAccountsForAddress(ctx sdk.Context, address sdk.AccAddress) ([]*types.CtAccount, error) { + // Create a prefix store scoped to the address + store := k.getAccountStoreForAddress(ctx, address) + + // Iterate over all keys in the prefix store + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + k.Logger(ctx).Error("failed to close iterator", "error", err) + } + }(iterator) + + accounts := make([]*types.CtAccount, 0) + for ; iterator.Valid(); iterator.Next() { + var ctAccount types.CtAccount + k.cdc.MustUnmarshal(iterator.Value(), &ctAccount) + accounts = append(accounts, &ctAccount) + } + + return accounts, nil +} + func (k BaseKeeper) GetParams(ctx sdk.Context) (params types.Params) { k.paramSpace.GetParamSet(ctx, ¶ms) return params From ec491ecbd810b98f1a1f0ab25f8a10bf44a81a7c Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Mon, 11 Nov 2024 17:37:24 -0800 Subject: [PATCH 08/16] formatting --- x/confidentialtransfers/keeper/genesis.go | 1 + x/confidentialtransfers/keeper/grpc_query.go | 1 + 2 files changed, 2 insertions(+) diff --git a/x/confidentialtransfers/keeper/genesis.go b/x/confidentialtransfers/keeper/genesis.go index ac0f7b663a..10f22062e7 100644 --- a/x/confidentialtransfers/keeper/genesis.go +++ b/x/confidentialtransfers/keeper/genesis.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index a7ad0c8640..e654d1c2f0 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" "google.golang.org/grpc/codes" From 865b8ee84d78ef0a5089cc499431847de3b51cbc Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 09:22:54 -0800 Subject: [PATCH 09/16] add pagination to request/response --- proto/confidentialtransfers/query.proto | 12 +- .../keeper/grpc_query_test.go | 6 +- x/confidentialtransfers/keeper/keeper.go | 6 +- x/confidentialtransfers/types/query.pb.go | 188 ++++++++++++++---- x/confidentialtransfers/types/query.pb.gw.go | 18 ++ 5 files changed, 186 insertions(+), 44 deletions(-) diff --git a/proto/confidentialtransfers/query.proto b/proto/confidentialtransfers/query.proto index ec2c94c191..0ace6cdeeb 100644 --- a/proto/confidentialtransfers/query.proto +++ b/proto/confidentialtransfers/query.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package seiprotocol.seichain.confidentialtransfers; +import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "confidentialtransfers/confidential.proto"; @@ -32,9 +33,18 @@ message GetAccountResponse { } message GetAllAccountsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + string address = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } message GetAllAccountsResponse { - repeated CtAccount accounts = 1; + repeated CtAccount accounts = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } \ No newline at end of file diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 13989de76f..861381d3f2 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -99,7 +99,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { testCases := []struct { name string req *types.GetAllAccountsRequest - expResponse []*types.CtAccount + expResponse []types.CtAccount expFail bool expErrorMessage string }{ @@ -119,12 +119,12 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { { name: "account for address does not exist", req: &types.GetAllAccountsRequest{Address: nonExistingAddr.String()}, - expResponse: []*types.CtAccount(nil), + expResponse: []types.CtAccount(nil), }, { name: "accounts for address exist", req: &types.GetAllAccountsRequest{Address: addr.String()}, - expResponse: []*types.CtAccount{&ctAccount1, &ctAccount2}, + expResponse: []types.CtAccount{ctAccount1, ctAccount2}, }, } diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 7cc3af389f..08306c3de9 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -125,7 +125,7 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres } // getCtAccountsForAddress gets all accounts associated with a given address -func (k BaseKeeper) getCtAccountsForAddress(ctx sdk.Context, address sdk.AccAddress) ([]*types.CtAccount, error) { +func (k BaseKeeper) getCtAccountsForAddress(ctx sdk.Context, address sdk.AccAddress) ([]types.CtAccount, error) { // Create a prefix store scoped to the address store := k.getAccountStoreForAddress(ctx, address) @@ -138,11 +138,11 @@ func (k BaseKeeper) getCtAccountsForAddress(ctx sdk.Context, address sdk.AccAddr } }(iterator) - accounts := make([]*types.CtAccount, 0) + accounts := make([]types.CtAccount, 0) for ; iterator.Valid(); iterator.Next() { var ctAccount types.CtAccount k.cdc.MustUnmarshal(iterator.Value(), &ctAccount) - accounts = append(accounts, &ctAccount) + accounts = append(accounts, ctAccount) } return accounts, nil diff --git a/x/confidentialtransfers/types/query.pb.go b/x/confidentialtransfers/types/query.pb.go index 71bfa57465..ae67f33540 100644 --- a/x/confidentialtransfers/types/query.pb.go +++ b/x/confidentialtransfers/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -127,6 +128,8 @@ func (m *GetAccountResponse) GetAccount() *CtAccount { type GetAllAccountsRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *GetAllAccountsRequest) Reset() { *m = GetAllAccountsRequest{} } @@ -162,15 +165,10 @@ func (m *GetAllAccountsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllAccountsRequest proto.InternalMessageInfo -func (m *GetAllAccountsRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - type GetAllAccountsResponse struct { - Accounts []*CtAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` + Accounts []CtAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *GetAllAccountsResponse) Reset() { *m = GetAllAccountsResponse{} } @@ -206,13 +204,20 @@ func (m *GetAllAccountsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllAccountsResponse proto.InternalMessageInfo -func (m *GetAllAccountsResponse) GetAccounts() []*CtAccount { +func (m *GetAllAccountsResponse) GetAccounts() []CtAccount { if m != nil { return m.Accounts } return nil } +func (m *GetAllAccountsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*GetAccountRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountRequest") proto.RegisterType((*GetAccountResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountResponse") @@ -223,33 +228,38 @@ func init() { func init() { proto.RegisterFile("confidentialtransfers/query.proto", fileDescriptor_35280e71e5f6c1ab) } var fileDescriptor_35280e71e5f6c1ab = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0xcf, 0x4b, - 0xcb, 0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x4c, 0xcc, 0x29, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, - 0x2a, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x2a, - 0x4e, 0xcd, 0x04, 0xb3, 0x92, 0xf3, 0x73, 0xf4, 0x8a, 0x53, 0x33, 0x93, 0x33, 0x12, 0x33, 0xf3, - 0xf4, 0xb0, 0xea, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd6, 0x07, 0xb1, 0x20, 0x26, - 0x48, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, - 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0x35, 0xb0, 0x3b, 0x01, 0x59, 0x14, - 0xa2, 0x52, 0xc9, 0x99, 0x4b, 0xd0, 0x3d, 0xb5, 0xc4, 0x31, 0x39, 0x39, 0xbf, 0x34, 0xaf, 0x24, - 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, 0x8b, 0x3d, 0x31, 0x25, 0xa5, 0x28, 0xb5, - 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x12, 0xe1, 0x62, 0x4d, 0x49, - 0xcd, 0xcb, 0xcf, 0x95, 0x60, 0x02, 0x8b, 0x43, 0x38, 0x4a, 0xa9, 0x5c, 0x42, 0xc8, 0x86, 0x14, - 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0xf9, 0x73, 0xb1, 0x27, 0x42, 0x84, 0xc0, 0xa6, 0x70, 0x1b, - 0x99, 0xea, 0x11, 0xef, 0x6d, 0x3d, 0x67, 0xb8, 0x79, 0x30, 0x53, 0x94, 0x0c, 0xb9, 0x44, 0x41, - 0xd6, 0xe4, 0xe4, 0x40, 0x65, 0x8a, 0x09, 0xba, 0x57, 0x29, 0x9b, 0x4b, 0x0c, 0x5d, 0x0b, 0xd4, - 0x75, 0x81, 0x5c, 0x1c, 0x50, 0x73, 0x41, 0x9a, 0x98, 0xc9, 0x77, 0x1e, 0xdc, 0x18, 0xa3, 0xb5, - 0xcc, 0x5c, 0xac, 0x81, 0xa0, 0x58, 0x16, 0x3a, 0xc7, 0xc8, 0xc5, 0x85, 0x08, 0x11, 0x21, 0x5b, - 0x52, 0x4c, 0xc6, 0x88, 0x0e, 0x29, 0x3b, 0x72, 0xb5, 0x43, 0xbc, 0xaa, 0xe4, 0xd8, 0x74, 0xf9, - 0xc9, 0x64, 0x26, 0x6b, 0x21, 0x4b, 0x7d, 0x98, 0x5e, 0x7d, 0xec, 0xe9, 0x03, 0xea, 0x13, 0xfd, - 0x6a, 0x68, 0xf0, 0xd5, 0xea, 0x57, 0x83, 0x23, 0xb8, 0x56, 0xe8, 0x12, 0x23, 0x17, 0x1f, 0x6a, - 0x40, 0x0a, 0x39, 0x92, 0xea, 0x2a, 0x8c, 0x78, 0x93, 0x72, 0xa2, 0xc4, 0x08, 0xa8, 0xe7, 0x2c, - 0xc1, 0x9e, 0x33, 0x16, 0x32, 0x24, 0xd9, 0x73, 0x4e, 0x91, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, - 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, - 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x0b, - 0x32, 0x56, 0x17, 0xe6, 0x46, 0x30, 0x07, 0x62, 0x49, 0x05, 0x0e, 0x6b, 0x4a, 0x2a, 0x0b, 0x52, - 0x8b, 0x93, 0xd8, 0xc0, 0x3a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xd8, 0xbe, 0xaf, - 0x0c, 0x04, 0x00, 0x00, + // 495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0xc1, 0x6a, 0x14, 0x31, + 0x18, 0x9e, 0xb4, 0xd6, 0xd6, 0x14, 0x04, 0x43, 0x95, 0x65, 0x91, 0x59, 0x9d, 0x83, 0x96, 0x82, + 0x09, 0xbb, 0xc5, 0x43, 0x15, 0x95, 0xdd, 0x82, 0x3d, 0xaa, 0x7b, 0x11, 0xbd, 0x65, 0x67, 0xff, + 0x4e, 0x03, 0xb3, 0xc9, 0x74, 0x92, 0x15, 0x4b, 0xe9, 0x45, 0x2f, 0x1e, 0x05, 0x5f, 0xa0, 0x2f, + 0xe0, 0x0b, 0xf8, 0x04, 0x3d, 0x49, 0xd1, 0x8b, 0x27, 0x91, 0x5d, 0x0f, 0x3e, 0x86, 0x4c, 0x92, + 0x6d, 0x47, 0x3b, 0x52, 0xb7, 0xbd, 0x25, 0x7f, 0xf2, 0x7d, 0xff, 0xf7, 0x7d, 0xff, 0x8f, 0x6f, + 0xc6, 0x4a, 0x6e, 0x8a, 0x3e, 0x48, 0x23, 0x78, 0x6a, 0x72, 0x2e, 0xf5, 0x26, 0xe4, 0x9a, 0x6d, + 0x0f, 0x21, 0xdf, 0xa1, 0x59,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xd1, 0x22, + 0x56, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xce, 0x4d, 0x31, 0xdb, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -460,6 +470,18 @@ func (m *GetAllAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -490,6 +512,18 @@ func (m *GetAllAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Accounts) > 0 { for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -558,6 +592,10 @@ func (m *GetAllAccountsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -573,6 +611,10 @@ func (m *GetAllAccountsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -843,6 +885,42 @@ func (m *GetAllAccountsRequest) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -922,11 +1000,47 @@ func (m *GetAllAccountsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Accounts = append(m.Accounts, &CtAccount{}) + m.Accounts = append(m.Accounts, CtAccount{}) if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/confidentialtransfers/types/query.pb.gw.go b/x/confidentialtransfers/types/query.pb.gw.go index 5a7a2f318a..8dc1aa53bc 100644 --- a/x/confidentialtransfers/types/query.pb.gw.go +++ b/x/confidentialtransfers/types/query.pb.gw.go @@ -109,6 +109,10 @@ func local_request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Mar } +var ( + filter_Query_GetAllAccounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetAllAccountsRequest var metadata runtime.ServerMetadata @@ -131,6 +135,13 @@ func request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GetAllAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -158,6 +169,13 @@ func local_request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllAccounts_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GetAllAccounts(ctx, &protoReq) return msg, metadata, err From 3cda1153ec892590ebfb8207fcaad7164d25eb18 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 10:35:10 -0800 Subject: [PATCH 10/16] update implementation to use paginated response instead --- x/confidentialtransfers/keeper/grpc_query.go | 17 +++++++-- .../keeper/grpc_query_test.go | 35 +++++++++++++++---- x/confidentialtransfers/keeper/keeper.go | 32 ++++------------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index e654d1c2f0..64349a443b 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "github.com/cosmos/cosmos-sdk/types/query" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" @@ -56,12 +57,22 @@ func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccount sdkCtx := sdk.UnwrapSDKContext(ctx) - accounts, err := k.getCtAccountsForAddress(sdkCtx, address) + store := k.getAccountStoreForAddress(sdkCtx, address) + accounts := make([]types.CtAccount, 0) + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { + var result types.CtAccount + err = k.cdc.Unmarshal(value, &result) + if err != nil { + return err + } + accounts = append(accounts, result) + return nil + }) if err != nil { - return nil, status.Errorf(codes.Internal, "failed to fetch accounts: %s", err.Error()) + return nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err) } - return &types.GetAllAccountsResponse{Accounts: accounts}, nil + return &types.GetAllAccountsResponse{Accounts: accounts, Pagination: pageRes}, nil } diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 861381d3f2..f4e67f7ea7 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "fmt" "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" "github.com/sei-protocol/sei-cryptography/pkg/encryption" ) @@ -99,7 +100,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { testCases := []struct { name string req *types.GetAllAccountsRequest - expResponse []types.CtAccount + expResponse *types.GetAllAccountsResponse expFail bool expErrorMessage string }{ @@ -119,12 +120,34 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { { name: "account for address does not exist", req: &types.GetAllAccountsRequest{Address: nonExistingAddr.String()}, - expResponse: []types.CtAccount(nil), + expResponse: &types.GetAllAccountsResponse{Pagination: &query.PageResponse{}}, }, { - name: "accounts for address exist", - req: &types.GetAllAccountsRequest{Address: addr.String()}, - expResponse: []types.CtAccount{ctAccount1, ctAccount2}, + name: "accounts for address exist", + req: &types.GetAllAccountsRequest{Address: addr.String()}, + expResponse: &types.GetAllAccountsResponse{ + Accounts: []types.CtAccount{ctAccount1, ctAccount2}, + Pagination: &query.PageResponse{Total: 2}, + }, + }, + { + name: "paginated request", + req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{Limit: 1}}, + expResponse: &types.GetAllAccountsResponse{ + Accounts: []types.CtAccount{ctAccount1}, + Pagination: &query.PageResponse{Total: 0, NextKey: []byte(testDenom2)}, + }, + }, + { + name: "paginated request - second page", + req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{ + Limit: 1, + Key: []byte(testDenom2)}, + }, + expResponse: &types.GetAllAccountsResponse{ + Accounts: []types.CtAccount{ctAccount2}, + Pagination: &query.PageResponse{}, + }, }, } @@ -144,7 +167,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { } else { suite.Require().NoError(err) suite.Require().NotNil(result) - suite.Require().Equal(tc.expResponse, result.Accounts) + suite.Require().Equal(tc.expResponse, result) } }) } diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 08306c3de9..06dd13b495 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" @@ -105,7 +104,12 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres // Iterate over all keys in the prefix store iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer iterator.Close() + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + k.Logger(ctx).Error("failed to close iterator", "error", err) + } + }(iterator) accounts := make(map[string]*types.Account) for ; iterator.Valid(); iterator.Next() { @@ -124,30 +128,6 @@ func (k BaseKeeper) GetAccountsForAddress(ctx sdk.Context, address sdk.AccAddres return accounts, nil } -// getCtAccountsForAddress gets all accounts associated with a given address -func (k BaseKeeper) getCtAccountsForAddress(ctx sdk.Context, address sdk.AccAddress) ([]types.CtAccount, error) { - // Create a prefix store scoped to the address - store := k.getAccountStoreForAddress(ctx, address) - - // Iterate over all keys in the prefix store - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - defer func(iterator sdk.Iterator) { - err := iterator.Close() - if err != nil { - k.Logger(ctx).Error("failed to close iterator", "error", err) - } - }(iterator) - - accounts := make([]types.CtAccount, 0) - for ; iterator.Valid(); iterator.Next() { - var ctAccount types.CtAccount - k.cdc.MustUnmarshal(iterator.Value(), &ctAccount) - accounts = append(accounts, ctAccount) - } - - return accounts, nil -} - func (k BaseKeeper) GetParams(ctx sdk.Context) (params types.Params) { k.paramSpace.GetParamSet(ctx, ¶ms) return params From 30b38fd5ad266d5e2fc2d29fa14498514237508b Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 10:36:09 -0800 Subject: [PATCH 11/16] formatting --- x/confidentialtransfers/keeper/grpc_query.go | 1 + x/confidentialtransfers/keeper/keeper.go | 1 + 2 files changed, 2 insertions(+) diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index 64349a443b..2e7670d1f2 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "github.com/cosmos/cosmos-sdk/types/query" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 06dd13b495..5926020dbc 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/cosmos/cosmos-sdk/store/prefix" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" From 2f54260a7b0de00c35e1afb7c84c8d3b168922f2 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 10:45:31 -0800 Subject: [PATCH 12/16] remove redundant param --- x/confidentialtransfers/keeper/grpc_query_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index f4e67f7ea7..b6c641510d 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -135,7 +135,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{Limit: 1}}, expResponse: &types.GetAllAccountsResponse{ Accounts: []types.CtAccount{ctAccount1}, - Pagination: &query.PageResponse{Total: 0, NextKey: []byte(testDenom2)}, + Pagination: &query.PageResponse{NextKey: []byte(testDenom2)}, }, }, { From ab47caa1afbe4aacc1cd0f55d51fb9fc694cc13c Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 11:12:26 -0800 Subject: [PATCH 13/16] all accounts with denoms --- .../confidentialtransfers/confidential.proto | 5 + proto/confidentialtransfers/query.proto | 2 +- x/confidentialtransfers/keeper/grpc_query.go | 11 +- .../keeper/grpc_query_test.go | 15 +- .../types/confidential.pb.go | 272 ++++++++++++++++-- x/confidentialtransfers/types/query.pb.go | 71 ++--- 6 files changed, 309 insertions(+), 67 deletions(-) diff --git a/proto/confidentialtransfers/confidential.proto b/proto/confidentialtransfers/confidential.proto index 5a5484d3b1..5ad98453fc 100644 --- a/proto/confidentialtransfers/confidential.proto +++ b/proto/confidentialtransfers/confidential.proto @@ -15,4 +15,9 @@ message CtAccount { uint32 pending_balance_credit_counter = 4; Ciphertext available_balance = 5; // elgamal encoded balance string decryptable_available_balance = 6; // aes encoded balance +} + +message CtAccountWithDenom { + string denom = 1; + CtAccount account = 2 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/proto/confidentialtransfers/query.proto b/proto/confidentialtransfers/query.proto index 0ace6cdeeb..b85c01bc8e 100644 --- a/proto/confidentialtransfers/query.proto +++ b/proto/confidentialtransfers/query.proto @@ -43,7 +43,7 @@ message GetAllAccountsRequest { } message GetAllAccountsResponse { - repeated CtAccount accounts = 1 [(gogoproto.nullable) = false]; + repeated CtAccountWithDenom accounts = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index 2e7670d1f2..64d56cddac 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -59,14 +59,15 @@ func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccount sdkCtx := sdk.UnwrapSDKContext(ctx) store := k.getAccountStoreForAddress(sdkCtx, address) - accounts := make([]types.CtAccount, 0) - pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { - var result types.CtAccount - err = k.cdc.Unmarshal(value, &result) + accounts := make([]types.CtAccountWithDenom, 0) + pageRes, err := query.Paginate(store, req.Pagination, func(denom, value []byte) error { + + var ctAccount types.CtAccount + err = k.cdc.Unmarshal(value, &ctAccount) if err != nil { return err } - accounts = append(accounts, result) + accounts = append(accounts, types.CtAccountWithDenom{Denom: string(denom), Account: ctAccount}) return nil }) diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index b6c641510d..51f9e52032 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -126,7 +126,16 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { name: "accounts for address exist", req: &types.GetAllAccountsRequest{Address: addr.String()}, expResponse: &types.GetAllAccountsResponse{ - Accounts: []types.CtAccount{ctAccount1, ctAccount2}, + Accounts: []types.CtAccountWithDenom{ + { + Denom: testDenom1, + Account: ctAccount1, + }, + { + Denom: testDenom2, + Account: ctAccount2, + }, + }, Pagination: &query.PageResponse{Total: 2}, }, }, @@ -134,7 +143,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { name: "paginated request", req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{Limit: 1}}, expResponse: &types.GetAllAccountsResponse{ - Accounts: []types.CtAccount{ctAccount1}, + Accounts: []types.CtAccountWithDenom{{Denom: testDenom1, Account: ctAccount1}}, Pagination: &query.PageResponse{NextKey: []byte(testDenom2)}, }, }, @@ -145,7 +154,7 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { Key: []byte(testDenom2)}, }, expResponse: &types.GetAllAccountsResponse{ - Accounts: []types.CtAccount{ctAccount2}, + Accounts: []types.CtAccountWithDenom{{Denom: testDenom2, Account: ctAccount2}}, Pagination: &query.PageResponse{}, }, }, diff --git a/x/confidentialtransfers/types/confidential.pb.go b/x/confidentialtransfers/types/confidential.pb.go index 5d922afdb6..f0c6460d44 100644 --- a/x/confidentialtransfers/types/confidential.pb.go +++ b/x/confidentialtransfers/types/confidential.pb.go @@ -108,8 +108,61 @@ func (m *CtAccount) GetDecryptableAvailableBalance() string { return "" } +type CtAccountWithDenom struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Account CtAccount `protobuf:"bytes,2,opt,name=account,proto3" json:"account"` +} + +func (m *CtAccountWithDenom) Reset() { *m = CtAccountWithDenom{} } +func (m *CtAccountWithDenom) String() string { return proto.CompactTextString(m) } +func (*CtAccountWithDenom) ProtoMessage() {} +func (*CtAccountWithDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_493ee92716eb88d4, []int{1} +} +func (m *CtAccountWithDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CtAccountWithDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CtAccountWithDenom.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 *CtAccountWithDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_CtAccountWithDenom.Merge(m, src) +} +func (m *CtAccountWithDenom) XXX_Size() int { + return m.Size() +} +func (m *CtAccountWithDenom) XXX_DiscardUnknown() { + xxx_messageInfo_CtAccountWithDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_CtAccountWithDenom proto.InternalMessageInfo + +func (m *CtAccountWithDenom) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *CtAccountWithDenom) GetAccount() CtAccount { + if m != nil { + return m.Account + } + return CtAccount{} +} + func init() { proto.RegisterType((*CtAccount)(nil), "seiprotocol.seichain.confidentialtransfers.CtAccount") + proto.RegisterType((*CtAccountWithDenom)(nil), "seiprotocol.seichain.confidentialtransfers.CtAccountWithDenom") } func init() { @@ -117,29 +170,32 @@ func init() { } var fileDescriptor_493ee92716eb88d4 = []byte{ - // 349 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x4b, 0xeb, 0x40, - 0x14, 0x85, 0x3b, 0xaf, 0xef, 0x15, 0x3a, 0x4f, 0x41, 0x83, 0x8b, 0xd0, 0xd2, 0x10, 0x5c, 0x05, - 0xc1, 0x04, 0x14, 0xdc, 0x4a, 0x9b, 0x8d, 0xa0, 0xab, 0xec, 0x74, 0x13, 0x26, 0x93, 0xdb, 0xe4, - 0x62, 0x9c, 0x09, 0x93, 0xa9, 0x34, 0xff, 0xc2, 0x9f, 0xe5, 0xb2, 0x4b, 0x97, 0xd2, 0xfa, 0x43, - 0xc4, 0x49, 0x2b, 0xb5, 0x56, 0x10, 0x74, 0x77, 0xe7, 0x72, 0xce, 0xf9, 0x0e, 0x33, 0x43, 0x3d, - 0x2e, 0xc5, 0x18, 0x53, 0x10, 0x1a, 0x59, 0xa1, 0x15, 0x13, 0xd5, 0x18, 0x54, 0x15, 0xac, 0x6f, - 0xfd, 0x52, 0x49, 0x2d, 0xad, 0xa3, 0x0a, 0xd0, 0x4c, 0x5c, 0x16, 0x7e, 0x05, 0xc8, 0x73, 0x86, - 0xc2, 0xdf, 0x6a, 0xef, 0x1d, 0x64, 0x32, 0x93, 0x46, 0x1c, 0xbc, 0x4d, 0x4d, 0x42, 0xef, 0x2b, - 0x96, 0xaa, 0x4b, 0x2d, 0x33, 0xc5, 0xca, 0xbc, 0x6e, 0x94, 0x87, 0x2f, 0x6d, 0xda, 0x0d, 0xf5, - 0x90, 0x73, 0x39, 0x11, 0xda, 0x1a, 0x50, 0x5a, 0x4e, 0x92, 0x02, 0x79, 0x7c, 0x0b, 0xb5, 0x4d, - 0x5c, 0xe2, 0xed, 0x44, 0xdd, 0x66, 0x73, 0x09, 0xb5, 0x95, 0x52, 0xab, 0x04, 0x91, 0xa2, 0xc8, - 0xe2, 0x84, 0x15, 0x4c, 0x70, 0x88, 0x0b, 0x69, 0xff, 0x71, 0x89, 0xf7, 0xff, 0xe4, 0xcc, 0xff, - 0x7e, 0x6b, 0x3f, 0xc4, 0x32, 0x07, 0xa5, 0x61, 0xaa, 0xa3, 0xbd, 0x65, 0xe2, 0xa8, 0x09, 0xbc, - 0x92, 0xdb, 0x28, 0x39, 0xda, 0xed, 0xdf, 0xa4, 0x5c, 0xa0, 0x15, 0x52, 0x67, 0x93, 0xc2, 0x15, - 0xa4, 0xa8, 0x63, 0x73, 0x15, 0xa0, 0xec, 0xbf, 0x2e, 0xf1, 0x76, 0xa3, 0xfe, 0x47, 0x67, 0x68, - 0x34, 0x61, 0x23, 0xb1, 0x38, 0xdd, 0x67, 0xf7, 0x0c, 0x0b, 0x96, 0x14, 0xb0, 0x8a, 0xb1, 0xff, - 0xfd, 0xac, 0xe9, 0x7b, 0xe0, 0x92, 0x68, 0x8d, 0xe8, 0x20, 0x05, 0xf3, 0x74, 0x06, 0xf3, 0x19, - 0xd8, 0x71, 0x89, 0xd7, 0x8d, 0xfa, 0x6b, 0xa2, 0xe1, 0x46, 0xc6, 0xe8, 0xfa, 0x71, 0xee, 0x90, - 0xd9, 0xdc, 0x21, 0xcf, 0x73, 0x87, 0x3c, 0x2c, 0x9c, 0xd6, 0x6c, 0xe1, 0xb4, 0x9e, 0x16, 0x4e, - 0xeb, 0xe6, 0x3c, 0x43, 0x9d, 0x4f, 0x12, 0x9f, 0xcb, 0xbb, 0xa0, 0x02, 0x3c, 0x5e, 0x55, 0x36, - 0x07, 0xd3, 0x39, 0x98, 0x06, 0xdb, 0xbf, 0x93, 0xae, 0x4b, 0xa8, 0x92, 0x8e, 0x71, 0x9c, 0xbe, - 0x06, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x8d, 0x96, 0x8c, 0xe0, 0x02, 0x00, 0x00, + // 399 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x4f, 0xcb, 0xd3, 0x40, + 0x10, 0xc6, 0xb3, 0xbe, 0x7f, 0x24, 0xab, 0x82, 0x2e, 0x3d, 0x84, 0x96, 0xc6, 0xd0, 0x53, 0x10, + 0x4c, 0x40, 0xd1, 0xab, 0x34, 0xf1, 0x20, 0xe8, 0x29, 0x20, 0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, + 0xd8, 0x3d, 0xa5, 0x30, 0x05, 0x39, 0xd7, 0xa9, 0xf9, 0x15, 0xa0, 0x9c, 0x4b, 0x0f, 0xf9, 0xf7, + 0x92, 0xd1, 0xaf, 0x9b, 0xb1, 0xd1, 0xc4, 0x9d, 0x84, 0x30, 0xfc, 0x80, 0x7e, 0xa2, 0xbc, 0xa2, + 0x59, 0x05, 0xbd, 0x8d, 0x73, 0xf5, 0x7f, 0x97, 0x1e, 0x0c, 0xf7, 0x44, 0x12, 0xe1, 0x71, 0x0e, + 0x26, 0x3a, 0x83, 0xf9, 0x1d, 0x78, 0xed, 0x21, 0xdf, 0x4e, 0x46, 0x47, 0xa2, 0xe9, 0x89, 0xc7, + 0xe4, 0x33, 0xc2, 0xe4, 0x10, 0xf3, 0x3b, 0xae, 0xcb, 0x97, 0x20, 0xe4, 0x9c, 0x0c, 0xf0, 0x55, + 0xbe, 0x2b, 0x4c, 0xd4, 0x76, 0xd2, 0x35, 0xe4, 0x2d, 0xbe, 0x4d, 0x3b, 0xe5, 0x3e, 0xdb, 0x67, + 0xff, 0xf4, 0x2d, 0x3d, 0x26, 0xba, 0x5c, 0x7d, 0x7b, 0x68, 0x25, 0xbd, 0x57, 0xf4, 0x7e, 0xb5, + 0x71, 0xd1, 0x7a, 0xe3, 0xa2, 0xef, 0x1b, 0x17, 0x7d, 0xd9, 0xba, 0xd6, 0x7a, 0xeb, 0x5a, 0x5f, + 0xb7, 0xae, 0xf5, 0xe1, 0x45, 0xc1, 0x75, 0xb9, 0xc8, 0x02, 0x26, 0xe7, 0x61, 0x03, 0xfc, 0x71, + 0x8f, 0x32, 0x8d, 0x61, 0x85, 0xcb, 0xf0, 0xfc, 0x93, 0xd6, 0x6d, 0x0d, 0x4d, 0x76, 0x6d, 0x36, + 0x9e, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x44, 0xaf, 0xd1, 0x18, 0x64, 0x03, 0x00, 0x00, } func (m *CtAccount) Marshal() (dAtA []byte, err error) { @@ -220,6 +276,46 @@ func (m *CtAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CtAccountWithDenom) 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 *CtAccountWithDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CtAccountWithDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Account.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConfidential(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintConfidential(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintConfidential(dAtA []byte, offset int, v uint64) int { offset -= sovConfidential(v) base := offset @@ -263,6 +359,21 @@ func (m *CtAccount) Size() (n int) { return n } +func (m *CtAccountWithDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovConfidential(uint64(l)) + } + l = m.Account.Size() + n += 1 + l + sovConfidential(uint64(l)) + return n +} + func sovConfidential(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -512,6 +623,121 @@ func (m *CtAccount) Unmarshal(dAtA []byte) error { } return nil } +func (m *CtAccountWithDenom) 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 ErrIntOverflowConfidential + } + 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: CtAccountWithDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CtAccountWithDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfidential + } + 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 ErrInvalidLengthConfidential + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConfidential + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfidential + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConfidential + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConfidential + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Account.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConfidential(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConfidential + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipConfidential(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/confidentialtransfers/types/query.pb.go b/x/confidentialtransfers/types/query.pb.go index ae67f33540..5750bcc56e 100644 --- a/x/confidentialtransfers/types/query.pb.go +++ b/x/confidentialtransfers/types/query.pb.go @@ -166,7 +166,7 @@ func (m *GetAllAccountsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllAccountsRequest proto.InternalMessageInfo type GetAllAccountsResponse struct { - Accounts []CtAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + Accounts []CtAccountWithDenom `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -204,7 +204,7 @@ func (m *GetAllAccountsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllAccountsResponse proto.InternalMessageInfo -func (m *GetAllAccountsResponse) GetAccounts() []CtAccount { +func (m *GetAllAccountsResponse) GetAccounts() []CtAccountWithDenom { if m != nil { return m.Accounts } @@ -228,38 +228,39 @@ func init() { func init() { proto.RegisterFile("confidentialtransfers/query.proto", fileDescriptor_35280e71e5f6c1ab) } var fileDescriptor_35280e71e5f6c1ab = []byte{ - // 495 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0xc1, 0x6a, 0x14, 0x31, - 0x18, 0x9e, 0xb4, 0xd6, 0xd6, 0x14, 0x04, 0x43, 0x95, 0x65, 0x91, 0x59, 0x9d, 0x83, 0x96, 0x82, - 0x09, 0xbb, 0xc5, 0x43, 0x15, 0x95, 0xdd, 0x82, 0x3d, 0xaa, 0x7b, 0x11, 0xbd, 0x65, 0x67, 0xff, - 0x4e, 0x03, 0xb3, 0xc9, 0x74, 0x92, 0x15,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x56, - 0xbd, 0x73, 0x1e, 0x0a, 0x6f, 0x6e, 0xcd, 0x9a, 0x5b, 0x25, 0xcd, 0xa9, 0xcd, 0x75, 0x5e, 0x1c, - 0x8c, 0x42, 0x74, 0x38, 0x0a, 0xd1, 0x8f, 0x51, 0x88, 0xde, 0x8f, 0xc3, 0xe0, 0x70, 0x1c, 0x06, - 0xdf, 0xc6, 0x61, 0xf0, 0xf2, 0x51, 0x22, 0xcc, 0xd6, 0xb0, 0x47, 0x63, 0x35, 0x28, 0x68, 0xef, - 0x4c, 0x34, 0xda, 0x8b, 0x6b, 0xf2, 0xfa, 0x1f, 0x6d, 0xcc, 0x4e, 0x06, 0xba, 0x77, 0xd1, 0x22, - 0x56, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xce, 0x4d, 0x31, 0xdb, 0x04, 0x00, 0x00, + // 505 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x31, 0x6f, 0x13, 0x31, + 0x14, 0x3e, 0xb7, 0x94, 0x16, 0x47, 0x42, 0xc2, 0x2a, 0x28, 0x8a, 0xd0, 0x05, 0x6e, 0x80, 0xa8, + 0x12, 0xb6, 0x92, 0x8a, 0xa1, 0x20, 0x8a, 0x92, 0x22, 0x3a, 0x02, 0x59, 0x10, 0x4c, 0x38, 0x97, + 0xd7, 0x8b, 0xa5, 0x8b, 0x7d, 0x3d, 0x3b, 0x88, 0xaa, 0xea, 0x02, 0x0b, 0x23, 0x12, 0x7f, 0xa0, + 0x7f, 0x80, 0x5f, 0xc1, 0xd2, 0x09, 0x55, 0xb0, 0x30, 0x21, 0x94, 0x30, 0xf0, 0x33, 0xd0, 0xd9, + 0x4e, 0x1b, 0x68, 0x50, 0x49, 0xd9, 0xec, 0x67, 0x7f, 0xdf, 0xfb, 0xbe, 0xef, 0x3d, 0x7c, 0x3d, + 0x56, 0x72, 0x4b, 0x74, 0x41, 0x1a, 0xc1, 0x53, 0x93, 0x73, 0xa9, 0xb7, 0x20, 0xd7, 0x6c, 0x7b, + 0x00, 0xf9, 0x0e, 0xcd, 0x72, 0x65, 0x14, 0x59, 0xd1, 0x20, 0xec, 0x29, 0x56, 0x29, 0xd5, 0x20, + 0xe2, 0x1e, 0x17, 0x92, 0x4e, 0xc5, 0x55, 0x56, 0x62, 0xa5, 0xfb, 0x4a, 0xb3, 0x0e, 0xd7, 0xe0, + 0x48, 0xd8, 0xcb, 0x7a, 0x07, 0x0c, 0xaf, 0xb3, 0x8c, 0x27, 0x42, 0x72, 0x23, 0x94, 0x74, 0xbc, + 0x95, 0xe5, 0x44, 0x25, 0xca, 0x1e, 0x59, 0x71, 0xf2, 0xd5, 0xab, 0x89, 0x52, 0x49, 0x0a, 0x8c, + 0x67, 0x82, 0x71, 0x29, 0x95, 0xb1, 0x10, 0xed, 0x5f, 0x6b, 0xd3, 0xe5, 0x4e, 0x56, 0xdd, 0xcf, + 0x68, 0x03, 0x5f, 0xda, 0x04, 0xd3, 0x8c, 0x63, 0x35, 0x90, 0xa6, 0x0d, 0xdb, 0x03, 0xd0, 0x86, + 0x94, 0xf1, 0x22, 0xef, 0x76, 0x73, 0xd0, 0xba, 0x8c, 0xae, 0xa1, 0xda, 0x85, 0xf6, 0xf8, 0x4a, + 0x96, 0xf1, 0x42, 0x17, 0xa4, 0xea, 0x97, 0xe7, 0x6c, 0xdd, 0x5d, 0x22, 0xc0, 0x64, 0x92, 0x44, + 0x67, 0x4a, 0x6a, 0x20, 0x8f, 0xf0, 0x22, 0x77, 0x25, 0xcb, 0x52, 0x6a, 0xdc, 0xa6, 0xff, 0x1e, + 0x11, 0xdd, 0x38, 0xe2, 0x1b, 0xb3, 0x44, 0x6f, 0x10, 0xbe, 0x5c, 0xf4, 0x49, 0x53, 0xff, 0xa4, + 0x4f, 0x17, 0xfc, 0x10, 0xe3, 0xe3, 0x44, 0xad, 0xea, 0x52, 0xe3, 0x06, 0x75,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1b, 0x74, 0x68, 0xac, 0xfa, 0x05, 0xed, 0xad, 0xb1, 0x46, 0x7b, 0x71, 0x4d, 0x5e, + 0xfd, 0xa5, 0x8d, 0xd9, 0xc9, 0x40, 0x77, 0xce, 0x5b, 0xc4, 0xea, 0xaf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xb6, 0x9a, 0x7f, 0xc3, 0xe4, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1000,7 +1001,7 @@ func (m *GetAllAccountsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Accounts = append(m.Accounts, CtAccount{}) + m.Accounts = append(m.Accounts, CtAccountWithDenom{}) if err := m.Accounts[len(m.Accounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 7e5d66ef0f82388a2eb090fd0579cfbd259b2880 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 11:19:20 -0800 Subject: [PATCH 14/16] clean up commented code --- x/confidentialtransfers/keeper/keeper_test.go | 6 ------ x/confidentialtransfers/module.go | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/x/confidentialtransfers/keeper/keeper_test.go b/x/confidentialtransfers/keeper/keeper_test.go index a2a24ee4b7..b2ffece545 100644 --- a/x/confidentialtransfers/keeper/keeper_test.go +++ b/x/confidentialtransfers/keeper/keeper_test.go @@ -25,12 +25,6 @@ func (suite *KeeperTestSuite) SetupTest() { suite.Setup() suite.queryClient = types.NewQueryClient(suite.QueryHelper) - //// TODO: remove this once the app initializes confidentialtransfers keeper - //suite.App.ConfidentialTransfersKeeper = keeper.NewKeeper( - // suite.App.AppCodec(), - // suite.App.GetKey(types.StoreKey), - // suite.App.GetSubspace(types.ModuleName), - // suite.App.AccountKeeper) suite.msgServer = keeper.NewMsgServerImpl(suite.App.ConfidentialTransfersKeeper) } diff --git a/x/confidentialtransfers/module.go b/x/confidentialtransfers/module.go index 033952c9f5..537479607f 100644 --- a/x/confidentialtransfers/module.go +++ b/x/confidentialtransfers/module.go @@ -92,9 +92,7 @@ func (am AppModuleBasic) ValidateGenesisStream(cdc codec.JSONCodec, config clien // TODO: Look into whether we require REST endpoints // RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, _ *mux.Router) { - //rest.RegisterHandlers(clientCtx, rtr) -} +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // TODO: Look into whether we require gRPC Gateway support // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. From 0901dc545e91a9aac23cd62bd75e1b34b717658f Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 13:31:43 -0800 Subject: [PATCH 15/16] return GetAccount back to keeper --- proto/confidentialtransfers/query.proto | 12 +- x/confidentialtransfers/keeper/grpc_query.go | 8 +- .../keeper/grpc_query_test.go | 48 +-- x/confidentialtransfers/keeper/keeper.go | 21 +- x/confidentialtransfers/types/query.pb.go | 308 +++++++++--------- x/confidentialtransfers/types/query.pb.gw.go | 62 ++-- 6 files changed, 234 insertions(+), 225 deletions(-) diff --git a/proto/confidentialtransfers/query.proto b/proto/confidentialtransfers/query.proto index b85c01bc8e..bc78f3e47f 100644 --- a/proto/confidentialtransfers/query.proto +++ b/proto/confidentialtransfers/query.proto @@ -10,29 +10,29 @@ option go_package = "github.com/sei-protocol/sei-chain/x/confidentialtransfers/t // Query defines the gRPC querier service. service Query { - rpc GetAccount (GetAccountRequest) returns (GetAccountResponse) { + rpc GetCtAccount (GetCtAccountRequest) returns (GetCtAccountResponse) { option (google.api.http) = { get: "/seichain/confidentialtransfers/account/{address}/{denom}" }; } - rpc GetAllAccounts (GetAllAccountsRequest) returns (GetAllAccountsResponse) { + rpc GetAllCtAccounts (GetAllCtAccountsRequest) returns (GetAllCtAccountsResponse) { option (google.api.http) = { get: "/seichain/confidentialtransfers/account/{address}" }; } } -message GetAccountRequest { +message GetCtAccountRequest { string address = 1; string denom = 2; } -message GetAccountResponse { +message GetCtAccountResponse { CtAccount account = 1; } -message GetAllAccountsRequest { +message GetAllCtAccountsRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -42,7 +42,7 @@ message GetAllAccountsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -message GetAllAccountsResponse { +message GetAllCtAccountsResponse { repeated CtAccountWithDenom accounts = 1 [(gogoproto.nullable) = false]; // pagination defines the pagination in the response. diff --git a/x/confidentialtransfers/keeper/grpc_query.go b/x/confidentialtransfers/keeper/grpc_query.go index 64d56cddac..7f2893bddf 100644 --- a/x/confidentialtransfers/keeper/grpc_query.go +++ b/x/confidentialtransfers/keeper/grpc_query.go @@ -13,7 +13,7 @@ import ( var _ types.QueryServer = BaseKeeper{} -func (k BaseKeeper) GetAccount(ctx context.Context, req *types.GetAccountRequest) (*types.GetAccountResponse, error) { +func (k BaseKeeper) GetCtAccount(ctx context.Context, req *types.GetCtAccountRequest) (*types.GetCtAccountResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -39,10 +39,10 @@ func (k BaseKeeper) GetAccount(ctx context.Context, req *types.GetAccountRequest req.Address, req.Denom) } - return &types.GetAccountResponse{Account: &ctAccount}, nil + return &types.GetCtAccountResponse{Account: &ctAccount}, nil } -func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccountsRequest) (*types.GetAllAccountsResponse, error) { +func (k BaseKeeper) GetAllCtAccounts(ctx context.Context, req *types.GetAllCtAccountsRequest) (*types.GetAllCtAccountsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -75,6 +75,6 @@ func (k BaseKeeper) GetAllAccounts(ctx context.Context, req *types.GetAllAccount return nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err) } - return &types.GetAllAccountsResponse{Accounts: accounts, Pagination: pageRes}, nil + return &types.GetAllCtAccountsResponse{Accounts: accounts, Pagination: pageRes}, nil } diff --git a/x/confidentialtransfers/keeper/grpc_query_test.go b/x/confidentialtransfers/keeper/grpc_query_test.go index 51f9e52032..849a9066c5 100644 --- a/x/confidentialtransfers/keeper/grpc_query_test.go +++ b/x/confidentialtransfers/keeper/grpc_query_test.go @@ -20,46 +20,46 @@ func (suite *KeeperTestSuite) TestAccountQuery() { testCases := []struct { name string - req *types.GetAccountRequest + req *types.GetCtAccountRequest expFail bool expErrorMessage string }{ { name: "empty request", - req: &types.GetAccountRequest{}, + req: &types.GetCtAccountRequest{}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = address cannot be empty", }, { name: "empty denom", - req: &types.GetAccountRequest{Address: addr.String()}, + req: &types.GetCtAccountRequest{Address: addr.String()}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = invalid denom", }, { name: "invalid address", - req: &types.GetAccountRequest{Address: "INVALID"}, + req: &types.GetCtAccountRequest{Address: "INVALID"}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = invalid address: decoding bech32 failed: " + "invalid bech32 string length 7", }, { name: "account for address does not exist", - req: &types.GetAccountRequest{Address: nonExistingAddr.String(), Denom: testDenom}, + req: &types.GetCtAccountRequest{Address: nonExistingAddr.String(), Denom: testDenom}, expFail: true, expErrorMessage: fmt.Sprintf("rpc error: code = NotFound desc = account not found for account %s "+ "and denom %s", nonExistingAddr, testDenom), }, { name: "account for the denom does not exist", - req: &types.GetAccountRequest{Address: addr.String(), Denom: nonExistingDenom}, + req: &types.GetCtAccountRequest{Address: addr.String(), Denom: nonExistingDenom}, expFail: true, expErrorMessage: fmt.Sprintf("rpc error: code = NotFound desc = account not found for account %s "+ "and denom %s", addr.String(), nonExistingDenom), }, { name: "existing account for address and denom", - req: &types.GetAccountRequest{Address: addr.String(), Denom: testDenom}, + req: &types.GetCtAccountRequest{Address: addr.String(), Denom: testDenom}, }, } @@ -68,9 +68,9 @@ func (suite *KeeperTestSuite) TestAccountQuery() { suite.SetupTest() // reset app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient - app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom, *account) + _ = app.ConfidentialTransfersKeeper.SetAccount(ctx, addr.String(), testDenom, *account) - result, err := queryClient.GetAccount(ctx.Context(), tc.req) + result, err := queryClient.GetCtAccount(ctx.Context(), tc.req) if tc.expFail { suite.Require().Error(err) @@ -99,33 +99,33 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { testCases := []struct { name string - req *types.GetAllAccountsRequest - expResponse *types.GetAllAccountsResponse + req *types.GetAllCtAccountsRequest + expResponse *types.GetAllCtAccountsResponse expFail bool expErrorMessage string }{ { name: "empty request", - req: &types.GetAllAccountsRequest{}, + req: &types.GetAllCtAccountsRequest{}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = address cannot be empty", }, { name: "invalid address", - req: &types.GetAllAccountsRequest{Address: "INVALID"}, + req: &types.GetAllCtAccountsRequest{Address: "INVALID"}, expFail: true, expErrorMessage: "rpc error: code = InvalidArgument desc = invalid address: decoding bech32 failed: " + "invalid bech32 string length 7", }, { name: "account for address does not exist", - req: &types.GetAllAccountsRequest{Address: nonExistingAddr.String()}, - expResponse: &types.GetAllAccountsResponse{Pagination: &query.PageResponse{}}, + req: &types.GetAllCtAccountsRequest{Address: nonExistingAddr.String()}, + expResponse: &types.GetAllCtAccountsResponse{Pagination: &query.PageResponse{}}, }, { name: "accounts for address exist", - req: &types.GetAllAccountsRequest{Address: addr.String()}, - expResponse: &types.GetAllAccountsResponse{ + req: &types.GetAllCtAccountsRequest{Address: addr.String()}, + expResponse: &types.GetAllCtAccountsResponse{ Accounts: []types.CtAccountWithDenom{ { Denom: testDenom1, @@ -141,19 +141,19 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { }, { name: "paginated request", - req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{Limit: 1}}, - expResponse: &types.GetAllAccountsResponse{ + req: &types.GetAllCtAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{Limit: 1}}, + expResponse: &types.GetAllCtAccountsResponse{ Accounts: []types.CtAccountWithDenom{{Denom: testDenom1, Account: ctAccount1}}, Pagination: &query.PageResponse{NextKey: []byte(testDenom2)}, }, }, { name: "paginated request - second page", - req: &types.GetAllAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{ + req: &types.GetAllCtAccountsRequest{Address: addr.String(), Pagination: &query.PageRequest{ Limit: 1, Key: []byte(testDenom2)}, }, - expResponse: &types.GetAllAccountsResponse{ + expResponse: &types.GetAllCtAccountsResponse{ Accounts: []types.CtAccountWithDenom{{Denom: testDenom2, Account: ctAccount2}}, Pagination: &query.PageResponse{}, }, @@ -165,10 +165,10 @@ func (suite *KeeperTestSuite) TestAllAccountsQuery() { suite.SetupTest() // reset app, ctx, queryClient := suite.App, suite.Ctx, suite.queryClient - app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom1, *account1) - app.ConfidentialTransfersKeeper.SetAccount(ctx, addr, testDenom2, *account2) + _ = app.ConfidentialTransfersKeeper.SetAccount(ctx, addr.String(), testDenom1, *account1) + _ = app.ConfidentialTransfersKeeper.SetAccount(ctx, addr.String(), testDenom2, *account2) - result, err := queryClient.GetAllAccounts(ctx.Context(), tc.req) + result, err := queryClient.GetAllCtAccounts(ctx.Context(), tc.req) if tc.expFail { suite.Require().Error(err) diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 5926020dbc..5559560b9d 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types" @@ -21,7 +20,8 @@ type Keeper interface { InitGenesis(sdk.Context, *types.GenesisState) ExportGenesis(sdk.Context) *types.GenesisState - SetAccount(ctx sdk.Context, address sdk.AccAddress, denom string, account types.Account) + GetAccount(ctx sdk.Context, addrString string, denom string) (types.Account, bool) + SetAccount(ctx sdk.Context, addrString string, denom string, account types.Account) error GetParams(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) @@ -60,8 +60,12 @@ func NewKeeper( } } -func (k BaseKeeper) getAccount(ctx sdk.Context, address sdk.AccAddress, denom string) (types.Account, bool) { - ctAccount, found := k.getCtAccount(ctx, address, denom) +func (k BaseKeeper) GetAccount(ctx sdk.Context, address string, denom string) (types.Account, bool) { + addr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return types.Account{}, false + } + ctAccount, found := k.getCtAccount(ctx, addr, denom) if !found { return types.Account{}, false } @@ -85,11 +89,16 @@ func (k BaseKeeper) getCtAccount(ctx sdk.Context, address sdk.AccAddress, denom return ctAccount, true } -func (k BaseKeeper) SetAccount(ctx sdk.Context, address sdk.AccAddress, denom string, account types.Account) { - store := k.getAccountStoreForAddress(ctx, address) +func (k BaseKeeper) SetAccount(ctx sdk.Context, address string, denom string, account types.Account) error { + addr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return err + } + store := k.getAccountStoreForAddress(ctx, addr) ctAccount := types.NewCtAccount(&account) bz := k.cdc.MustMarshal(ctAccount) // Marshal the Account object into bytes store.Set([]byte(denom), bz) // Store the serialized account under denom name as key + return nil } // Logger returns a logger for the x/confidentialtransfers module diff --git a/x/confidentialtransfers/types/query.pb.go b/x/confidentialtransfers/types/query.pb.go index 5750bcc56e..d016bbfe69 100644 --- a/x/confidentialtransfers/types/query.pb.go +++ b/x/confidentialtransfers/types/query.pb.go @@ -30,23 +30,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type GetAccountRequest struct { +type GetCtAccountRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *GetAccountRequest) Reset() { *m = GetAccountRequest{} } -func (m *GetAccountRequest) String() string { return proto.CompactTextString(m) } -func (*GetAccountRequest) ProtoMessage() {} -func (*GetAccountRequest) Descriptor() ([]byte, []int) { +func (m *GetCtAccountRequest) Reset() { *m = GetCtAccountRequest{} } +func (m *GetCtAccountRequest) String() string { return proto.CompactTextString(m) } +func (*GetCtAccountRequest) ProtoMessage() {} +func (*GetCtAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{0} } -func (m *GetAccountRequest) XXX_Unmarshal(b []byte) error { +func (m *GetCtAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetCtAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAccountRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_GetCtAccountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -56,48 +56,48 @@ func (m *GetAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *GetAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountRequest.Merge(m, src) +func (m *GetCtAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCtAccountRequest.Merge(m, src) } -func (m *GetAccountRequest) XXX_Size() int { +func (m *GetCtAccountRequest) XXX_Size() int { return m.Size() } -func (m *GetAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountRequest.DiscardUnknown(m) +func (m *GetCtAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCtAccountRequest.DiscardUnknown(m) } -var xxx_messageInfo_GetAccountRequest proto.InternalMessageInfo +var xxx_messageInfo_GetCtAccountRequest proto.InternalMessageInfo -func (m *GetAccountRequest) GetAddress() string { +func (m *GetCtAccountRequest) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *GetAccountRequest) GetDenom() string { +func (m *GetCtAccountRequest) GetDenom() string { if m != nil { return m.Denom } return "" } -type GetAccountResponse struct { +type GetCtAccountResponse struct { Account *CtAccount `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` } -func (m *GetAccountResponse) Reset() { *m = GetAccountResponse{} } -func (m *GetAccountResponse) String() string { return proto.CompactTextString(m) } -func (*GetAccountResponse) ProtoMessage() {} -func (*GetAccountResponse) Descriptor() ([]byte, []int) { +func (m *GetCtAccountResponse) Reset() { *m = GetCtAccountResponse{} } +func (m *GetCtAccountResponse) String() string { return proto.CompactTextString(m) } +func (*GetCtAccountResponse) ProtoMessage() {} +func (*GetCtAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{1} } -func (m *GetAccountResponse) XXX_Unmarshal(b []byte) error { +func (m *GetCtAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetCtAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAccountResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_GetCtAccountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -107,43 +107,43 @@ func (m *GetAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *GetAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAccountResponse.Merge(m, src) +func (m *GetCtAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCtAccountResponse.Merge(m, src) } -func (m *GetAccountResponse) XXX_Size() int { +func (m *GetCtAccountResponse) XXX_Size() int { return m.Size() } -func (m *GetAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAccountResponse.DiscardUnknown(m) +func (m *GetCtAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetCtAccountResponse.DiscardUnknown(m) } -var xxx_messageInfo_GetAccountResponse proto.InternalMessageInfo +var xxx_messageInfo_GetCtAccountResponse proto.InternalMessageInfo -func (m *GetAccountResponse) GetAccount() *CtAccount { +func (m *GetCtAccountResponse) GetAccount() *CtAccount { if m != nil { return m.Account } return nil } -type GetAllAccountsRequest struct { +type GetAllCtAccountsRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *GetAllAccountsRequest) Reset() { *m = GetAllAccountsRequest{} } -func (m *GetAllAccountsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllAccountsRequest) ProtoMessage() {} -func (*GetAllAccountsRequest) Descriptor() ([]byte, []int) { +func (m *GetAllCtAccountsRequest) Reset() { *m = GetAllCtAccountsRequest{} } +func (m *GetAllCtAccountsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllCtAccountsRequest) ProtoMessage() {} +func (*GetAllCtAccountsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{2} } -func (m *GetAllAccountsRequest) XXX_Unmarshal(b []byte) error { +func (m *GetAllCtAccountsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAllAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetAllCtAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAllAccountsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_GetAllCtAccountsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -153,36 +153,36 @@ func (m *GetAllAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *GetAllAccountsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllAccountsRequest.Merge(m, src) +func (m *GetAllCtAccountsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllCtAccountsRequest.Merge(m, src) } -func (m *GetAllAccountsRequest) XXX_Size() int { +func (m *GetAllCtAccountsRequest) XXX_Size() int { return m.Size() } -func (m *GetAllAccountsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllAccountsRequest.DiscardUnknown(m) +func (m *GetAllCtAccountsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllCtAccountsRequest.DiscardUnknown(m) } -var xxx_messageInfo_GetAllAccountsRequest proto.InternalMessageInfo +var xxx_messageInfo_GetAllCtAccountsRequest proto.InternalMessageInfo -type GetAllAccountsResponse struct { +type GetAllCtAccountsResponse struct { Accounts []CtAccountWithDenom `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *GetAllAccountsResponse) Reset() { *m = GetAllAccountsResponse{} } -func (m *GetAllAccountsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllAccountsResponse) ProtoMessage() {} -func (*GetAllAccountsResponse) Descriptor() ([]byte, []int) { +func (m *GetAllCtAccountsResponse) Reset() { *m = GetAllCtAccountsResponse{} } +func (m *GetAllCtAccountsResponse) String() string { return proto.CompactTextString(m) } +func (*GetAllCtAccountsResponse) ProtoMessage() {} +func (*GetAllCtAccountsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_35280e71e5f6c1ab, []int{3} } -func (m *GetAllAccountsResponse) XXX_Unmarshal(b []byte) error { +func (m *GetAllCtAccountsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetAllAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *GetAllCtAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetAllAccountsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_GetAllCtAccountsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -192,26 +192,26 @@ func (m *GetAllAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *GetAllAccountsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllAccountsResponse.Merge(m, src) +func (m *GetAllCtAccountsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllCtAccountsResponse.Merge(m, src) } -func (m *GetAllAccountsResponse) XXX_Size() int { +func (m *GetAllCtAccountsResponse) XXX_Size() int { return m.Size() } -func (m *GetAllAccountsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllAccountsResponse.DiscardUnknown(m) +func (m *GetAllCtAccountsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllCtAccountsResponse.DiscardUnknown(m) } -var xxx_messageInfo_GetAllAccountsResponse proto.InternalMessageInfo +var xxx_messageInfo_GetAllCtAccountsResponse proto.InternalMessageInfo -func (m *GetAllAccountsResponse) GetAccounts() []CtAccountWithDenom { +func (m *GetAllCtAccountsResponse) GetAccounts() []CtAccountWithDenom { if m != nil { return m.Accounts } return nil } -func (m *GetAllAccountsResponse) GetPagination() *query.PageResponse { +func (m *GetAllCtAccountsResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -219,48 +219,48 @@ func (m *GetAllAccountsResponse) GetPagination() *query.PageResponse { } func init() { - proto.RegisterType((*GetAccountRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountRequest") - proto.RegisterType((*GetAccountResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAccountResponse") - proto.RegisterType((*GetAllAccountsRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllAccountsRequest") - proto.RegisterType((*GetAllAccountsResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllAccountsResponse") + proto.RegisterType((*GetCtAccountRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetCtAccountRequest") + proto.RegisterType((*GetCtAccountResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetCtAccountResponse") + proto.RegisterType((*GetAllCtAccountsRequest)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllCtAccountsRequest") + proto.RegisterType((*GetAllCtAccountsResponse)(nil), "seiprotocol.seichain.confidentialtransfers.GetAllCtAccountsResponse") } func init() { proto.RegisterFile("confidentialtransfers/query.proto", fileDescriptor_35280e71e5f6c1ab) } var fileDescriptor_35280e71e5f6c1ab = []byte{ - // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x31, 0x6f, 0x13, 0x31, - 0x14, 0x3e, 0xb7, 0x94, 0x16, 0x47, 0x42, 0xc2, 0x2a, 0x28, 0x8a, 0xd0, 0x05, 0x6e, 0x80, 0xa8, - 0x12, 0xb6, 0x92, 0x8a, 0xa1, 0x20, 0x8a, 0x92, 0x22, 0x3a, 0x02, 0x59, 0x10, 0x4c, 0x38, 0x97, - 0xd7, 0x8b, 0xa5, 0x8b, 0x7d, 0x3d, 0x3b, 0x88, 0xaa, 0xea, 0x02, 0x0b, 0x23, 0x12, 0x7f, 0xa0, - 0x7f, 0x80, 0x5f, 0xc1, 0xd2, 0x09, 0x55, 0xb0, 0x30, 0x21, 0x94, 0x30, 0xf0, 0x33, 0xd0, 0xd9, - 0x4e, 0x1b, 0x68, 0x50, 0x49, 0xd9, 0xec, 0x67, 0x7f, 0xdf, 0xfb, 0xbe, 0xef, 0x3d, 0x7c, 0x3d, - 0x56, 0x72, 0x4b, 0x74, 0x41, 0x1a, 0xc1, 0x53, 0x93, 0x73, 0xa9, 0xb7, 0x20, 0xd7, 0x6c, 0x7b, - 0x00, 0xf9, 0x0e, 0xcd, 0x72, 0x65, 0x14, 0x59, 0xd1, 0x20, 0xec, 0x29, 0x56, 0x29, 0xd5, 0x20, - 0x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, 0xff, - 0xff, 0xb6, 0x9a, 0x7f, 0xc3, 0xe4, 0x04, 0x00, 0x00, + // 508 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xde, 0x6d, 0xad, 0xad, 0x13, 0x0f, 0x32, 0x06, 0x0c, 0x41, 0x36, 0xba, 0x07, 0x0d, 0x05, + 0x67, 0x48, 0x8a, 0x87, 0x2a, 0x58, 0xd3, 0x56, 0x73, 0x54, 0x73, 0x11, 0x3d, 0x39, 0xd9, 0xbc, + 0x6e, 0x06, 0x36, 0x33, 0xdb, 0x9d, 0x89, 0x58, 0x4a, 0x2f, 0x82, 0xe0, 0x51, 0xf0, 0x0f, 0xf4, + 0x6f, 0xf8, 0x03, 0x84, 0x1e, 0x0b, 0x7a, 0xe8, 0x49, 0x24, 0xf1, 0xe0, 0xcf, 0x90, 0x9d, 0x99, + 0xb4, 0x51, 0x57, 0x6a, 0xda, 0xdb, 0xbc, 0x37, 0xf3, 0x7d, 0xf3, 0x7d, 0xef, 0x7b, 0xe8, 0x66, + 0x24, 0xc5, 0x16, 0xef, 0x81, 0xd0, 0x9c, 0x25, 0x3a, 0x63, 0x42, 0x6d, 0x41, 0xa6, 0xe8, 0xf6, + 0x10, 0xb2, 0x1d, 0x92, 0x66, 0x52, 0x4b, 0xbc, 0xac, 0x80, 0x9b, 0x53, 0x24, 0x13, 0xa2, 0x80, + 0x47, 0x7d, 0xc6, 0x05, 0x29, 0xc4, 0x55, 0x97, 0x23, 0xa9, 0x06, 0x52, 0xd1, 0x2e, 0x53, 0x60, + 0x49, 0xe8, 0xeb, 0x46, 0x17, 0x34, 0x6b, 0xd0, 0x94, 0xc5, 0x5c, 0x30, 0xcd, 0xa5, 0xb0, 0xbc, + 0xd5, 0x72, 0x2c, 0x63, 0x69, 0x8e, 0x34, 0x3f, 0xb9, 0xee, 0xf5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, 0x0c, 0xdd, 0x3e, 0xd5, 0x90, 0x95, 0x37, 0xed, 0xa8, 0xf9, 0x69, 0x1e, 0x2d, 0x3c, 0xcb, + 0x9f, 0xe2, 0xaf, 0x3e, 0xba, 0x3c, 0x9d, 0x21, 0x5e, 0x9b, 0x45, 0x73, 0xc1, 0x12, 0x55, 0x1f, + 0x9e, 0x9d, 0xc0, 0x2a, 0x0d, 0x5b, 0x6f, 0xbf, 0xfc, 0xf8, 0x38, 0x77, 0x1f, 0xaf, 0xd2, 0x09, + 0x9a, 0x16, 0x6f, 0xb6, 0x1b, 0x0c, 0xdd, 0x75, 0x89, 0xef, 0xd1, 0x5d, 0xb3, 0x98, 0x7b, 0xf8, + 0xc8, 0x47, 0x57, 0xfe, 0x0c, 0x0a, 0x6f, 0xcc, 0xa8, 0xac, 0x68, 0xdd, 0xaa, 0x9b, 0xe7, 0x23, + 0x71, 0x16, 0x57, 0x8d, 0xc5, 0x15, 0xdc, 0x98, 0xd9, 0xe2, 0xfa, 0x8b, 0x83, 0x51, 0xe0, 0x1f, + 0x8e, 0x02, 0xff, 0xfb, 0x28, 0xf0, 0x3f, 0x8c, 0x03, 0xef, 0x70, 0x1c, 0x78, 0x47, 0xe3, 0xc0, + 0x7b, 0xb9, 0x16, 0x73, 0xdd, 0x1f, 0x76, 0x49, 0x24, 0x07, 0x39, 0xed, 0x9d, 0x89, 0x4a, 0x53, + 0xd8, 0x4f, 0xde, 0xfc, 0xe3, 0x1b, 0xbd, 0x93, 0x82, 0xea, 0x5e, 0x34, 0x88, 0x95, 0x5f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xd0, 0xd2, 0xd2, 0xaa, 0xf8, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -275,8 +275,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 { - GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) - GetAllAccounts(ctx context.Context, in *GetAllAccountsRequest, opts ...grpc.CallOption) (*GetAllAccountsResponse, error) + GetCtAccount(ctx context.Context, in *GetCtAccountRequest, opts ...grpc.CallOption) (*GetCtAccountResponse, error) + GetAllCtAccounts(ctx context.Context, in *GetAllCtAccountsRequest, opts ...grpc.CallOption) (*GetAllCtAccountsResponse, error) } type queryClient struct { @@ -287,18 +287,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) GetAccount(ctx context.Context, in *GetAccountRequest, opts ...grpc.CallOption) (*GetAccountResponse, error) { - out := new(GetAccountResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetAccount", in, out, opts...) +func (c *queryClient) GetCtAccount(ctx context.Context, in *GetCtAccountRequest, opts ...grpc.CallOption) (*GetCtAccountResponse, error) { + out := new(GetCtAccountResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetCtAccount", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) GetAllAccounts(ctx context.Context, in *GetAllAccountsRequest, opts ...grpc.CallOption) (*GetAllAccountsResponse, error) { - out := new(GetAllAccountsResponse) - err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetAllAccounts", in, out, opts...) +func (c *queryClient) GetAllCtAccounts(ctx context.Context, in *GetAllCtAccountsRequest, opts ...grpc.CallOption) (*GetAllCtAccountsResponse, error) { + out := new(GetAllCtAccountsResponse) + err := c.cc.Invoke(ctx, "/seiprotocol.seichain.confidentialtransfers.Query/GetAllCtAccounts", in, out, opts...) if err != nil { return nil, err } @@ -307,57 +307,57 @@ func (c *queryClient) GetAllAccounts(ctx context.Context, in *GetAllAccountsRequ // QueryServer is the server API for Query service. type QueryServer interface { - GetAccount(context.Context, *GetAccountRequest) (*GetAccountResponse, error) - GetAllAccounts(context.Context, *GetAllAccountsRequest) (*GetAllAccountsResponse, error) + GetCtAccount(context.Context, *GetCtAccountRequest) (*GetCtAccountResponse, error) + GetAllCtAccounts(context.Context, *GetAllCtAccountsRequest) (*GetAllCtAccountsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) GetAccount(ctx context.Context, req *GetAccountRequest) (*GetAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented") +func (*UnimplementedQueryServer) GetCtAccount(ctx context.Context, req *GetCtAccountRequest) (*GetCtAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCtAccount not implemented") } -func (*UnimplementedQueryServer) GetAllAccounts(ctx context.Context, req *GetAllAccountsRequest) (*GetAllAccountsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllAccounts not implemented") +func (*UnimplementedQueryServer) GetAllCtAccounts(ctx context.Context, req *GetAllCtAccountsRequest) (*GetAllCtAccountsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllCtAccounts not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAccountRequest) +func _Query_GetCtAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCtAccountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetAccount(ctx, in) + return srv.(QueryServer).GetCtAccount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetAccount", + FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetCtAccount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAccount(ctx, req.(*GetAccountRequest)) + return srv.(QueryServer).GetCtAccount(ctx, req.(*GetCtAccountRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_GetAllAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllAccountsRequest) +func _Query_GetAllCtAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllCtAccountsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetAllAccounts(ctx, in) + return srv.(QueryServer).GetAllCtAccounts(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetAllAccounts", + FullMethod: "/seiprotocol.seichain.confidentialtransfers.Query/GetAllCtAccounts", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllAccounts(ctx, req.(*GetAllAccountsRequest)) + return srv.(QueryServer).GetAllCtAccounts(ctx, req.(*GetAllCtAccountsRequest)) } return interceptor(ctx, in, info, handler) } @@ -367,19 +367,19 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "GetAccount", - Handler: _Query_GetAccount_Handler, + MethodName: "GetCtAccount", + Handler: _Query_GetCtAccount_Handler, }, { - MethodName: "GetAllAccounts", - Handler: _Query_GetAllAccounts_Handler, + MethodName: "GetAllCtAccounts", + Handler: _Query_GetAllCtAccounts_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "confidentialtransfers/query.proto", } -func (m *GetAccountRequest) Marshal() (dAtA []byte, err error) { +func (m *GetCtAccountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -389,12 +389,12 @@ func (m *GetAccountRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAccountRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetCtAccountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetCtAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -416,7 +416,7 @@ func (m *GetAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetAccountResponse) Marshal() (dAtA []byte, err error) { +func (m *GetCtAccountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -426,12 +426,12 @@ func (m *GetAccountResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAccountResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetCtAccountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetCtAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -451,7 +451,7 @@ func (m *GetAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetAllAccountsRequest) Marshal() (dAtA []byte, err error) { +func (m *GetAllCtAccountsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -461,12 +461,12 @@ func (m *GetAllAccountsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAllAccountsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetAllCtAccountsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAllAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetAllCtAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -493,7 +493,7 @@ func (m *GetAllAccountsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetAllAccountsResponse) Marshal() (dAtA []byte, err error) { +func (m *GetAllCtAccountsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -503,12 +503,12 @@ func (m *GetAllAccountsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetAllAccountsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetAllCtAccountsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetAllAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *GetAllCtAccountsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -553,7 +553,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *GetAccountRequest) Size() (n int) { +func (m *GetCtAccountRequest) Size() (n int) { if m == nil { return 0 } @@ -570,7 +570,7 @@ func (m *GetAccountRequest) Size() (n int) { return n } -func (m *GetAccountResponse) Size() (n int) { +func (m *GetCtAccountResponse) Size() (n int) { if m == nil { return 0 } @@ -583,7 +583,7 @@ func (m *GetAccountResponse) Size() (n int) { return n } -func (m *GetAllAccountsRequest) Size() (n int) { +func (m *GetAllCtAccountsRequest) Size() (n int) { if m == nil { return 0 } @@ -600,7 +600,7 @@ func (m *GetAllAccountsRequest) Size() (n int) { return n } -func (m *GetAllAccountsResponse) Size() (n int) { +func (m *GetAllCtAccountsResponse) Size() (n int) { if m == nil { return 0 } @@ -625,7 +625,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *GetAccountRequest) Unmarshal(dAtA []byte) error { +func (m *GetCtAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -648,10 +648,10 @@ func (m *GetAccountRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAccountRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetCtAccountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetCtAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -739,7 +739,7 @@ func (m *GetAccountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetAccountResponse) Unmarshal(dAtA []byte) error { +func (m *GetCtAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -762,10 +762,10 @@ func (m *GetAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetCtAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetCtAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -825,7 +825,7 @@ func (m *GetAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetAllAccountsRequest) Unmarshal(dAtA []byte) error { +func (m *GetAllCtAccountsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -848,10 +848,10 @@ func (m *GetAllAccountsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAllAccountsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetAllCtAccountsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetAllCtAccountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -943,7 +943,7 @@ func (m *GetAllAccountsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetAllAccountsResponse) Unmarshal(dAtA []byte) error { +func (m *GetAllCtAccountsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -966,10 +966,10 @@ func (m *GetAllAccountsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetAllAccountsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetAllCtAccountsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetAllCtAccountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/confidentialtransfers/types/query.pb.gw.go b/x/confidentialtransfers/types/query.pb.gw.go index 8dc1aa53bc..1d74b4db92 100644 --- a/x/confidentialtransfers/types/query.pb.gw.go +++ b/x/confidentialtransfers/types/query.pb.gw.go @@ -33,8 +33,8 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAccountRequest +func request_Query_GetCtAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCtAccountRequest var metadata runtime.ServerMetadata var ( @@ -66,13 +66,13 @@ func request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } - msg, err := client.GetAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetCtAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAccountRequest +func local_request_Query_GetCtAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCtAccountRequest var metadata runtime.ServerMetadata var ( @@ -104,17 +104,17 @@ func local_request_Query_GetAccount_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } - msg, err := server.GetAccount(ctx, &protoReq) + msg, err := server.GetCtAccount(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_GetAllAccounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_GetAllCtAccounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllAccountsRequest +func request_Query_GetAllCtAccounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllCtAccountsRequest var metadata runtime.ServerMetadata var ( @@ -138,17 +138,17 @@ func request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marsh if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllAccounts_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllCtAccounts_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetAllAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetAllCtAccounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllAccountsRequest +func local_request_Query_GetAllCtAccounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllCtAccountsRequest var metadata runtime.ServerMetadata var ( @@ -172,11 +172,11 @@ func local_request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllAccounts_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllCtAccounts_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetAllAccounts(ctx, &protoReq) + msg, err := server.GetAllCtAccounts(ctx, &protoReq) return msg, metadata, err } @@ -187,7 +187,7 @@ func local_request_Query_GetAllAccounts_0(ctx context.Context, marshaler runtime // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_GetAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetCtAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -198,7 +198,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetCtAccount_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 { @@ -206,11 +206,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetCtAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetAllAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAllCtAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -221,7 +221,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetAllAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetAllCtAccounts_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 { @@ -229,7 +229,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetAllAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAllCtAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -274,7 +274,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_GetAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetCtAccount_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) @@ -283,18 +283,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetAccount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetCtAccount_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_GetAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetCtAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetAllAccounts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAllCtAccounts_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) @@ -303,14 +303,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetAllAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetAllCtAccounts_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_GetAllAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAllCtAccounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -318,13 +318,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_GetAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"seichain", "confidentialtransfers", "account", "address", "denom"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetCtAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"seichain", "confidentialtransfers", "account", "address", "denom"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_GetAllAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seichain", "confidentialtransfers", "account", "address"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_GetAllCtAccounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seichain", "confidentialtransfers", "account", "address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Query_GetAccount_0 = runtime.ForwardResponseMessage + forward_Query_GetCtAccount_0 = runtime.ForwardResponseMessage - forward_Query_GetAllAccounts_0 = runtime.ForwardResponseMessage + forward_Query_GetAllCtAccounts_0 = runtime.ForwardResponseMessage ) From c9c0828fcc31497be791b64c6ceff5f9c2750f18 Mon Sep 17 00:00:00 2001 From: _dssei_ Date: Tue, 12 Nov 2024 13:33:40 -0800 Subject: [PATCH 16/16] formatting --- x/confidentialtransfers/keeper/keeper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/confidentialtransfers/keeper/keeper.go b/x/confidentialtransfers/keeper/keeper.go index 5559560b9d..fd446aa86a 100644 --- a/x/confidentialtransfers/keeper/keeper.go +++ b/x/confidentialtransfers/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/cosmos/cosmos-sdk/store/prefix" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/sei-protocol/sei-chain/x/confidentialtransfers/types"