From f23d8a5f4a84f025986640e7516ee82b3e26f718 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 8 Sep 2020 12:09:08 +0300 Subject: [PATCH] [#21] ir: Remove excess todo Signed-off-by: Alex Vanin --- pkg/innerring/invoke/balance.go | 2 +- pkg/innerring/processors/balance/handlers.go | 4 ++-- .../processors/balance/process_assets.go | 2 +- .../processors/container/handlers.go | 8 ++++---- pkg/innerring/processors/neofs/handlers.go | 20 +++++++++---------- .../processors/neofs/process_assets.go | 4 ++-- pkg/innerring/processors/netmap/handlers.go | 16 +++++++-------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pkg/innerring/invoke/balance.go b/pkg/innerring/invoke/balance.go index 41465a835a..ef3a349f96 100644 --- a/pkg/innerring/invoke/balance.go +++ b/pkg/innerring/invoke/balance.go @@ -89,6 +89,6 @@ func LockAsset(cli *client.Client, con util.Uint160, p *LockParams) error { p.User.BytesBE(), p.LockAccount.BytesBE(), p.Amount, - int64(p.Until), // fixme: invoke can work only with int64 values + int64(p.Until), ) } diff --git a/pkg/innerring/processors/balance/handlers.go b/pkg/innerring/processors/balance/handlers.go index 8aa8ed9dcf..9403a5b898 100644 --- a/pkg/innerring/processors/balance/handlers.go +++ b/pkg/innerring/processors/balance/handlers.go @@ -9,7 +9,7 @@ import ( ) func (bp *Processor) handleLock(ev event.Event) { - lock := ev.(balanceEvent.Lock) // todo: check panic in production + lock := ev.(balanceEvent.Lock) bp.log.Info("notification", zap.String("type", "lock"), zap.String("value", hex.EncodeToString(lock.ID()))) @@ -18,7 +18,7 @@ func (bp *Processor) handleLock(ev event.Event) { err := bp.pool.Submit(func() { bp.processLock(&lock) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage bp.log.Warn("balance worker pool drained", zap.Int("capacity", bp.pool.Cap())) } diff --git a/pkg/innerring/processors/balance/process_assets.go b/pkg/innerring/processors/balance/process_assets.go index acb1803918..dc5a125d79 100644 --- a/pkg/innerring/processors/balance/process_assets.go +++ b/pkg/innerring/processors/balance/process_assets.go @@ -17,7 +17,7 @@ func (bp *Processor) processLock(lock *balanceEvent.Lock) { err := invoke.CashOutCheque(bp.mainnetClient, bp.neofsContract, &invoke.ChequeParams{ ID: lock.ID(), - Amount: lock.Amount() / 1_0000_0000, // todo: Fixed16 to Fixed8 + Amount: lock.Amount() / 1_0000_0000, // Fixed16 to Fixed8 User: lock.User(), LockAccount: lock.LockAccount(), }) diff --git a/pkg/innerring/processors/container/handlers.go b/pkg/innerring/processors/container/handlers.go index 9e62e26608..a294456769 100644 --- a/pkg/innerring/processors/container/handlers.go +++ b/pkg/innerring/processors/container/handlers.go @@ -10,7 +10,7 @@ import ( ) func (cp *Processor) handlePut(ev event.Event) { - put := ev.(containerEvent.Put) // todo: check panic in production + put := ev.(containerEvent.Put) id := sha256.Sum256(put.Container()) cp.log.Info("notification", @@ -21,14 +21,14 @@ func (cp *Processor) handlePut(ev event.Event) { err := cp.pool.Submit(func() { cp.processContainerPut(&put) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage cp.log.Warn("container processor worker pool drained", zap.Int("capacity", cp.pool.Cap())) } } func (cp *Processor) handleDelete(ev event.Event) { - del := ev.(containerEvent.Delete) // todo: check panic in production + del := ev.(containerEvent.Delete) cp.log.Info("notification", zap.String("type", "container delete"), zap.String("id", base58.Encode(del.ContainerID()))) @@ -37,7 +37,7 @@ func (cp *Processor) handleDelete(ev event.Event) { err := cp.pool.Submit(func() { cp.processContainerDelete(&del) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage cp.log.Warn("container processor worker pool drained", zap.Int("capacity", cp.pool.Cap())) } diff --git a/pkg/innerring/processors/neofs/handlers.go b/pkg/innerring/processors/neofs/handlers.go index 487b02cac6..deed878503 100644 --- a/pkg/innerring/processors/neofs/handlers.go +++ b/pkg/innerring/processors/neofs/handlers.go @@ -9,7 +9,7 @@ import ( ) func (np *Processor) handleDeposit(ev event.Event) { - deposit := ev.(neofsEvent.Deposit) // todo: check panic in production + deposit := ev.(neofsEvent.Deposit) np.log.Info("notification", zap.String("type", "deposit"), zap.String("id", hex.EncodeToString(deposit.ID()))) @@ -18,14 +18,14 @@ func (np *Processor) handleDeposit(ev event.Event) { err := np.pool.Submit(func() { np.processDeposit(&deposit) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("neofs processor worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleWithdraw(ev event.Event) { - withdraw := ev.(neofsEvent.Withdraw) // todo: check panic in production + withdraw := ev.(neofsEvent.Withdraw) np.log.Info("notification", zap.String("type", "withdraw"), zap.String("id", hex.EncodeToString(withdraw.ID()))) @@ -34,14 +34,14 @@ func (np *Processor) handleWithdraw(ev event.Event) { err := np.pool.Submit(func() { np.processWithdraw(&withdraw) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("neofs processor worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleCheque(ev event.Event) { - cheque := ev.(neofsEvent.Cheque) // todo: check panic in production + cheque := ev.(neofsEvent.Cheque) np.log.Info("notification", zap.String("type", "cheque"), zap.String("id", hex.EncodeToString(cheque.ID()))) @@ -50,14 +50,14 @@ func (np *Processor) handleCheque(ev event.Event) { err := np.pool.Submit(func() { np.processCheque(&cheque) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("neofs processor worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleConfig(ev event.Event) { - cfg := ev.(neofsEvent.Config) // todo: check panic in production + cfg := ev.(neofsEvent.Config) np.log.Info("notification", zap.String("type", "set config"), zap.String("key", hex.EncodeToString(cfg.Key())), @@ -67,14 +67,14 @@ func (np *Processor) handleConfig(ev event.Event) { err := np.pool.Submit(func() { np.processConfig(&cfg) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("neofs processor worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleUpdateInnerRing(ev event.Event) { - updIR := ev.(neofsEvent.UpdateInnerRing) // todo: check panic in production + updIR := ev.(neofsEvent.UpdateInnerRing) np.log.Info("notification", zap.String("type", "update inner ring"), ) @@ -83,7 +83,7 @@ func (np *Processor) handleUpdateInnerRing(ev event.Event) { err := np.pool.Submit(func() { np.processUpdateInnerRing(&updIR) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("neofs processor worker pool drained", zap.Int("capacity", np.pool.Cap())) } diff --git a/pkg/innerring/processors/neofs/process_assets.go b/pkg/innerring/processors/neofs/process_assets.go index 52e43da4ca..b35d6c7df3 100644 --- a/pkg/innerring/processors/neofs/process_assets.go +++ b/pkg/innerring/processors/neofs/process_assets.go @@ -55,7 +55,7 @@ func (np *Processor) processWithdraw(withdraw *neofsEvent.Withdraw) { } // create lock account - // todo: check collision there, consider reversed script hash + // fixme: check collision there, consider reversed script hash lock, err := util.Uint160DecodeBytesBE(withdraw.ID()[:util.Uint160Size]) if err != nil { np.log.Error("can't create lock account", zap.Error(err)) @@ -69,7 +69,7 @@ func (np *Processor) processWithdraw(withdraw *neofsEvent.Withdraw) { ID: withdraw.ID(), User: withdraw.User(), LockAccount: lock, - Amount: withdraw.Amount() * 1_0000_0000, // todo: from Fixed8 to Fixed16 + Amount: withdraw.Amount() * 1_0000_0000, // from Fixed8 to Fixed16 Until: curEpoch + lockAccountLifetime, }) if err != nil { diff --git a/pkg/innerring/processors/netmap/handlers.go b/pkg/innerring/processors/netmap/handlers.go index 51aba5b95d..bd0b1cdee3 100644 --- a/pkg/innerring/processors/netmap/handlers.go +++ b/pkg/innerring/processors/netmap/handlers.go @@ -10,21 +10,21 @@ import ( ) func (np *Processor) handleNewEpochTick(ev event.Event) { - _ = ev.(timerEvent.NewEpochTick) // todo: check panic in production + _ = ev.(timerEvent.NewEpochTick) np.log.Info("tick", zap.String("type", "epoch")) // send event to the worker pool err := np.pool.Submit(func() { np.processNewEpochTick() }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("netmap worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleNewEpoch(ev event.Event) { - epochEvent := ev.(netmapEvent.NewEpoch) // todo: check panic in production + epochEvent := ev.(netmapEvent.NewEpoch) np.log.Info("notification", zap.String("type", "new epoch"), zap.Uint64("value", epochEvent.EpochNumber())) @@ -35,14 +35,14 @@ func (np *Processor) handleNewEpoch(ev event.Event) { np.processNewEpoch(epochEvent.EpochNumber()) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("netmap worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleAddPeer(ev event.Event) { - newPeer := ev.(netmapEvent.AddPeer) // todo: check panic in production + newPeer := ev.(netmapEvent.AddPeer) np.log.Info("notification", zap.String("type", "add peer"), @@ -54,14 +54,14 @@ func (np *Processor) handleAddPeer(ev event.Event) { np.processAddPeer(newPeer.Node()) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("netmap worker pool drained", zap.Int("capacity", np.pool.Cap())) } } func (np *Processor) handleUpdateState(ev event.Event) { - updPeer := ev.(netmapEvent.UpdatePeer) // todo: check panic in production + updPeer := ev.(netmapEvent.UpdatePeer) np.log.Info("notification", zap.String("type", "update peer state"), zap.String("key", hex.EncodeToString(updPeer.PublicKey().Bytes()))) @@ -72,7 +72,7 @@ func (np *Processor) handleUpdateState(ev event.Event) { np.processUpdatePeer(updPeer) }) if err != nil { - // todo: move into controlled degradation stage + // there system can be moved into controlled degradation stage np.log.Warn("netmap worker pool drained", zap.Int("capacity", np.pool.Cap())) }