[#452] Update neo-go to latest master

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-05 12:27:58 +03:00 committed by Alex Vanin
parent b18da34b55
commit 7cf48d4d91
7 changed files with 54 additions and 4 deletions

View file

@ -180,7 +180,7 @@ func (s *loggingReputationServer) SendLocalTrust(_ context.Context, req *v2reput
for _, t := range body.GetTrusts() { for _, t := range body.GetTrusts() {
log.Info("local trust received", log.Info("local trust received",
zap.String("peer", hex.EncodeToString(t.GetPeer())), zap.String("peer", hex.EncodeToString(t.GetPeer().GetValue())),
zap.Float64("value", t.GetValue()), zap.Float64("value", t.GetValue()),
) )
} }
@ -190,3 +190,11 @@ func (s *loggingReputationServer) SendLocalTrust(_ context.Context, req *v2reput
return resp, nil return resp, nil
} }
func (s *loggingReputationServer) SendIntermediateResult(_ context.Context, req *v2reputation.SendIntermediateResultRequest) (*v2reputation.SendIntermediateResultResponse, error) {
resp := new(v2reputation.SendIntermediateResultResponse)
// todo: implement me
return resp, nil
}

2
go.mod
View file

@ -16,7 +16,7 @@ require (
github.com/multiformats/go-multihash v0.0.13 // indirect github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.94.0 github.com/nspcc-dev/neo-go v0.94.0
github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210325082034-b792e4e4647a github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210402125759-771f395d9d4e
github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0 github.com/panjf2000/ants/v2 v2.3.0

4
go.sum
View file

@ -279,8 +279,8 @@ github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5
github.com/nspcc-dev/neo-go v0.94.0 h1:2eafoyEnueqEMGDZF06HZJQN0MHgYxFzlcre5YUOP1M= github.com/nspcc-dev/neo-go v0.94.0 h1:2eafoyEnueqEMGDZF06HZJQN0MHgYxFzlcre5YUOP1M=
github.com/nspcc-dev/neo-go v0.94.0/go.mod h1:IrBT/UG3/Slhqgjge8r6zni5tNRsWmwwG9OnVdASheI= github.com/nspcc-dev/neo-go v0.94.0/go.mod h1:IrBT/UG3/Slhqgjge8r6zni5tNRsWmwwG9OnVdASheI=
github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210325082034-b792e4e4647a h1:wCf07NTkQeIn0ev8AOGckuz7HmmmV/sEREyGX0Ae7xw= github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210402125759-771f395d9d4e h1:yAsO+uJDClvttFwhStZgnV2xdYP+TWGyk0ib5ceTaIo=
github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210325082034-b792e4e4647a/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.25.1-0.20210402125759-771f395d9d4e/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=

View file

@ -35,3 +35,18 @@ func (s *Server) SendLocalTrust(ctx context.Context, r *reputation2.SendLocalTru
return resp.ToGRPCMessage().(*reputation2.SendLocalTrustResponse), nil return resp.ToGRPCMessage().(*reputation2.SendLocalTrustResponse), nil
} }
func (s *Server) SendIntermediateResult(ctx context.Context, r *reputation2.SendIntermediateResultRequest) (*reputation2.SendIntermediateResultResponse, error) {
req := new(reputation.SendIntermediateResultRequest)
if err := req.FromGRPCMessage(r); err != nil {
return nil, err
}
resp, err := s.srv.SendIntermediateResult(ctx, req)
if err != nil {
// TODO: think about how we transport errors through gRPC
return nil, err
}
return resp.ToGRPCMessage().(*reputation2.SendIntermediateResultResponse), nil
}

View file

@ -35,3 +35,16 @@ func (s *responseService) SendLocalTrust(ctx context.Context, req *reputation.Se
return resp.(*reputation.SendLocalTrustResponse), nil return resp.(*reputation.SendLocalTrustResponse), nil
} }
func (s *responseService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error) {
resp, err := s.respSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
return s.svc.SendIntermediateResult(ctx, req.(*reputation.SendIntermediateResultRequest))
},
)
if err != nil {
return nil, err
}
return resp.(*reputation.SendIntermediateResultResponse), nil
}

View file

@ -9,4 +9,5 @@ import (
// Server is an interface of the NeoFS API v2 Reputation service server. // Server is an interface of the NeoFS API v2 Reputation service server.
type Server interface { type Server interface {
SendLocalTrust(context.Context, *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error) SendLocalTrust(context.Context, *reputation.SendLocalTrustRequest) (*reputation.SendLocalTrustResponse, error)
SendIntermediateResult(context.Context, *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error)
} }

View file

@ -33,3 +33,16 @@ func (s *signService) SendLocalTrust(ctx context.Context, req *reputation.SendLo
return resp.(*reputation.SendLocalTrustResponse), nil return resp.(*reputation.SendLocalTrustResponse), nil
} }
func (s *signService) SendIntermediateResult(ctx context.Context, req *reputation.SendIntermediateResultRequest) (*reputation.SendIntermediateResultResponse, error) {
resp, err := s.sigSvc.HandleUnaryRequest(ctx, req,
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
return s.svc.SendIntermediateResult(ctx, req.(*reputation.SendIntermediateResultRequest))
},
)
if err != nil {
return nil, err
}
return resp.(*reputation.SendIntermediateResultResponse), nil
}