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:
Felföldi Zsolt
2021-05-30 19:37:52 +02:00
committed by GitHub
parent 966ee3ae6d
commit 2d716c4b01
5 changed files with 102 additions and 12 deletions

View File

@ -395,6 +395,26 @@ func TestTransactionTipAboveFeeCap(t *testing.T) {
}
}
func TestTransactionVeryHighValues(t *testing.T) {
t.Parallel()
pool, key := setupTxPoolWithConfig(eip1559Config)
defer pool.Stop()
veryBigNumber := big.NewInt(1)
veryBigNumber.Lsh(veryBigNumber, 300)
tx := dynamicFeeTx(0, 100, big.NewInt(1), veryBigNumber, key)
if err := pool.AddRemote(tx); err != ErrTipVeryHigh {
t.Error("expected", ErrTipVeryHigh, "got", err)
}
tx2 := dynamicFeeTx(0, 100, veryBigNumber, big.NewInt(1), key)
if err := pool.AddRemote(tx2); err != ErrFeeCapVeryHigh {
t.Error("expected", ErrFeeCapVeryHigh, "got", err)
}
}
func TestTransactionChainFork(t *testing.T) {
t.Parallel()