Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions op-service/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,32 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
}
}

// Calculate the intrinsic gas for the transaction
callMsg := ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: candidate.TxData,
Value: candidate.Value,
}
if len(blobHashes) > 0 {
callMsg.BlobGasFeeCap = blobBaseFee
callMsg.BlobHashes = blobHashes
}
// If the gas limit is set, we can use that as the gas
if gasLimit == 0 {
// Calculate the intrinsic gas for the transaction
callMsg := ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: candidate.TxData,
Value: candidate.Value,
}
if len(blobHashes) > 0 {
callMsg.BlobGasFeeCap = blobBaseFee
callMsg.BlobHashes = blobHashes
}
gas, err := m.backend.EstimateGas(ctx, callMsg)
if err != nil {
return nil, fmt.Errorf("failed to estimate gas: %w", errutil.TryAddRevertReason(err))
}
gasLimit = gas
} else {
callMsg.Gas = gasLimit
_, err := m.backend.CallContract(ctx, callMsg, nil)
if err != nil {
return nil, fmt.Errorf("failed to call: %w", errutil.TryAddRevertReason(err))
}
}

var txMessage types.TxData
Expand Down