From 5f39342a76ed32059bf340a8679d6f56fef9d4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 7 Nov 2023 12:04:45 +0200 Subject: [PATCH] internal/ethapi: make tests a bit more complex --- internal/ethapi/api_test.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index fed44fe353..a67bd1203b 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -680,41 +680,44 @@ func TestEstimateGas(t *testing.T) { }, // Test for a bug where the gas price was set to zero but the basefee non-zero // - // contract Tipper { + // contract BasefeeChecker { // constructor() { - // tx.gasprice - block.basefee; + // require(tx.gasprice >= block.basefee); + // if (tx.gasprice > 0) { + // require(block.basefee > 0); + // } // } - // } + //} { blockNumber: rpc.LatestBlockNumber, call: TransactionArgs{ From: &accounts[0].addr, - Input: hex2Bytes("6080604052348015600f57600080fd5b50483a601a91906058565b506085565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000606182601f565b9150606a83601f565b9250828203905081811115607f57607e6029565b5b92915050565b603f8060926000396000f3fe6080604052600080fdfea2646970667358221220389a4956b32bb784f6afd2e9db61cef06edaed0e2609234a291e7830e025853364736f6c63430008160033"), + Input: hex2Bytes("6080604052348015600f57600080fd5b50483a1015601c57600080fd5b60003a111560315760004811603057600080fd5b5b603f80603e6000396000f3fe6080604052600080fdfea264697066735822122060729c2cee02b10748fae5200f1c9da4661963354973d9154c13a8e9ce9dee1564736f6c63430008130033"), GasPrice: (*hexutil.Big)(big.NewInt(1_000_000_000)), // Legacy as pricing }, expectErr: nil, - want: 68757, + want: 67617, }, { blockNumber: rpc.LatestBlockNumber, call: TransactionArgs{ From: &accounts[0].addr, - Input: hex2Bytes("6080604052348015600f57600080fd5b50483a601a91906058565b506085565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000606182601f565b9150606a83601f565b9250828203905081811115607f57607e6029565b5b92915050565b603f8060926000396000f3fe6080604052600080fdfea2646970667358221220389a4956b32bb784f6afd2e9db61cef06edaed0e2609234a291e7830e025853364736f6c63430008160033"), + Input: hex2Bytes("6080604052348015600f57600080fd5b50483a1015601c57600080fd5b60003a111560315760004811603057600080fd5b5b603f80603e6000396000f3fe6080604052600080fdfea264697066735822122060729c2cee02b10748fae5200f1c9da4661963354973d9154c13a8e9ce9dee1564736f6c63430008130033"), MaxFeePerGas: (*hexutil.Big)(big.NewInt(1_000_000_000)), // 1559 gas pricing }, expectErr: nil, - want: 68757, + want: 67617, }, { blockNumber: rpc.LatestBlockNumber, call: TransactionArgs{ From: &accounts[0].addr, - Input: hex2Bytes("6080604052348015600f57600080fd5b50483a601a91906058565b506085565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000606182601f565b9150606a83601f565b9250828203905081811115607f57607e6029565b5b92915050565b603f8060926000396000f3fe6080604052600080fdfea2646970667358221220389a4956b32bb784f6afd2e9db61cef06edaed0e2609234a291e7830e025853364736f6c63430008160033"), + Input: hex2Bytes("6080604052348015600f57600080fd5b50483a1015601c57600080fd5b60003a111560315760004811603057600080fd5b5b603f80603e6000396000f3fe6080604052600080fdfea264697066735822122060729c2cee02b10748fae5200f1c9da4661963354973d9154c13a8e9ce9dee1564736f6c63430008130033"), GasPrice: nil, // No legacy gas pricing MaxFeePerGas: nil, // No 1559 gas pricing }, expectErr: nil, - want: 68757, + want: 67595, }, } for i, tc := range testSuite {