Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Diego/ora 1389 worker and reputer leader nonce validation before send…
Browse files Browse the repository at this point in the history
…ing (#120)

Check that nonces are in the bulk before sending.
  • Loading branch information
xmariachi authored May 9, 2024
1 parent 88b9e6e commit e2e0a18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/node/appchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ func (ap *AppChain) SendWorkerModeData(ctx context.Context, topicId uint64, resu
}
}

if nonce == nil {
ap.Logger.Warn().Msg("No valid WorkerDataBundles with nonces found, not sending data to the chain")
return
}

// Make 1 request per worker
req := &types.MsgInsertBulkWorkerPayload{
Sender: ap.ReputerAddress,
Expand Down Expand Up @@ -413,6 +418,11 @@ func (ap *AppChain) SendReputerModeData(ctx context.Context, topicId uint64, res
}
}

if nonceCurrent == nil || nonceEval == nil {
ap.Logger.Error().Uint64("topic", topicId).Msg("No valid ReputerDataBundles with nonces found, not sending data to the chain")
return
}

// Make 1 request per worker
req := &types.MsgInsertBulkReputerPayload{
Sender: ap.ReputerAddress,
Expand Down

0 comments on commit e2e0a18

Please sign in to comment.