From 24e5497b1d117e44930dba1c9910935132aab284 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 18 Nov 2019 19:22:08 +0300 Subject: [PATCH] Update develop branch --- Makefile | 2 +- accounting/service.go | 3 - accounting/service.pb.go | Bin 18970 -> 21135 bytes accounting/service.proto | 11 ++- accounting/withdraw.go | 12 --- accounting/withdraw.pb.go | Bin 66702 -> 73944 bytes accounting/withdraw.proto | 54 +++++++----- bootstrap/service.go | 3 - bootstrap/service.pb.go | Bin 13256 -> 15356 bytes bootstrap/service.proto | 13 +-- container/service.go | 12 --- container/service.pb.go | Bin 55156 -> 62382 bytes container/service.proto | 51 ++++++----- object/service.go | 51 +---------- object/service.pb.go | Bin 114748 -> 120649 bytes object/service.proto | 105 ++++++++++------------ object/utils.go | 14 ++- service/meta.go | 90 +++++++++++++++++++ service/meta.pb.go | Bin 0 -> 8671 bytes service/meta.proto | 12 +++ service/meta_test.go | 70 +++++++++++++++ service/role_test.go | 3 +- service/ttl.go | 45 ---------- service/ttl_test.go | 72 --------------- service/verify.go | 179 ++++++++++++++++++++++++++++++++++++++ service/verify.pb.go | Bin 0 -> 21382 bytes service/verify.proto | 20 +++++ service/verify_test.go | 106 ++++++++++++++++++++++ service/verify_test.pb.go | Bin 0 -> 13453 bytes service/verify_test.proto | 17 ++++ session/service.pb.go | Bin 24221 -> 27061 bytes session/service.proto | 4 + state/service.pb.go | Bin 29918 -> 37509 bytes state/service.proto | 17 +++- 34 files changed, 642 insertions(+), 324 deletions(-) create mode 100644 service/meta.go create mode 100644 service/meta.pb.go create mode 100644 service/meta.proto create mode 100644 service/meta_test.go delete mode 100644 service/ttl.go delete mode 100644 service/ttl_test.go create mode 100644 service/verify.go create mode 100644 service/verify.pb.go create mode 100644 service/verify.proto create mode 100644 service/verify_test.go create mode 100644 service/verify_test.pb.go create mode 100644 service/verify_test.proto diff --git a/Makefile b/Makefile index 64b0939..9609923 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ protoc: echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ --proto_path=.:./vendor:/usr/local/include \ - --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done diff --git a/accounting/service.go b/accounting/service.go index df74e58..ac1ceb5 100644 --- a/accounting/service.go +++ b/accounting/service.go @@ -31,9 +31,6 @@ const ( 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. func SumFunds(accounts []*Account) (res *decimal.Decimal) { res = decimal.Zero.Copy() diff --git a/accounting/service.pb.go b/accounting/service.pb.go index bc31ce1c95e387bba39ce3f43caadbbb4a6c5fec..7a8a08697d669bbe504b7a89aeddd598ed2a25ad 100644 GIT binary patch delta 3175 zcmb7GzmFS56qX&##a1G5B8cP)G%>NcC89+RhIHZ-RgB0;QO0k_3`~_Q5DH7 zKkO$Ll`5?`vWokaHIZX=WU{hg;9ASrIP8m$%3^ZZHwOLVUiaWYEMmW}rlWk6BI^aA zQ7NP-RV9jCl%tc0tY%YHnt$qHt)>^^t}5QVC+-%R64j}!ghott?wZGv@c-xdggiE> z#+LgJS2$d3u;uZRFa9;H&dwFF_G@-JdzY90o7X!B9sHS}biTbb&%3{DwW8+E_GulY zmaxy`p;?p6tbsCXmYCJGtzOqYAA06b5!-`94h|0F31M%;H_C~C2N9rcsOljB2_gwk5H7$;WW=b?8P&@Tehh>N zu@$li!BZ)Uga?e|B3{Z=NtCkToX$S>l#})>i36{|to4F(>Hr}{W~A$ai3CL(9x3)A z%AEqu0Wx`#2uniFER2Mu?k98-cm@dJYv)>v4$K&lQe@0M8zh9PF&f8)JRY2h6Cy7y zj}b2h0=q;ZXbLoTU9}Ht;LDL*6P`!{MX&?>fqm&_5_E3a9 zZ;1q2$Z!-7x#ZY;h%nSA8lOiJ92~i(QpWNjv7CDtQ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koMF2@7}0@x8EIAWYS&S8dnRxMc*om~8k;oq)+6BD`!jJ_C^C~Hxf*qp_G-ef&D3Etx3Bi_d=m!b% zd*~1EAzzV@En(|{O%181(a>ffnGm@z=<53NiigPWBABD3 zc{LPkfDFWr@qjsq3%C#KW1kNPo4&dMkdx0BS;Q!lch$TDwgf+{Ei+C%r8FTqLxx~>OyZaiUWEMsE%C8t=?Q%JKxXa@i^l^3rE72|*s4SV0|*cznls5;!beGB z3=~QjKoXfW@9n(a{CDv}S0=#mz=f5sy3M(DmiupZU)&yN;_O}XwG`cu zjh^|0x5ozu#-_*R@s06KVLU2Fn(ylJ-`+2qZ#)xf9CNWh6i)M4?ruNDFdt##*xdf$ z)#fiXTt0Gs-D>{+XtyPs$AkAb?05aMlifBsm;}v_*RD1{pWJ^5r0x%&eANF4t}I`> N`e$qT*75w6{{cXrR6zg$ diff --git a/accounting/service.proto b/accounting/service.proto index 9cfdb0f..f2696c4 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "accounting/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Accounting { message BalanceRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (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; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // 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 BalanceResponse { diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 3cd2766..0a8cf90 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -11,18 +11,6 @@ type ( 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. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index f0e78aa5dcd5182df57c0a7f759e10290077b87b..a2116c01a729f0d2f6b3bcbaeedee0341339c404 100644 GIT binary patch delta 7540 zcmeHMON06C6YBG7Xv0incMZ;{ zq@r;n5d~g!Cu}sjU|~|MjF4br{3T*^;{tWUf`vvC*T%&6&Z&Vm0~!-afWV@7{p!B^ zIrrTA?sUKL+Pv>i&--visjn+K`&yAW{M+p_%Y0esgKGAecy2;;(}zVGY!yK)I!4qU zPlMKY*JzC=?ao+`w%X%H5Vj{$qeEe1Oi3HNA>K8Hy1UyGdtxILh8PP)9E(^TP1{PU z+YLs=x@x5`zG1epY}ejSJ8g#($?#w}m5Of7_iF9EX>B|h6C>KI8Uz}(8Qs_%G@k9Y z$A<^Cz~HWGW#dMp(EX(7w31c?uZw_MT_Z5MA~o8H(QS>62kAsdboD2(FB6?9V~1!z z@VK#~9SbAf9i)b`7%AUX95Vs`_ZTnX$Lvu3ntdTw9GIFFEw^Xl-Kmd93aoR1Ik>*9s^y^A)@&A;nE)psM^*L%A6uUaVMwM+A%<=f{S*)Tu< zdexHoH?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Y~~th2U^ME6o3-?A`1Hxc7Yhk(hPT4_4F=-ZhBNCnwMDVDba(N zn>?ZiY~2LWWy%1I4V!$)u}ydoV1wj5;4_11;7BKXIoLR- z)N?_HP#owC=dGe1K_$wi0GbaB&P%qVfP9DdOfFkyl}U$>HwGx8VlQD=(rMnpW>j?{}?-Nf6j6(f1Y69qx>Ijabu4QLG2`-2mN zG~qPk1qyeLK0RS65Cnz7?E<9pq;M=iyi?MTarn94Qq`6S78^;r7i~Wc+$dCrh zlB>6@G@w8W2(PE$fJi(w2$o{?77S3({qDexchqJdpYsmdU<(WPkYRbA9Jv zS5@h6A3gj>kNoH3?oQ>ZeCv}n-Rl3*QQ7zD8}icfCGCUrM;?*JZI54DwL~7Ae?|@; z@wI}Fj=zfEkFOn@yMw;V#}>i0?Z>y?US}%LkN31sezs$U-1KF?9R1~Kcy-~6{t}^7 zNXie-{kRmk&TY8y2bso?>{g0 V%PXhuTlDu19rD?e{T*YE{tH?AbOQhY diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index eb58d08..bb950ba 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -34,12 +36,13 @@ message Item { message GetRequest { // 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 - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (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 = 3; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // 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 GetResponse { @@ -49,18 +52,19 @@ message GetResponse { message PutRequest { // 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 - decimal.Decimal Amount = 2; + decimal.Decimal Amount = 2; // 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) - 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 - bytes Signature = 5; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 6; + bytes Signature = 5; + // 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 { // ID is cheque identifier @@ -69,10 +73,11 @@ message PutResponse { message ListRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (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; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // 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 ListResponse { @@ -82,16 +87,17 @@ message ListResponse { message DeleteRequest { // 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 - 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) - 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 - bytes Signature = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Signature = 4; + // 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 diff --git a/bootstrap/service.go b/bootstrap/service.go index 6d0d3ca..e67ea6d 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -6,6 +6,3 @@ import ( // NodeType type alias. type NodeType = service.NodeRole - -// SetTTL sets ttl to Request to satisfy TTLRequest interface. -func (m *Request) SetTTL(v uint32) { m.TTL = v } diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index f00f814b8b9127a72859dfd937b007460c21ebcc..7165399abca3e1f22125e42612a8b4e77b732e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?-} z1hk0yjeH&~a9w$*TUZw*I@DvdzytHgmQ9I*Lm-C;j-Zpg)auPD0ee39@u52iPGAYq z;fACk4m3aot|J^fq@E)o^`x6RB?jZVwz?EiV)bUVN#UXgm$ZU_1il(vvB-@MyATbY zV_J|k0uI|r(5(jkI0irlCl}?7jcenqGGan%>c|&?F$a?N5Pb>|xFj*T1sB3i^6)2y z^jIX)4R6rEIa`JeevD#bb^_gD6&OA71L`Sy7@+_U&?Dsbkvj%eBMd!5x&T$UsDhMa zh~fY&7Y08<@DRZ!0Lw}^Vl8lKUxlbM{qCV0b1A?8=pfT&P zL0}w_(cuteM3B6>%)xF0OfrE#J%!|PlLE|*v*oNf!vuCplfvRN6E7u+4%jm%1_a){ z&20$K11~wDhv{@u}ll^RY57 zkVVi47I4U?iRl;|c);fk;48x3xH5cX9gYE=kGMA+H18WrrOa?aDO2ct@W?PH%)NC$ zgX659z4XWJ7wxCZex~f_%TZVD550S@!_YV1+fKf}Z)AE@AAOpCri{nR4cjN`we<(R zU!S{m9ozo+*52;q*hV~V@2EG|zr6kT?v~#^bzW{i?;qWn9QOw1OJB+4axONl{Umle bfN6j3|9;!RKRVoePuuVBK3IS2U)}l-rRzWU diff --git a/bootstrap/service.proto b/bootstrap/service.proto index cde94dc..f0bf755 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package bootstrap; option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Bootstrap { message Request { // 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 - bootstrap.NodeInfo info = 2 [(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 = 3; + bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + // 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]; } diff --git a/container/service.go b/container/service.go index 27f39e7..5f446da 100644 --- a/container/service.go +++ b/container/service.go @@ -19,18 +19,6 @@ type ( 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. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/container/service.pb.go b/container/service.pb.go index cfd401d920b046267eef658e8ff3d2d569c6d528..8b98cfa59116761173e6a5fa44f193826114d292 100644 GIT binary patch delta 7166 zcmeHMU5H%O9cOp5$;@O;vI|@Av;WXJ)^7d+P0fO}%usM=WIwAXB7a@KgF$a@E8^@7>OR&!y&sBQmR^t)L%0qUAi zw=g235CbF6jG}wI7Y&AeQRq)%r4;>B#)BgN#Y4t}c`A&-iD+ObkBP#rc&rir|2f_O z$9k$^+qudW8&0ib%jq?~_$1HnxP8XB=1-p4cc8KMS$?=dy$pBLx z+qI?Iw{vx>y1e^^oAo}F`e-R$|B(f-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Z!b5D=|fl#N<{(^Z@ zx5NZ3ZxP<$w{MA=NjgWT9nATc%DMd=4?kN{r@fvmt!#z*R0kk_#+l+5>(rckjF3$} VtQRsbk3YC}3Fub^+xoYi{{p+M`Ro7y literal 0 HcmV?d00001 diff --git a/service/meta.proto b/service/meta.proto new file mode 100644 index 0000000..4c09fb3 --- /dev/null +++ b/service/meta.proto @@ -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; +} diff --git a/service/meta_test.go b/service/meta_test.go new file mode 100644 index 0000000..893ca5e --- /dev/null +++ b/service/meta_test.go @@ -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()) + } + }) + } +} diff --git a/service/role_test.go b/service/role_test.go index a1f1cc0..01dbee2 100644 --- a/service/role_test.go +++ b/service/role_test.go @@ -1,8 +1,9 @@ package service import ( - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" ) func TestNodeRole_String(t *testing.T) { diff --git a/service/ttl.go b/service/ttl.go deleted file mode 100644 index 8ddf1de..0000000 --- a/service/ttl.go +++ /dev/null @@ -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 -} diff --git a/service/ttl_test.go b/service/ttl_test.go deleted file mode 100644 index 1349198..0000000 --- a/service/ttl_test.go +++ /dev/null @@ -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) - } - }) - } -} diff --git a/service/verify.go b/service/verify.go new file mode 100644 index 0000000..d8ede7e --- /dev/null +++ b/service/verify.go @@ -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 +} diff --git a/service/verify.pb.go b/service/verify.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..3c0f357ec62f5c1b9f723676d4a9c1e2355febde GIT binary patch literal 21382 zcmeHPdvDuD68~HJ6ng?%NR2G(Wm|UR0KF#Z1!$9^Ns9u8&*ft&^CFQtl5*_2`R+IK zo8?0iB~h-8UfdV~L+$Q7cXnoXW~Kdo^=;^CHP(TStVFxYzEQI%OhRXm+V;lbIP9qB zZ`A8I@6?Ouuika)`}-;m=aHjNRIH;b-_iS5I`X}n4&dtbndQ8<#yah-*Zt`%j1twX z*Su+>8uVz?YZt09_LIxG-EqR{KGWF;ygm2u2_I-2{$Cn9v4U|vIvweUs^NzOGPROR z)!?W3aAEsNEG_%|+NihcEXPmU(~%Awt%Su`C83Jvvst9$Sm`JVqgeT#N-p({vLda5 zFi|0Wiaz+UR`Xc9o%)p(sS9-~TI>8^Me(II$y!O+&I?B5WlhXj=T+c=g?E=ek%*P0 zNDVW8qW2Pis+AR!ZWBKYm?Is;b0VHxS_wU9a6VfeL9is$$naL;+Y_xmkYbr>;Yp9ZvO`_v=uN~=GJFuquG#eGSF>26I|B1ukq*3Syr+%WRv*f1nTfO${ufJZr4u1~b z>l^KUPaTmpF?`;B%vmda`%O^qrFiB+q@8da_`lP-<-fCYX0Q~t*tm=*CIpV)t$YRCB7<>$F8v73-wg%23{_ucowg*3JT{tR6Yr{$2>FdOdoVGH|n;3?1{y^S<9GdWbn=-Ts?75De$e$%)L_kfM zmNrcfDYnJtXqe;Gn-9Gh+OB(GI|p6u93S=vBLi{U{a8O(s0`13ylDN7-RGDF_S?0)cIsW&7;Jv1U!XbzZLpZDvZH zoT_Q+GT()7*^vJ^_sA*JsCtb&FAw_1sS5lFt1ZcI=onGq@5ptW!hGRXcuj=yks9_6a|}@cBFX+DW3bWV?{1G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gm9j6s`LI0H`=`x&QzG literal 0 HcmV?d00001 diff --git a/service/verify.proto b/service/verify.proto new file mode 100644 index 0000000..7d83308 --- /dev/null +++ b/service/verify.proto @@ -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; +} diff --git a/service/verify_test.go b/service/verify_test.go new file mode 100644 index 0000000..4aaefb4 --- /dev/null +++ b/service/verify_test.go @@ -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()) + } +} diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..a029c2e2af2b981508f1a30f47410b6c04925a0d GIT binary patch literal 13453 zcmeHOZExE~68q(+wYW?6FW0Bw`>0yIg{xuwD89AieRoRlN~dX(W-1I+ey#76 zlWG+wxk~UWeG_I{tupQRnm10WuGE>huJ^)8vukHjj>6d9Q(_d9L!?;mc^t3`=hq=b zWXe%+!!lgxgFKA1axyqL50jWQ(s8ze@ci1zaRG4^vH&y45)9IOClB3)R&U@~Qd)FU zML@!w=v*Df^Fo@hoVgRm2p)0y!VH5AB(wdhkhutBtrp>Hy|`16cH&Ik0ScI~yi*Cg zh&V{J3W2fKKKs;#vz9)Atk?7sh_gKQEkW*E!OZjQN1bL6K2pSNp&fGba-KQ>>Xt#x zW`4KS>KxenPXBX-e^i#ID=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i*!fg66a$)NPu`?y2Y`*wwWrVTl z!z6@Z_QCQ&`2ET0fF%I^J4(~?kZ3i~)=x7Rj9e=naLS;`R`aslqhOpYy9e;Ij|g~P zRo6aV`akfkW7Pvzg8voZZzIO~bg6bd_yY;x>%dtpa!CMQA?b5fIqp;DWUuix#9i6G zr=Qh6(cWm8{nggTO!cXV763D*6ZM04r6?9{S-sFURde;_^&+kaV~t#weKP zmDau%k*}Bdj2P9rwq5jbT0?ln^YjmNhcLa?TV`>nJ7r6Z)*3`@)17lWiaR$CZxR(< ziQ>>kzl9fV=}fbvB%WOT&`us>++My+(SwAVu3^!;EHmqq%@!f;5z9JTx~gKz#b=kN z%;Zh0i!x0hmUnKZq~DWB<~v6Gx0u~hi%-GN>dcMNsLjJ0{I?9jQjo0B8TMEF`S+^$ zTpHhkQ)hTrSuG?etZH>G#n-iSeDj~&NVndw+8^6`R;#jUkJqg}eTP}Jtvk(s0chZb Ai2wiq literal 0 HcmV?d00001 diff --git a/service/verify_test.proto b/service/verify_test.proto new file mode 100644 index 0000000..5eb8cfd --- /dev/null +++ b/service/verify_test.proto @@ -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]; +} diff --git a/session/service.pb.go b/session/service.pb.go index b99b611d61a1b1d61790d0a64c8783d5f9992ccf..eef58192979350812ad2f5ceb3ffabf56c925878 100644 GIT binary patch delta 3065 zcmb7G&u<%55LSx$VS^EERaF&9SeYLpU?;o#*83xpTY5kgq@swTs!|DL_r15Uh}gm2 zR4!HJBV3Rw_RJrFERMayg$rj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1(bv)9Xt)H(Jf1^X9dIT6n2)*V=C>|yw4avgL_0}bt?qny zcInf1{`dPXh>d|}eyjZ-i-kzGA4@Q&n-J#M`(*_1kY~V|E;N|oH@aic5 T%cd4+{`}3qR_1%x2WS5Vxwb&< delta 1738 zcmYk7yKWUR5QcS#AWEVfZYiJuoi|E!PW?}Pc_&7=9v?(VX4^3RxYxaR_S(f4jw|tTI4SPjeB7zKA0+>ciy*i}aw*6nVQk)xxxYb&v z9PK@k9P(w&UGjTRHHQR)D#x`NAtLXGm^6(o?5#w@-bov)v<+ymL<~$FUep~3fdff& zKo6<*=vYgMVn1-LSBb=H8qF1)4$T%NIb3W2p@O%F1@;X!;&HMV(H$3LA=<_sWUpp` zU#S7G=u#cbwYRS6<{1NpkS3% z;?iKW5K7n?*Q6J_OP zC`ASsYbHx%RM- Q|60xOPLG!NFOF~j17ByluK)l5 diff --git a/session/service.proto b/session/service.proto index 4b37aaf..9b0c65e 100644 --- a/session/service.proto +++ b/session/service.proto @@ -3,6 +3,8 @@ package session; option go_package = "github.com/nspcc-dev/neofs-proto/session"; import "session/types.proto"; +import "service/meta.proto"; +import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -34,6 +36,8 @@ message CreateRequest { // Signed Init message response (Unsigned) from server with user private key 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 { diff --git a/state/service.pb.go b/state/service.pb.go index a3684101176dc7672a7ab3b85e33ed22fec9b65c..8e66a2f8fd1094e11e3cfe81e9efb57e402459ae 100644 GIT binary patch delta 5652 zcmeHLOK%%h7*$?vY^WMiM4(93CYbT8#mI4j?Gy)8 zoDCaTp<%}cgpfe$BGq)kiWR%A_yd5D5Ms+8fP2ren}oC~FVRI4DbwqF@AsYao$oPm zzyEdM{VxW$?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zp(gD0{-bGs9sC>O&)kIgeuTdkKz^?N+d%f^*pYl|<*UI1u~9C&tK>fyJ0E@Jsp5gq L|AWvoGC%qU^7?DC delta 2071 zcmYk7yK5Fv5XJfOASNmys3_Q&I*HzW?^ad;Q}_anC=%G$6-BEw={^xfECk7x+FIBJ z7c2h`n-sAS0wM&#!q$6#XMcuzR*SW=R zf8l)pY4-iJbL@84PtEoF3%BO|X}@>w!^!C=G~LbRN8_Yky<~QZz}w1t8@Jxpk++dq zU6?mJfx(sHA~etaw+XTMlhS{uv9}H1A-2Y(Xc9>_kP7N2n?Ptt z&NvQfv7xA?gylP=Xd`@Ec$O8!B5a0YC01x*Bm^1_IB2NXKtMB$K`X%@97SUvGF^kB(N$;ve7mL*n#8nqNMgtmyJd6rIXhaX5W7)Mf7bHg8@TS*DG zB>pyp5{aNl+wG+swqE3iJ>)c`P);KfECZ%=9*3V(F5}p#=MhR>L=d!rEypcVTGl`k zrD1>pJ(1 z2jIIW$o*6Ozmz+s2BAhubt3leBD&Cm1U*v$l~k`%x7s1v(Pkzp4YHn_Q~*sf_Vu(- z!!1&jEO~nH8r5JWVzGc-i$BF0vfAV2@|%<)cZGUd?vi94AGfjKm)du-^#oN6H)Alh zIwVc6m{#2A*=tpsW64mHoFIU*4R!?r7sg|Lfkv x(cnn?%MYH-^nafJ81-BB^Aum*mYpZ?@WuC0x3<01eS3MoU)w&MbH}?&{{Y3qAsYYy diff --git a/state/service.proto b/state/service.proto index 3c85d86..cb2698b 100644 --- a/state/service.proto +++ b/state/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package state; option go_package = "github.com/nspcc-dev/neofs-proto/state"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -19,10 +21,16 @@ service Status { } // 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 -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, // every []byte is marshaled MetricFamily proto message @@ -32,7 +40,10 @@ message MetricsResponse { } // 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 message HealthResponse {