1616    TypedReceipt ,
1717)
1818
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 }
2025
2126UNRECOGNIZED_TRANSACTION_TYPES  =  tuple (
2227    (to_bytes (val ), UnrecognizedTransactionType )
6267        ), 
6368    ) 
6469) 
65- def  test_transaction_decode (vm_class , encoded , expected ):
70+ def  test_receipt_decode (vm_class , encoded , expected ):
6671    expected_encoding  =  expected .encode ()
6772    assert  encoded  ==  expected_encoding 
6873
@@ -83,8 +88,24 @@ def test_transaction_decode(vm_class, encoded, expected):
8388    +  UNRECOGNIZED_TRANSACTION_TYPES  
8489    +  INVALID_TRANSACTION_TYPES  
8590) 
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 ()
88109    with  pytest .raises (expected_failure ):
89110        rlp .decode (encoded , sedes = sedes )
90111
0 commit comments