diff --git a/CHANGELOG.md b/CHANGELOG.md index 098ac1f5ad..ce8af7910a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* Add restricted status info to name module cli queries [#806](https://github.com/provenance-io/provenance/issues/806) + --- ## [v1.10.0](https://github.com/provenance-io/provenance/releases/tag/v1.10.0) - 2022-05-11 diff --git a/docs/proto-docs.md b/docs/proto-docs.md index 71a3213432..f10359c87f 100644 --- a/docs/proto-docs.md +++ b/docs/proto-docs.md @@ -5460,6 +5460,7 @@ Event emitted when name is bound. | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | | | `name` | [string](#string) | | | +| `restricted` | [bool](#bool) | | | @@ -5476,6 +5477,7 @@ Event emitted when name is unbound. | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | | | `name` | [string](#string) | | | +| `restricted` | [bool](#bool) | | | @@ -5614,6 +5616,7 @@ QueryResolveResponse is the response type for the Query/Resolve method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | a string containing the address the name resolves to | +| `restricted` | [bool](#bool) | | Whether owner signature is required to add sub-names. | diff --git a/proto/provenance/name/v1/name.proto b/proto/provenance/name/v1/name.proto index 7f2e0f67c9..8346f374cb 100644 --- a/proto/provenance/name/v1/name.proto +++ b/proto/provenance/name/v1/name.proto @@ -49,12 +49,14 @@ message CreateRootNameProposal { // Event emitted when name is bound. message EventNameBound { - string address = 1; - string name = 2; + string address = 1; + string name = 2; + bool restricted = 3; } // Event emitted when name is unbound. message EventNameUnbound { - string address = 1; - string name = 2; + string address = 1; + string name = 2; + bool restricted = 3; } diff --git a/proto/provenance/name/v1/query.proto b/proto/provenance/name/v1/query.proto index f27d411f7f..620106b9e4 100644 --- a/proto/provenance/name/v1/query.proto +++ b/proto/provenance/name/v1/query.proto @@ -51,6 +51,8 @@ message QueryResolveRequest { message QueryResolveResponse { // a string containing the address the name resolves to string address = 1; + // Whether owner signature is required to add sub-names. + bool restricted = 2; } // QueryReverseLookupRequest is the request type for the Query/ReverseLookup method. diff --git a/x/name/client/cli/cli_test.go b/x/name/client/cli/cli_test.go index 6fe1d05c30..eb8f721a35 100644 --- a/x/name/client/cli/cli_test.go +++ b/x/name/client/cli/cli_test.go @@ -227,12 +227,12 @@ func (s *IntegrationTestSuite) TestResolveNameCommand() { { "query name, json output", []string{"attribute", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - fmt.Sprintf("{\"address\":\"%s\"}", s.accountAddr.String()), + fmt.Sprintf("{\"address\":\"%s\",\"restricted\":false}", s.accountAddr.String()), }, { "query name, text output", []string{"attribute", fmt.Sprintf("--%s=text", tmcli.OutputFlag)}, - fmt.Sprintf("address: %s", s.accountAddr.String()), + fmt.Sprintf("address: %s\nrestricted: false", s.accountAddr.String()), }, { "query name that does not exist, text output", diff --git a/x/name/handler_test.go b/x/name/handler_test.go index b9f07ec70a..3e5ce5ca92 100644 --- a/x/name/handler_test.go +++ b/x/name/handler_test.go @@ -63,7 +63,7 @@ func TestCreateName(t *testing.T) { name: "create name record", msg: nametypes.NewMsgBindNameRequest(nametypes.NewNameRecord("new", addr2, false), nametypes.NewNameRecord("example.name", addr1, false)), expectedError: nil, - expectedEvent: nametypes.NewEventNameBound(addr2.String(), "new.example.name"), + expectedEvent: nametypes.NewEventNameBound(addr2.String(), "new.example.name", false), }, { name: "create bad name record", @@ -126,7 +126,7 @@ func TestDeleteName(t *testing.T) { name: "delete name record", msg: nametypes.NewMsgDeleteNameRequest(nametypes.NewNameRecord("example.name", addr1, false)), expectedError: nil, - expectedEvent: nametypes.NewEventNameUnbound(addr1.String(), "example.name"), + expectedEvent: nametypes.NewEventNameUnbound(addr1.String(), "example.name", false), }, { name: "create bad name record", diff --git a/x/name/keeper/keeper.go b/x/name/keeper/keeper.go index 4bc89940e7..b6b32cd99d 100644 --- a/x/name/keeper/keeper.go +++ b/x/name/keeper/keeper.go @@ -102,7 +102,7 @@ func (keeper Keeper) SetNameRecord(ctx sdk.Context, name string, addr sdk.AccAdd addrPrefix = append(addrPrefix, key...) // [0x04] :: [addr-bytes] :: [name-key-bytes] store.Set(addrPrefix, bz) - nameBoundEvent := types.NewEventNameBound(record.Address, name) + nameBoundEvent := types.NewEventNameBound(record.Address, name, record.Restricted) if err := ctx.EventManager().EmitTypedEvent(nameBoundEvent); err != nil { return err @@ -201,7 +201,7 @@ func (keeper Keeper) DeleteRecord(ctx sdk.Context, name string) error { store.Delete(addrPrefix) } - nameUnboundEvent := types.NewEventNameUnbound(record.Address, name) + nameUnboundEvent := types.NewEventNameUnbound(record.Address, name, record.Restricted) if err := ctx.EventManager().EmitTypedEvent(nameUnboundEvent); err != nil { return err diff --git a/x/name/keeper/query_server.go b/x/name/keeper/query_server.go index 282db2cb17..b9597048b2 100644 --- a/x/name/keeper/query_server.go +++ b/x/name/keeper/query_server.go @@ -35,7 +35,7 @@ func (keeper Keeper) Resolve(c context.Context, request *types.QueryResolveReque if record == nil { return nil, types.ErrNameNotBound } - return &types.QueryResolveResponse{Address: record.Address}, nil + return &types.QueryResolveResponse{Address: record.Address, Restricted: record.Restricted}, nil } // ReverseLookup gets all names bound to an address. diff --git a/x/name/types/events.go b/x/name/types/events.go index c4eacce8b1..6883484f34 100644 --- a/x/name/types/events.go +++ b/x/name/types/events.go @@ -12,16 +12,18 @@ const ( KeyAttributeAddress string = "address" ) -func NewEventNameBound(address string, name string) *EventNameBound { +func NewEventNameBound(address string, name string, restricted bool) *EventNameBound { return &EventNameBound{ - Address: address, - Name: name, + Address: address, + Name: name, + Restricted: restricted, } } -func NewEventNameUnbound(address string, name string) *EventNameUnbound { +func NewEventNameUnbound(address string, name string, restricted bool) *EventNameUnbound { return &EventNameUnbound{ - Address: address, - Name: name, + Address: address, + Name: name, + Restricted: restricted, } } diff --git a/x/name/types/name.pb.go b/x/name/types/name.pb.go index 88f7456838..1457f1d704 100644 --- a/x/name/types/name.pb.go +++ b/x/name/types/name.pb.go @@ -204,8 +204,9 @@ var xxx_messageInfo_CreateRootNameProposal proto.InternalMessageInfo // Event emitted when name is bound. type EventNameBound struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Restricted bool `protobuf:"varint,3,opt,name=restricted,proto3" json:"restricted,omitempty"` } func (m *EventNameBound) Reset() { *m = EventNameBound{} } @@ -255,10 +256,18 @@ func (m *EventNameBound) GetName() string { return "" } +func (m *EventNameBound) GetRestricted() bool { + if m != nil { + return m.Restricted + } + return false +} + // Event emitted when name is unbound. type EventNameUnbound struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Restricted bool `protobuf:"varint,3,opt,name=restricted,proto3" json:"restricted,omitempty"` } func (m *EventNameUnbound) Reset() { *m = EventNameUnbound{} } @@ -308,6 +317,13 @@ func (m *EventNameUnbound) GetName() string { return "" } +func (m *EventNameUnbound) GetRestricted() bool { + if m != nil { + return m.Restricted + } + return false +} + func init() { proto.RegisterType((*Params)(nil), "provenance.name.v1.Params") proto.RegisterType((*NameRecord)(nil), "provenance.name.v1.NameRecord") @@ -319,35 +335,36 @@ func init() { func init() { proto.RegisterFile("provenance/name/v1/name.proto", fileDescriptor_a314256905bb00ec) } var fileDescriptor_a314256905bb00ec = []byte{ - // 446 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0x13, 0x41, - 0x10, 0x86, 0x6f, 0x13, 0x3b, 0xc4,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xeb, 0x32, 0x0a, 0xae, 0x96, 0x51, 0xf0, 0x6b, 0x19, 0x05, 0xf0, 0x50, 0xd2, 0xed, 0x6d, - 0x9c, 0xe7, 0x98, 0x7d, 0x7c, 0x9e, 0x4b, 0x77, 0x3e, 0x9b, 0x8e, 0x52, 0x5d, 0xc6, 0x6b, 0xc3, - 0x33, 0xa9, 0x5b, 0x51, 0x3c, 0x6f, 0xce, 0xdd, 0x7d, 0xae, 0xd0, 0x4e, 0x77, 0xe8, 0x86, 0x5f, - 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x10, 0x3c, 0x3a, 0x83, 0x0e, 0x03, 0x00, 0x00, + // 452 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xb1, 0x6e, 0x13, 0x4d, + 0x10, 0xc7, 0x6f, 0x13, 0x3b, 0x5f, 0x3c, 0x1f, 0x81, 0x68, 0x65, 0xa2, 0x13, 0x12, 0x17, 0xcb, + 0x05, 0x4a, 0x01, 0x3e, 0x22, 0x1a, 0x44, 0x19, 0x44, 0x17, 0x21, 0xeb, 0x50, 0x1a, 0x0a, 0x9c, + 0xf5, 0xdd, 0xe8, 0xb2, 0xd2, 0xdd, 0xee, 0x69, 0x77, 0x7d, 0x31, 0x6f, 0x40, 0x49, 0x49, 0x99, + 0x92, 0x27, 0x41, 0x94, 0x29, 0x29, 0x91, 0xdd, 0xf0, 0x18, 0x68, 0xe7, 0xe2, 0xf8, 0x62, 0x0a, + 0x1a, 0xaa, 0xdb, 0x99, 0xff, 0x7f, 0x66, 0x7e, 0x73, 0xda, 0x85, 0xc7, 0x95, 0xd1, 0x35, 0x2a, + 0xa1, 0x52, 0x8c, 0x95, 0x28, 0x31, 0xae, 0x8f, 0xe9, 0x3b, 0xaa, 0x8c, 0x76, 0x9a, 0xf3, 0xb5, + 0x3c, 0xa2, 0x74, 0x7d, 0xfc, 0xa8, 0x9f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0x07, 0xf0, 0x7f, 0x86, + 0x36, 0x35, 0xb2, 0x72, 0x52, 0xab, 0x9b, 0xa1, 0xed, 0xd4, 0x2d, 0xe6, 0x76, 0x0b, 0xb3, 0x0f, + 0x5d, 0x7d, 0xa9, 0xd0, 0xd0, 0xbe, 0xbd, 0xa4, 0x09, 0x36, 0x10, 0xbb, 0x7f, 0x20, 0xde, 0xfb, + 0x74, 0x75, 0x18, 0x78, 0xcc, 0x5f, 0x1e, 0xf5, 0x03, 0xdc, 0x7f, 0x53, 0xa3, 0x22, 0xc8, 0x13, + 0x3d, 0x53, 0x59, 0x7b, 0x79, 0x76, 0x77, 0xf9, 0x15, 0xc3, 0x56, 0x8b, 0xe1, 0x2f, 0x3f, 0x64, + 0x78, 0x0e, 0xfb, 0xb7, 0xfd, 0xcf, 0xd4, 0xf4, 0xdf, 0x4f, 0x38, 0x49, 0xbf, 0x2f, 0x22, 0x76, + 0xbd, 0x88, 0xd8, 0xcf, 0x45, 0xc4, 0x3e, 0x2f, 0xa3, 0xe0, 0x7a, 0x19, 0x05, 0x3f, 0x96, 0x51, + 0x00, 0x0f, 0x25, 0xdd, 0xdd, 0x8d, 0xeb, 0x3d, 0x66, 0xef, 0x9f, 0xe7, 0xd2, 0x5d, 0xcc, 0xa6, + 0xa3, 0x54, 0x97, 0xf1, 0xda, 0xf0, 0x4c, 0xea, 0x56, 0x14, 0xcf, 0x9b, 0xe7, 0xe2, 0x3e, 0x56, + 0x68, 0xa7, 0x3b, 0xf4, 0x06, 0x5e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x38, 0xb5, 0xff, + 0x4e, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -526,6 +543,16 @@ func (m *EventNameBound) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Restricted { + i-- + if m.Restricted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) @@ -563,6 +590,16 @@ func (m *EventNameUnbound) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Restricted { + i-- + if m.Restricted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) @@ -674,6 +711,9 @@ func (m *EventNameBound) Size() (n int) { if l > 0 { n += 1 + l + sovName(uint64(l)) } + if m.Restricted { + n += 2 + } return n } @@ -691,6 +731,9 @@ func (m *EventNameUnbound) Size() (n int) { if l > 0 { n += 1 + l + sovName(uint64(l)) } + if m.Restricted { + n += 2 + } return n } @@ -1252,6 +1295,26 @@ func (m *EventNameBound) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Restricted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowName + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Restricted = bool(v != 0) default: iNdEx = preIndex skippy, err := skipName(dAtA[iNdEx:]) @@ -1366,6 +1429,26 @@ func (m *EventNameUnbound) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Restricted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowName + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Restricted = bool(v != 0) default: iNdEx = preIndex skippy, err := skipName(dAtA[iNdEx:]) diff --git a/x/name/types/query.pb.go b/x/name/types/query.pb.go index 21b2dae734..cf9f1a941a 100644 --- a/x/name/types/query.pb.go +++ b/x/name/types/query.pb.go @@ -156,6 +156,8 @@ var xxx_messageInfo_QueryResolveRequest proto.InternalMessageInfo type QueryResolveResponse struct { // a string containing the address the name resolves to Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Whether owner signature is required to add sub-names. + Restricted bool `protobuf:"varint,2,opt,name=restricted,proto3" json:"restricted,omitempty"` } func (m *QueryResolveResponse) Reset() { *m = QueryResolveResponse{} } @@ -198,6 +200,13 @@ func (m *QueryResolveResponse) GetAddress() string { return "" } +func (m *QueryResolveResponse) GetRestricted() bool { + if m != nil { + return m.Restricted + } + return false +} + // QueryReverseLookupRequest is the request type for the Query/ReverseLookup method. type QueryReverseLookupRequest struct { // address to find name records for @@ -292,40 +301,41 @@ func init() { func init() { proto.RegisterFile("provenance/name/v1/query.proto", fileDescriptor_4e9b0d5536fc961a) } var fileDescriptor_4e9b0d5536fc961a = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xb1, 0x6e, 0x13, 0x41, - 0x10, 0xbd, 0x4d, 0x82, 0x03, 0x8b, 0x68, 0x06, 0x23, 0x99, 0x53, 0x38, 0xa3, 0x53, 0xe4, 0x44, - 0x11, 0xd9, 0x8d, 0x93, 0x06, 0x51, 0xa6, 0x80, 0x06, 0x09, 0x73, 0x25, 0xdd, 0xda, 0x59, 0x1d, - 0x27, 0xec, 0x9b, 0xcb, 0xed, 0xf9, 0x44, 0x14, 0xb9, 0x81, 0x82, 0x94, 0x48, 0xb4, 0x14, 0xf9, - 0x04, 0x3e, 0x23, 0x65, 0x24, 0x1a, 0x2a, 0x84, 0x6c, 0x0a, 0x3e, 0x03, 0xdd, 0xee, 0x5a, 0xb6, - 0xe5, 0x0d, 0xa6, 0x5b, 0xcf, 0xbc, 0x37, 0x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, 0x1c, 0x90, 0xcf, 0x93, 0xc0, 0xbb, 0x9e, 0x04, 0xde, 0x8f, - 0x49, 0xe0, 0xd1, 0x07, 0x09, 0x3a, 0x94, 0x3b, 0xe4, 0xcd, 0x41, 0x9c, 0x14, 0x6f, 0x87, 0x5d, - 0xd6, 0xc3, 0xc1, 0x9c, 0xc4, 0x7e, 0x82, 0xf3, 0x82, 0xef, 0x8d, 0x64, 0x71, 0x96, 0x49, 0xd5, - 0xad, 0xe9, 0x8f, 0xff, 0xe8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb0, 0x67, 0x48, 0xb1, - 0x04, 0x00, 0x00, + // 533 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x7d, 0x6d, 0x49, 0xcb, 0x55, 0x2c, 0x47, 0x90, 0x82, 0x55, 0x9c, 0xca, 0xaa, 0xd2, + 0xa8, 0xa2, 0x77, 0x24, 0x5d, 0x10, 0x63, 0x07, 0x58, 0x90, 0x08, 0x1e, 0xd9, 0x2e, 0xce, 0xc9, + 0x58, 0x24, 0x7e, 0x5d, 0x9f, 0x63, 0x51, 0x55, 0x59, 0x60, 0xa0, 0x23, 0x12, 0x2b, 0x43, 0x3f, + 0x02, 0x1f, 0xa3, 0x63, 0x25, 0x16, 0x26, 0x84, 0x12, 0x06, 0x3e, 0x06, 0xf2, 0xdd, 0x45, 0x71, + 0x94, 0x2b, 0x61, 0xbb, 0xbc, 0xff, 0x9e, 0xdf, 0xeb, 0xe7, 0x55, 0xb0, 0x97, 0x66, 0x50, 0x88, + 0x84, 0x27, 0xa1, 0x60, 0x09, 0x1f, 0x09, 0x56, 0x74, 0xd8, 0xd9, 0x58, 0x64, 0xe7, 0x34, 0xcd, + 0x20, 0x07, 0x42, 0x16, 0x79, 0x5a, 0xe6, 0x69, 0xd1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 0xf0, 0x83, 0x18, 0x2c, 0xca, 0x3d, 0xf4, 0xe6, 0x49, 0x14, 0xe7, + 0x6f, 0xc7, 0x7d, 0x1a, 0xc2, 0xa8, 0x22, 0x71, 0x1c, 0x43, 0x55, 0xf0, 0xbd, 0x96, 0xcc, 0xcf, + 0x53, 0x21, 0xfb, 0x35, 0xf5, 0xe7, 0x70, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x9d, 0xe6, + 0x24, 0xd1, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -592,6 +602,16 @@ func (m *QueryResolveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Restricted { + i-- + if m.Restricted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -742,6 +762,9 @@ func (m *QueryResolveResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Restricted { + n += 2 + } return n } @@ -1063,6 +1086,26 @@ func (m *QueryResolveResponse) Unmarshal(dAtA []byte) error { } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Restricted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Restricted = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])