Small fixes #607

Merged
fyrchik merged 4 commits from fyrchik/frostfs-node:gopatch-example into master 2023-08-17 16:50:04 +00:00
15 changed files with 17 additions and 50 deletions

View file

@ -104,8 +104,7 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
for i := range wallets {
i := i
ps := make(keys.PublicKeys, len(pubs))
copy(ps, pubs)
ps := pubs.Copy()
errG.Go(func() error {
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
return fmt.Errorf("can't create committee account: %w", err)

View file

@ -104,14 +104,14 @@ func serveGRPC(c *cfg) {
go func() {
defer func() {
c.log.Info(logs.FrostFSNodeStopListeningGRPCEndpoint,
zap.String("endpoint", lis.Addr().String()),
zap.Stringer("endpoint", lis.Addr()),
)
c.wg.Done()
}()
c.log.Info(logs.FrostFSNodeStartListeningGRPCEndpoint,
zap.String("endpoint", lis.Addr().String()),
zap.Stringer("endpoint", lis.Addr()),
)
if err := srv.Serve(lis); err != nil {

View file

@ -246,11 +246,7 @@ func (s *Server) initAlphabetProcessor(cfg *viper.Viper) error {
}
err = bindMorphProcessor(s.alphabetProcessor, s)
if err != nil {
return err
}
return nil
}
func (s *Server) initContainerProcessor(cfg *viper.Viper, cnrClient *container.Client,
@ -454,11 +450,7 @@ func (s *Server) initProcessors(cfg *viper.Viper, morphClients *serverMorphClien
}
err = s.initAlphabetProcessor(cfg)
if err != nil {
return err
}
return nil
}
func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<- error) (*chainParams, error) {

View file

@ -45,7 +45,7 @@ func (np *Processor) processDeposit(deposit frostfsEvent.Deposit) bool {
val, ok := np.mintEmitCache.Get(receiver.String())
if ok && val+np.mintEmitThreshold >= curEpoch {
np.log.Warn(logs.FrostFSDoubleMintEmissionDeclined,
zap.String("receiver", receiver.String()),
zap.Stringer("receiver", receiver),
zap.Uint64("last_emission", val),
zap.Uint64("current_epoch", curEpoch))

View file

@ -60,8 +60,7 @@ func TestNewAlphabetList(t *testing.T) {
orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
main := keys.PublicKeys{k[1], k[2], k[5], k[4]}
exp := make(keys.PublicKeys, len(main))
copy(exp, main)
exp := main.Copy()
sort.Sort(exp)
got, err := newAlphabetList(orig, main)

View file

@ -33,11 +33,7 @@ func (c *Config) Init() error {
}
c.decoder, err = zstd.NewReader(nil)
if err != nil {
return err
}
return nil
}
// NeedsCompression returns true if the object should be compressed.

View file

@ -55,7 +55,7 @@ func (e *StorageEngine) RemoveDuplicates(ctx context.Context, prm RemoveDuplicat
// This is not currently the case, because `FreeSpace` metric used by weight sorting is always 0.
// However we could change weights in future and easily forget this function.
for _, sh := range e.shards {
e.log.Debug(logs.EngineStartedDuplicatesRemovalRoutine, zap.String("shard_id", sh.ID().String()))
e.log.Debug(logs.EngineStartedDuplicatesRemovalRoutine, zap.Stringer("shard_id", sh.ID()))
ch := make(chan oid.Address)
errG, ctx := errgroup.WithContext(ctx)

View file

@ -146,10 +146,7 @@ func (t *boltForest) Init() error {
return err
}
_, err = tx.CreateBucketIfNotExists(logBucket)
if err != nil {
return err
}
return nil
})
}
func (t *boltForest) Close() error {

View file

@ -49,7 +49,7 @@ func (s *Shard) UpdateID() (err error) {
}
}
s.log = &logger.Logger{Logger: s.log.With(zap.String("shard_id", s.info.ID.String()))}
s.log = &logger.Logger{Logger: s.log.With(zap.Stringer("shard_id", s.info.ID))}
s.metaBase.SetLogger(s.log)
s.blobStor.SetLogger(s.log)
if s.hasWriteCache() {

View file

@ -101,9 +101,5 @@ func (c *Client) UnsubscribeAll() error {
}
err := c.client.UnsubscribeAll()
if err != nil {
return err
}
return nil
}

View file

@ -243,11 +243,7 @@ func (p Preparator) validateParameterOpcodes(ops []Op) error {
}
err = validateNestedArgs(argsLen, ops[:l-2])
if err != nil {
return err
}
return nil
}
func validateNestedArgs(expArgLen int64, ops []Op) error {

View file

@ -74,11 +74,7 @@ func (n *Writer) Notify(topic string, address oid.Address) error {
}
_, err := n.js.Publish(topic, []byte(address.EncodeToString()), nats.MsgId(messageID))
if err != nil {
return err
}
return nil
}
// New creates new Writer.

View file

@ -102,11 +102,7 @@ func (s *TokenStore) Get(ownerID user.ID, tokenID []byte) (t *storage.PrivateTok
var err error
t, err = s.unpackToken(rawToken)
if err != nil {
return err
}
return nil
})
if err != nil {
s.l.Error(logs.PersistentCouldNotGetSessionFromPersistentStorage,

View file

@ -89,7 +89,7 @@ func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op
if !basicACL.AllowedBearerRules(op) {
s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL,
zap.String("cid", cid.EncodeToString()),
zap.String("op", op.String()),
zap.Stringer("op", op),
)
} else {
useBearer = true