mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
internal/ethapi: make tests a bit more complex
This commit is contained in:
parent
de24a7a612
commit
5f39342a76
1 changed files with 12 additions and 9 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue