From e2e0a185b4ac3b0feca49f0d63f828ffbac0059b Mon Sep 17 00:00:00 2001 From: Diego C Date: Thu, 9 May 2024 11:55:19 +0200 Subject: [PATCH] Diego/ora 1389 worker and reputer leader nonce validation before sending (#120) Check that nonces are in the bulk before sending. --- cmd/node/appchain.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/node/appchain.go b/cmd/node/appchain.go index 5ad7b7a..e9428ca 100644 --- a/cmd/node/appchain.go +++ b/cmd/node/appchain.go @@ -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, @@ -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,