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

Commit

Permalink
fix: handle first nonce in orchestrator (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Oct 12, 2023
1 parent 2c83c82 commit f1353f0
Showing 1 changed file with 9 additions and 7 deletions.
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

0 comments on commit f1353f0

Please sign in to comment.