From 43c96ea899a81aaf1a7a692c7fbcebfe5649208c Mon Sep 17 00:00:00 2001 From: Tian Date: Thu, 13 Jun 2024 00:08:17 -0400 Subject: [PATCH] [TRA-380] use serializable int for equity and inventory in vault query (#1688) --- .../src/codegen/dydxprotocol/vault/query.ts | 28 +-- proto/dydxprotocol/vault/query.proto | 12 +- protocol/x/vault/keeper/grpc_query_vault.go | 5 +- .../x/vault/keeper/grpc_query_vault_test.go | 20 +- protocol/x/vault/types/query.pb.go | 204 ++++++++++-------- 5 files changed, 158 insertions(+), 111 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts index ebd83f6e08..d2cf4d2f7d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/query.ts @@ -37,8 +37,8 @@ export interface QueryVaultRequestSDKType { export interface QueryVaultResponse { vaultId?: VaultId; subaccountId?: SubaccountId; - equity: Long; - inventory: Long; + equity: Uint8Array; + inventory: Uint8Array; totalShares: Long; } /** QueryVaultResponse is a response type for the Vault RPC method. */ @@ -46,8 +46,8 @@ export interface QueryVaultResponse { export interface QueryVaultResponseSDKType { vault_id?: VaultIdSDKType; subaccount_id?: SubaccountIdSDKType; - equity: Long; - inventory: Long; + equity: Uint8Array; + inventory: Uint8Array; total_shares: Long; } /** QueryAllVaultsRequest is a request type for the AllVaults RPC method. */ @@ -249,8 +249,8 @@ function createBaseQueryVaultResponse(): QueryVaultResponse { return { vaultId: undefined, subaccountId: undefined, - equity: Long.UZERO, - inventory: Long.UZERO, + equity: new Uint8Array(), + inventory: new Uint8Array(), totalShares: Long.UZERO }; } @@ -265,12 +265,12 @@ export const QueryVaultResponse = { SubaccountId.encode(message.subaccountId, writer.uint32(18).fork()).ldelim(); } - if (!message.equity.isZero()) { - writer.uint32(24).uint64(message.equity); + if (message.equity.length !== 0) { + writer.uint32(26).bytes(message.equity); } - if (!message.inventory.isZero()) { - writer.uint32(32).uint64(message.inventory); + if (message.inventory.length !== 0) { + writer.uint32(34).bytes(message.inventory); } if (!message.totalShares.isZero()) { @@ -298,11 +298,11 @@ export const QueryVaultResponse = { break; case 3: - message.equity = (reader.uint64() as Long); + message.equity = reader.bytes(); break; case 4: - message.inventory = (reader.uint64() as Long); + message.inventory = reader.bytes(); break; case 5: @@ -322,8 +322,8 @@ export const QueryVaultResponse = { const message = createBaseQueryVaultResponse(); message.vaultId = object.vaultId !== undefined && object.vaultId !== null ? VaultId.fromPartial(object.vaultId) : undefined; message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined; - message.equity = object.equity !== undefined && object.equity !== null ? Long.fromValue(object.equity) : Long.UZERO; - message.inventory = object.inventory !== undefined && object.inventory !== null ? Long.fromValue(object.inventory) : Long.UZERO; + message.equity = object.equity ?? new Uint8Array(); + message.inventory = object.inventory ?? new Uint8Array(); message.totalShares = object.totalShares !== undefined && object.totalShares !== null ? Long.fromValue(object.totalShares) : Long.UZERO; return message; } diff --git a/proto/dydxprotocol/vault/query.proto b/proto/dydxprotocol/vault/query.proto index 093862a769..0249eb75fe 100644 --- a/proto/dydxprotocol/vault/query.proto +++ b/proto/dydxprotocol/vault/query.proto @@ -51,8 +51,16 @@ message QueryVaultResponse { VaultId vault_id = 1 [ (gogoproto.nullable) = false ]; dydxprotocol.subaccounts.SubaccountId subaccount_id = 2 [ (gogoproto.nullable) = false ]; - uint64 equity = 3; - uint64 inventory = 4; + bytes equity = 3 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; + bytes inventory = 4 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; uint64 total_shares = 5; } diff --git a/protocol/x/vault/keeper/grpc_query_vault.go b/protocol/x/vault/keeper/grpc_query_vault.go index 00f6087e06..708de74cbb 100644 --- a/protocol/x/vault/keeper/grpc_query_vault.go +++ b/protocol/x/vault/keeper/grpc_query_vault.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc/status" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/dydxprotocol/v4-chain/protocol/dtypes" "github.com/dydxprotocol/v4-chain/protocol/lib" clobtypes "github.com/dydxprotocol/v4-chain/protocol/x/clob/types" "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" @@ -51,8 +52,8 @@ func (k Keeper) Vault( return &types.QueryVaultResponse{ VaultId: vaultId, SubaccountId: *vaultId.ToSubaccountId(), - Equity: equity.Uint64(), - Inventory: inventory.Uint64(), + Equity: dtypes.NewIntFromBigInt(equity), + Inventory: dtypes.NewIntFromBigInt(inventory), TotalShares: totalShares.NumShares.BigInt().Uint64(), }, nil } diff --git a/protocol/x/vault/keeper/grpc_query_vault_test.go b/protocol/x/vault/keeper/grpc_query_vault_test.go index 53b0cc1471..be9a96cdac 100644 --- a/protocol/x/vault/keeper/grpc_query_vault_test.go +++ b/protocol/x/vault/keeper/grpc_query_vault_test.go @@ -31,7 +31,7 @@ func TestVault(t *testing.T) { req *vaulttypes.QueryVaultRequest /* --- Expectations --- */ - expectedEquity uint64 + expectedEquity *big.Int expectedErr string }{ "Success": { @@ -44,7 +44,19 @@ func TestVault(t *testing.T) { perpId: 0, inventory: big.NewInt(200), totalShares: big.NewInt(300), - expectedEquity: 500, + expectedEquity: big.NewInt(500), + }, + "Success: negative inventory and equity": { + req: &vaulttypes.QueryVaultRequest{ + Type: vaulttypes.VaultType_VAULT_TYPE_CLOB, + Number: 0, + }, + vaultId: constants.Vault_Clob_0, + asset: big.NewInt(100), + perpId: 0, + inventory: big.NewInt(-200), + totalShares: big.NewInt(300), + expectedEquity: big.NewInt(-300), }, "Error: query non-existent vault": { req: &vaulttypes.QueryVaultRequest{ @@ -113,8 +125,8 @@ func TestVault(t *testing.T) { expectedResponse := vaulttypes.QueryVaultResponse{ VaultId: tc.vaultId, SubaccountId: *tc.vaultId.ToSubaccountId(), - Equity: tc.expectedEquity, - Inventory: tc.inventory.Uint64(), + Equity: dtypes.NewIntFromBigInt(tc.expectedEquity), + Inventory: dtypes.NewIntFromBigInt(tc.inventory), TotalShares: tc.totalShares.Uint64(), } require.Equal(t, expectedResponse, *response) diff --git a/protocol/x/vault/types/query.pb.go b/protocol/x/vault/types/query.pb.go index 692dfd47e0..d8d1991754 100644 --- a/protocol/x/vault/types/query.pb.go +++ b/protocol/x/vault/types/query.pb.go @@ -11,6 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" types "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -169,11 +170,11 @@ func (m *QueryVaultRequest) GetNumber() uint32 { // QueryVaultResponse is a response type for the Vault RPC method. type QueryVaultResponse struct { - VaultId VaultId `protobuf:"bytes,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id"` - SubaccountId types.SubaccountId `protobuf:"bytes,2,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id"` - Equity uint64 `protobuf:"varint,3,opt,name=equity,proto3" json:"equity,omitempty"` - Inventory uint64 `protobuf:"varint,4,opt,name=inventory,proto3" json:"inventory,omitempty"` - TotalShares uint64 `protobuf:"varint,5,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` + VaultId VaultId `protobuf:"bytes,1,opt,name=vault_id,json=vaultId,proto3" json:"vault_id"` + SubaccountId types.SubaccountId `protobuf:"bytes,2,opt,name=subaccount_id,json=subaccountId,proto3" json:"subaccount_id"` + Equity github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=equity,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"equity"` + Inventory github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,4,opt,name=inventory,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"inventory"` + TotalShares uint64 `protobuf:"varint,5,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` } func (m *QueryVaultResponse) Reset() { *m = QueryVaultResponse{} } @@ -223,20 +224,6 @@ func (m *QueryVaultResponse) GetSubaccountId() types.SubaccountId { return types.SubaccountId{} } -func (m *QueryVaultResponse) GetEquity() uint64 { - if m != nil { - return m.Equity - } - return 0 -} - -func (m *QueryVaultResponse) GetInventory() uint64 { - if m != nil { - return m.Inventory - } - return 0 -} - func (m *QueryVaultResponse) GetTotalShares() uint64 { if m != nil { return m.TotalShares @@ -524,56 +511,59 @@ func init() { func init() { proto.RegisterFile("dydxprotocol/vault/query.proto", fileDescriptor_478fb8dc0ff21ea6) } var fileDescriptor_478fb8dc0ff21ea6 = []byte{ - // 779 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0x42, 0xdb, 0xef, 0x63, 0x0a, 0x5f, 0xf2, 0x8d, 0x88, 0xa5, 0xe0, 0x02, 0x9b, 0xc8, - 0x4f, 0xd9, 0xb5, 0x55, 0x23, 0x07, 0x63, 0x02, 0x07, 0x8d, 0x17, 0x81, 0xc5, 0x78, 0xf0, 0x60, - 0xb3, 0x6d, 0x27, 0xcb, 0x26, 0xed, 0x4e, 0xd9, 0x99, 0xad, 0x34, 0x84, 0x8b, 0x89, 0x07, 0x6f, - 0x26, 0xfe, 0x05, 0x7a, 0xf0, 0xe4, 0xd1, 0xbb, 0x57, 0x8e, 0x44, 0x2f, 0x9e, 0x8c, 0x01, 0xff, - 0x0e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, 0x56, 0xdd, 0x2f, 0x98, 0x7f, 0x23, 0x0f, 0xcd, 0x57, 0xe8, - 0x92, 0x35, 0xe8, 0x91, 0xb6, 0x0e, 0xa2, 0x20, 0x1e, 0x5a, 0x07, 0x2a, 0x79, 0x87, 0xf4, 0xb5, - 0x46, 0x46, 0x5a, 0x17, 0x90, 0x2e, 0x0d, 0x6c, 0xd4, 0xfd, 0x0c, 0xe4, 0x96, 0x2f, 0x02, 0x45, - 0x5d, 0x73, 0xa0, 0x6b, 0x8a, 0x4e, 0x0e, 0xd4, 0x45, 0x3f, 0x68, 0x24, 0x13, 0x0b, 0x10, 0x5d, - 0x19, 0x48, 0xdf, 0x7b, 0x15, 0x73, 0x37, 0x2f, 0x06, 0x46, 0x35, 0x6b, 0xa0, 0xa6, 0x40, 0x6f, - 0xf5, 0x53, 0x13, 0x4f, 0x6b, 0xb7, 0x59, 0x1b, 0xdb, 0x47, 0x27, 0xba, 0x76, 0x7c, 0xa2, 0x6b, - 0x3f, 0x4f, 0x74, 0xed, 0xed, 0xa9, 0x9e, 0x38, 0x3e, 0xd5, 0x13, 0xdf, 0x4f, 0xf5, 0xc4, 0xf3, - 0x7b, 0xae, 0x27, 0x77, 0xc3, 0x92, 0x59, 0xe6, 0xb5, 0x2e, 0xd6, 0x3b, 0xab, 0xe5, 0x5d, 0xc7, - 0xf3, 0xad, 0x56, 0x65, 0x1f, 0x3b, 0x45, 0xdc, 0xa2, 0x94, 0x86, 0xfa, 0xed, 0x3f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x36, 0x27, 0x20, 0x64, 0x52, 0x08, 0x00, 0x00, + // 818 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x6f, 0x13, 0x49, + 0x14, 0xf6, 0xc6, 0x3f, 0xee, 0x32, 0x76, 0x4e, 0xba, 0xb9, 0x5c, 0xce, 0x71, 0x72, 0x1b,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 0xa9, 0x09, 0xbb, 0xb5, 0xb7, 0x58, 0xc5, 0xed, + 0xc3, 0x13, 0x55, 0x39, 0x3a, 0x51, 0x95, 0x1f, 0x27, 0xaa, 0xf2, 0xfa, 0x54, 0x8d, 0x1c, 0x9d, + 0xaa, 0x91, 0x6f, 0xa7, 0x6a, 0xe4, 0xd1, 0x8d, 0xd1, 0x5f, 0xe7, 0x3d, 0x99, 0x89, 0x3f, 0xd2, + 0x95, 0x04, 0x8f, 0x5f, 0xfd, 0x15, 0x00, 0x00, 0xff, 0xff, 0xba, 0xc6, 0x80, 0x08, 0xe6, 0x08, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -886,16 +876,26 @@ func (m *QueryVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if m.Inventory != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Inventory)) - i-- - dAtA[i] = 0x20 + { + size := m.Inventory.Size() + i -= size + if _, err := m.Inventory.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } - if m.Equity != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Equity)) - i-- - dAtA[i] = 0x18 + i-- + dAtA[i] = 0x22 + { + size := m.Equity.Size() + i -= size + if _, err := m.Equity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a { size, err := m.SubaccountId.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1195,12 +1195,10 @@ func (m *QueryVaultResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) l = m.SubaccountId.Size() n += 1 + l + sovQuery(uint64(l)) - if m.Equity != 0 { - n += 1 + sovQuery(uint64(m.Equity)) - } - if m.Inventory != 0 { - n += 1 + sovQuery(uint64(m.Inventory)) - } + l = m.Equity.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Inventory.Size() + n += 1 + l + sovQuery(uint64(l)) if m.TotalShares != 0 { n += 1 + sovQuery(uint64(m.TotalShares)) } @@ -1617,10 +1615,10 @@ func (m *QueryVaultResponse) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Equity", wireType) } - m.Equity = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1630,16 +1628,30 @@ func (m *QueryVaultResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Equity |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Equity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 4: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Inventory", wireType) } - m.Inventory = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1649,11 +1661,25 @@ func (m *QueryVaultResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Inventory |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Inventory.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TotalShares", wireType)