File tree Expand file tree Collapse file tree 4 files changed +24
-18
lines changed Expand file tree Collapse file tree 4 files changed +24
-18
lines changed Original file line number Diff line number Diff line change 2
2
Exceptions specific to this fork.
3
3
"""
4
4
5
- from typing import Final
5
+ from typing import TYPE_CHECKING , Final
6
6
7
7
from ethereum_types .numeric import Uint
8
8
9
9
from ethereum .exceptions import InvalidTransaction
10
10
11
+ if TYPE_CHECKING :
12
+ from .transactions import Transaction
13
+
11
14
12
15
class TransactionTypeError (InvalidTransaction ):
13
16
"""
@@ -28,20 +31,20 @@ def __init__(self, transaction_type: int):
28
31
29
32
class TransactionTypeContractCreationError (InvalidTransaction ):
30
33
"""
31
- Transaction type is not allowed for contract creation .
34
+ Contract creation is not allowed for a transaction type .
32
35
"""
33
36
34
- transaction_type : Final [ int ]
37
+ transaction : "Transaction"
35
38
"""
36
- The type byte of the transaction that caused the error.
39
+ The transaction that caused the error.
37
40
"""
38
41
39
- def __init__ (self , transaction_type : int ):
42
+ def __init__ (self , transaction : "Transaction" ):
40
43
super ().__init__ (
41
- f"transaction type `{ transaction_type } ` not allowed for "
42
- "contract creation "
44
+ f"transaction type `{ type ( transaction ). __name__ } ` not allowed to "
45
+ "create contracts "
43
46
)
44
- self .transaction_type = transaction_type
47
+ self .transaction = transaction
45
48
46
49
47
50
class BlobGasLimitExceededError (InvalidTransaction ):
Original file line number Diff line number Diff line change @@ -451,7 +451,7 @@ def check_transaction(
451
451
452
452
if isinstance (tx , BlobTransaction ):
453
453
if not isinstance (tx .to , Address ):
454
- raise TransactionTypeContractCreationError (tx [ 0 ] )
454
+ raise TransactionTypeContractCreationError (tx )
455
455
if len (tx .blob_versioned_hashes ) == 0 :
456
456
raise NoBlobDataError ("no blob data in transaction" )
457
457
for blob_versioned_hash in tx .blob_versioned_hashes :
Original file line number Diff line number Diff line change 2
2
Exceptions specific to this fork.
3
3
"""
4
4
5
- from typing import Final
5
+ from typing import TYPE_CHECKING , Final
6
6
7
7
from ethereum_types .numeric import Uint
8
8
9
9
from ethereum .exceptions import InvalidTransaction
10
10
11
+ if TYPE_CHECKING :
12
+ from .transactions import Transaction
13
+
11
14
12
15
class TransactionTypeError (InvalidTransaction ):
13
16
"""
@@ -28,20 +31,20 @@ def __init__(self, transaction_type: int):
28
31
29
32
class TransactionTypeContractCreationError (InvalidTransaction ):
30
33
"""
31
- Transaction type is not allowed for contract creation .
34
+ Contract creation is not allowed for a transaction type .
32
35
"""
33
36
34
- transaction_type : Final [ int ]
37
+ transaction : "Transaction"
35
38
"""
36
- The type byte of the transaction that caused the error.
39
+ The transaction that caused the error.
37
40
"""
38
41
39
- def __init__ (self , transaction_type : int ):
42
+ def __init__ (self , transaction : "Transaction" ):
40
43
super ().__init__ (
41
- f"transaction type `{ transaction_type } ` not allowed for "
42
- "contract creation "
44
+ f"transaction type `{ type ( transaction ). __name__ } ` not allowed to "
45
+ "create contracts "
43
46
)
44
- self .transaction_type = transaction_type
47
+ self .transaction = transaction
45
48
46
49
47
50
class BlobGasLimitExceededError (InvalidTransaction ):
Original file line number Diff line number Diff line change @@ -502,7 +502,7 @@ def check_transaction(
502
502
503
503
if isinstance (tx , (BlobTransaction , SetCodeTransaction )):
504
504
if not isinstance (tx .to , Address ):
505
- raise TransactionTypeContractCreationError (tx [ 0 ] )
505
+ raise TransactionTypeContractCreationError (tx )
506
506
507
507
if isinstance (tx , SetCodeTransaction ):
508
508
if not any (tx .authorizations ):
You can’t perform that action at this time.
0 commit comments