22
22
from ethereum .crypto .hash import Hash32 , keccak256
23
23
from ethereum .exceptions import (
24
24
EthereumException ,
25
+ InsufficientBalanceError ,
25
26
InvalidBlock ,
26
27
InvalidSenderError ,
27
- InsufficientBalanceError ,
28
- NonceMismatchError
28
+ NonceMismatchError ,
29
29
)
30
30
31
31
from . import vm
32
32
from .blocks import Block , Header , Log , Receipt , Withdrawal , encode_receipt
33
33
from .bloom import logs_bloom
34
34
from .exceptions import (
35
- TransactionTypeContractCreationError ,
36
35
BlobGasLimitExceededError ,
36
+ EmptyAuthorizationListError ,
37
37
InsufficientMaxFeePerBlobGasError ,
38
38
InsufficientMaxFeePerGasError ,
39
39
InvalidBlobVersionedHashError ,
40
40
NoBlobDataError ,
41
41
PriorityFeeGreaterThanMaxFeeError ,
42
- EmptyAuthorizationListError
42
+ TransactionTypeContractCreationError ,
43
43
)
44
44
from .fork_types import Account , Address , Authorization , VersionedHash
45
45
from .requests import (
@@ -430,7 +430,9 @@ def check_transaction(
430
430
tx , (FeeMarketTransaction , BlobTransaction , SetCodeTransaction )
431
431
):
432
432
if tx .max_fee_per_gas < tx .max_priority_fee_per_gas :
433
- raise PriorityFeeGreaterThanMaxFeeError ("priority fee greater than max fee" )
433
+ raise PriorityFeeGreaterThanMaxFeeError (
434
+ "priority fee greater than max fee"
435
+ )
434
436
if tx .max_fee_per_gas < block_env .base_fee_per_gas :
435
437
raise InsufficientMaxFeePerGasError ("insufficient max fee per gas" )
436
438
@@ -451,11 +453,15 @@ def check_transaction(
451
453
raise NoBlobDataError ("no blob data in transaction" )
452
454
for blob_versioned_hash in tx .blob_versioned_hashes :
453
455
if blob_versioned_hash [0 :1 ] != VERSIONED_HASH_VERSION_KZG :
454
- raise InvalidBlobVersionedHashError ("invalid blob versioned hash" )
456
+ raise InvalidBlobVersionedHashError (
457
+ "invalid blob versioned hash"
458
+ )
455
459
456
460
blob_gas_price = calculate_blob_gas_price (block_env .excess_blob_gas )
457
461
if Uint (tx .max_fee_per_blob_gas ) < blob_gas_price :
458
- raise InsufficientMaxFeePerBlobGasError ("insufficient max fee per blob gas" )
462
+ raise InsufficientMaxFeePerBlobGasError (
463
+ "insufficient max fee per blob gas"
464
+ )
459
465
460
466
max_gas_fee += Uint (calculate_total_blob_gas (tx )) * Uint (
461
467
tx .max_fee_per_blob_gas
@@ -473,7 +479,7 @@ def check_transaction(
473
479
raise EmptyAuthorizationListError ("empty authorization list" )
474
480
475
481
if sender_account .nonce != tx .nonce :
476
- if sender_account .nonce > tx .nonce :
482
+ if sender_account .nonce > Uint ( tx .nonce ) :
477
483
raise NonceMismatchError ("nonce too low" )
478
484
else :
479
485
raise NonceMismatchError ("nonce too high" )
0 commit comments