Update develop branch

This commit is contained in:
Evgeniy Kulikov 2019-11-18 19:22:08 +03:00
parent 5d4759a6c6
commit 24e5497b1d
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
34 changed files with 4503 additions and 1310 deletions

View file

@ -33,5 +33,5 @@ protoc:
echo "${B}${G}⇒ Processing $$f ${R}"; \ echo "${B}${G}⇒ Processing $$f ${R}"; \
protoc \ protoc \
--proto_path=.:./vendor:/usr/local/include \ --proto_path=.:./vendor:/usr/local/include \
--gofast_out=plugins=grpc,paths=source_relative:. $$f; \ --gofast_out=plugins=grpc,paths=source_relative:. $$f; \
done done

View file

@ -31,9 +31,6 @@ const (
ErrEmptyParentAddress = internal.Error("empty parent address") ErrEmptyParentAddress = internal.Error("empty parent address")
) )
// SetTTL sets ttl to BalanceRequest to satisfy TTLRequest interface.
func (m BalanceRequest) SetTTL(v uint32) { m.TTL = v }
// SumFunds goes through all accounts and sums up active funds. // SumFunds goes through all accounts and sums up active funds.
func SumFunds(accounts []*Account) (res *decimal.Decimal) { func SumFunds(accounts []*Account) (res *decimal.Decimal) {
res = decimal.Zero.Copy() res = decimal.Zero.Copy()

View file

@ -9,6 +9,7 @@ import (
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
decimal "github.com/nspcc-dev/neofs-proto/decimal" decimal "github.com/nspcc-dev/neofs-proto/decimal"
service "github.com/nspcc-dev/neofs-proto/service"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -31,12 +32,13 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type BalanceRequest struct { type BalanceRequest struct {
// OwnerID is a wallet address // OwnerID is a wallet address
OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } func (m *BalanceRequest) Reset() { *m = BalanceRequest{} }
@ -68,13 +70,6 @@ func (m *BalanceRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo
func (m *BalanceRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type BalanceResponse struct { type BalanceResponse struct {
// Balance contains current account balance state // Balance contains current account balance state
Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"`
@ -137,27 +132,31 @@ func init() {
func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) }
var fileDescriptor_7f9514b8f1d4c7fe = []byte{ var fileDescriptor_7f9514b8f1d4c7fe = []byte{
// 311 bytes of a gzipped FileDescriptorProto // 381 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x4c, 0x4e, 0xce, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbd, 0x6e, 0xdb, 0x30,
0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x14, 0x85, 0xcd, 0xb6, 0xb0, 0x0b, 0xda, 0xa8, 0x0b, 0xf6, 0x07, 0x82, 0x0a, 0xc8, 0x86, 0x27,
0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0xc8, 0x48, 0x89, 0xa6, 0xa4, 0x26, 0x67, 0xe6, 0x26, 0xb7, 0x85, 0x25, 0x40, 0x1d, 0xda, 0xd5, 0x82, 0x87, 0x16, 0x68, 0xd1, 0x40, 0x43, 0x86, 0x6c,
0xe6, 0xe8, 0x43, 0x69, 0x88, 0x12, 0x29, 0x31, 0x24, 0xcd, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x50, 0x14, 0x7d, 0xad, 0x08, 0xb1, 0x49, 0x45, 0xa4, 0x14, 0xf8, 0x4d, 0xf2, 0x2e, 0x79, 0x01, 0x8f,
0x71, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, 0x1e, 0x83, 0x0c, 0x46, 0xa0, 0xbc, 0x48, 0x60, 0x8a, 0xf2, 0x4f, 0x92, 0x89, 0xe4, 0x77, 0xee,
0x7c, 0x7d, 0xb0, 0x70, 0x52, 0x69, 0x1a, 0x98, 0x07, 0xe6, 0x80, 0x59, 0x10, 0xe5, 0x4a, 0xbe, 0xb9, 0xbc, 0x3c, 0xc4, 0x16, 0x65, 0x4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, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0x5b, 0x07, 0x37, 0xa9, 0xd6, 0xb0, 0x2e, 0x20, 0x3f, 0x71, 0xe7, 0xaf, 0x60, 0x17, 0xe3, 0x2a,
0x21, 0x61, 0x8b, 0x30, 0x32, 0x89, 0x0d, 0x2c, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x49, 0x69, 0xbd, 0xea, 0xbf, 0x1e, 0xb6, 0xfd, 0x0f, 0xee, 0x3e, 0x5a, 0xd7, 0x68, 0xe1, 0x51,
0x45, 0x3c, 0x0a, 0xe8, 0x01, 0x00, 0x00, 0xa1, 0x7f, 0x82, 0xf1, 0x78, 0x57, 0x43, 0x82, 0xdd, 0x95, 0xc4, 0x3e, 0xf4, 0x1e, 0xe7, 0x6a,
0x7f, 0x79, 0x51, 0xab, 0xc6, 0x0e, 0xc6, 0xab, 0xd2, 0x41, 0xeb, 0xd2, 0x41, 0xb7, 0xa5, 0x83,
0xee, 0x4b, 0x07, 0x5d, 0x3f, 0x38, 0x8d, 0xb3, 0xef, 0x07, 0x9f, 0xc9, 0x65, 0xca, 0xd8, 0x68,
0x0a, 0x85, 0xc7, 0x41, 0xcc, 0xe4, 0xa8, 0xfa, 0xca, 0x7d, 0xcb, 0xa8, 0xa9, 0xc9, 0x8f, 0xc7,
0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xca, 0x86, 0x87, 0x81, 0x02, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -266,11 +265,30 @@ func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintService(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x10 return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size := m.OwnerID.Size() size := m.OwnerID.Size()
i -= size i -= size
@ -356,9 +374,10 @@ func (m *BalanceRequest) Size() (n int) {
_ = l _ = l
l = m.OwnerID.Size() l = m.OwnerID.Size()
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovService(uint64(m.TTL)) n += 2 + l + sovService(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -455,11 +474,11 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowService return ErrIntOverflowService
@ -469,11 +488,58 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package accounting; package accounting;
option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; option go_package = "github.com/nspcc-dev/neofs-proto/accounting";
import "service/meta.proto";
import "service/verify.proto";
import "decimal/decimal.proto"; import "decimal/decimal.proto";
import "accounting/types.proto"; import "accounting/types.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -17,10 +19,11 @@ service Accounting {
message BalanceRequest { message BalanceRequest {
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 2; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message BalanceResponse { message BalanceResponse {

View file

@ -11,18 +11,6 @@ type (
MessageID = refs.MessageID MessageID = refs.MessageID
) )
// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface.
func (m *GetRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface.
func (m *PutRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface.
func (m *ListRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface.
func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v }
// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. // SetSignature sets signature to PutRequest to satisfy SignedRequest interface.
func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } func (m *PutRequest) SetSignature(v []byte) { m.Signature = v }

View file

@ -9,6 +9,7 @@ import (
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
decimal "github.com/nspcc-dev/neofs-proto/decimal" decimal "github.com/nspcc-dev/neofs-proto/decimal"
service "github.com/nspcc-dev/neofs-proto/service"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -99,12 +100,13 @@ type GetRequest struct {
ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"`
// OwnerID is a wallet address // OwnerID is a wallet address
OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) Reset() { *m = GetRequest{} }
@ -136,13 +138,6 @@ func (m *GetRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_GetRequest proto.InternalMessageInfo var xxx_messageInfo_GetRequest proto.InternalMessageInfo
func (m *GetRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type GetResponse struct { type GetResponse struct {
// Withdraw is cheque with meta information // Withdraw is cheque with meta information
Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"`
@ -198,12 +193,13 @@ type PutRequest struct {
MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"`
// Signature is a signature of the sent request // Signature is a signature of the sent request
Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) Reset() { *m = PutRequest{} }
@ -256,13 +252,6 @@ func (m *PutRequest) GetSignature() []byte {
return nil return nil
} }
func (m *PutRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type PutResponse struct { type PutResponse struct {
// ID is cheque identifier // ID is cheque identifier
ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"`
@ -303,12 +292,13 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo
type ListRequest struct { type ListRequest struct {
// OwnerID is a wallet address // OwnerID is a wallet address
OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ListRequest) Reset() { *m = ListRequest{} } func (m *ListRequest) Reset() { *m = ListRequest{} }
@ -340,13 +330,6 @@ func (m *ListRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ListRequest proto.InternalMessageInfo var xxx_messageInfo_ListRequest proto.InternalMessageInfo
func (m *ListRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type ListResponse struct { type ListResponse struct {
// Items is a set of cheques with meta information // Items is a set of cheques with meta information
Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"`
@ -400,12 +383,13 @@ type DeleteRequest struct {
MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"`
// Signature is a signature of the sent request // Signature is a signature of the sent request
Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
@ -444,13 +428,6 @@ func (m *DeleteRequest) GetSignature() []byte {
return nil return nil
} }
func (m *DeleteRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
// DeleteResponse is empty // DeleteResponse is empty
type DeleteResponse struct { type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -502,42 +479,46 @@ func init() {
func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) }
var fileDescriptor_b3a38a4dc2575267 = []byte{ var fileDescriptor_b3a38a4dc2575267 = []byte{
// 550 bytes of a gzipped FileDescriptorProto // 615 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6b, 0xd4, 0x40,
0x10, 0xc7, 0xbb, 0xb6, 0xe3, 0xb6, 0x93, 0x14, 0xc2, 0x4a, 0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x1e, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd3,
0x26, 0xc1, 0xc6, 0x55, 0x07, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -831,11 +812,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x18 return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size := m.OwnerID.Size() size := m.OwnerID.Size()
i -= size i -= size
@ -922,11 +922,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x30 return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if len(m.Signature) > 0 { if len(m.Signature) > 0 {
i -= len(m.Signature) i -= len(m.Signature)
copy(dAtA[i:], m.Signature) copy(dAtA[i:], m.Signature)
@ -1035,11 +1054,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x10 return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size := m.OwnerID.Size() size := m.OwnerID.Size()
i -= size i -= size
@ -1118,11 +1156,30 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x28 return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintWithdraw(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if len(m.Signature) > 0 { if len(m.Signature) > 0 {
i -= len(m.Signature) i -= len(m.Signature)
copy(dAtA[i:], m.Signature) copy(dAtA[i:], m.Signature)
@ -1238,9 +1295,10 @@ func (m *GetRequest) Size() (n int) {
n += 1 + l + sovWithdraw(uint64(l)) n += 1 + l + sovWithdraw(uint64(l))
l = m.OwnerID.Size() l = m.OwnerID.Size()
n += 1 + l + sovWithdraw(uint64(l)) n += 1 + l + sovWithdraw(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovWithdraw(uint64(m.TTL)) n += 2 + l + sovWithdraw(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovWithdraw(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1284,9 +1342,10 @@ func (m *PutRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovWithdraw(uint64(l)) n += 1 + l + sovWithdraw(uint64(l))
} }
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovWithdraw(uint64(m.TTL)) n += 2 + l + sovWithdraw(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovWithdraw(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1315,9 +1374,10 @@ func (m *ListRequest) Size() (n int) {
_ = l _ = l
l = m.OwnerID.Size() l = m.OwnerID.Size()
n += 1 + l + sovWithdraw(uint64(l)) n += 1 + l + sovWithdraw(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovWithdraw(uint64(m.TTL)) n += 2 + l + sovWithdraw(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovWithdraw(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1358,9 +1418,10 @@ func (m *DeleteRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovWithdraw(uint64(l)) n += 1 + l + sovWithdraw(uint64(l))
} }
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovWithdraw(uint64(m.TTL)) n += 2 + l + sovWithdraw(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovWithdraw(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1689,11 +1750,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 3: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowWithdraw return ErrIntOverflowWithdraw
@ -1703,11 +1764,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdraw
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipWithdraw(dAtA[iNdEx:]) skippy, err := skipWithdraw(dAtA[iNdEx:])
@ -2007,11 +2115,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
m.Signature = []byte{} m.Signature = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowWithdraw return ErrIntOverflowWithdraw
@ -2021,11 +2129,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdraw
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipWithdraw(dAtA[iNdEx:]) skippy, err := skipWithdraw(dAtA[iNdEx:])
@ -2200,11 +2355,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowWithdraw return ErrIntOverflowWithdraw
@ -2214,11 +2369,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdraw
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipWithdraw(dAtA[iNdEx:]) skippy, err := skipWithdraw(dAtA[iNdEx:])
@ -2494,11 +2696,11 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error {
m.Signature = []byte{} m.Signature = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 5: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowWithdraw return ErrIntOverflowWithdraw
@ -2508,11 +2710,58 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWithdraw
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthWithdraw
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthWithdraw
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipWithdraw(dAtA[iNdEx:]) skippy, err := skipWithdraw(dAtA[iNdEx:])

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package accounting; package accounting;
option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; option go_package = "github.com/nspcc-dev/neofs-proto/accounting";
import "service/meta.proto";
import "service/verify.proto";
import "decimal/decimal.proto"; import "decimal/decimal.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -34,12 +36,13 @@ message Item {
message GetRequest { message GetRequest {
// ID is cheque identifier // ID is cheque identifier
bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false];
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 3; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message GetResponse { message GetResponse {
@ -49,18 +52,19 @@ message GetResponse {
message PutRequest { message PutRequest {
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// Amount of funds // Amount of funds
decimal.Decimal Amount = 2; decimal.Decimal Amount = 2;
// Height is the neo blockchain height until the cheque is valid // Height is the neo blockchain height until the cheque is valid
uint64 Height = 3; uint64 Height = 3;
// MessageID is a nonce for uniq request (UUIDv4) // MessageID is a nonce for uniq request (UUIDv4)
bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false];
// Signature is a signature of the sent request // Signature is a signature of the sent request
bytes Signature = 5; bytes Signature = 5;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 6; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message PutResponse { message PutResponse {
// ID is cheque identifier // ID is cheque identifier
@ -69,10 +73,11 @@ message PutResponse {
message ListRequest { message ListRequest {
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 2; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message ListResponse { message ListResponse {
@ -82,16 +87,17 @@ message ListResponse {
message DeleteRequest { message DeleteRequest {
// ID is cheque identifier // ID is cheque identifier
bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false];
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// MessageID is a nonce for uniq request (UUIDv4) // MessageID is a nonce for uniq request (UUIDv4)
bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false];
// Signature is a signature of the sent request // Signature is a signature of the sent request
bytes Signature = 4; bytes Signature = 4;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 5; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
// DeleteResponse is empty // DeleteResponse is empty

View file

@ -6,6 +6,3 @@ import (
// NodeType type alias. // NodeType type alias.
type NodeType = service.NodeRole type NodeType = service.NodeRole
// SetTTL sets ttl to Request to satisfy TTLRequest interface.
func (m *Request) SetTTL(v uint32) { m.TTL = v }

View file

@ -8,6 +8,7 @@ import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
service "github.com/nspcc-dev/neofs-proto/service"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -32,12 +33,13 @@ type Request struct {
Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"`
// Info contains information about node // Info contains information about node
Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *Request) Reset() { *m = Request{} } func (m *Request) Reset() { *m = Request{} }
@ -76,13 +78,6 @@ func (m *Request) GetInfo() NodeInfo {
return NodeInfo{} return NodeInfo{}
} }
func (m *Request) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
func init() { func init() {
proto.RegisterType((*Request)(nil), "bootstrap.Request") proto.RegisterType((*Request)(nil), "bootstrap.Request")
} }
@ -90,25 +85,29 @@ func init() {
func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) }
var fileDescriptor_21bce759c9d8eb63 = []byte{ var fileDescriptor_21bce759c9d8eb63 = []byte{
// 284 bytes of a gzipped FileDescriptorProto // 342 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xca, 0xcf, 0x2f, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbd, 0x4e, 0xeb, 0x30,
0x29, 0x2e, 0x29, 0x4a, 0x2c, 0xd0, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0x14, 0xae, 0xaf, 0x72, 0xfb, 0xe3, 0xbb, 0xf9, 0x16, 0x11, 0x65, 0x48, 0xaa, 0x4e, 0x15, 0x22,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x4b, 0x48, 0x89, 0x22, 0xd4, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x89, 0xd4, 0x2e, 0x8c, 0x55, 0xc4, 0x00, 0x43, 0x11, 0x0a, 0x88, 0x81, 0xcd, 0x71, 0x4e, 0x4a,
0x43, 0x54, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0x86, 0xc6, 0xc6, 0x76, 0x2b, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x11, 0x43, 0x84, 0x82, 0xc4,
0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0x85, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc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x7e,
0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x42, 0xbc, 0x0f, 0x37, 0x2b, 0x89, 0x0d, 0x2c, 0x60, 0x0c, 0x08, 0x65, 0x34, 0xde, 0xf1, 0x14, 0xf7, 0xa2, 0xfd, 0x86, 0x64, 0x82, 0x3b, 0xb7, 0x92, 0x33, 0x50,
0x00, 0x00, 0xff, 0xff, 0xdf, 0x93, 0xe2, 0x48, 0x70, 0x01, 0x00, 0x00, 0x8a, 0x90, 0xa3, 0xc5, 0x9b, 0x3c, 0xa7, 0x7f, 0x84, 0xdd, 0x09, 0x09, 0x34, 0x9d, 0x51, 0x11,
0x4d, 0x37, 0x95, 0x8b, 0xb6, 0x95, 0x8b, 0x5e, 0x2b, 0x17, 0xbd, 0x57, 0x2e, 0x7a, 0xf9, 0x70,
0x5b, 0x8f, 0x67, 0x47, 0x7d, 0x17, 0x4a, 0x30, 0xe6, 0xa7, 0xb0, 0x0a, 0x0b, 0xe0, 0x99, 0xf2,
0x77, 0x6d, 0x1f, 0xb2, 0x92, 0xb6, 0x01, 0x26, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xcb,
0xf7, 0x92, 0x09, 0x02, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -217,11 +216,30 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintService(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x18 return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) size, err := m.Info.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -262,9 +280,10 @@ func (m *Request) Size() (n int) {
} }
l = m.Info.Size() l = m.Info.Size()
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovService(uint64(m.TTL)) n += 2 + l + sovService(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -358,11 +377,11 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 3: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowService return ErrIntOverflowService
@ -372,11 +391,58 @@ func (m *Request) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package bootstrap; package bootstrap;
option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap";
import "service/meta.proto";
import "service/verify.proto";
import "bootstrap/types.proto"; import "bootstrap/types.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -17,10 +19,11 @@ service Bootstrap {
message Request { message Request {
// Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2)
int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"];
// Info contains information about node // Info contains information about node
bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 3; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }

View file

@ -19,18 +19,6 @@ type (
MessageID = refs.MessageID MessageID = refs.MessageID
) )
// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface.
func (m *GetRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface.
func (m *PutRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface.
func (m *ListRequest) SetTTL(v uint32) { m.TTL = v }
// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface.
func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v }
// SetSignature sets signature to PutRequest to satisfy SignedRequest interface. // SetSignature sets signature to PutRequest to satisfy SignedRequest interface.
func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } func (m *PutRequest) SetSignature(v []byte) { m.Signature = v }

View file

@ -8,6 +8,7 @@ import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
service "github.com/nspcc-dev/neofs-proto/service"
netmap "github.com/nspcc-dev/netmap" netmap "github.com/nspcc-dev/netmap"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
@ -39,12 +40,13 @@ type PutRequest struct {
Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"`
// Signature of the user (owner id) // Signature of the user (owner id)
Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *PutRequest) Reset() { *m = PutRequest{} } func (m *PutRequest) Reset() { *m = PutRequest{} }
@ -97,13 +99,6 @@ func (m *PutRequest) GetSignature() []byte {
return nil return nil
} }
func (m *PutRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type PutResponse struct { type PutResponse struct {
// CID (container id) is a SHA256 hash of the container structure // CID (container id) is a SHA256 hash of the container structure
CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"`
@ -144,14 +139,15 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo
type DeleteRequest struct { type DeleteRequest struct {
// CID (container id) is a SHA256 hash of the container structure // CID (container id) is a SHA256 hash of the container structure
CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"`
// TTL must be larger than zero, it decreased in every neofs-node
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"`
// Signature of the container owner // Signature of the container owner
Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` // RequestMetaHeader contains information about request meta headers (should be embedded into message)
XXX_unrecognized []byte `json:"-"` service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
XXX_sizecache int32 `json:"-"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
@ -183,13 +179,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
func (m *DeleteRequest) GetSignature() []byte { func (m *DeleteRequest) GetSignature() []byte {
if m != nil { if m != nil {
return m.Signature return m.Signature
@ -237,12 +226,13 @@ var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
type GetRequest struct { type GetRequest struct {
// CID (container id) is a SHA256 hash of the container structure // CID (container id) is a SHA256 hash of the container structure
CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) Reset() { *m = GetRequest{} }
@ -274,13 +264,6 @@ func (m *GetRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_GetRequest proto.InternalMessageInfo var xxx_messageInfo_GetRequest proto.InternalMessageInfo
func (m *GetRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type GetResponse struct { type GetResponse struct {
// Container is a structure that contains placement rules and owner id // Container is a structure that contains placement rules and owner id
Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"`
@ -328,12 +311,13 @@ func (m *GetResponse) GetContainer() *Container {
type ListRequest struct { type ListRequest struct {
// OwnerID is a wallet address // OwnerID is a wallet address
OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_unrecognized []byte `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ListRequest) Reset() { *m = ListRequest{} } func (m *ListRequest) Reset() { *m = ListRequest{} }
@ -365,13 +349,6 @@ func (m *ListRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ListRequest proto.InternalMessageInfo var xxx_messageInfo_ListRequest proto.InternalMessageInfo
func (m *ListRequest) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
type ListResponse struct { type ListResponse struct {
// CID (container id) is list of SHA256 hashes of the container structures // CID (container id) is list of SHA256 hashes of the container structures
CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"`
@ -423,40 +400,44 @@ func init() {
func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) }
var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{
// 520 bytes of a gzipped FileDescriptorProto // 586 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
0x10, 0xee, 0xd6, 0x69, 0xfa, 0xcb, 0xb8, 0xfd, 0x51, 0x56, 0x84, 0x1a, 0x0b, 0xdc, 0xc8, 0xa7, 0x14, 0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d6, 0xde, 0xfc, 0xee, 0x9f, 0x47, 0x67, 0x44, 0x9c, 0xd6, 0x0a, 0xd5, 0xc9, 0x1f, 0x17, 0xed, 0xe6, 0x3a, 0x2c, 0x37, 0x78, 0x02, 0x95,
0x7c, 0x20, 0x7f, 0x6e, 0x45, 0x37, 0x6b, 0xe7, 0x8e, 0xa7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xba, 0x50, 0xb5, 0x10, 0xb1, 0x32, 0x0f, 0xda, 0xad, 0x4b, 0x18, 0x99, 0x7e, 0x00, 0xa5,
0xa3, 0xe9, 0x55, 0x5c, 0x57, 0x04, 0x00, 0x00, 0x43, 0x5c, 0xdd, 0x34, 0xbf, 0x6a, 0x2b, 0x9b, 0x16, 0x9b, 0xfa, 0x08, 0xca, 0xb1, 0x4b, 0x5a,
0xe4, 0x0b, 0x0d, 0xd3, 0xf6, 0x2f, 0xe0, 0x49, 0x62, 0xf7, 0xe9, 0xd9, 0xb2, 0x4e, 0xce, 0x97,
0x75, 0xf2, 0x65, 0x59, 0x27, 0xdf, 0x96, 0x75, 0xf2, 0xfe, 0x7b, 0x7d, 0xe3, 0xf5, 0xaf, 0x9e,
0x68, 0x7f, 0xc4, 0xda, 0xc9, 0xa3, 0x9b, 0xc9, 0x0d, 0x2b, 0x02, 0x78, 0xf8, 0x33, 0x00, 0x00,
0xff, 0xff, 0xd2, 0x95, 0x12, 0x0c, 0x3c, 0x06, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -685,11 +666,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintService(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x30 return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if len(m.Signature) > 0 { if len(m.Signature) > 0 {
i -= len(m.Signature) i -= len(m.Signature)
copy(dAtA[i:], m.Signature) copy(dAtA[i:], m.Signature)
@ -796,17 +796,36 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if len(m.Signature) > 0 { if len(m.Signature) > 0 {
i -= len(m.Signature) i -= len(m.Signature)
copy(dAtA[i:], m.Signature) copy(dAtA[i:], m.Signature)
i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) i = encodeVarintService(dAtA, i, uint64(len(m.Signature)))
i-- i--
dAtA[i] = 0x1a dAtA[i] = 0x12
}
if m.TTL != 0 {
i = encodeVarintService(dAtA, i, uint64(m.TTL))
i--
dAtA[i] = 0x10
} }
{ {
size := m.CID.Size() size := m.CID.Size()
@ -872,11 +891,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintService(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x10 return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size := m.CID.Size() size := m.CID.Size()
i -= size i -= size
@ -953,11 +991,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
if m.TTL != 0 { {
i = encodeVarintService(dAtA, i, uint64(m.TTL)) size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
i-- if err != nil {
dAtA[i] = 0x10 return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{ {
size := m.OwnerID.Size() size := m.OwnerID.Size()
i -= size i -= size
@ -1042,9 +1099,10 @@ func (m *PutRequest) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
} }
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovService(uint64(m.TTL)) n += 2 + l + sovService(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1073,13 +1131,14 @@ func (m *DeleteRequest) Size() (n int) {
_ = l _ = l
l = m.CID.Size() l = m.CID.Size()
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
if m.TTL != 0 {
n += 1 + sovService(uint64(m.TTL))
}
l = len(m.Signature) l = len(m.Signature)
if l > 0 { if l > 0 {
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
} }
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1106,9 +1165,10 @@ func (m *GetRequest) Size() (n int) {
_ = l _ = l
l = m.CID.Size() l = m.CID.Size()
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovService(uint64(m.TTL)) n += 2 + l + sovService(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1139,9 +1199,10 @@ func (m *ListRequest) Size() (n int) {
_ = l _ = l
l = m.OwnerID.Size() l = m.OwnerID.Size()
n += 1 + l + sovService(uint64(l)) n += 1 + l + sovService(uint64(l))
if m.TTL != 0 { l = m.RequestMetaHeader.Size()
n += 1 + sovService(uint64(m.TTL)) n += 2 + l + sovService(uint64(l))
} l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -1353,11 +1414,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
m.Signature = []byte{} m.Signature = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowService return ErrIntOverflowService
@ -1367,11 +1428,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])
@ -1547,25 +1655,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error {
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
}
m.TTL = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TTL |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
} }
@ -1599,6 +1688,72 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error {
m.Signature = []byte{} m.Signature = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])
@ -1740,11 +1895,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowService return ErrIntOverflowService
@ -1754,11 +1909,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])
@ -1936,11 +2138,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 98:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
} }
m.TTL = 0 var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowService return ErrIntOverflowService
@ -1950,11 +2152,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.TTL |= uint32(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package container; package container;
option go_package = "github.com/nspcc-dev/neofs-proto/container"; option go_package = "github.com/nspcc-dev/neofs-proto/container";
import "service/meta.proto";
import "service/verify.proto";
import "container/types.proto"; import "container/types.proto";
import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/nspcc-dev/netmap/selector.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -28,23 +30,24 @@ service Service {
message PutRequest { message PutRequest {
// MessageID is a nonce for uniq container id calculation // MessageID is a nonce for uniq container id calculation
bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false];
// Capacity defines amount of data that can be stored in the container (doesn't used for now). // Capacity defines amount of data that can be stored in the container (doesn't used for now).
uint64 Capacity = 2; uint64 Capacity = 2;
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// Rules define storage policy for the object inside the container. // Rules define storage policy for the object inside the container.
netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false];
// Signature of the user (owner id) // Signature of the user (owner id)
bytes Signature = 5; bytes Signature = 5;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 6; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message PutResponse { message PutResponse {
@ -54,14 +57,15 @@ message PutResponse {
message DeleteRequest { message DeleteRequest {
// CID (container id) is a SHA256 hash of the container structure // CID (container id) is a SHA256 hash of the container structure
bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint32 TTL = 2;
// Signature of the container owner // Signature of the container owner
bytes Signature = 3; bytes Signature = 2;
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
// DeleteResponse is empty because delete operation is asynchronous and done // DeleteResponse is empty because delete operation is asynchronous and done
@ -71,11 +75,12 @@ message DeleteResponse { }
message GetRequest { message GetRequest {
// CID (container id) is a SHA256 hash of the container structure // CID (container id) is a SHA256 hash of the container structure
bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 2; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message GetResponse { message GetResponse {
@ -85,11 +90,11 @@ message GetResponse {
message ListRequest { message ListRequest {
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
// TTL must be larger than zero, it decreased in every neofs-node service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
uint32 TTL = 2; service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message ListResponse { message ListResponse {

View file

@ -31,8 +31,7 @@ type (
// All object operations must have TTL, Epoch, Container ID and // All object operations must have TTL, Epoch, Container ID and
// permission of usage previous network map. // permission of usage previous network map.
Request interface { Request interface {
service.TTLRequest service.MetaHeader
service.EpochRequest
CID() CID CID() CID
AllowPreviousNetMap() bool AllowPreviousNetMap() bool
@ -124,54 +123,6 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) }
// NotFull checks if protobuf stream provided whole object for put operation. // NotFull checks if protobuf stream provided whole object for put operation.
func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) }
// GetTTL returns TTL value from object put request.
func (m *PutRequest) GetTTL() uint32 { return m.GetHeader().TTL }
// GetEpoch returns epoch value from object put request.
func (m *PutRequest) GetEpoch() uint64 { return m.GetHeader().GetEpoch() }
// SetTTL sets TTL value into object put request.
func (m *PutRequest) SetTTL(ttl uint32) { m.GetHeader().TTL = ttl }
// SetTTL sets TTL value into object get request.
func (m *GetRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetTTL sets TTL value into object head request.
func (m *HeadRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetTTL sets TTL value into object search request.
func (m *SearchRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetTTL sets TTL value into object delete request.
func (m *DeleteRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetTTL sets TTL value into object get range request.
func (m *GetRangeRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetTTL sets TTL value into object get range hash request.
func (m *GetRangeHashRequest) SetTTL(ttl uint32) { m.TTL = ttl }
// SetEpoch sets epoch value into object put request.
func (m *PutRequest) SetEpoch(v uint64) { m.GetHeader().Epoch = v }
// SetEpoch sets epoch value into object get request.
func (m *GetRequest) SetEpoch(v uint64) { m.Epoch = v }
// SetEpoch sets epoch value into object head request.
func (m *HeadRequest) SetEpoch(v uint64) { m.Epoch = v }
// SetEpoch sets epoch value into object search request.
func (m *SearchRequest) SetEpoch(v uint64) { m.Epoch = v }
// SetEpoch sets epoch value into object delete request.
func (m *DeleteRequest) SetEpoch(v uint64) { m.Epoch = v }
// SetEpoch sets epoch value into object get range request.
func (m *GetRangeRequest) SetEpoch(v uint64) { m.Epoch = v }
// SetEpoch sets epoch value into object get range hash request.
func (m *GetRangeHashRequest) SetEpoch(v uint64) { m.Epoch = v }
// CID returns container id value from object put request. // CID returns container id value from object put request.
func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID } func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID }

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,8 @@ option go_package = "github.com/nspcc-dev/neofs-proto/object";
import "refs/types.proto"; import "refs/types.proto";
import "object/types.proto"; import "object/types.proto";
import "session/types.proto"; import "session/types.proto";
import "service/meta.proto";
import "service/verify.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true; option (gogoproto.stable_marshaler_all) = true;
@ -52,14 +54,12 @@ service Service {
} }
message GetRequest { message GetRequest {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Address of object (container id + object id) // Address of object (container id + object id)
refs.Address Address = 2 [(gogoproto.nullable) = false]; refs.Address Address = 1 [(gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 3; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message GetResponse { message GetResponse {
@ -73,16 +73,10 @@ message GetResponse {
message PutRequest { message PutRequest {
message PutHeader { message PutHeader {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Object with at least container id and owner id fields // Object with at least container id and owner id fields
Object Object = 2; Object Object = 1;
// TTL must be larger than zero, it decreased in every neofs-node
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint32 TTL = 3;
// Token with session public key and user's signature // Token with session public key and user's signature
session.Token Token = 4; session.Token Token = 2;
} }
oneof R { oneof R {
@ -91,6 +85,11 @@ message PutRequest {
// Chunk should be a remaining message in stream should be chunks // Chunk should be a remaining message in stream should be chunks
bytes Chunk = 2; bytes Chunk = 2;
} }
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message PutResponse { message PutResponse {
@ -98,18 +97,16 @@ message PutResponse {
refs.Address Address = 1 [(gogoproto.nullable) = false]; refs.Address Address = 1 [(gogoproto.nullable) = false];
} }
message DeleteRequest { message DeleteRequest {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Address of object (container id + object id) // Address of object (container id + object id)
refs.Address Address = 2 [(gogoproto.nullable) = false]; refs.Address Address = 1 [(gogoproto.nullable) = false];
// OwnerID is a wallet address // OwnerID is a wallet address
bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"];
// TTL must be larger than zero, it decreased in every neofs-node
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint32 TTL = 4;
// Token with session public key and user's signature // Token with session public key and user's signature
session.Token Token = 5; session.Token Token = 3;
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
// DeleteResponse is empty because we cannot guarantee permanent object removal // DeleteResponse is empty because we cannot guarantee permanent object removal
@ -117,16 +114,14 @@ message DeleteRequest {
message DeleteResponse {} message DeleteResponse {}
message HeadRequest { message HeadRequest {
// Epoch should be empty on user side, node sets epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Address of object (container id + object id) // Address of object (container id + object id)
refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"];
// FullHeaders can be set true for extended headers in the object // FullHeaders can be set true for extended headers in the object
bool FullHeaders = 3; bool FullHeaders = 2;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 4; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message HeadResponse { message HeadResponse {
// Object without payload // Object without payload
@ -134,18 +129,16 @@ message HeadResponse {
} }
message SearchRequest { message SearchRequest {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Version of search query format // Version of search query format
uint32 Version = 2; uint32 Version = 1;
// ContainerID for searching the object // ContainerID for searching the object
bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; bytes ContainerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"];
// Query in the binary serialized format // Query in the binary serialized format
bytes Query = 4; bytes Query = 3;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 5; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message SearchResponse { message SearchResponse {
@ -154,16 +147,14 @@ message SearchResponse {
} }
message GetRangeRequest { message GetRangeRequest {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Address of object (container id + object id) // Address of object (container id + object id)
refs.Address Address = 2 [(gogoproto.nullable) = false]; refs.Address Address = 1 [(gogoproto.nullable) = false];
// Ranges of object's payload to return // Ranges of object's payload to return
repeated Range Ranges = 3 [(gogoproto.nullable) = false]; repeated Range Ranges = 2 [(gogoproto.nullable) = false];
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 4; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message GetRangeResponse { message GetRangeResponse {
@ -172,18 +163,16 @@ message GetRangeResponse {
} }
message GetRangeHashRequest { message GetRangeHashRequest {
// Epoch is set by user to 0, node set epoch to the actual value
// Deprecated: will be replaced with RequestMetaHeader (see develop branch)
uint64 Epoch = 1;
// Address of object (container id + object id) // Address of object (container id + object id)
refs.Address Address = 2 [(gogoproto.nullable) = false]; refs.Address Address = 1 [(gogoproto.nullable) = false];
// Ranges of object's payload to calculate homomorphic hash // Ranges of object's payload to calculate homomorphic hash
repeated Range Ranges = 3 [(gogoproto.nullable) = false]; repeated Range Ranges = 2 [(gogoproto.nullable) = false];
// Salt is used to XOR object's payload ranges before hashing, it can be nil // Salt is used to XOR object's payload ranges before hashing, it can be nil
bytes Salt = 4; bytes Salt = 3;
// TTL must be larger than zero, it decreased in every neofs-node // RequestMetaHeader contains information about request meta headers (should be embedded into message)
// Deprecated: will be replaced with RequestMetaHeader (see develop branch) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
uint32 TTL = 5; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message GetRangeHashResponse { message GetRangeHashResponse {

View file

@ -4,6 +4,7 @@ import (
"io" "io"
"code.cloudfoundry.org/bytefmt" "code.cloudfoundry.org/bytefmt"
"github.com/nspcc-dev/neofs-proto/service"
"github.com/nspcc-dev/neofs-proto/session" "github.com/nspcc-dev/neofs-proto/session"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -49,14 +50,11 @@ func SendPutRequest(s Service_PutClient, obj *Object, epoch uint64, ttl uint32)
// into header of object put request. // into header of object put request.
func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest { func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest {
return &PutRequest{ return &PutRequest{
R: &PutRequest_Header{ RequestMetaHeader: service.RequestMetaHeader{TTL: ttl, Epoch: epoch},
Header: &PutRequest_PutHeader{ R: &PutRequest_Header{Header: &PutRequest_PutHeader{
Epoch: epoch, Object: obj,
Object: obj, Token: token,
TTL: ttl, }},
Token: token,
},
},
} }
} }

90
service/meta.go Normal file
View file

@ -0,0 +1,90 @@
package service
import (
"github.com/nspcc-dev/neofs-proto/internal"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type (
// MetaHeader contains meta information of request.
// It provides methods to get or set meta information
// and reset meta header.
MetaHeader interface {
ResetMeta()
// TTLRequest to verify and update ttl requests.
GetTTL() uint32
SetTTL(uint32)
// EpochRequest gives possibility to get or set epoch in RPC Requests.
GetEpoch() uint64
SetEpoch(v uint64)
}
// TTLCondition is closure, that allows to validate request with ttl
TTLCondition func(ttl uint32) error
)
const (
// ZeroTTL is empty ttl, should produce ErrZeroTTL.
ZeroTTL = iota
// NonForwardingTTL is a ttl that allows direct connections only.
NonForwardingTTL
// SingleForwardingTTL is a ttl that allows connections through another node.
SingleForwardingTTL
)
const (
// ErrZeroTTL is raised when zero ttl is passed.
ErrZeroTTL = internal.Error("zero ttl")
// ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode.
ErrIncorrectTTL = internal.Error("incorrect ttl")
)
// SetTTL sets TTL to RequestMetaHeader
func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v }
// SetEpoch sets Epoch to RequestMetaHeader
func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v }
// ResetMeta sets RequestMetaHeader to empty value
func (m *RequestMetaHeader) ResetMeta() { m.Reset() }
// IRNonForwarding condition that allows NonForwardingTTL only for IR
func IRNonForwarding(role NodeRole) TTLCondition {
return func(ttl uint32) error {
if ttl == NonForwardingTTL && role != InnerRingNode {
return ErrIncorrectTTL
}
return nil
}
}
// ProcessRequestTTL validates and update ttl requests.
func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error {
var ttl = req.GetTTL()
if ttl == ZeroTTL {
return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err()
}
for i := range cond {
if cond[i] == nil {
continue
}
// check specific condition:
if err := cond[i](ttl); err != nil {
return status.New(codes.InvalidArgument, err.Error()).Err()
}
}
req.SetTTL(ttl - 1)
return nil
}

346
service/meta.pb.go Normal file
View file

@ -0,0 +1,346 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: service/meta.proto
package service
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type RequestMetaHeader struct {
TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"`
Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} }
func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) }
func (*RequestMetaHeader) ProtoMessage() {}
func (*RequestMetaHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_a638867e7b43457c, []int{0}
}
func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *RequestMetaHeader) XXX_Merge(src proto.Message) {
xxx_messageInfo_RequestMetaHeader.Merge(m, src)
}
func (m *RequestMetaHeader) XXX_Size() int {
return m.Size()
}
func (m *RequestMetaHeader) XXX_DiscardUnknown() {
xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m)
}
var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo
func (m *RequestMetaHeader) GetTTL() uint32 {
if m != nil {
return m.TTL
}
return 0
}
func (m *RequestMetaHeader) GetEpoch() uint64 {
if m != nil {
return m.Epoch
}
return 0
}
func init() {
proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader")
}
func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) }
var fileDescriptor_a638867e7b43457c = []byte{
// 185 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a,
0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62,
0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7,
0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8,
0x53, 0xb2, 0xe6, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4,
0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60,
0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98,
0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x27, 0xbb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92,
0x63, 0xbc, 0xf1, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0xa2, 0x34,
0x90, 0x5c, 0x90, 0x57, 0x5c, 0x90, 0x9c, 0xac, 0x9b, 0x92, 0x5a, 0xa6, 0x9f, 0x97, 0x9a, 0x9f,
0x56, 0xac, 0x0b, 0xb1, 0x1f, 0xea, 0xd6, 0x24, 0x36, 0x30, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff,
0xff, 0x73, 0x6f, 0x01, 0x49, 0xd1, 0x00, 0x00, 0x00,
}
func (m *RequestMetaHeader) 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 *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Epoch != 0 {
i = encodeVarintMeta(dAtA, i, uint64(m.Epoch))
i--
dAtA[i] = 0x10
}
if m.TTL != 0 {
i = encodeVarintMeta(dAtA, i, uint64(m.TTL))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintMeta(dAtA []byte, offset int, v uint64) int {
offset -= sovMeta(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *RequestMetaHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.TTL != 0 {
n += 1 + sovMeta(uint64(m.TTL))
}
if m.Epoch != 0 {
n += 1 + sovMeta(uint64(m.Epoch))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovMeta(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozMeta(x uint64) (n int) {
return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *RequestMetaHeader) 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 ErrIntOverflowMeta
}
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: RequestMetaHeader: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
}
m.TTL = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMeta
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.TTL |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType)
}
m.Epoch = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMeta
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Epoch |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipMeta(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthMeta
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthMeta
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipMeta(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMeta
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMeta
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMeta
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthMeta
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupMeta
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthMeta
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group")
)

12
service/meta.proto Normal file
View file

@ -0,0 +1,12 @@
syntax = "proto3";
package service;
option go_package = "github.com/nspcc-dev/neofs-proto/service";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
message RequestMetaHeader {
uint32 TTL = 1;
uint64 Epoch = 2;
}

70
service/meta_test.go Normal file
View file

@ -0,0 +1,70 @@
package service
import (
"testing"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type mockedRequest struct {
msg string
name string
role NodeRole
code codes.Code
RequestMetaHeader
}
func TestMetaRequest(t *testing.T) {
tests := []mockedRequest{
{
role: InnerRingNode,
name: "direct to ir node",
RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL},
},
{
role: StorageNode,
code: codes.InvalidArgument,
msg: ErrIncorrectTTL.Error(),
name: "direct to storage node",
RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL},
},
{
role: StorageNode,
msg: ErrZeroTTL.Error(),
code: codes.InvalidArgument,
name: "zero ttl",
RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL},
},
{
role: InnerRingNode,
name: "default to ir node",
RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL},
},
{
role: StorageNode,
name: "default to storage node",
RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL},
},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
before := tt.GetTTL()
err := ProcessRequestTTL(&tt, IRNonForwarding(tt.role))
if tt.msg != "" {
require.Errorf(t, err, tt.msg)
state, ok := status.FromError(err)
require.True(t, ok)
require.Equal(t, state.Code(), tt.code)
require.Equal(t, state.Message(), tt.msg)
} else {
require.NoError(t, err)
require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL())
}
})
}
}

View file

@ -1,8 +1,9 @@
package service package service
import ( import (
"github.com/stretchr/testify/require"
"testing" "testing"
"github.com/stretchr/testify/require"
) )
func TestNodeRole_String(t *testing.T) { func TestNodeRole_String(t *testing.T) {

View file

@ -1,45 +0,0 @@
package service
import (
"github.com/nspcc-dev/neofs-proto/internal"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// TTLRequest to verify and update ttl requests.
type TTLRequest interface {
GetTTL() uint32
SetTTL(uint32)
}
const (
// ZeroTTL is empty ttl, should produce ErrZeroTTL.
ZeroTTL = iota
// NonForwardingTTL is a ttl that allows direct connections only.
NonForwardingTTL
// SingleForwardingTTL is a ttl that allows connections through another node.
SingleForwardingTTL
// ErrZeroTTL is raised when zero ttl is passed.
ErrZeroTTL = internal.Error("zero ttl")
// ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode.
ErrIncorrectTTL = internal.Error("incorrect ttl")
)
// CheckTTLRequest validates and update ttl requests.
func CheckTTLRequest(req TTLRequest, role NodeRole) error {
var ttl = req.GetTTL()
if ttl == ZeroTTL {
return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err()
} else if ttl == NonForwardingTTL && role != InnerRingNode {
return status.New(codes.InvalidArgument, ErrIncorrectTTL.Error()).Err()
}
req.SetTTL(ttl - 1)
return nil
}

View file

@ -1,72 +0,0 @@
package service
import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"testing"
)
type mockedRequest struct {
msg string
ttl uint32
name string
role NodeRole
code codes.Code
}
func (m *mockedRequest) SetTTL(v uint32) { m.ttl = v }
func (m mockedRequest) GetTTL() uint32 { return m.ttl }
func TestCheckTTLRequest(t *testing.T) {
tests := []mockedRequest{
{
ttl: NonForwardingTTL,
role: InnerRingNode,
name: "direct to ir node",
},
{
ttl: NonForwardingTTL,
role: StorageNode,
code: codes.InvalidArgument,
msg: ErrIncorrectTTL.Error(),
name: "direct to storage node",
},
{
ttl: ZeroTTL,
role: StorageNode,
msg: ErrZeroTTL.Error(),
code: codes.InvalidArgument,
name: "zero ttl",
},
{
ttl: SingleForwardingTTL,
role: InnerRingNode,
name: "default to ir node",
},
{
ttl: SingleForwardingTTL,
role: StorageNode,
name: "default to storage node",
},
}
for i := range tests {
tt := tests[i]
t.Run(tt.name, func(t *testing.T) {
before := tt.ttl
err := CheckTTLRequest(&tt, tt.role)
if tt.msg != "" {
require.Errorf(t, err, tt.msg)
state, ok := status.FromError(err)
require.True(t, ok)
require.Equal(t, state.Code(), tt.code)
require.Equal(t, state.Message(), tt.msg)
} else {
require.NoError(t, err)
require.NotEqualf(t, before, tt.ttl, "ttl should be changed: %d vs %d", before, tt.ttl)
}
})
}
}

179
service/verify.go Normal file
View file

@ -0,0 +1,179 @@
package service
import (
"crypto/ecdsa"
"github.com/gogo/protobuf/proto"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-proto/internal"
"github.com/pkg/errors"
)
type (
// VerifiableRequest adds possibility to sign and verify request header
VerifiableRequest interface {
proto.Message
Marshal() ([]byte, error)
AddSignature(*RequestVerificationHeader_Signature)
GetSignatures() []*RequestVerificationHeader_Signature
SetSignatures([]*RequestVerificationHeader_Signature)
}
// MaintainableRequest adds possibility to set and get (+validate)
// owner (client) public key from RequestVerificationHeader.
MaintainableRequest interface {
proto.Message
GetOwner() (*ecdsa.PublicKey, error)
SetOwner(*ecdsa.PublicKey, []byte)
GetLastPeer() (*ecdsa.PublicKey, error)
}
)
const (
// ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign
ErrCannotLoadPublicKey = internal.Error("cannot load public key")
// ErrCannotFindOwner is raised when signatures empty in GetOwner
ErrCannotFindOwner = internal.Error("cannot find owner public key")
)
// SetSignatures replaces signatures stored in RequestVerificationHeader
func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) {
m.Signatures = signatures
}
// AddSignature adds new Signature into RequestVerificationHeader
func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_Signature) {
if sig == nil {
return
}
m.Signatures = append(m.Signatures, sig)
}
// SetOwner adds origin (sign and public key) of owner (client) into first signature.
func (m *RequestVerificationHeader) SetOwner(pub *ecdsa.PublicKey, sign []byte) {
if len(m.Signatures) == 0 || pub == nil {
return
}
m.Signatures[0].Origin = &RequestVerificationHeader_Sign{
Sign: sign,
Peer: crypto.MarshalPublicKey(pub),
}
}
// GetOwner tries to get owner (client) public key from signatures.
// If signatures contains not empty Origin, we should try to validate,
// that session key was signed by owner (client), otherwise return error.
func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) {
if len(m.Signatures) == 0 {
return nil, ErrCannotFindOwner
}
// if first signature contains origin, we should try to validate session key
if m.Signatures[0].Origin != nil {
owner := crypto.UnmarshalPublicKey(m.Signatures[0].Origin.Peer)
if owner == nil {
return nil, ErrCannotLoadPublicKey
} else if err := crypto.Verify(owner, m.Signatures[0].Peer, m.Signatures[0].Origin.Sign); err != nil {
return nil, errors.Wrap(err, "could not verify session token")
}
return owner, nil
} else if key := crypto.UnmarshalPublicKey(m.Signatures[0].Peer); key != nil {
return key, nil
}
return nil, ErrCannotLoadPublicKey
}
// GetLastPeer tries to get last peer public key from signatures.
// If signatures has zero length, returns ErrCannotFindOwner.
// If signatures has length equal to one, uses GetOwner.
// Otherwise tries to unmarshal last peer public key.
func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) {
switch ln := len(m.Signatures); ln {
case 0:
return nil, ErrCannotFindOwner
case 1:
return m.GetOwner()
default:
if key := crypto.UnmarshalPublicKey(m.Signatures[ln-1].Peer); key != nil {
return key, nil
}
return nil, ErrCannotLoadPublicKey
}
}
func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeader_Signature, error) {
sign, err := crypto.Sign(key, data)
if err != nil {
return nil, err
}
return &RequestVerificationHeader_Signature{
RequestVerificationHeader_Sign: RequestVerificationHeader_Sign{
Sign: sign,
Peer: crypto.MarshalPublicKey(&key.PublicKey),
},
}, nil
}
// SignRequestHeader receives private key and request with RequestVerificationHeader,
// tries to marshal and sign request with passed PrivateKey, after that adds
// new signature to headers. If something went wrong, returns error.
func SignRequestHeader(key *ecdsa.PrivateKey, req VerifiableRequest) error {
msg := proto.Clone(req).(VerifiableRequest)
// ignore meta header
if meta, ok := msg.(MetaHeader); ok {
meta.ResetMeta()
}
data, err := msg.Marshal()
if err != nil {
return err
}
signature, err := newSignature(key, data)
if err != nil {
return err
}
req.AddSignature(signature)
return nil
}
// VerifyRequestHeader receives request with RequestVerificationHeader,
// tries to marshal and verify each signature from request
// If something went wrong, returns error.
func VerifyRequestHeader(req VerifiableRequest) error {
msg := proto.Clone(req).(VerifiableRequest)
// ignore meta header
if meta, ok := msg.(MetaHeader); ok {
meta.ResetMeta()
}
signatures := msg.GetSignatures()
for i := range signatures {
msg.SetSignatures(signatures[:i])
peer := signatures[i].GetPeer()
sign := signatures[i].GetSign()
key := crypto.UnmarshalPublicKey(peer)
if key == nil {
return errors.Wrapf(ErrCannotLoadPublicKey, "%d: %02x", i, peer)
}
if data, err := msg.Marshal(); err != nil {
return errors.Wrapf(err, "%d: %02x", i, peer)
} else if err := crypto.Verify(key, data, sign); err != nil {
return errors.Wrapf(err, "%d: %02x", i, peer)
}
}
return nil
}

813
service/verify.pb.go Normal file
View file

@ -0,0 +1,813 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: service/verify.proto
package service
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type RequestVerificationHeader struct {
Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} }
func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) }
func (*RequestVerificationHeader) ProtoMessage() {}
func (*RequestVerificationHeader) Descriptor() ([]byte, []int) {
return fileDescriptor_4bdd5bc50ec96238, []int{0}
}
func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) {
xxx_messageInfo_RequestVerificationHeader.Merge(m, src)
}
func (m *RequestVerificationHeader) XXX_Size() int {
return m.Size()
}
func (m *RequestVerificationHeader) XXX_DiscardUnknown() {
xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m)
}
var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo
func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader_Signature {
if m != nil {
return m.Signatures
}
return nil
}
type RequestVerificationHeader_Sign struct {
Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"`
Peer []byte `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RequestVerificationHeader_Sign) Reset() { *m = RequestVerificationHeader_Sign{} }
func (m *RequestVerificationHeader_Sign) String() string { return proto.CompactTextString(m) }
func (*RequestVerificationHeader_Sign) ProtoMessage() {}
func (*RequestVerificationHeader_Sign) Descriptor() ([]byte, []int) {
return fileDescriptor_4bdd5bc50ec96238, []int{0, 0}
}
func (m *RequestVerificationHeader_Sign) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RequestVerificationHeader_Sign) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *RequestVerificationHeader_Sign) XXX_Merge(src proto.Message) {
xxx_messageInfo_RequestVerificationHeader_Sign.Merge(m, src)
}
func (m *RequestVerificationHeader_Sign) XXX_Size() int {
return m.Size()
}
func (m *RequestVerificationHeader_Sign) XXX_DiscardUnknown() {
xxx_messageInfo_RequestVerificationHeader_Sign.DiscardUnknown(m)
}
var xxx_messageInfo_RequestVerificationHeader_Sign proto.InternalMessageInfo
func (m *RequestVerificationHeader_Sign) GetSign() []byte {
if m != nil {
return m.Sign
}
return nil
}
func (m *RequestVerificationHeader_Sign) GetPeer() []byte {
if m != nil {
return m.Peer
}
return nil
}
type RequestVerificationHeader_Signature struct {
RequestVerificationHeader_Sign `protobuf:"bytes,1,opt,name=Sign,proto3,embedded=Sign" json:"Sign"`
Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} }
func (m *RequestVerificationHeader_Signature) String() string { return proto.CompactTextString(m) }
func (*RequestVerificationHeader_Signature) ProtoMessage() {}
func (*RequestVerificationHeader_Signature) Descriptor() ([]byte, []int) {
return fileDescriptor_4bdd5bc50ec96238, []int{0, 1}
}
func (m *RequestVerificationHeader_Signature) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RequestVerificationHeader_Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *RequestVerificationHeader_Signature) XXX_Merge(src proto.Message) {
xxx_messageInfo_RequestVerificationHeader_Signature.Merge(m, src)
}
func (m *RequestVerificationHeader_Signature) XXX_Size() int {
return m.Size()
}
func (m *RequestVerificationHeader_Signature) XXX_DiscardUnknown() {
xxx_messageInfo_RequestVerificationHeader_Signature.DiscardUnknown(m)
}
var xxx_messageInfo_RequestVerificationHeader_Signature proto.InternalMessageInfo
func (m *RequestVerificationHeader_Signature) GetOrigin() *RequestVerificationHeader_Sign {
if m != nil {
return m.Origin
}
return nil
}
func init() {
proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader")
proto.RegisterType((*RequestVerificationHeader_Sign)(nil), "service.RequestVerificationHeader.Sign")
proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature")
}
func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) }
var fileDescriptor_4bdd5bc50ec96238 = []byte{
// 270 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a,
0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7,
0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc,
0x82, 0xe8, 0x53, 0x5a, 0xcf, 0xc4, 0x25, 0x19, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x06,
0x32, 0x2f, 0x33, 0x39, 0xb1, 0x24, 0x33, 0x3f, 0xcf, 0x23, 0x35, 0x31, 0x25, 0xb5, 0x48, 0xc8,
0x87, 0x8b, 0x2b, 0x38, 0x33, 0x3d, 0x2f, 0xb1, 0xa4, 0xb4, 0x28, 0xb5, 0x58, 0x82, 0x51, 0x81,
0x59, 0x83, 0xdb, 0x48, 0x47, 0x0f, 0x6a, 0x95, 0x1e, 0x4e, 0x7d, 0x7a, 0x70, 0x4d, 0x41, 0x48,
0xfa, 0xa5, 0xf4, 0xb8, 0x58, 0x40, 0x3c, 0x21, 0x21, 0x08, 0x2d, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1,
0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19,
0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e,
0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94,
0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0xec, 0x4e, 0x3c, 0x92,
0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c,
0x96, 0x63, 0x88, 0xd2, 0x40, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32,
0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0x5d, 0x48, 0xa0, 0x43, 0xad, 0x49, 0x62, 0x03, 0x73, 0x8d,
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x15, 0xf6, 0x5e, 0xc8, 0x01, 0x00, 0x00,
}
func (m *RequestVerificationHeader) 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 *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RequestVerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Signatures) > 0 {
for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintVerify(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *RequestVerificationHeader_Sign) 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 *RequestVerificationHeader_Sign) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RequestVerificationHeader_Sign) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Peer) > 0 {
i -= len(m.Peer)
copy(dAtA[i:], m.Peer)
i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer)))
i--
dAtA[i] = 0x12
}
if len(m.Sign) > 0 {
i -= len(m.Sign)
copy(dAtA[i:], m.Sign)
i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *RequestVerificationHeader_Signature) 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 *RequestVerificationHeader_Signature) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RequestVerificationHeader_Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Origin != nil {
{
size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintVerify(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
{
size, err := m.RequestVerificationHeader_Sign.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintVerify(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintVerify(dAtA []byte, offset int, v uint64) int {
offset -= sovVerify(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *RequestVerificationHeader) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Signatures) > 0 {
for _, e := range m.Signatures {
l = e.Size()
n += 1 + l + sovVerify(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *RequestVerificationHeader_Sign) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Sign)
if l > 0 {
n += 1 + l + sovVerify(uint64(l))
}
l = len(m.Peer)
if l > 0 {
n += 1 + l + sovVerify(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *RequestVerificationHeader_Signature) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.RequestVerificationHeader_Sign.Size()
n += 1 + l + sovVerify(uint64(l))
if m.Origin != nil {
l = m.Origin.Size()
n += 1 + l + sovVerify(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovVerify(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozVerify(x uint64) (n int) {
return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *RequestVerificationHeader) 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 ErrIntOverflowVerify
}
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: RequestVerificationHeader: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signatures = append(m.Signatures, &RequestVerificationHeader_Signature{})
if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipVerify(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *RequestVerificationHeader_Sign) 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 ErrIntOverflowVerify
}
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: Sign: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Sign: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...)
if m.Sign == nil {
m.Sign = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Peer = append(m.Peer[:0], dAtA[iNdEx:postIndex]...)
if m.Peer == nil {
m.Peer = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipVerify(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *RequestVerificationHeader_Signature) 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 ErrIntOverflowVerify
}
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: Signature: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader_Sign", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader_Sign.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthVerify
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthVerify
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Origin == nil {
m.Origin = &RequestVerificationHeader_Sign{}
}
if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipVerify(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthVerify
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipVerify(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerify
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerify
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerify
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthVerify
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupVerify
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthVerify
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group")
)

20
service/verify.proto Normal file
View file

@ -0,0 +1,20 @@
syntax = "proto3";
package service;
option go_package = "github.com/nspcc-dev/neofs-proto/service";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
message RequestVerificationHeader {
message Sign {
bytes Sign = 1;
bytes Peer = 2;
}
message Signature {
Sign Sign = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
Sign Origin = 2;
}
repeated Signature Signatures = 1;
}

106
service/verify_test.go Normal file
View file

@ -0,0 +1,106 @@
package service
import (
"math"
"testing"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-crypto/test"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
)
func TestSignRequestHeader(t *testing.T) {
req := &TestRequest{
IntField: math.MaxInt32,
StringField: "TestRequestStringField",
BytesField: []byte("TestRequestBytesField"),
}
key := test.DecodeKey(0)
peer := crypto.MarshalPublicKey(&key.PublicKey)
data, err := req.Marshal()
require.NoError(t, err)
require.NoError(t, SignRequestHeader(key, req))
require.Len(t, req.Signatures, 1)
for i := range req.Signatures {
sign := req.Signatures[i].GetSign()
require.Equal(t, peer, req.Signatures[i].GetPeer())
require.NoError(t, crypto.Verify(&key.PublicKey, data, sign))
}
}
func TestVerifyRequestHeader(t *testing.T) {
req := &TestRequest{
IntField: math.MaxInt32,
StringField: "TestRequestStringField",
BytesField: []byte("TestRequestBytesField"),
RequestMetaHeader: RequestMetaHeader{TTL: 10},
}
for i := 0; i < 10; i++ {
req.TTL--
require.NoError(t, SignRequestHeader(test.DecodeKey(i), req))
}
require.NoError(t, VerifyRequestHeader(req))
}
func TestMaintainableRequest(t *testing.T) {
req := &TestRequest{
IntField: math.MaxInt32,
StringField: "TestRequestStringField",
BytesField: []byte("TestRequestBytesField"),
RequestMetaHeader: RequestMetaHeader{TTL: 10},
}
count := 10
owner := test.DecodeKey(count + 1)
for i := 0; i < count; i++ {
req.TTL--
key := test.DecodeKey(i)
require.NoError(t, SignRequestHeader(key, req))
// sign first key (session key) by owner key
if i == 0 {
sign, err := crypto.Sign(owner, crypto.MarshalPublicKey(&key.PublicKey))
require.NoError(t, err)
req.SetOwner(&owner.PublicKey, sign)
}
}
{ // Good case:
require.NoError(t, VerifyRequestHeader(req))
// validate, that first key (session key) was signed with owner
signatures := req.GetSignatures()
require.Len(t, signatures, count)
pub, err := req.GetOwner()
require.NoError(t, err)
require.Equal(t, &owner.PublicKey, pub)
}
{ // wrong owner:
req.Signatures[0].Origin = nil
pub, err := req.GetOwner()
require.NoError(t, err)
require.NotEqual(t, &owner.PublicKey, pub)
}
{ // Wrong signatures:
copy(req.Signatures[count-1].Sign, req.Signatures[count-1].Peer)
err := VerifyRequestHeader(req)
require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error())
}
}

518
service/verify_test.pb.go Normal file
View file

@ -0,0 +1,518 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: service/verify_test.proto
package service
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type TestRequest struct {
IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"`
StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"`
BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"`
RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
RequestVerificationHeader `protobuf:"bytes,99,opt,name=Header,proto3,embedded=Header" json:"Header"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TestRequest) Reset() { *m = TestRequest{} }
func (m *TestRequest) String() string { return proto.CompactTextString(m) }
func (*TestRequest) ProtoMessage() {}
func (*TestRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_1effa83201a30d75, []int{0}
}
func (m *TestRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *TestRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_TestRequest.Merge(m, src)
}
func (m *TestRequest) XXX_Size() int {
return m.Size()
}
func (m *TestRequest) XXX_DiscardUnknown() {
xxx_messageInfo_TestRequest.DiscardUnknown(m)
}
var xxx_messageInfo_TestRequest proto.InternalMessageInfo
func (m *TestRequest) GetIntField() int32 {
if m != nil {
return m.IntField
}
return 0
}
func (m *TestRequest) GetStringField() string {
if m != nil {
return m.StringField
}
return ""
}
func (m *TestRequest) GetBytesField() []byte {
if m != nil {
return m.BytesField
}
return nil
}
func init() {
proto.RegisterType((*TestRequest)(nil), "service.TestRequest")
}
func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) }
var fileDescriptor_1effa83201a30d75 = []byte{
// 296 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4e, 0xeb, 0x30,
0x14, 0xc6, 0xeb, 0x7b, 0xa1, 0x14, 0x97, 0xc9, 0x62, 0x28, 0x19, 0xdc, 0xa8, 0x53, 0x96, 0x26,
0x12, 0x2c, 0x4c, 0x0c, 0x15, 0x42, 0x30, 0xb0, 0x04, 0xc4, 0xc0, 0x82, 0x12, 0xe7, 0x24, 0x58,
0xa2, 0x71, 0x89, 0x4f, 0x22, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x99, 0x2a, 0x14, 0x46, 0x5e,
0x02, 0xd5, 0x36, 0x28, 0xc0, 0x96, 0xef, 0xcf, 0x2f, 0x47, 0xfe, 0xe8, 0x91, 0x86, 0xaa, 0x91,
0x02, 0xa2, 0x06, 0x2a, 0x99, 0x2f, 0x1f, 0x10, 0x34, 0x86, 0x8b, 0x4a, 0xa1, 0x62, 0x7b, 0x2e,
0xf2, 0xd8, 0x57, 0x67, 0x0e, 0x98, 0xd8, 0xd0, 0x3b, 0xfc, 0xc9, 0x39, 0x77, 0x5a, 0x48, 0x7c,
0xac, 0xd3, 0x50, 0xa8, 0x79, 0x54, 0xa8, 0x42, 0x45, 0xc6, 0x4e, 0xeb, 0xdc, 0x28, 0x23, 0xcc,
0x97, 0xad, 0x4f, 0x3e, 0x08, 0x1d, 0xde, 0x82, 0xc6, 0x18, 0x9e, 0x6b, 0xd0, 0xc8, 0x3c, 0x3a,
0xb8, 0x2a, 0xf1, 0x42, 0xc2, 0x53, 0x36, 0x22, 0x3e, 0x09, 0x76, 0xe3, 0x6f, 0xcd, 0x7c, 0x3a,
0xbc, 0xc1, 0x4a, 0x96, 0x85, 0x8d, 0xff, 0xf9, 0x24, 0xd8, 0x8f, 0xbb, 0x16, 0xe3, 0x94, 0xce,
0x96, 0x08, 0xda, 0x16, 0xfe, 0xfb, 0x24, 0x38, 0x88, 0x3b, 0x0e, 0x3b, 0xa5, 0x3b, 0xd7, 0x80,
0xc9, 0x28, 0xf5, 0x49, 0x30, 0x3c, 0xf6, 0x42, 0xf7, 0x82, 0xd0, 0x5d, 0xdf, 0x66, 0x97, 0x90,
0x64, 0x50, 0xcd, 0x06, 0xab, 0xcd, 0xb8, 0xb7, 0xde, 0x8c, 0x49, 0x6c, 0x08, 0x76, 0x4e, 0xfb,
0x36, 0x19, 0x09, 0xc3, 0x4e, 0x7e, 0xb3, 0x77, 0xdb, 0x11, 0xa4, 0x48, 0x50, 0xaa, 0xf2, 0xcf,
0x3f, 0x1c, 0x3b, 0x3b, 0x5b, 0xb5, 0x9c, 0xac, 0x5b, 0x4e, 0x5e, 0x5b, 0x4e, 0xde, 0x5a, 0x4e,
0x5e, 0xde, 0x79, 0xef, 0x3e, 0xe8, 0x4c, 0x56, 0xea, 0x85, 0x10, 0xd3, 0x0c, 0x9a, 0xa8, 0x04,
0x95, 0xeb, 0xa9, 0x1d, 0xcc, 0xdd, 0x4a, 0xfb, 0x46, 0x9e, 0x7c, 0x06, 0x00, 0x00, 0xff, 0xff,
0xa6, 0xdb, 0x5f, 0x7a, 0xb3, 0x01, 0x00, 0x00,
}
func (m *TestRequest) 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 *TestRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintVerifyTest(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintVerifyTest(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if len(m.BytesField) > 0 {
i -= len(m.BytesField)
copy(dAtA[i:], m.BytesField)
i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.BytesField)))
i--
dAtA[i] = 0x1a
}
if len(m.StringField) > 0 {
i -= len(m.StringField)
copy(dAtA[i:], m.StringField)
i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.StringField)))
i--
dAtA[i] = 0x12
}
if m.IntField != 0 {
i = encodeVarintVerifyTest(dAtA, i, uint64(m.IntField))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintVerifyTest(dAtA []byte, offset int, v uint64) int {
offset -= sovVerifyTest(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *TestRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.IntField != 0 {
n += 1 + sovVerifyTest(uint64(m.IntField))
}
l = len(m.StringField)
if l > 0 {
n += 1 + l + sovVerifyTest(uint64(l))
}
l = len(m.BytesField)
if l > 0 {
n += 1 + l + sovVerifyTest(uint64(l))
}
l = m.RequestMetaHeader.Size()
n += 2 + l + sovVerifyTest(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovVerifyTest(uint64(l))
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovVerifyTest(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozVerifyTest(x uint64) (n int) {
return sovVerifyTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TestRequest) 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 ErrIntOverflowVerifyTest
}
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: TestRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TestRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IntField", wireType)
}
m.IntField = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.IntField |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field StringField", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerifyTest
}
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 ErrInvalidLengthVerifyTest
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthVerifyTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.StringField = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BytesField", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthVerifyTest
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthVerifyTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.BytesField = append(m.BytesField[:0], dAtA[iNdEx:postIndex]...)
if m.BytesField == nil {
m.BytesField = []byte{}
}
iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthVerifyTest
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthVerifyTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthVerifyTest
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthVerifyTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipVerifyTest(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthVerifyTest
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthVerifyTest
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipVerifyTest(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVerifyTest
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthVerifyTest
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupVerifyTest
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthVerifyTest
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthVerifyTest = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowVerifyTest = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupVerifyTest = fmt.Errorf("proto: unexpected end of group")
)

17
service/verify_test.proto Normal file
View file

@ -0,0 +1,17 @@
syntax = "proto3";
package service;
option go_package = "github.com/nspcc-dev/neofs-proto/service";
import "service/meta.proto";
import "service/verify.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
message TestRequest {
int32 IntField = 1;
string StringField = 2;
bytes BytesField = 3;
RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
RequestVerificationHeader Header = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
}

View file

@ -8,6 +8,7 @@ import (
fmt "fmt" fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
service "github.com/nspcc-dev/neofs-proto/service"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -33,10 +34,12 @@ type CreateRequest struct {
// Types that are valid to be assigned to Message: // Types that are valid to be assigned to Message:
// *CreateRequest_Init // *CreateRequest_Init
// *CreateRequest_Signed // *CreateRequest_Signed
Message isCreateRequest_Message `protobuf_oneof:"Message"` Message isCreateRequest_Message `protobuf_oneof:"Message"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
XXX_unrecognized []byte `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_sizecache int32 `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *CreateRequest) Reset() { *m = CreateRequest{} } func (m *CreateRequest) Reset() { *m = CreateRequest{} }
@ -205,25 +208,30 @@ func init() {
func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) }
var fileDescriptor_b329bee0fd1148e0 = []byte{ var fileDescriptor_b329bee0fd1148e0 = []byte{
// 284 bytes of a gzipped FileDescriptorProto // 364 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x4e, 0xeb, 0x30,
0x10, 0xc7, 0x6b, 0x84, 0x12, 0x30, 0xa2, 0x83, 0x11, 0x50, 0x65, 0xb0, 0x50, 0xc5, 0x90, 0x81, 0x14, 0xae, 0xaf, 0xaa, 0xb4, 0xd7, 0x57, 0xb7, 0x83, 0xef, 0x0f, 0x51, 0x86, 0x14, 0x55, 0x0c,
0x24, 0xa8, 0xcc, 0x30, 0x94, 0xa5, 0x0c, 0x2c, 0x29, 0x2c, 0x6c, 0x4d, 0x7a, 0x35, 0xe6, 0xc3, 0x19, 0x68, 0x82, 0xca, 0xc2, 0x02, 0x43, 0x61, 0x28, 0x43, 0x97, 0x14, 0x18, 0xd8, 0x92, 0xf4,
0x0e, 0x39, 0xa7, 0x12, 0x6f, 0xc2, 0x23, 0x31, 0x32,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af, 0x62, 0x69, 0x12, 0x49, 0xca,
0x73, 0xf2, 0x55, 0x73, 0xf2, 0xf6, 0xcd, 0x7b, 0x77, 0x61, 0x6b, 0xdf, 0x0a, 0x8b, 0x3c, 0x8f, 0xd9, 0x4e, 0x0f, 0xe3, 0xed, 0xff, 0xc4, 0x8d, 0x21, 0x08, 0x11, 0xa5, 0xd0, 0x11, 0xb8, 0x55,
0xe6, 0xb0, 0x4c, 0x14, 0xe8, 0x05, 0x46, 0x6e, 0xdb, 0xcd, 0xc8, 0xcc, 0xb3, 0xf2, 0xec, 0x27, 0x65, 0x15, 0x19, 0x67, 0x02, 0xc8, 0x31, 0x6e, 0xde, 0x32, 0xa1, 0x83, 0xec, 0x0b, 0xbc, 0x51,
0x00, 0x00, 0xff, 0xff, 0x74, 0x3d, 0x2a, 0x06, 0xd7, 0x01, 0x00, 0x00, 0xac, 0x43, 0x87, 0x20, 0x8a, 0x27, 0xb9, 0x3f, 0xb4, 0xe6, 0xb7, 0x86, 0xf6, 0x06, 0xb8, 0x31,
0xd2, 0x2a, 0x72, 0x8e, 0x2d, 0x3d, 0x9f, 0xfc, 0xdf, 0x38, 0xbf, 0x7c, 0xbe, 0x73, 0xb0, 0x83,
0xeb, 0x45, 0x3d, 0x74, 0x82, 0xfa, 0x17, 0x8b, 0xd2, 0x45, 0xcb, 0xd2, 0x45, 0xaf, 0xa5, 0x8b,
0xde, 0x4a, 0x17, 0xbd, 0xbc, 0xbb, 0xb5, 0x7b, 0x6f, 0xeb, 0xe0, 0x4c, 0x64, 0x49, 0xd2, 0x1d,
0xc3, 0x2c, 0x60, 0xc0, 0x27, 0xa2, 0xab, 0xcf, 0x6d, 0x5a, 0xc6, 0x96, 0x2a, 0x4f, 0x3f, 0x03,
0x00, 0x00, 0xff, 0xff, 0xf6, 0xdd, 0x2a, 0xdb, 0x82, 0x02, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -382,6 +390,30 @@ func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
if m.Message != nil { if m.Message != nil {
{ {
size := m.Message.Size() size := m.Message.Size()
@ -534,6 +566,10 @@ func (m *CreateRequest) Size() (n int) {
if m.Message != nil { if m.Message != nil {
n += m.Message.Size() n += m.Message.Size()
} }
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -709,6 +745,72 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error {
} }
m.Message = &CreateRequest_Signed{v} m.Message = &CreateRequest_Signed{v}
iNdEx = postIndex iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])

View file

@ -3,6 +3,8 @@ package session;
option go_package = "github.com/nspcc-dev/neofs-proto/session"; option go_package = "github.com/nspcc-dev/neofs-proto/session";
import "session/types.proto"; import "session/types.proto";
import "service/meta.proto";
import "service/verify.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true; option (gogoproto.stable_marshaler_all) = true;
@ -34,6 +36,8 @@ message CreateRequest {
// Signed Init message response (Unsigned) from server with user private key // Signed Init message response (Unsigned) from server with user private key
session.Token Signed = 2; session.Token Signed = 2;
} }
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
} }
message CreateResponse { message CreateResponse {

View file

@ -9,6 +9,7 @@ import (
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap" bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap"
service "github.com/nspcc-dev/neofs-proto/service"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -30,9 +31,11 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// NetmapRequest message to request current node netmap // NetmapRequest message to request current node netmap
type NetmapRequest struct { type NetmapRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
XXX_unrecognized []byte `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_sizecache int32 `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *NetmapRequest) Reset() { *m = NetmapRequest{} } func (m *NetmapRequest) Reset() { *m = NetmapRequest{} }
@ -66,9 +69,11 @@ var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo
// MetricsRequest message to request node metrics // MetricsRequest message to request node metrics
type MetricsRequest struct { type MetricsRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
XXX_unrecognized []byte `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_sizecache int32 `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } func (m *MetricsRequest) Reset() { *m = MetricsRequest{} }
@ -148,9 +153,11 @@ func (m *MetricsResponse) GetMetrics() [][]byte {
// HealthRequest message to check current state // HealthRequest message to check current state
type HealthRequest struct { type HealthRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
XXX_unrecognized []byte `json:"-"` service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"`
XXX_sizecache int32 `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *HealthRequest) Reset() { *m = HealthRequest{} } func (m *HealthRequest) Reset() { *m = HealthRequest{} }
@ -247,27 +254,33 @@ func init() {
func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) }
var fileDescriptor_695592f6f2fc97b7 = []byte{ var fileDescriptor_695592f6f2fc97b7 = []byte{
// 320 bytes of a gzipped FileDescriptorProto // 408 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x93, 0xbf, 0xae, 0xd3, 0x30,
0x10, 0xc6, 0x31, 0x88, 0x02, 0x06, 0x5a, 0x64, 0xda, 0x2a, 0xca, 0x10, 0x55, 0x1d, 0x50, 0x25, 0x14, 0xc6, 0xaf, 0xf9, 0x13, 0x2e, 0xbe, 0x70, 0x91, 0x4c, 0x5b, 0x45, 0x19, 0xd2, 0xa8, 0x03,
0xd4, 0x44, 0x02, 0x06, 0x84, 0x98, 0xca, 0xc2, 0x52, 0x86, 0x74, 0x63, 0x73, 0xdc, 0xeb, 0x1f, 0x8a, 0x84, 0x9a, 0x48, 0x85, 0xa1, 0x42, 0x4c, 0x85, 0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, 0xfa, 0x97, 0xbd, 0xde, 0x39, 0xb6, 0x65, 0x5f, 0xd1, 0x9b,
0xba, 0xdd, 0x9b, 0x35, 0x88, 0x8f, 0xed, 0x47, 0x4f, 0x66, 0xec, 0x75, 0xcf, 0x68, 0x9d, 0x9d,
0xbc, 0xde, 0x57, 0x3e, 0x39, 0x54, 0x3e, 0xf9, 0x51, 0xf9, 0xe4, 0x67, 0xe5, 0x93, 0x6f, 0xbf,
0xfc, 0xab, 0x0f, 0xcf, 0xfe, 0xb9, 0x23, 0xb9, 0x56, 0x42, 0x0c, 0x17, 0xb0, 0x8d, 0x73, 0x90,
0x4b, 0x3d, 0xac, 0x6f, 0x88, 0x39, 0x2c, 0x75, 0x8c, 0x78, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff,
0x78, 0x9b, 0x96, 0xe5, 0xb1, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -454,6 +467,30 @@ func (m *NetmapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -481,6 +518,30 @@ func (m *MetricsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -544,6 +605,30 @@ func (m *HealthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized)
} }
{
size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x9a
{
size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -608,6 +693,10 @@ func (m *NetmapRequest) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -620,6 +709,10 @@ func (m *MetricsRequest) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -650,6 +743,10 @@ func (m *HealthRequest) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
n += 2 + l + sovService(uint64(l))
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized) n += len(m.XXX_unrecognized)
} }
@ -710,6 +807,72 @@ func (m *NetmapRequest) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])
@ -764,6 +927,72 @@ func (m *MetricsRequest) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])
@ -904,6 +1133,72 @@ func (m *HealthRequest) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 99:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipService(dAtA[iNdEx:]) skippy, err := skipService(dAtA[iNdEx:])

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package state; package state;
option go_package = "github.com/nspcc-dev/neofs-proto/state"; option go_package = "github.com/nspcc-dev/neofs-proto/state";
import "service/meta.proto";
import "service/verify.proto";
import "bootstrap/types.proto"; import "bootstrap/types.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -19,10 +21,16 @@ service Status {
} }
// NetmapRequest message to request current node netmap // NetmapRequest message to request current node netmap
message NetmapRequest {} message NetmapRequest {
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
}
// MetricsRequest message to request node metrics // MetricsRequest message to request node metrics
message MetricsRequest {} message MetricsRequest {
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
}
// MetricsResponse contains [][]byte, // MetricsResponse contains [][]byte,
// every []byte is marshaled MetricFamily proto message // every []byte is marshaled MetricFamily proto message
@ -32,7 +40,10 @@ message MetricsResponse {
} }
// HealthRequest message to check current state // HealthRequest message to check current state
message HealthRequest {} message HealthRequest {
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
}
// HealthResponse message with current state // HealthResponse message with current state
message HealthResponse { message HealthResponse {