From 41addbe94bfd19377377f4e6ddbbfa8ba523d970 Mon Sep 17 00:00:00 2001 From: rachid Date: Thu, 12 Oct 2023 02:12:32 +0200 Subject: [PATCH] fix: handle first nonce in orchestrator --- orchestrator/orchestrator.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/orchestrator/orchestrator.go b/orchestrator/orchestrator.go index 9a4c0f30..4d480d0d 100644 --- a/orchestrator/orchestrator.go +++ b/orchestrator/orchestrator.go @@ -302,13 +302,15 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error { } // check if we need to sign or not - previousValset, err := orch.AppQuerier.QueryLastValsetBeforeNonce(ctx, att.GetNonce()) - if err != nil { - orch.Logger.Debug("failed to query last valset before nonce (most likely pruned). signing anyway", "err", err.Error()) - } else if !ValidatorPartOfValset(previousValset.Members, orch.EvmAccount.Address.Hex()) { - // no need to sign if the orchestrator is not part of the validator set that needs to sign the attestation - orch.Logger.Debug("validator not part of valset. won't sign", "nonce", nonce) - return nil + if nonce != 1 { + previousValset, err := orch.AppQuerier.QueryLastValsetBeforeNonce(ctx, att.GetNonce()) + if err != nil { + orch.Logger.Debug("failed to query last valset before nonce (most likely pruned). signing anyway", "err", err.Error()) + } else if !ValidatorPartOfValset(previousValset.Members, orch.EvmAccount.Address.Hex()) { + // no need to sign if the orchestrator is not part of the validator set that needs to sign the attestation + orch.Logger.Debug("validator not part of valset. won't sign", "nonce", nonce) + return nil + } } switch castedAtt := att.(type) {