Skip to content

Commit

Permalink
dont log error messages if cant find expected num of signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
nadim-az committed Nov 8, 2024
1 parent 990e639 commit 4c418a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions hyperlane/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func NewRelayer(hyperlaneClient Client, storageLocationOverrides map[string]stri
}

var (
ErrMessageAlreadyDelivered = fmt.Errorf("message has already been delivered")
ErrMessageAlreadyDelivered = fmt.Errorf("message has already been delivered")
ErrNotEnoughSignaturesFound = errors.New("signatures found below expected threshold in in multisig signed checkpoint")
)

func (r *relayer) Relay(ctx context.Context, originChainID string, initiateTxHash string) (destinationTxHash string, destinationChainID string, err error) {
Expand Down Expand Up @@ -108,7 +109,7 @@ func (r *relayer) Relay(ctx context.Context, originChainID string, initiateTxHas
// there
quorumCheckpoint, err := r.checkpointAtIndex(ctx, merkleHookPostDispatch.Index, checkpointFetchers, threshold, dispatch.MessageID)
if err != nil {
return "", "", fmt.Errorf("getting checkpoint at index %d: %w", merkleHookPostDispatch.Index, err)
return "", "", err
}

lmt.Logger(ctx).Debug("found checkpoint with quorum", zap.Uint64("index", merkleHookPostDispatch.Index))
Expand Down Expand Up @@ -215,7 +216,10 @@ func (r *relayer) checkpointAtIndex(
}
}
if len(multiSigCheckpoint.Signatures) < int(threshold) {
return types.MultiSigSignedCheckpoint{}, fmt.Errorf("expected atleast %d signatures in multisig signed checkpoint, but got %d", threshold, len(multiSigCheckpoint.Signatures))
lmt.Logger(ctx).Warn("failed to find expected number of signatures in multisig signed checkpoint",
zap.Uint8("threshold", threshold), zap.Int("num_signatures_found", len(multiSigCheckpoint.Signatures)))

return types.MultiSigSignedCheckpoint{}, ErrNotEnoughSignaturesFound
}
if strings.TrimPrefix(multiSigCheckpoint.Checkpoint.MessageID, "0x") != strings.TrimPrefix(messageID, "0x") {
return types.MultiSigSignedCheckpoint{}, fmt.Errorf("mismatch message id in checkpoint and dipsatch message. dispatch has %s and checkpoint has %s", messageID, multiSigCheckpoint.Checkpoint.MessageID)
Expand Down
6 changes: 5 additions & 1 deletion hyperlane/relayer_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *RelayerRunner) Run(ctx context.Context) error {
isTransferValid, err := r.validateHyperlaneTransfer(ctx, transfer)
if err != nil {
lmt.Logger(ctx).Warn(
"failed to validate Hyperlane transfer- will retry validation on next interval",
"failed to validate Hyperlane transfer",
zap.Error(err),
zap.Int64("transferId", transfer.ID),
zap.String("txHash", transfer.MessageSentTx),
Expand Down Expand Up @@ -119,6 +119,10 @@ func (r *RelayerRunner) Run(ctx context.Context) error {

destinationTxHash, destinationChainID, err := r.relayHandler.Relay(ctx, transfer.SourceChainID, transfer.MessageSentTx)
if err != nil {
if errors.Is(err, ErrNotEnoughSignaturesFound) {
// warning already logged in relayer
continue
}
lmt.Logger(ctx).Error(
"error relaying pending hyperlane transfer",
zap.Error(err),
Expand Down
2 changes: 1 addition & 1 deletion ordersettler/ordersettler.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (r *OrderSettler) verifyOrderSettlements(ctx context.Context) error {

if err = r.verifyOrderSettlement(ctx, settlement); err != nil {
lmt.Logger(ctx).Warn(
"failed to verify order settlement",
"failed to verify order settlement, will retry verification on next interval",
zap.Error(err),
zap.String("orderID", settlement.OrderID),
zap.String("sourceChainID", settlement.SourceChainID),
Expand Down

0 comments on commit 4c418a6

Please sign in to comment.