|
3 | 3 | import logging |
4 | 4 |
|
5 | 5 | import rlp |
6 | | -from web3.types import LogReceipt |
7 | 6 |
|
8 | 7 | from .types import ( |
9 | 8 | Annotation, |
10 | | - EntityKey, |
11 | | - ExtendEntityReturnType, |
12 | | - GenericBytes, |
13 | 9 | GolemBaseTransaction, |
14 | 10 | ) |
15 | 11 |
|
@@ -73,34 +69,3 @@ def format_annotation[T](annotation: Annotation[T]) -> tuple[str, T]: |
73 | 69 | encoded: bytes = rlp.encode(payload) |
74 | 70 | logger.debug("Encoded payload: %s", encoded) |
75 | 71 | return encoded |
76 | | - |
77 | | - |
78 | | -def parse_legacy_btl_extended_log(log_receipt: LogReceipt) -> ExtendEntityReturnType: |
79 | | - """ |
80 | | - Parse legacy BTL extended logs. |
81 | | -
|
82 | | - For legacy extend ABI types, the type signature in the ABI does |
83 | | - not correspond to the actual data returned, so we need |
84 | | - to parse the data ourselves. |
85 | | - """ |
86 | | - # pylint: disable=line-too-long |
87 | | - # Take the first 64 bytes by masking the rest |
88 | | - # (shift 1 to the left 256 positions, then negate the number) |
89 | | - # Example: |
90 | | - # 0x 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 012f |
91 | | - # 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0143 |
92 | | - # mask this with: |
93 | | - # 0x 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 |
94 | | - # 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 |
95 | | - # to obtain 0x143 |
96 | | - # and then shift the original number to the right |
97 | | - # by 256 to obtain 0x12f |
98 | | - data_parsed = int.from_bytes(log_receipt["data"], byteorder="big", signed=False) |
99 | | - new_expiration_block = data_parsed & ((1 << 256) - 1) |
100 | | - old_expiration_block = data_parsed >> 256 |
101 | | - |
102 | | - return ExtendEntityReturnType( |
103 | | - old_expiration_block=old_expiration_block, |
104 | | - new_expiration_block=new_expiration_block, |
105 | | - entity_key=EntityKey(GenericBytes(log_receipt["topics"][1])), |
106 | | - ) |
0 commit comments