Skip to content

Commit 54ff0cc

Browse files
committed
Handle ErrHeightOutOfRange errors in EstimateGas
1 parent c50ffde commit 54ff0cc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

services/requester/requester.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func (e *EVM) Call(
478478
Uint64("cadence-height", height).
479479
Int64("evm-height", evmHeight).
480480
Str("from", from.String()).
481-
Str("data", string(data)).
481+
Str("data", hex.EncodeToString(data)).
482482
Msg("failed to execute call")
483483
}
484484
return nil, fmt.Errorf("failed to execute script at height: %d, with: %w", height, err)
@@ -528,6 +528,15 @@ func (e *EVM) EstimateGas(
528528
[]cadence.Value{hexEncodedTx, hexEncodedAddress},
529529
)
530530
if err != nil {
531+
if !errors.Is(err, errs.ErrHeightOutOfRange) {
532+
e.logger.Error().
533+
Err(err).
534+
Uint64("cadence-height", height).
535+
Int64("evm-height", evmHeight).
536+
Str("from", from.String()).
537+
Str("data", hex.EncodeToString(data)).
538+
Msg("failed to execute estimateGas")
539+
}
531540
return 0, fmt.Errorf("failed to execute script at height: %d, with: %w", height, err)
532541
}
533542

@@ -540,7 +549,9 @@ func (e *EVM) EstimateGas(
540549

541550
e.logger.Debug().
542551
Uint64("gas", gasConsumed).
543-
Msg("gas estimation executed")
552+
Int64("evm-height", evmHeight).
553+
Uint64("cadence-height", height).
554+
Msg("estimateGas executed")
544555

545556
return gasConsumed, nil
546557
}

0 commit comments

Comments
 (0)