core: add new eip-1559 tx constraints (#22970)
This PR adds the new consensus constraints of EIP-1559 transactions as specified in https://github.com/ethereum/EIPs#3594
This commit is contained in:
@ -83,10 +83,6 @@ var (
|
||||
// than some meaningful limit a user might use. This is not a consensus error
|
||||
// making the transaction invalid, rather a DOS protection.
|
||||
ErrOversizedData = errors.New("oversized data")
|
||||
|
||||
// ErrTipAboveFeeCap is a sanity error to ensure no one is able to specify a
|
||||
// transaction with a tip higher than the total fee cap.
|
||||
ErrTipAboveFeeCap = errors.New("tip higher than fee cap")
|
||||
)
|
||||
|
||||
var (
|
||||
@ -559,6 +555,13 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
|
||||
if pool.currentMaxGas < tx.Gas() {
|
||||
return ErrGasLimit
|
||||
}
|
||||
// Sanity check for extremely large numbers
|
||||
if tx.FeeCap().BitLen() > 256 {
|
||||
return ErrFeeCapVeryHigh
|
||||
}
|
||||
if tx.Tip().BitLen() > 256 {
|
||||
return ErrTipVeryHigh
|
||||
}
|
||||
// Ensure feeCap is less than or equal to tip.
|
||||
if tx.FeeCapIntCmp(tx.Tip()) < 0 {
|
||||
return ErrTipAboveFeeCap
|
||||
|
Reference in New Issue
Block a user