From 6374efb6b374b3c8761d783b5157b72ede8e47ae Mon Sep 17 00:00:00 2001 From: Oliver Townsend <133903322+ogtownsend@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:08:18 -0700 Subject: [PATCH] [LM] Remove leftover log fatals (#1104) Return error instead of fataling --- .../plugins/liquiditymanager/bridge/opstack/l1_to_l2.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/services/ocr2/plugins/liquiditymanager/bridge/opstack/l1_to_l2.go b/core/services/ocr2/plugins/liquiditymanager/bridge/opstack/l1_to_l2.go index cb8c2b8a4e..8d51f7929b 100644 --- a/core/services/ocr2/plugins/liquiditymanager/bridge/opstack/l1_to_l2.go +++ b/core/services/ocr2/plugins/liquiditymanager/bridge/opstack/l1_to_l2.go @@ -5,7 +5,6 @@ import ( "database/sql" "errors" "fmt" - "log" "math/big" "time" @@ -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(), @@ -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: