diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e73de..ca8623e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#55](https://github.com/allora-network/allora-offchain-node/pull/55) Passive set retrial optimization. * [#56](https://github.com/allora-network/allora-offchain-node/pull/56) Improve logs +* [#57](https://github.com/allora-network/allora-offchain-node/pull/57) Reduced severity of nonce failure to Warning. ### Security diff --git a/usecase/spawn_actor_processes.go b/usecase/spawn_actor_processes.go index 6bf29b6..797e086 100644 --- a/usecase/spawn_actor_processes.go +++ b/usecase/spawn_actor_processes.go @@ -60,21 +60,20 @@ func (suite *UseCaseSuite) runWorkerProcess(worker lib.WorkerConfig) { for { latestOpenWorkerNonce, err := suite.Node.GetLatestOpenWorkerNonceByTopicId(worker.TopicId) if err != nil { - log.Error().Err(err).Uint64("topicId", worker.TopicId).Msg("Error getting latest open worker nonce on topic") - } - - if latestOpenWorkerNonce.BlockHeight > latestNonceHeightActedUpon { - log.Debug().Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Building and committing worker payload for topic") - - success, err := suite.BuildCommitWorkerPayload(worker, latestOpenWorkerNonce) - if !success || err != nil { - log.Error().Err(err).Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Error building and committing worker payload for topic") - } - latestNonceHeightActedUpon = latestOpenWorkerNonce.BlockHeight + log.Warn().Err(err).Uint64("topicId", worker.TopicId).Msg("Error getting latest open worker nonce on topic - node availability issue?") } else { - log.Debug().Uint64("topicId", worker.TopicId).Msg("No new worker nonce found") + if latestOpenWorkerNonce.BlockHeight > latestNonceHeightActedUpon { + log.Debug().Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Building and committing worker payload for topic") + + success, err := suite.BuildCommitWorkerPayload(worker, latestOpenWorkerNonce) + if !success || err != nil { + log.Error().Err(err).Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Error building and committing worker payload for topic") + } + latestNonceHeightActedUpon = latestOpenWorkerNonce.BlockHeight + } else { + log.Debug().Uint64("topicId", worker.TopicId).Msg("No new worker nonce found") + } } - suite.Wait(worker.LoopSeconds) } } @@ -92,21 +91,20 @@ func (suite *UseCaseSuite) runReputerProcess(reputer lib.ReputerConfig) { for { latestOpenReputerNonce, err := suite.Node.GetOldestReputerNonceByTopicId(reputer.TopicId) if err != nil { - log.Error().Err(err).Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Error getting latest open reputer nonce on topic") - } - - if latestOpenReputerNonce > latestNonceHeightActedUpon { - log.Debug().Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Building and committing reputer payload for topic") - - success, err := suite.BuildCommitReputerPayload(reputer, latestOpenReputerNonce) - if !success || err != nil { - log.Error().Err(err).Uint64("topicId", reputer.TopicId).Msg("Error building and committing reputer payload for topic") - } - latestNonceHeightActedUpon = latestOpenReputerNonce + log.Warn().Err(err).Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Error getting latest open reputer nonce on topic - node availability issue?") } else { - log.Debug().Uint64("topicId", reputer.TopicId).Msg("No new reputer nonce found") + if latestOpenReputerNonce > latestNonceHeightActedUpon { + log.Debug().Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Building and committing reputer payload for topic") + + success, err := suite.BuildCommitReputerPayload(reputer, latestOpenReputerNonce) + if !success || err != nil { + log.Error().Err(err).Uint64("topicId", reputer.TopicId).Msg("Error building and committing reputer payload for topic") + } + latestNonceHeightActedUpon = latestOpenReputerNonce + } else { + log.Debug().Uint64("topicId", reputer.TopicId).Msg("No new reputer nonce found") + } } - suite.Wait(reputer.LoopSeconds) } }