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

Commit

Permalink
chore: not sign nonce 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Oct 12, 2023
1 parent 41addbe commit e1259d9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,18 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
return celestiatypes.ErrAttestationNotFound
}

if nonce == 1 {
// there is no need to sign nonce 1 as the Blobstream contract will trust it when deploying.
return nil
}
// check if we need to sign or not
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
}
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 e1259d9

Please sign in to comment.