Skip to content

Commit

Permalink
Merge pull request #8572 from roberto-bayardo/fix-fee-swap
Browse files Browse the repository at this point in the history
fix swapped fee/tip parameters to estimateGas
  • Loading branch information
sebastianst authored and trianglesphere committed Dec 12, 2023
1 parent eb0d89d commit 54a7dbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions op-service/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{
From: m.cfg.From,
To: candidate.To,
GasFeeCap: gasFeeCap,
GasTipCap: gasTipCap,
GasFeeCap: gasFeeCap,
Data: rawTx.Data,
Value: rawTx.Value,
})
Expand Down Expand Up @@ -535,8 +535,8 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
gas, err := m.backend.EstimateGas(ctx, ethereum.CallMsg{
From: m.cfg.From,
To: rawTx.To,
GasFeeCap: bumpedTip,
GasTipCap: bumpedFee,
GasTipCap: bumpedTip,
GasFeeCap: bumpedFee,
Data: rawTx.Data,
})
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions op-service/txmgr/txmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ func (b *mockBackend) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (ui
if b.g.err != nil {
return 0, b.g.err
}
if msg.GasFeeCap.Cmp(msg.GasTipCap) < 0 {
return 0, core.ErrTipAboveFeeCap
}
return b.g.basefee().Uint64(), nil
}

Expand Down

0 comments on commit 54a7dbf

Please sign in to comment.