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

fix: handle first nonce in orchestrator #529

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading