16
16
TypedReceipt ,
17
17
)
18
18
19
- RECOGNIZED_TRANSACTION_TYPES = {1 }
19
+ # The type of receipt is based on the type of the transaction. So we are
20
+ # checking the type of the receipt against known transaction types.
21
+ # Add recognized types here if any fork knows about it. Then,
22
+ # add manual unrecognized types for older forks. For example,
23
+ # (BerlinVM, to_bytes(2), UnrecognizedTransactionType) should be added explicitly.
24
+ RECOGNIZED_TRANSACTION_TYPES = {1 , 2 }
20
25
21
26
UNRECOGNIZED_TRANSACTION_TYPES = tuple (
22
27
(to_bytes (val ), UnrecognizedTransactionType )
62
67
),
63
68
)
64
69
)
65
- def test_transaction_decode (vm_class , encoded , expected ):
70
+ def test_receipt_decode (vm_class , encoded , expected ):
66
71
expected_encoding = expected .encode ()
67
72
assert encoded == expected_encoding
68
73
@@ -83,8 +88,24 @@ def test_transaction_decode(vm_class, encoded, expected):
83
88
+ UNRECOGNIZED_TRANSACTION_TYPES
84
89
+ INVALID_TRANSACTION_TYPES
85
90
)
86
- def test_transaction_decode_failure (vm_class , encoded , expected_failure ):
87
- sedes = vm_class .get_transaction_builder ()
91
+ def test_receipt_decode_failure (vm_class , encoded , expected_failure ):
92
+ sedes = vm_class .get_receipt_builder ()
93
+ with pytest .raises (expected_failure ):
94
+ rlp .decode (encoded , sedes = sedes )
95
+
96
+
97
+ @pytest .mark .parametrize (
98
+ 'vm_class, encoded, expected_failure' ,
99
+ (
100
+ (
101
+ BerlinVM ,
102
+ to_bytes (2 ),
103
+ UnrecognizedTransactionType ,
104
+ ),
105
+ )
106
+ )
107
+ def test_receipt_decode_failure_by_vm (vm_class , encoded , expected_failure ):
108
+ sedes = vm_class .get_receipt_builder ()
88
109
with pytest .raises (expected_failure ):
89
110
rlp .decode (encoded , sedes = sedes )
90
111
0 commit comments