Skip to content

Commit

Permalink
Drop Prm/Res from shard (#3025)
Browse files Browse the repository at this point in the history
Follow #3001, #3008. With some additions.
  • Loading branch information
carpawell authored Nov 25, 2024
2 parents 339b4cb + 953ffc4 commit 3f6d545
Show file tree
Hide file tree
Showing 122 changed files with 774 additions and 1,677 deletions.
2 changes: 1 addition & 1 deletion cmd/neofs-ir/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func main() {
err := srv.Shutdown()
if err != nil {
log.Debug("could not shutdown HTTP server",
zap.String("error", err.Error()),
zap.Error(err),
)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func initBasics(c *cfg, key *keys.PrivateKey, stateStorage *state.PersistentStor
fromSideChainBlock, err := stateStorage.UInt32(persistateSideChainLastBlockKey)
if err != nil {
fromSideChainBlock = 0
c.log.Warn("can't get last processed side chain block number", zap.String("error", err.Error()))
c.log.Warn("can't get last processed side chain block number", zap.Error(err))
}

cli, err := client.New(key,
Expand All @@ -687,7 +687,7 @@ func initBasics(c *cfg, key *keys.PrivateKey, stateStorage *state.PersistentStor
if err != nil {
c.log.Info("failed to create neo RPC client",
zap.Any("endpoints", addresses),
zap.String("error", err.Error()),
zap.Error(err),
)

fatalOnErr(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-node/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (d *localStorageLoad) Iterate(f loadcontroller.UsedSpaceFilter, h loadcontr
if err != nil {
d.log.Debug("failed to calculate container size in storage engine",
zap.Stringer("cid", idList[i]),
zap.String("error", err.Error()),
zap.Error(err),
)

continue
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func preRunAndLog(c *cfg, name string, srv *httputil.Server) {
ln, err := srv.Listen()
if err != nil {
c.log.Fatal(fmt.Sprintf("could not init %s service", name),
zap.String("error", err.Error()),
zap.Error(err),
)
return
}
Expand All @@ -103,7 +103,7 @@ func preRunAndLog(c *cfg, name string, srv *httputil.Server) {
err := srv.Shutdown()
if err != nil {
c.log.Debug(fmt.Sprintf("could not shutdown %s server", name),
zap.String("error", err.Error()),
zap.Error(err),
)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func initNetmapService(c *cfg) {
if err != nil {
c.log.Error("could not update node state on new epoch",
zap.Uint64("epoch", e),
zap.String("error", err.Error()),
zap.Error(err),
)

return
Expand All @@ -210,7 +210,7 @@ func initNetmapService(c *cfg) {
err := makeNotaryDeposit(c)
if err != nil {
c.log.Error("could not make notary deposit",
zap.String("error", err.Error()),
zap.Error(err),
)
}
})
Expand Down
6 changes: 3 additions & 3 deletions cmd/neofs-node/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *cfg) MaxObjectSize() uint64 {
sz, err := c.cfgNetmap.wrapper.MaxObjectSize()
if err != nil {
c.log.Error("could not get max object size value",
zap.String("error", err.Error()),
zap.Error(err),
)
}

Expand Down Expand Up @@ -210,7 +210,7 @@ func initObjectService(c *cfg) {
err := ls.Delete(addr)
if err != nil {
c.log.Warn("could not inhume mark redundant copy as garbage",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}),
Expand Down Expand Up @@ -494,7 +494,7 @@ func (c *reputationClientConstructor) Get(info coreclient.NodeInfo) (coreclient.
}
} else {
c.log.Warn("could not get latest network map to overload the client",
zap.String("error", err.Error()),
zap.Error(err),
)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-node/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func initLocalStorage(c *cfg) {
err := ls.Close()
if err != nil {
c.log.Info("storage engine closing failure",
zap.String("error", err.Error()),
zap.Error(err),
)
} else {
c.log.Info("all components of the storage engine closed successfully")
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-node/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func initTreeService(c *cfg) {
// Ignore pilorama.ErrTreeNotFound but other errors, including shard.ErrReadOnly, should be logged.
c.log.Error("container removal event received, but trees weren't removed",
zap.Stringer("cid", ev.ID),
zap.String("error", err.Error()))
zap.Error(err))
}
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/innerring/blocktimer.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func newEpochTimer(args *epochTimerArgs) *timer.BlockTimer {
if err != nil {
args.l.Warn("can't stop epoch estimation",
zap.Uint64("epoch", epochN),
zap.String("error", err.Error()))
zap.Error(err))
}
})

Expand Down
8 changes: 4 additions & 4 deletions pkg/innerring/innerring.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) {
if err != nil {
// we don't stop inner ring execution on this error
s.log.Warn("can't vote for prepared validators",
zap.String("error", err.Error()))
zap.Error(err))
}

// tick initial epoch
Expand Down Expand Up @@ -284,7 +284,7 @@ func (s *Server) Stop() {
for _, c := range s.closers {
if err := c(); err != nil {
s.log.Warn("closer error",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}
Expand Down Expand Up @@ -324,7 +324,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
fromSideChainBlock, err := server.persistate.UInt32(persistateSideChainLastBlockKey)
if err != nil {
fromSideChainBlock = 0
log.Warn("can't get last processed side chain block number", zap.String("error", err.Error()))
log.Warn("can't get last processed side chain block number", zap.Error(err))
}

morphChain := chainParams{
Expand Down Expand Up @@ -588,7 +588,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
fromMainChainBlock, err := server.persistate.UInt32(persistateMainChainLastBlockKey)
if err != nil {
fromMainChainBlock = 0
log.Warn("can't get last processed main chain block number", zap.String("error", err.Error()))
log.Warn("can't get last processed main chain block number", zap.Error(err))
}
mainnetChain.from = fromMainChainBlock

Expand Down
8 changes: 4 additions & 4 deletions pkg/innerring/processors/alphabet/process_emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (ap *Processor) processEmit() {
// there is no signature collecting, so we don't need extra fee
err := ap.morphClient.Invoke(contract, 0, emitMethod)
if err != nil {
ap.log.Warn("can't invoke alphabet emit method", zap.String("error", err.Error()))
ap.log.Warn("can't invoke alphabet emit method", zap.Error(err))

return
}
Expand All @@ -43,7 +43,7 @@ func (ap *Processor) processEmit() {
networkMap, err := ap.netmapClient.NetMap()
if err != nil {
ap.log.Warn("can't get netmap snapshot to emit gas to storage nodes",
zap.String("error", err.Error()))
zap.Error(err))

return
}
Expand All @@ -65,7 +65,7 @@ func (ap *Processor) processEmit() {
key, err := keys.NewPublicKeyFromBytes(keyBytes, elliptic.P256())
if err != nil {
ap.log.Warn("can't parse node public key",
zap.String("error", err.Error()))
zap.Error(err))

continue
}
Expand All @@ -75,7 +75,7 @@ func (ap *Processor) processEmit() {
ap.log.Warn("can't transfer gas",
zap.String("receiver", key.Address()),
zap.Int64("amount", int64(gasPerNode)),
zap.String("error", err.Error()),
zap.Error(err),
)

continue
Expand Down
14 changes: 7 additions & 7 deletions pkg/innerring/processors/audit/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {

containers, err := ap.selectContainersToAudit(epoch)
if err != nil {
log.Error("container selection failure", zap.String("error", err.Error()))
log.Error("container selection failure", zap.Error(err))

return
}
Expand All @@ -40,7 +40,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {
nm, err := ap.netmapClient.GetNetMap(0)
if err != nil {
ap.log.Error("can't fetch network map",
zap.String("error", err.Error()))
zap.Error(err))

return
}
Expand All @@ -53,7 +53,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {
if err != nil {
log.Error("can't get container info, ignore",
zap.Stringer("cid", containers[i]),
zap.String("error", err.Error()))
zap.Error(err))

continue
}
Expand All @@ -63,7 +63,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {
if err != nil {
log.Info("can't build placement for container, ignore",
zap.Stringer("cid", containers[i]),
zap.String("error", err.Error()))
zap.Error(err))

continue
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {

if err := ap.taskManager.PushTask(auditTask); err != nil {
ap.log.Error("could not push audit task",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func (ap *Processor) findStorageGroups(cnr cid.ID, shuffled netmapcore.Nodes) []

err := clientcore.NodeInfoFromRawNetmapElement(&info, netmapcore.Node(shuffled[i]))
if err != nil {
log.Warn("parse client node info", zap.String("error", err.Error()))
log.Warn("parse client node info", zap.Error(err))

continue
}
Expand All @@ -152,7 +152,7 @@ func (ap *Processor) findStorageGroups(cnr cid.ID, shuffled netmapcore.Nodes) []
cancel()

if err != nil {
log.Warn("error in storage group search", zap.String("error", err.Error()))
log.Warn("error in storage group search", zap.Error(err))
continue
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/innerring/processors/container/process_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (cp *Processor) processContainerPut(put putEvent) {
err := cp.checkPutContainer(ctx)
if err != nil {
cp.log.Error("put container check failed",
zap.String("error", err.Error()),
zap.Error(err),
)

return
Expand Down Expand Up @@ -108,7 +108,7 @@ func (cp *Processor) approvePutContainer(ctx *putContainerContext) {

if err != nil {
cp.log.Error("could not approve put container",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}
Expand All @@ -124,7 +124,7 @@ func (cp *Processor) processContainerDelete(e *containerEvent.Delete) {
err := cp.checkDeleteContainer(e)
if err != nil {
cp.log.Error("delete container check failed",
zap.String("error", err.Error()),
zap.Error(err),
)

return
Expand Down Expand Up @@ -179,7 +179,7 @@ func (cp *Processor) approveDeleteContainer(e *containerEvent.Delete) {

if err != nil {
cp.log.Error("could not approve delete container",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/innerring/processors/container/process_eacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (cp *Processor) processSetEACL(e container.SetEACL) {
err := cp.checkSetEACL(e)
if err != nil {
cp.log.Error("set EACL check failed",
zap.String("error", err.Error()),
zap.Error(err),
)

return
Expand Down Expand Up @@ -92,7 +92,7 @@ func (cp *Processor) approveSetEACL(e container.SetEACL) {

if err != nil {
cp.log.Error("could not approve set EACL",
zap.String("error", err.Error()),
zap.Error(err),
)
}
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/innerring/processors/governance/process_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
mainnetAlphabet, err := gp.mainnetClient.NeoFSAlphabetList()
if err != nil {
gp.log.Error("can't fetch alphabet list from main net",
zap.String("error", err.Error()))
zap.Error(err))
return
}

sidechainAlphabet, err := gp.morphClient.Committee()
if err != nil {
gp.log.Error("can't fetch alphabet list from side chain",
zap.String("error", err.Error()))
zap.Error(err))
return
}

newAlphabet, err := newAlphabetList(sidechainAlphabet, mainnetAlphabet)
if err != nil {
gp.log.Error("can't merge alphabet lists from main net and side chain",
zap.String("error", err.Error()))
zap.Error(err))
return
}

Expand All @@ -55,19 +55,19 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
err = gp.voter.VoteForSidechainValidator(newAlphabet, &txHash)
if err != nil {
gp.log.Error("can't vote for side chain committee",
zap.String("error", err.Error()))
zap.Error(err))
}

// 2. Update NeoFSAlphabet role in the sidechain.
innerRing, err := gp.irFetcher.InnerRingKeys()
if err != nil {
gp.log.Error("can't fetch inner ring list from side chain",
zap.String("error", err.Error()))
zap.Error(err))
} else {
newInnerRing, err := updateInnerRing(innerRing, sidechainAlphabet, newAlphabet)
if err != nil {
gp.log.Error("can't create new inner ring list with new alphabet keys",
zap.String("error", err.Error()))
zap.Error(err))
} else {
sort.Sort(newInnerRing)

Expand All @@ -80,7 +80,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {

if err != nil {
gp.log.Error("can't update inner ring list with new alphabet keys",
zap.String("error", err.Error()))
zap.Error(err))
}
}
}
Expand All @@ -89,7 +89,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
err = gp.morphClient.UpdateNotaryList(newAlphabet, txHash)
if err != nil {
gp.log.Error("can't update list of notary nodes in side chain",
zap.String("error", err.Error()))
zap.Error(err))
}

// 4. Update NeoFS contract in the mainnet.
Expand All @@ -98,7 +98,7 @@ func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
err = gp.neofsClient.AlphabetUpdate(id, newAlphabet)
if err != nil {
gp.log.Error("can't update list of alphabet nodes in neofs contract",
zap.String("error", err.Error()))
zap.Error(err))
}

gp.log.Info("finished alphabet list update")
Expand Down
2 changes: 1 addition & 1 deletion pkg/innerring/processors/neofs/process_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) {
err = np.morphClient.TransferGas(receiver, np.mintEmitValue)
if err != nil {
np.log.Error("can't transfer native gas to receiver",
zap.String("error", err.Error()))
zap.Error(err))

return
}
Expand Down
Loading

0 comments on commit 3f6d545

Please sign in to comment.