mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
core/types: add overflow check on GasFeeCap calculation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
c42b31a1f6
commit
c464cf2589
1 changed files with 4 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ var (
|
|||
ErrInvalidTxType = errors.New("transaction type not valid in this context")
|
||||
ErrTxTypeNotSupported = errors.New("transaction type not supported")
|
||||
ErrGasFeeCapTooLow = errors.New("fee cap less than base fee")
|
||||
ErrGasFeeCapOverflow = errors.New("fee cap overflow, too large for uint256")
|
||||
errShortTypedTx = errors.New("typed transaction too short")
|
||||
errInvalidYParity = errors.New("'yParity' field must be 0 or 1")
|
||||
errVYParityMismatch = errors.New("'v' and 'yParity' fields do not match")
|
||||
|
|
@ -374,7 +375,9 @@ func (tx *Transaction) calcEffectiveGasTip(dst *uint256.Int, baseFee *uint256.In
|
|||
}
|
||||
|
||||
var err error
|
||||
dst.SetFromBig(tx.inner.gasFeeCap())
|
||||
if dst.SetFromBig(tx.inner.gasFeeCap()) {
|
||||
return ErrGasFeeCapOverflow
|
||||
}
|
||||
if dst.Cmp(baseFee) < 0 {
|
||||
err = ErrGasFeeCapTooLow
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue