Commit 32a9f494 authored by Mark Tyneway's avatar Mark Tyneway

l2geth: better error message for when fee is too large

The sequencer will reject transactions when the fee
is too large to prevent users from accidentally sending
transactions with a huge fee.

This PR adds an actionable error message for when
the fee is too large.
parent 6112b7aa
---
'@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 {
}
userFee := new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice())
expectedFee := new(big.Int).Mul(expectedTxGasLimit, fees.BigTxGasPrice)
opts := fees.PaysEnoughOpts{
UserFee: userFee,
ExpectedFee: expectedTxGasLimit.Mul(expectedTxGasLimit, fees.BigTxGasPrice),
ExpectedFee: expectedFee,
ThresholdUp: s.feeThresholdUp,
ThresholdDown: s.feeThresholdDown,
}
......@@ -881,7 +882,8 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error {
fees.ErrFeeTooLow, userFee, expectedTxGasLimit, fees.BigTxGasPrice)
}
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
}
......
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