@@ -500,6 +500,7 @@ async def test_eth_send_transaction(
500
500
"maxFeePerGas" : async_w3 .to_wei (3 , "gwei" ),
501
501
"maxPriorityFeePerGas" : async_w3 .to_wei (1 , "gwei" ),
502
502
}
503
+
503
504
txn_hash = await async_w3 .eth .send_transaction (txn_params )
504
505
txn = await async_w3 .eth .get_transaction (txn_hash )
505
506
@@ -509,7 +510,7 @@ async def test_eth_send_transaction(
509
510
assert txn ["gas" ] == 21000
510
511
assert txn ["maxFeePerGas" ] == txn_params ["maxFeePerGas" ]
511
512
assert txn ["maxPriorityFeePerGas" ] == txn_params ["maxPriorityFeePerGas" ]
512
- assert txn ["gasPrice" ] == txn_params ["maxFeePerGas" ]
513
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
513
514
514
515
@pytest .mark .asyncio
515
516
async def test_eth_send_transaction_default_fees (
@@ -523,6 +524,7 @@ async def test_eth_send_transaction_default_fees(
523
524
"value" : Wei (1 ),
524
525
"gas" : 21000 ,
525
526
}
527
+
526
528
txn_hash = await async_w3 .eth .send_transaction (txn_params )
527
529
txn = await async_w3 .eth .get_transaction (txn_hash )
528
530
@@ -532,7 +534,7 @@ async def test_eth_send_transaction_default_fees(
532
534
assert txn ["gas" ] == 21000
533
535
assert is_integer (txn ["maxPriorityFeePerGas" ])
534
536
assert is_integer (txn ["maxFeePerGas" ])
535
- assert txn ["gasPrice" ] == txn ["maxFeePerGas" ]
537
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
536
538
537
539
@pytest .mark .asyncio
538
540
async def test_eth_send_transaction_hex_fees (
@@ -809,7 +811,7 @@ def gas_price_strategy(w3: "Web3", txn: TxParams) -> Wei:
809
811
else 2 * latest_block ["baseFeePerGas" ] + max_priority_fee
810
812
)
811
813
assert txn ["maxPriorityFeePerGas" ] == max_priority_fee
812
- assert txn ["gasPrice" ] == txn ["maxFeePerGas" ]
814
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
813
815
814
816
async_w3 .eth .set_gas_price_strategy (None ) # reset strategy
815
817
@@ -3114,6 +3116,7 @@ def test_eth_send_transaction(
3114
3116
"maxFeePerGas" : w3 .to_wei (3 , "gwei" ),
3115
3117
"maxPriorityFeePerGas" : w3 .to_wei (1 , "gwei" ),
3116
3118
}
3119
+
3117
3120
txn_hash = w3 .eth .send_transaction (txn_params )
3118
3121
txn = w3 .eth .get_transaction (txn_hash )
3119
3122
@@ -3123,7 +3126,7 @@ def test_eth_send_transaction(
3123
3126
assert txn ["gas" ] == 21000
3124
3127
assert txn ["maxFeePerGas" ] == txn_params ["maxFeePerGas" ]
3125
3128
assert txn ["maxPriorityFeePerGas" ] == txn_params ["maxPriorityFeePerGas" ]
3126
- assert txn ["gasPrice" ] == txn_params ["maxFeePerGas" ]
3129
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
3127
3130
3128
3131
def test_eth_send_transaction_with_nonce (
3129
3132
self , w3 : "Web3" , keyfile_account_address : ChecksumAddress
@@ -3174,7 +3177,7 @@ def test_eth_send_transaction_default_fees(
3174
3177
assert txn ["gas" ] == 21000
3175
3178
assert is_integer (txn ["maxPriorityFeePerGas" ])
3176
3179
assert is_integer (txn ["maxFeePerGas" ])
3177
- assert txn ["gasPrice" ] == txn ["maxFeePerGas" ]
3180
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
3178
3181
3179
3182
def test_eth_send_transaction_hex_fees (
3180
3183
self , w3 : "Web3" , keyfile_account_address_dual_type : ChecksumAddress
@@ -3340,7 +3343,7 @@ def gas_price_strategy(_w3: "Web3", _txn: TxParams) -> Wei:
3340
3343
else 2 * latest_block ["baseFeePerGas" ] + max_priority_fee
3341
3344
)
3342
3345
assert txn ["maxPriorityFeePerGas" ] == max_priority_fee
3343
- assert txn ["gasPrice" ] == txn ["maxFeePerGas" ]
3346
+ assert txn ["gasPrice" ] <= txn ["maxFeePerGas" ] # effective gas price
3344
3347
3345
3348
w3 .eth .set_gas_price_strategy (None ) # reset strategy
3346
3349
0 commit comments