From c0a63a529508b6b945cf9a3fb2db2548b971802f 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 a09fb11992..51c4664eaf 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" @@ -277,6 +278,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