Skip to content

Commit

Permalink
[LM] Remove leftover log fatals (#1104)
Browse files Browse the repository at this point in the history
Return error instead of fataling
  • Loading branch information
ogtownsend authored Jun 27, 2024
1 parent 62c1bab commit 6374efb
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"database/sql"
"errors"
"fmt"
"log"
"math/big"
"time"

Expand Down Expand Up @@ -255,18 +254,18 @@ func (l *l1ToL2Bridge) GetBridgePayloadAndFee(
// If we're sending WETH, the bridge adapter unwraps it and calls depositETHTo on the native bridge
DepositETHToFunction,
transfer.Receiver, // 'to'
0, // 'l2Gas': hardcoded to 0 in the OptimismL1BridgeAdapter contract
uint32(0), // 'l2Gas': hardcoded to 0 in the OptimismL1BridgeAdapter contract
transfer.BridgeData, // 'data'
)
if err != nil {
log.Fatalf("Failed to pack depositETHTo function call: %v", err)
return nil, nil, fmt.Errorf("failed to pack depositETHTo function call: %w", err)
}

// Estimate gas needed for the depositETHTo call issued from the L1 Bridge Adapter
l1StandardBridgeAddress := l.l1StandardBridge.Address()
gasPrice, err := l.l1Client.SuggestGasPrice(ctx)
if err != nil {
log.Fatalf("Failed to get suggested gas price: %v", err)
return nil, nil, fmt.Errorf("failed to get suggested gas price: %w", err)
}
gasLimit, err := l.l1Client.EstimateGas(ctx, ethereum.CallMsg{
From: l.l1BridgeAdapter.Address(),
Expand All @@ -275,7 +274,7 @@ func (l *l1ToL2Bridge) GetBridgePayloadAndFee(
GasPrice: gasPrice,
})
if err != nil {
log.Fatalf("Failed to estimate gas: %v", err)
return nil, nil, fmt.Errorf("failed to estimate gas: %w", err)
}

// Scale gas limit by recommended 20% buffer to account for gas burned for L2 txn:
Expand Down

0 comments on commit 6374efb

Please sign in to comment.