Skip to content

Commit

Permalink
Reduce severity of node nonce error (#57)
Browse files Browse the repository at this point in the history
* Reduce severity of node nonce error

* add to changelog
  • Loading branch information
xmariachi authored Sep 19, 2024
1 parent a5376bf commit c48ff3e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
50 changes: 24 additions & 26 deletions usecase/spawn_actor_processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}

0 comments on commit c48ff3e

Please sign in to comment.