forked from TrueCloudLab/frostfs-node
[#1570] Upgrade NeoFS SDK Go with changed reputation API
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9a6da336db
commit
9a11a75b77
28 changed files with 142 additions and 154 deletions
|
@ -35,7 +35,6 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/policer"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/replicator"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
|
@ -44,6 +43,7 @@ import (
|
|||
eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl"
|
||||
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -526,11 +526,14 @@ func (c *reputationClientConstructor) Get(info coreclient.NodeInfo) (coreclient.
|
|||
key := info.PublicKey()
|
||||
|
||||
nmNodes := nm.Nodes()
|
||||
var peer apireputation.PeerID
|
||||
|
||||
for i := range nmNodes {
|
||||
if bytes.Equal(nmNodes[i].PublicKey(), key) {
|
||||
peer.SetPublicKey(nmNodes[i].PublicKey())
|
||||
|
||||
prm := truststorage.UpdatePrm{}
|
||||
prm.SetPeer(reputation.PeerIDFromBytes(nmNodes[i].PublicKey()))
|
||||
prm.SetPeer(peer)
|
||||
|
||||
return &reputationClient{
|
||||
MultiAddressClient: cl.(coreclient.MultiAddressClient),
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage"
|
||||
reputationrpc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/rpc"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -330,11 +331,15 @@ func (s *reputationServer) processLocalTrust(epoch uint64, t reputation.Trust,
|
|||
|
||||
// apiToLocalTrust converts v2 Trust to local reputation.Trust, adding trustingPeer.
|
||||
func apiToLocalTrust(t *v2reputation.Trust, trustingPeer []byte) reputation.Trust {
|
||||
var trusted, trusting apireputation.PeerID
|
||||
trusted.SetPublicKey(t.GetPeer().GetPublicKey())
|
||||
trusting.SetPublicKey(trustingPeer)
|
||||
|
||||
localTrust := reputation.Trust{}
|
||||
|
||||
localTrust.SetValue(reputation.TrustValueFromFloat64(t.GetValue()))
|
||||
localTrust.SetPeer(reputation.PeerIDFromBytes(t.GetPeer().GetPublicKey()))
|
||||
localTrust.SetTrustingPeer(reputation.PeerIDFromBytes(trustingPeer))
|
||||
localTrust.SetPeer(trusted)
|
||||
localTrust.SetTrustingPeer(trusting)
|
||||
|
||||
return localTrust
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
eigencalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
eigentrustctrl "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/controller"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// InitialTrustSource is an implementation of the
|
||||
|
@ -20,7 +21,7 @@ type InitialTrustSource struct {
|
|||
var ErrEmptyNetMap = errors.New("empty NepMap")
|
||||
|
||||
// InitialTrust returns `initialTrust` as an initial trust value.
|
||||
func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustValue, error) {
|
||||
func (i InitialTrustSource) InitialTrust(apireputation.PeerID) (reputation.TrustValue, error) {
|
||||
nm, err := i.NetMap.GetNetMap(1)
|
||||
if err != nil {
|
||||
return reputation.TrustZero, fmt.Errorf("failed to get NetMap: %w", err)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package intermediate
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
|
@ -34,8 +32,8 @@ func (w *ConsumerTrustWriter) Write(t reputation.Trust) error {
|
|||
w.log.Debug("writing received consumer's trusts",
|
||||
zap.Uint64("epoch", w.eiCtx.Epoch()),
|
||||
zap.Uint32("iteration", w.eiCtx.I()),
|
||||
zap.String("trusting_peer", hex.EncodeToString(t.TrustingPeer().Bytes())),
|
||||
zap.String("trusted_peer", hex.EncodeToString(t.Peer().Bytes())),
|
||||
zap.Stringer("trusting_peer", t.TrustingPeer()),
|
||||
zap.Stringer("trusted_peer", t.Peer()),
|
||||
)
|
||||
|
||||
trust := eigentrust.IterationTrust{Trust: t}
|
||||
|
|
|
@ -2,13 +2,13 @@ package intermediate
|
|||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
repClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
eigentrustcalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -75,27 +75,23 @@ func (fw FinalWriter) WriteIntermediateTrust(t eigentrust.IterationTrust) error
|
|||
|
||||
args := repClient.PutPrm{}
|
||||
|
||||
var trustedPublicKey [33]byte
|
||||
copy(trustedPublicKey[:], t.Peer().Bytes())
|
||||
apiTrustedPeerID := t.Peer()
|
||||
|
||||
apiTrustedPeerID := apireputation.NewPeerID()
|
||||
apiTrustedPeerID.SetPublicKey(trustedPublicKey)
|
||||
|
||||
apiTrust := apireputation.NewTrust()
|
||||
var apiTrust apireputation.Trust
|
||||
apiTrust.SetValue(t.Value().Float64())
|
||||
apiTrust.SetPeer(apiTrustedPeerID)
|
||||
apiTrust.SetPeer(t.Peer())
|
||||
|
||||
var managerPublicKey [33]byte
|
||||
copy(managerPublicKey[:], fw.pubKey)
|
||||
|
||||
apiMangerPeerID := apireputation.NewPeerID()
|
||||
apiMangerPeerID.SetPublicKey(managerPublicKey)
|
||||
var apiMangerPeerID apireputation.PeerID
|
||||
apiMangerPeerID.SetPublicKey(managerPublicKey[:])
|
||||
|
||||
gTrust := apireputation.NewGlobalTrust()
|
||||
var gTrust apireputation.GlobalTrust
|
||||
gTrust.SetTrust(apiTrust)
|
||||
gTrust.SetManager(apiMangerPeerID)
|
||||
|
||||
err := gTrust.Sign(fw.privatKey)
|
||||
err := gTrust.Sign(neofsecdsa.Signer(*fw.privatKey))
|
||||
if err != nil {
|
||||
fw.l.Debug(
|
||||
"failed to sign global trust",
|
||||
|
@ -105,8 +101,8 @@ func (fw FinalWriter) WriteIntermediateTrust(t eigentrust.IterationTrust) error
|
|||
}
|
||||
|
||||
args.SetEpoch(t.Epoch())
|
||||
args.SetValue(*gTrust)
|
||||
args.SetPeerID(*apiTrustedPeerID)
|
||||
args.SetValue(gTrust)
|
||||
args.SetPeerID(apiTrustedPeerID)
|
||||
|
||||
err = fw.client.Put(
|
||||
args,
|
||||
|
@ -123,7 +119,7 @@ func (fw FinalWriter) WriteIntermediateTrust(t eigentrust.IterationTrust) error
|
|||
"sent global trust to contract",
|
||||
zap.Uint64("epoch", t.Epoch()),
|
||||
zap.Float64("value", t.Value().Float64()),
|
||||
zap.String("peer", hex.EncodeToString(t.Peer().Bytes())),
|
||||
zap.Stringer("peer", t.Peer()),
|
||||
)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package intermediate
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/daughters"
|
||||
|
@ -29,8 +27,8 @@ type DaughterTrustWriter struct {
|
|||
func (w *DaughterTrustWriter) Write(t reputation.Trust) error {
|
||||
w.log.Debug("writing received daughter's trusts",
|
||||
zap.Uint64("epoch", w.ctx.Epoch()),
|
||||
zap.String("trusting_peer", hex.EncodeToString(t.TrustingPeer().Bytes())),
|
||||
zap.String("trusted_peer", hex.EncodeToString(t.Peer().Bytes())),
|
||||
zap.Stringer("trusting_peer", t.TrustingPeer()),
|
||||
zap.Stringer("trusted_peer", t.Peer()),
|
||||
)
|
||||
|
||||
w.storage.Put(w.ctx.Epoch(), t)
|
||||
|
|
|
@ -2,7 +2,6 @@ package intermediate
|
|||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/common"
|
||||
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/internal/client"
|
||||
|
@ -95,22 +94,16 @@ func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error {
|
|||
rtp.log.Debug("announcing trust",
|
||||
zap.Uint64("epoch", epoch),
|
||||
zap.Uint32("iteration", i),
|
||||
zap.String("trusting_peer", hex.EncodeToString(t.TrustingPeer().Bytes())),
|
||||
zap.String("trusted_peer", hex.EncodeToString(t.Peer().Bytes())),
|
||||
zap.Stringer("trusting_peer", t.TrustingPeer()),
|
||||
zap.Stringer("trusted_peer", t.Peer()),
|
||||
)
|
||||
|
||||
apiTrustingPeer := reputationapi.NewPeerID()
|
||||
apiTrustingPeer.SetPublicKey(t.TrustingPeer())
|
||||
|
||||
apiTrustedPeer := reputationapi.NewPeerID()
|
||||
apiTrustedPeer.SetPublicKey(t.Peer())
|
||||
|
||||
apiTrust := reputationapi.NewTrust()
|
||||
var apiTrust reputationapi.Trust
|
||||
apiTrust.SetValue(t.Value().Float64())
|
||||
apiTrust.SetPeer(apiTrustedPeer)
|
||||
apiTrust.SetPeer(t.Peer())
|
||||
|
||||
apiPeerToPeerTrust := reputationapi.NewPeerToPeerTrust()
|
||||
apiPeerToPeerTrust.SetTrustingPeer(apiTrustingPeer)
|
||||
var apiPeerToPeerTrust reputationapi.PeerToPeerTrust
|
||||
apiPeerToPeerTrust.SetTrustingPeer(t.TrustingPeer())
|
||||
apiPeerToPeerTrust.SetTrust(apiTrust)
|
||||
|
||||
var p internalclient.AnnounceIntermediatePrm
|
||||
|
@ -119,7 +112,7 @@ func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error {
|
|||
p.SetClient(rtp.client)
|
||||
p.SetEpoch(epoch)
|
||||
p.SetIteration(i)
|
||||
p.SetTrust(*apiPeerToPeerTrust)
|
||||
p.SetTrust(apiPeerToPeerTrust)
|
||||
|
||||
_, err := internalclient.AnnounceIntermediate(p)
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package intermediate
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
eigentrustcalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
consumerstorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/consumers"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/daughters"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// DaughterTrustIteratorProvider is an implementation of the
|
||||
|
@ -20,15 +19,12 @@ type DaughterTrustIteratorProvider struct {
|
|||
// InitDaughterIterator returns an iterator over the received
|
||||
// local trusts for ctx.Epoch() epoch from daughter p.
|
||||
func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context,
|
||||
p reputation.PeerID) (eigentrustcalc.TrustIterator, error) {
|
||||
p apireputation.PeerID) (eigentrustcalc.TrustIterator, error) {
|
||||
epoch := ctx.Epoch()
|
||||
|
||||
daughterIterator, ok := ip.DaughterStorage.DaughterTrusts(epoch, p)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no data in %d epoch for daughter: %s",
|
||||
epoch,
|
||||
hex.EncodeToString(p.Bytes()),
|
||||
)
|
||||
return nil, fmt.Errorf("no data in %d epoch for daughter: %s", epoch, p)
|
||||
}
|
||||
|
||||
return daughterIterator, nil
|
||||
|
|
|
@ -82,15 +82,12 @@ type RemoteTrustWriter struct {
|
|||
}
|
||||
|
||||
func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error {
|
||||
apiTrust := reputationapi.NewTrust()
|
||||
|
||||
apiPeer := reputationapi.NewPeerID()
|
||||
apiPeer.SetPublicKey(t.Peer())
|
||||
var apiTrust reputationapi.Trust
|
||||
|
||||
apiTrust.SetValue(t.Value().Float64())
|
||||
apiTrust.SetPeer(apiPeer)
|
||||
apiTrust.SetPeer(t.Peer())
|
||||
|
||||
rtp.buf = append(rtp.buf, *apiTrust)
|
||||
rtp.buf = append(rtp.buf, apiTrust)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
trustcontroller "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/controller"
|
||||
truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -87,10 +88,15 @@ func (it *TrustIterator) Iterate(h reputation.TrustHandler) error {
|
|||
continue
|
||||
}
|
||||
|
||||
var trusted, trusting apireputation.PeerID
|
||||
|
||||
trusted.SetPublicKey(nmNodes[i].PublicKey())
|
||||
trusting.SetPublicKey(it.storage.LocalKey)
|
||||
|
||||
trust := reputation.Trust{}
|
||||
trust.SetPeer(reputation.PeerIDFromBytes(nmNodes[i].PublicKey()))
|
||||
trust.SetPeer(trusted)
|
||||
trust.SetValue(p)
|
||||
trust.SetTrustingPeer(reputation.PeerIDFromBytes(it.storage.LocalKey))
|
||||
trust.SetTrustingPeer(trusting)
|
||||
|
||||
if err := h(trust); err != nil {
|
||||
return err
|
||||
|
|
4
go.mod
4
go.mod
|
@ -17,9 +17,9 @@ require (
|
|||
github.com/nspcc-dev/hrw v1.0.9
|
||||
github.com/nspcc-dev/neo-go v0.99.1-pre.0.20220609082921-2c9fb2044242
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220601120906-3bec6657f5c5 // indirect
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.3-0.20220630100506-c6f7ab3ef1bf
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.13.0
|
||||
github.com/nspcc-dev/neofs-contract v0.15.1
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.4.0.20220704082116-2ad89085a341
|
||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.4.0.20220705084258-cec2373b50ae
|
||||
github.com/nspcc-dev/tzhash v1.5.2
|
||||
github.com/panjf2000/ants/v2 v2.4.0
|
||||
github.com/paulmach/orb v0.2.2
|
||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
|
@ -15,7 +15,7 @@ func (rp *Processor) handlePutReputation(ev event.Event) {
|
|||
// FIXME: #1147 do not use `ToV2` method outside neofs-api-go library
|
||||
rp.log.Info("notification",
|
||||
zap.String("type", "reputation put"),
|
||||
zap.String("peer_id", hex.EncodeToString(peerID.ToV2().GetPublicKey())))
|
||||
zap.String("peer_id", hex.EncodeToString(peerID.PublicKey())))
|
||||
|
||||
// send event to the worker pool
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
repClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation"
|
||||
reputationEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -37,16 +36,16 @@ func (rp *Processor) processPut(e *reputationEvent.Put) {
|
|||
}
|
||||
|
||||
// check signature
|
||||
if err := value.VerifySignature(); err != nil {
|
||||
if !value.VerifySignature() {
|
||||
rp.log.Info("ignore reputation value",
|
||||
zap.String("reason", "invalid signature"),
|
||||
zap.String("error", err.Error()))
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// check if manager is correct
|
||||
if err := rp.checkManagers(epoch, *value.Manager(), id); err != nil {
|
||||
if err := rp.checkManagers(epoch, value.Manager(), id); err != nil {
|
||||
rp.log.Info("ignore reputation value",
|
||||
zap.String("reason", "wrong manager"),
|
||||
zap.String("error", err.Error()))
|
||||
|
@ -58,14 +57,14 @@ func (rp *Processor) processPut(e *reputationEvent.Put) {
|
|||
}
|
||||
|
||||
func (rp *Processor) checkManagers(e uint64, mng apireputation.PeerID, peer apireputation.PeerID) error {
|
||||
mm, err := rp.mngBuilder.BuildManagers(e, reputation.PeerIDFromBytes(peer.ToV2().GetPublicKey()))
|
||||
mm, err := rp.mngBuilder.BuildManagers(e, peer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not build managers: %w", err)
|
||||
}
|
||||
|
||||
for _, m := range mm {
|
||||
// FIXME: #1147 do not use `ToV2` method outside neofs-api-go library
|
||||
if bytes.Equal(mng.ToV2().GetPublicKey(), m.PublicKey()) {
|
||||
if bytes.Equal(mng.PublicKey(), m.PublicKey()) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ func (rp *Processor) approvePutReputation(e *reputationEvent.Put) {
|
|||
if err != nil {
|
||||
// FIXME: #1147 do not use `ToV2` method outside neofs-api-go library
|
||||
rp.log.Warn("can't send approval tx for reputation value",
|
||||
zap.String("peer_id", hex.EncodeToString(id.ToV2().GetPublicKey())),
|
||||
zap.String("peer_id", hex.EncodeToString(id.PublicKey())),
|
||||
zap.String("error", err.Error()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ func (g *GetByIDPrm) SetID(v ID) {
|
|||
func (c *Client) Get(p GetPrm) ([]reputation.GlobalTrust, error) {
|
||||
invokePrm := client.TestInvokePrm{}
|
||||
invokePrm.SetMethod(getMethod)
|
||||
invokePrm.SetArgs(p.epoch, p.peerID.ToV2().GetPublicKey())
|
||||
invokePrm.SetArgs(p.epoch, p.peerID.PublicKey())
|
||||
|
||||
res, err := c.client.TestInvoke(invokePrm)
|
||||
if err != nil {
|
||||
|
|
|
@ -35,16 +35,11 @@ func (p *PutPrm) SetValue(v reputation.GlobalTrust) {
|
|||
//
|
||||
// If TryNotary is provided, calls notary contract.
|
||||
func (c *Client) Put(p PutPrm) error {
|
||||
data, err := p.value.Marshal()
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't marshal global trust value: %w", err)
|
||||
}
|
||||
|
||||
prm := client.InvokePrm{}
|
||||
prm.SetMethod(putMethod)
|
||||
prm.SetArgs(p.epoch, p.peerID.ToV2().GetPublicKey(), data)
|
||||
prm.SetArgs(p.epoch, p.peerID.PublicKey(), p.value.Marshal())
|
||||
|
||||
err = c.client.Invoke(prm)
|
||||
err := c.client.Invoke(prm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke method (%s): %w", putMethod, err)
|
||||
}
|
||||
|
|
|
@ -82,9 +82,7 @@ func ParsePut(e *subscriptions.NotificationEvent) (event.Event, error) {
|
|||
return nil, fmt.Errorf("peer ID is %d byte long, expected %d", ln, peerIDLength)
|
||||
}
|
||||
|
||||
var publicKey [33]byte
|
||||
copy(publicKey[:], peerID)
|
||||
ev.peerID.SetPublicKey(publicKey)
|
||||
ev.peerID.SetPublicKey(peerID)
|
||||
|
||||
// parse global trust value
|
||||
rawValue, err := client.BytesFromStackItem(params[2])
|
||||
|
|
|
@ -15,9 +15,7 @@ func (p *Put) setPeerID(v []byte) error {
|
|||
return fmt.Errorf("peer ID is %d byte long, expected %d", ln, peerIDLength)
|
||||
}
|
||||
|
||||
var publicKey [33]byte
|
||||
copy(publicKey[:], v)
|
||||
p.peerID.SetPublicKey(publicKey)
|
||||
p.peerID.SetPublicKey(v)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -9,31 +9,27 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
reputationtest "github.com/nspcc-dev/neofs-sdk-go/reputation/test"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestParsePut(t *testing.T) {
|
||||
var (
|
||||
peerID reputation.PeerID
|
||||
peerID = reputationtest.PeerID()
|
||||
|
||||
value reputation.GlobalTrust
|
||||
trust reputation.Trust
|
||||
trustValue float64 = 64
|
||||
trustValue float64 = 0.64
|
||||
|
||||
epoch uint64 = 42
|
||||
|
||||
rawPeerID = [33]byte{1, 2, 3, 4, 5, 6}
|
||||
)
|
||||
|
||||
peerID.SetPublicKey(rawPeerID)
|
||||
|
||||
trust.SetValue(trustValue)
|
||||
trust.SetPeer(&peerID)
|
||||
trust.SetPeer(peerID)
|
||||
|
||||
value.SetTrust(&trust)
|
||||
value.SetTrust(trust)
|
||||
|
||||
rawValue, err := value.Marshal()
|
||||
require.NoError(t, err)
|
||||
rawValue := value.Marshal()
|
||||
|
||||
t.Run("wrong number of parameters", func(t *testing.T) {
|
||||
prms := []stackitem.Item{
|
||||
|
@ -65,7 +61,7 @@ func TestParsePut(t *testing.T) {
|
|||
t.Run("wrong value parameter", func(t *testing.T) {
|
||||
_, err := ParsePut(createNotifyEventFromItems([]stackitem.Item{
|
||||
stackitem.NewBigInteger(new(big.Int).SetUint64(epoch)),
|
||||
stackitem.NewByteArray(rawPeerID[:]),
|
||||
stackitem.NewByteArray(peerID.PublicKey()),
|
||||
stackitem.NewMap(),
|
||||
}))
|
||||
|
||||
|
@ -75,7 +71,7 @@ func TestParsePut(t *testing.T) {
|
|||
t.Run("correct behavior", func(t *testing.T) {
|
||||
ev, err := ParsePut(createNotifyEventFromItems([]stackitem.Item{
|
||||
stackitem.NewBigInteger(new(big.Int).SetUint64(epoch)),
|
||||
stackitem.NewByteArray(rawPeerID[:]),
|
||||
stackitem.NewByteArray(peerID.PublicKey()),
|
||||
stackitem.NewByteArray(rawValue),
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"io"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// Context wraps stdlib context
|
||||
|
@ -59,7 +60,7 @@ type WriterProvider interface {
|
|||
type ManagerBuilder interface {
|
||||
// BuildManagers must compose list of managers. It depends on
|
||||
// particular epoch and PeerID of the current route point.
|
||||
BuildManagers(epoch uint64, p reputation.PeerID) ([]ServerInfo, error)
|
||||
BuildManagers(epoch uint64, p apireputation.PeerID) ([]ServerInfo, error)
|
||||
}
|
||||
|
||||
// ServerInfo describes a set of
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/hrw"
|
||||
netmapcore "github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
apiNetmap "github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -73,10 +71,10 @@ func (x nodeServer) NumberOfAddresses() int {
|
|||
|
||||
// BuildManagers sorts nodes in NetMap with HRW algorithms and
|
||||
// takes the next node after the current one as the only manager.
|
||||
func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]ServerInfo, error) {
|
||||
func (mb *managerBuilder) BuildManagers(epoch uint64, p apireputation.PeerID) ([]ServerInfo, error) {
|
||||
mb.log.Debug("start building managers",
|
||||
zap.Uint64("epoch", epoch),
|
||||
zap.String("peer", hex.EncodeToString(p.Bytes())),
|
||||
zap.Stringer("peer", p),
|
||||
)
|
||||
|
||||
nm, err := mb.nmSrc.GetNetMapByEpoch(epoch)
|
||||
|
@ -94,7 +92,7 @@ func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]Se
|
|||
hrw.SortSliceByValue(nodes, epoch)
|
||||
|
||||
for i := range nodes {
|
||||
if bytes.Equal(nodes[i].PublicKey(), p.Bytes()) {
|
||||
if apireputation.ComparePeerKey(p, nodes[i].PublicKey()) {
|
||||
managerIndex := i + 1
|
||||
|
||||
if managerIndex == len(nodes) {
|
||||
|
|
|
@ -2,10 +2,10 @@ package eigentrustcalc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -69,7 +69,7 @@ func (c *Calculator) Calculate(prm CalculatePrm) {
|
|||
// continue with initial iteration number
|
||||
ctx.SetI(iter)
|
||||
|
||||
err = consumersIter.Iterate(func(daughter reputation.PeerID, iter TrustIterator) error {
|
||||
err = consumersIter.Iterate(func(daughter apireputation.PeerID, iter TrustIterator) error {
|
||||
err := c.prm.WorkerPool.Submit(func() {
|
||||
c.iterateDaughter(iterDaughterPrm{
|
||||
lastIter: prm.last,
|
||||
|
@ -99,7 +99,7 @@ type iterDaughterPrm struct {
|
|||
|
||||
ctx Context
|
||||
|
||||
id reputation.PeerID
|
||||
id apireputation.PeerID
|
||||
|
||||
consumersIter TrustIterator
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ func (c *Calculator) iterateDaughter(p iterDaughterPrm) {
|
|||
initTrust, err := c.prm.InitialTrustSource.InitialTrust(p.id)
|
||||
if err != nil {
|
||||
c.opts.log.Debug("get initial trust failure",
|
||||
zap.String("daughter", hex.EncodeToString(p.id.Bytes())),
|
||||
zap.Stringer("daughter", p.id),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
|
@ -244,14 +244,14 @@ func (c *Calculator) sendInitialValues(ctx Context) {
|
|||
return
|
||||
}
|
||||
|
||||
err = daughterIter.Iterate(func(daughter reputation.PeerID, iterator TrustIterator) error {
|
||||
err = daughterIter.Iterate(func(daughter apireputation.PeerID, iterator TrustIterator) error {
|
||||
return iterator.Iterate(func(trust reputation.Trust) error {
|
||||
trusted := trust.Peer()
|
||||
|
||||
initTrust, err := c.prm.InitialTrustSource.InitialTrust(trusted)
|
||||
if err != nil {
|
||||
c.opts.log.Debug("get initial trust failure",
|
||||
zap.String("peer", hex.EncodeToString(trusted.Bytes())),
|
||||
zap.Stringer("peer", trusted),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
type Context interface {
|
||||
|
@ -22,7 +23,7 @@ type Context interface {
|
|||
// trusts to current node's daughter. Realization may depends
|
||||
// on daughter.
|
||||
type InitialTrustSource interface {
|
||||
InitialTrust(reputation.PeerID) (reputation.TrustValue, error)
|
||||
InitialTrust(apireputation.PeerID) (reputation.TrustValue, error)
|
||||
}
|
||||
|
||||
// TrustIterator must iterate over all retrieved(or calculated) trusts
|
||||
|
@ -31,7 +32,7 @@ type TrustIterator interface {
|
|||
Iterate(reputation.TrustHandler) error
|
||||
}
|
||||
|
||||
type PeerTrustsHandler func(reputation.PeerID, TrustIterator) error
|
||||
type PeerTrustsHandler func(apireputation.PeerID, TrustIterator) error
|
||||
|
||||
// PeerTrustsIterator must iterate over all nodes(PeerIDs) and provide
|
||||
// TrustIterator for iteration over node's Trusts to others peers.
|
||||
|
@ -43,7 +44,7 @@ type DaughterTrustIteratorProvider interface {
|
|||
// InitDaughterIterator must init TrustIterator
|
||||
// that iterates over received local trusts from
|
||||
// daughter p for ctx.Epoch() epoch.
|
||||
InitDaughterIterator(ctx Context, p reputation.PeerID) (TrustIterator, error)
|
||||
InitDaughterIterator(ctx Context, p apireputation.PeerID) (TrustIterator, error)
|
||||
// InitAllDaughtersIterator must init PeerTrustsIterator
|
||||
// that must iterate over all daughters of the current
|
||||
// node(manager) and all trusts received from them for
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package consumerstorage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
eigentrustcalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// Put saves intermediate trust of the consumer to daughter peer.
|
||||
|
@ -76,7 +78,7 @@ func (x *iterationConsumersStorage) put(trust eigentrust.IterationTrust) {
|
|||
s = x.mItems[iter]
|
||||
if s == nil {
|
||||
s = &ConsumersStorage{
|
||||
mItems: make(map[reputation.PeerID]*ConsumersTrusts, 1),
|
||||
mItems: make(map[string]*ConsumersTrusts, 1),
|
||||
}
|
||||
|
||||
x.mItems[iter] = s
|
||||
|
@ -107,7 +109,7 @@ func (x *iterationConsumersStorage) consumers(iter uint32) (s *ConsumersStorage,
|
|||
type ConsumersStorage struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
mItems map[reputation.PeerID]*ConsumersTrusts
|
||||
mItems map[string]*ConsumersTrusts
|
||||
}
|
||||
|
||||
func (x *ConsumersStorage) put(trust eigentrust.IterationTrust) {
|
||||
|
@ -116,12 +118,12 @@ func (x *ConsumersStorage) put(trust eigentrust.IterationTrust) {
|
|||
x.mtx.Lock()
|
||||
|
||||
{
|
||||
daughter := trust.Peer()
|
||||
daughter := trust.Peer().EncodeToString()
|
||||
|
||||
s = x.mItems[daughter]
|
||||
if s == nil {
|
||||
s = &ConsumersTrusts{
|
||||
mItems: make(map[reputation.PeerID]reputation.Trust, 1),
|
||||
mItems: make(map[string]reputation.Trust, 1),
|
||||
}
|
||||
|
||||
x.mItems[daughter] = s
|
||||
|
@ -140,7 +142,16 @@ func (x *ConsumersStorage) Iterate(h eigentrustcalc.PeerTrustsHandler) (err erro
|
|||
x.mtx.RLock()
|
||||
|
||||
{
|
||||
for trusted, trusts := range x.mItems {
|
||||
for strTrusted, trusts := range x.mItems {
|
||||
var trusted apireputation.PeerID
|
||||
|
||||
if strTrusted != "" {
|
||||
err = trusted.DecodeString(strTrusted)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("decode peer ID string %s: %v", strTrusted, err))
|
||||
}
|
||||
}
|
||||
|
||||
if err = h(trusted, trusts); err != nil {
|
||||
break
|
||||
}
|
||||
|
@ -157,14 +168,14 @@ func (x *ConsumersStorage) Iterate(h eigentrustcalc.PeerTrustsHandler) (err erro
|
|||
type ConsumersTrusts struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
mItems map[reputation.PeerID]reputation.Trust
|
||||
mItems map[string]reputation.Trust
|
||||
}
|
||||
|
||||
func (x *ConsumersTrusts) put(trust eigentrust.IterationTrust) {
|
||||
x.mtx.Lock()
|
||||
|
||||
{
|
||||
x.mItems[trust.TrustingPeer()] = trust.Trust
|
||||
x.mItems[trust.TrustingPeer().EncodeToString()] = trust.Trust
|
||||
}
|
||||
|
||||
x.mtx.Unlock()
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package daughters
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
eigentrustcalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// Put saves daughter peer's trust to its provider for the epoch.
|
||||
|
@ -17,7 +19,7 @@ func (x *Storage) Put(epoch uint64, trust reputation.Trust) {
|
|||
s = x.mItems[epoch]
|
||||
if s == nil {
|
||||
s = &DaughterStorage{
|
||||
mItems: make(map[reputation.PeerID]*DaughterTrusts, 1),
|
||||
mItems: make(map[string]*DaughterTrusts, 1),
|
||||
}
|
||||
|
||||
x.mItems[epoch] = s
|
||||
|
@ -32,7 +34,7 @@ func (x *Storage) Put(epoch uint64, trust reputation.Trust) {
|
|||
// DaughterTrusts returns daughter trusts for the epoch.
|
||||
//
|
||||
// Returns false if there is no data for the epoch and daughter.
|
||||
func (x *Storage) DaughterTrusts(epoch uint64, daughter reputation.PeerID) (*DaughterTrusts, bool) {
|
||||
func (x *Storage) DaughterTrusts(epoch uint64, daughter apireputation.PeerID) (*DaughterTrusts, bool) {
|
||||
var (
|
||||
s *DaughterStorage
|
||||
ok bool
|
||||
|
@ -69,7 +71,7 @@ func (x *Storage) AllDaughterTrusts(epoch uint64) (*DaughterStorage, bool) {
|
|||
type DaughterStorage struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
mItems map[reputation.PeerID]*DaughterTrusts
|
||||
mItems map[string]*DaughterTrusts
|
||||
}
|
||||
|
||||
// Iterate passes IDs of the daughter peers with their trusts to h.
|
||||
|
@ -79,7 +81,16 @@ func (x *DaughterStorage) Iterate(h eigentrustcalc.PeerTrustsHandler) (err error
|
|||
x.mtx.RLock()
|
||||
|
||||
{
|
||||
for daughter, daughterTrusts := range x.mItems {
|
||||
for strDaughter, daughterTrusts := range x.mItems {
|
||||
var daughter apireputation.PeerID
|
||||
|
||||
if strDaughter != "" {
|
||||
err = daughter.DecodeString(strDaughter)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("decode peer ID string %s: %v", strDaughter, err))
|
||||
}
|
||||
}
|
||||
|
||||
if err = h(daughter, daughterTrusts); err != nil {
|
||||
break
|
||||
}
|
||||
|
@ -97,12 +108,12 @@ func (x *DaughterStorage) put(trust reputation.Trust) {
|
|||
x.mtx.Lock()
|
||||
|
||||
{
|
||||
trusting := trust.TrustingPeer()
|
||||
trusting := trust.TrustingPeer().EncodeToString()
|
||||
|
||||
dt = x.mItems[trusting]
|
||||
if dt == nil {
|
||||
dt = &DaughterTrusts{
|
||||
mItems: make(map[reputation.PeerID]reputation.Trust, 1),
|
||||
mItems: make(map[string]reputation.Trust, 1),
|
||||
}
|
||||
|
||||
x.mItems[trusting] = dt
|
||||
|
@ -114,11 +125,11 @@ func (x *DaughterStorage) put(trust reputation.Trust) {
|
|||
dt.put(trust)
|
||||
}
|
||||
|
||||
func (x *DaughterStorage) daughterTrusts(id reputation.PeerID) (dt *DaughterTrusts, ok bool) {
|
||||
func (x *DaughterStorage) daughterTrusts(id apireputation.PeerID) (dt *DaughterTrusts, ok bool) {
|
||||
x.mtx.RLock()
|
||||
|
||||
{
|
||||
dt, ok = x.mItems[id]
|
||||
dt, ok = x.mItems[id.EncodeToString()]
|
||||
}
|
||||
|
||||
x.mtx.RUnlock()
|
||||
|
@ -133,14 +144,14 @@ func (x *DaughterStorage) daughterTrusts(id reputation.PeerID) (dt *DaughterTrus
|
|||
type DaughterTrusts struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
mItems map[reputation.PeerID]reputation.Trust
|
||||
mItems map[string]reputation.Trust
|
||||
}
|
||||
|
||||
func (x *DaughterTrusts) put(trust reputation.Trust) {
|
||||
x.mtx.Lock()
|
||||
|
||||
{
|
||||
x.mItems[trust.Peer()] = trust
|
||||
x.mItems[trust.Peer().EncodeToString()] = trust
|
||||
}
|
||||
|
||||
x.mtx.Unlock()
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// UpdatePrm groups the parameters of Storage's Update operation.
|
||||
|
@ -13,7 +14,7 @@ type UpdatePrm struct {
|
|||
|
||||
epoch uint64
|
||||
|
||||
peer reputation.PeerID
|
||||
peer apireputation.PeerID
|
||||
}
|
||||
|
||||
// SetEpoch sets number of the epoch
|
||||
|
@ -24,7 +25,7 @@ func (p *UpdatePrm) SetEpoch(e uint64) {
|
|||
|
||||
// SetPeer sets identifier of the peer
|
||||
// with which the local node interacted.
|
||||
func (p *UpdatePrm) SetPeer(id reputation.PeerID) {
|
||||
func (p *UpdatePrm) SetPeer(id apireputation.PeerID) {
|
||||
p.peer = id
|
||||
}
|
||||
|
||||
|
@ -51,12 +52,13 @@ func newTrustValueStorage() *EpochTrustValueStorage {
|
|||
}
|
||||
}
|
||||
|
||||
func stringifyPeerID(id reputation.PeerID) string {
|
||||
return string(id.Bytes())
|
||||
func stringifyPeerID(id apireputation.PeerID) string {
|
||||
return string(id.PublicKey())
|
||||
}
|
||||
|
||||
func peerIDFromString(str string) reputation.PeerID {
|
||||
return reputation.PeerIDFromBytes([]byte(str))
|
||||
func peerIDFromString(str string) (res apireputation.PeerID) {
|
||||
res.SetPublicKey([]byte(str))
|
||||
return
|
||||
}
|
||||
|
||||
func (s *EpochTrustValueStorage) update(prm UpdatePrm) {
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package reputation
|
||||
|
||||
const peerIDLength = 33
|
||||
|
||||
// PeerID represents identifier of reputation system participant.
|
||||
type PeerID [peerIDLength]byte
|
||||
|
||||
// Bytes converts PeerID to []byte.
|
||||
func (id PeerID) Bytes() []byte {
|
||||
return id[:]
|
||||
}
|
||||
|
||||
// PeerIDFromBytes restores PeerID from []byte.
|
||||
func PeerIDFromBytes(data []byte) (id PeerID) {
|
||||
copy(id[:], data)
|
||||
return
|
||||
}
|
|
@ -2,6 +2,8 @@ package reputation
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
// TrustValue represents the numeric value of the node's trust.
|
||||
|
@ -56,7 +58,7 @@ func (v TrustValue) IsZero() bool {
|
|||
|
||||
// Trust represents peer's trust (reputation).
|
||||
type Trust struct {
|
||||
trusting, peer PeerID
|
||||
trusting, peer reputation.PeerID
|
||||
|
||||
val TrustValue
|
||||
}
|
||||
|
@ -80,21 +82,21 @@ func (t *Trust) SetValue(val TrustValue) {
|
|||
}
|
||||
|
||||
// Peer returns trusted peer ID.
|
||||
func (t Trust) Peer() PeerID {
|
||||
func (t Trust) Peer() reputation.PeerID {
|
||||
return t.peer
|
||||
}
|
||||
|
||||
// SetPeer sets trusted peer ID.
|
||||
func (t *Trust) SetPeer(id PeerID) {
|
||||
func (t *Trust) SetPeer(id reputation.PeerID) {
|
||||
t.peer = id
|
||||
}
|
||||
|
||||
// TrustingPeer returns trusting peer ID.
|
||||
func (t Trust) TrustingPeer() PeerID {
|
||||
func (t Trust) TrustingPeer() reputation.PeerID {
|
||||
return t.trusting
|
||||
}
|
||||
|
||||
// SetTrustingPeer sets trusting peer ID.
|
||||
func (t *Trust) SetTrustingPeer(id PeerID) {
|
||||
func (t *Trust) SetTrustingPeer(id reputation.PeerID) {
|
||||
t.trusting = id
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue