From 1227634cef38a8d13b1668aef05e4195bf21e707 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 28 May 2024 10:56:53 +0800 Subject: [PATCH] tests: fix eip1559 tx on non-eip1559 network (#23054) --- tests/state_test_util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 6445afb36822..16ed9926eec0 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -19,6 +19,7 @@ package tests import ( "encoding/hex" "encoding/json" + "errors" "fmt" "math/big" "strings" @@ -276,6 +277,9 @@ func (tx *stTransaction) toMessage(ps stPostState, number *big.Int, baseFee *big gasPrice = math.BigMin(new(big.Int).Add(tx.MaxPriorityFeePerGas, baseFee), tx.MaxFeePerGas) } + if gasPrice == nil { + return nil, errors.New("no gas price provided") + } msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, tx.MaxFeePerGas, tx.MaxPriorityFeePerGas, data, accessList, true, nil, number) return msg, nil