File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/ethereum/arrow_glacier Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 23
23
from ethereum .ethash import dataset_size , generate_cache , hashimoto_light
24
24
from ethereum .exceptions import (
25
25
EthereumException ,
26
+ GasUsedExceedsLimitError ,
27
+ InsufficientBalanceError ,
26
28
InvalidBlock ,
27
29
InvalidSenderError ,
30
+ NonceMismatchError ,
28
31
)
29
32
30
33
from . import vm
@@ -445,7 +448,7 @@ def check_transaction(
445
448
"""
446
449
gas_available = block_env .block_gas_limit - block_output .block_gas_used
447
450
if tx .gas > gas_available :
448
- raise InvalidBlock
451
+ raise GasUsedExceedsLimitError ( "gas used exceeds limit" )
449
452
sender_address = recover_sender (block_env .chain_id , tx )
450
453
sender_account = get_account (block_env .state , sender_address )
451
454
@@ -467,10 +470,12 @@ def check_transaction(
467
470
effective_gas_price = tx .gas_price
468
471
max_gas_fee = tx .gas * tx .gas_price
469
472
470
- if sender_account .nonce != tx .nonce :
471
- raise InvalidBlock
473
+ if sender_account .nonce > Uint (tx .nonce ):
474
+ raise NonceMismatchError ("nonce too low" )
475
+ elif sender_account .nonce < Uint (tx .nonce ):
476
+ raise NonceMismatchError ("nonce too high" )
472
477
if Uint (sender_account .balance ) < max_gas_fee + Uint (tx .value ):
473
- raise InvalidBlock
478
+ raise InsufficientBalanceError ( "insufficient sender balance" )
474
479
if sender_account .code :
475
480
raise InvalidSenderError ("not EOA" )
476
481
You can’t perform that action at this time.
0 commit comments