Commit fc297257 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1256 from ethereum-optimism/fix/better-fee-log

l2geth: better error message for when fee is too large
parents 7c1c0d37 32a9f494
---
'@eth-optimism/l2geth': patch
---
Give a better error message for when the fee is too high when sending transactions to the sequencer
...@@ -868,9 +868,10 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error { ...@@ -868,9 +868,10 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error {
} }
userFee := new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice()) userFee := new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice())
expectedFee := new(big.Int).Mul(expectedTxGasLimit, fees.BigTxGasPrice)
opts := fees.PaysEnoughOpts{ opts := fees.PaysEnoughOpts{
UserFee: userFee, UserFee: userFee,
ExpectedFee: expectedTxGasLimit.Mul(expectedTxGasLimit, fees.BigTxGasPrice), ExpectedFee: expectedFee,
ThresholdUp: s.feeThresholdUp, ThresholdUp: s.feeThresholdUp,
ThresholdDown: s.feeThresholdDown, ThresholdDown: s.feeThresholdDown,
} }
...@@ -881,7 +882,8 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error { ...@@ -881,7 +882,8 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error {
fees.ErrFeeTooLow, userFee, expectedTxGasLimit, fees.BigTxGasPrice) fees.ErrFeeTooLow, userFee, expectedTxGasLimit, fees.BigTxGasPrice)
} }
if errors.Is(err, fees.ErrFeeTooHigh) { if errors.Is(err, fees.ErrFeeTooHigh) {
return fmt.Errorf("%w: %d", fees.ErrFeeTooHigh, userFee) return fmt.Errorf("%w: %d, use less than %d * %f", fees.ErrFeeTooHigh, userFee,
expectedFee, s.feeThresholdDown)
} }
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment