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) bftCount := smartcontract.GetDefaultHonestNodeCount(size)
for i := range wallets { for i := range wallets {
i := i i := i
ps := make(keys.PublicKeys, len(pubs)) ps := pubs.Copy()
copy(ps, pubs)
errG.Go(func() error { errG.Go(func() error {
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil { if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
return fmt.Errorf("can't create committee account: %w", err) return fmt.Errorf("can't create committee account: %w", err)

View file

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

View file

@ -246,13 +246,9 @@ func (s *Server) initAlphabetProcessor(cfg *viper.Viper) error {
} }
err = bindMorphProcessor(s.alphabetProcessor, s) err = bindMorphProcessor(s.alphabetProcessor, s)
if err != nil {
return err return err
} }
return nil
}
func (s *Server) initContainerProcessor(cfg *viper.Viper, cnrClient *container.Client, func (s *Server) initContainerProcessor(cfg *viper.Viper, cnrClient *container.Client,
frostfsIDClient *frostfsid.Client) error { frostfsIDClient *frostfsid.Client) error {
// container processor // container processor
@ -454,13 +450,9 @@ func (s *Server) initProcessors(cfg *viper.Viper, morphClients *serverMorphClien
} }
err = s.initAlphabetProcessor(cfg) err = s.initAlphabetProcessor(cfg)
if err != nil {
return err return err
} }
return nil
}
func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<- error) (*chainParams, error) { func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<- error) (*chainParams, error) {
fromSideChainBlock, err := s.persistate.UInt32(persistateSideChainLastBlockKey) fromSideChainBlock, err := s.persistate.UInt32(persistateSideChainLastBlockKey)
if err != nil { if err != nil {

View file

@ -45,7 +45,7 @@ func (np *Processor) processDeposit(deposit frostfsEvent.Deposit) bool {
val, ok := np.mintEmitCache.Get(receiver.String()) val, ok := np.mintEmitCache.Get(receiver.String())
if ok && val+np.mintEmitThreshold >= curEpoch { if ok && val+np.mintEmitThreshold >= curEpoch {
np.log.Warn(logs.FrostFSDoubleMintEmissionDeclined, np.log.Warn(logs.FrostFSDoubleMintEmissionDeclined,
zap.String("receiver", receiver.String()), zap.Stringer("receiver", receiver),
zap.Uint64("last_emission", val), zap.Uint64("last_emission", val),
zap.Uint64("current_epoch", curEpoch)) 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]} orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
main := keys.PublicKeys{k[1], k[2], k[5], k[4]} main := keys.PublicKeys{k[1], k[2], k[5], k[4]}
exp := make(keys.PublicKeys, len(main)) exp := main.Copy()
copy(exp, main)
sort.Sort(exp) sort.Sort(exp)
got, err := newAlphabetList(orig, main) got, err := newAlphabetList(orig, main)

View file

@ -33,13 +33,9 @@ func (c *Config) Init() error {
} }
c.decoder, err = zstd.NewReader(nil) c.decoder, err = zstd.NewReader(nil)
if err != nil {
return err return err
} }
return nil
}
// NeedsCompression returns true if the object should be compressed. // NeedsCompression returns true if the object should be compressed.
// For an object to be compressed 2 conditions must hold: // For an object to be compressed 2 conditions must hold:
// 1. Compression is enabled in settings. // 1. Compression is enabled in settings.

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. // 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. // However we could change weights in future and easily forget this function.
for _, sh := range e.shards { 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) ch := make(chan oid.Address)
errG, ctx := errgroup.WithContext(ctx) errG, ctx := errgroup.WithContext(ctx)

View file

@ -146,10 +146,7 @@ func (t *boltForest) Init() error {
return err return err
} }
_, err = tx.CreateBucketIfNotExists(logBucket) _, err = tx.CreateBucketIfNotExists(logBucket)
if err != nil {
return err return err
}
return nil
}) })
} }
func (t *boltForest) Close() error { 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.metaBase.SetLogger(s.log)
s.blobStor.SetLogger(s.log) s.blobStor.SetLogger(s.log)
if s.hasWriteCache() { if s.hasWriteCache() {

View file

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

View file

@ -243,13 +243,9 @@ func (p Preparator) validateParameterOpcodes(ops []Op) error {
} }
err = validateNestedArgs(argsLen, ops[:l-2]) err = validateNestedArgs(argsLen, ops[:l-2])
if err != nil {
return err return err
} }
return nil
}
func validateNestedArgs(expArgLen int64, ops []Op) error { func validateNestedArgs(expArgLen int64, ops []Op) error {
var ( var (
currentCode opcode.Opcode currentCode opcode.Opcode

View file

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

View file

@ -102,11 +102,7 @@ func (s *TokenStore) Get(ownerID user.ID, tokenID []byte) (t *storage.PrivateTok
var err error var err error
t, err = s.unpackToken(rawToken) t, err = s.unpackToken(rawToken)
if err != nil {
return err return err
}
return nil
}) })
if err != nil { if err != nil {
s.l.Error(logs.PersistentCouldNotGetSessionFromPersistentStorage, 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) { if !basicACL.AllowedBearerRules(op) {
s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL, s.log.Debug(logs.TreeBearerPresentedButNotAllowedByACL,
zap.String("cid", cid.EncodeToString()), zap.String("cid", cid.EncodeToString()),
zap.String("op", op.String()), zap.Stringer("op", op),
) )
} else { } else {
useBearer = true useBearer = true