@@ -43,6 +43,7 @@ class TypedReceipt(ReceiptAPI, ReceiptDecoderAPI):
4343 type_id : int
4444 rlp_type = Binary (min_length = 1 ) # must have at least one byte for the type
4545 _inner : ReceiptAPI
46+ codecs = TYPED_RECEIPT_BODY_CODECS
4647
4748 def __init__ (self , type_id : int , proxy_target : ReceiptAPI ) -> None :
4849 self .type_id = type_id
@@ -69,8 +70,8 @@ def encode(self) -> bytes:
6970
7071 @classmethod
7172 def get_payload_codec (cls , type_id : int ) -> Type [ReceiptDecoderAPI ]:
72- if type_id in TYPED_RECEIPT_BODY_CODECS :
73- return TYPED_RECEIPT_BODY_CODECS [type_id ]
73+ if type_id in cls . codecs :
74+ return cls . codecs [type_id ]
7475 elif type_id in VALID_TRANSACTION_TYPES :
7576 raise UnrecognizedTransactionType (type_id , "Unknown receipt type" )
7677 else :
@@ -124,23 +125,23 @@ def __eq__(self, other: Any) -> bool:
124125
125126class BerlinReceiptBuilder (ReceiptBuilderAPI ):
126127 legacy_sedes = Receipt
127- codecs = TYPED_RECEIPT_BODY_CODECS
128+ typed_receipt_class = TypedReceipt
128129
129130 @classmethod
130131 def decode (cls , encoded : bytes ) -> ReceiptAPI :
131132 if len (encoded ) == 0 :
132133 raise ValidationError ("Encoded receipt was empty, which makes it invalid" )
133134
134135 type_id = to_int (encoded [0 ])
135- if type_id in cls .codecs :
136- return TypedReceipt .decode (encoded )
136+ if type_id in cls .typed_receipt_class . codecs :
137+ return cls . typed_receipt_class .decode (encoded )
137138 else :
138139 return rlp .decode (encoded , sedes = cls .legacy_sedes )
139140
140141 @classmethod
141142 def deserialize (cls , encoded : DecodedZeroOrOneLayerRLP ) -> ReceiptAPI :
142143 if isinstance (encoded , bytes ):
143- return TypedReceipt .deserialize (encoded )
144+ return cls . typed_receipt_class .deserialize (encoded )
144145 else :
145146 return cls .legacy_sedes .deserialize (encoded )
146147
0 commit comments