From 7764dff91c1147a9c52344969d531e92aaad1f39 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Wed, 11 Jun 2025 17:49:31 +0200 Subject: [PATCH] chore: remove old ABI events that do not exist anymore --- golem_base_sdk/__init__.py | 19 ++----------------- golem_base_sdk/constants.py | 22 ---------------------- golem_base_sdk/utils.py | 35 ----------------------------------- 3 files changed, 2 insertions(+), 74 deletions(-) diff --git a/golem_base_sdk/__init__.py b/golem_base_sdk/__init__.py index 6f445c7..095afe0 100755 --- a/golem_base_sdk/__init__.py +++ b/golem_base_sdk/__init__.py @@ -50,7 +50,7 @@ UpdateEntityReturnType, WatchLogsHandle, ) -from .utils import parse_legacy_btl_extended_log, rlp_encode_transaction +from .utils import rlp_encode_transaction __all__: Sequence[str] = [ # Exports from .types @@ -541,15 +541,6 @@ async def _process_golem_base_log_receipt( ), ) ) - # This is only here for backwards compatibility and can be removed - # once we undeploy kaolin. - case ( - "GolemBaseStorageEntityBTLExptended" - | "GolemBaseStorageEntityTTLExptended" - ): - extensions.append(parse_legacy_btl_extended_log(log_receipt)) - case other: - raise ValueError(f"Unknown event type: {other}") return GolemBaseTransactionReceipt( creates=creates, @@ -695,13 +686,7 @@ def create_subscription(topic: HexStr) -> LogsSubscription: if delete_callback: event_names.append("GolemBaseStorageEntityDeleted") if extend_callback: - event_names.extend( - [ - "GolemBaseStorageEntityBTLExtended", - "GolemBaseStorageEntityBTLExptended", - "GolemBaseStorageEntityTTLExptended", - ] - ) + event_names.append("GolemBaseStorageEntityBTLExtended") events = list( map( diff --git a/golem_base_sdk/constants.py b/golem_base_sdk/constants.py index 5d13e35..3376cb4 100644 --- a/golem_base_sdk/constants.py +++ b/golem_base_sdk/constants.py @@ -47,26 +47,4 @@ "name": "GolemBaseStorageEntityBTLExtended", "type": "event", }, - # Old ABI event that has a typo in the name and a missing non-indexed argument. - # This can be removed once we retire the kaolin network (the only one using - # this event hash). - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "entityKey", "type": "uint256"}, - {"indexed": False, "name": "expirationBlock", "type": "uint256"}, - ], - "name": "GolemBaseStorageEntityBTLExptended", - "type": "event", - }, - # Old ABI before rename of TTL -> BTL - { - "anonymous": False, - "inputs": [ - {"indexed": True, "name": "entityKey", "type": "uint256"}, - {"indexed": False, "name": "expirationBlock", "type": "uint256"}, - ], - "name": "GolemBaseStorageEntityTTLExptended", - "type": "event", - }, ] diff --git a/golem_base_sdk/utils.py b/golem_base_sdk/utils.py index 952c6c4..d9b5919 100644 --- a/golem_base_sdk/utils.py +++ b/golem_base_sdk/utils.py @@ -3,13 +3,9 @@ import logging import rlp -from web3.types import LogReceipt from .types import ( Annotation, - EntityKey, - ExtendEntityReturnType, - GenericBytes, GolemBaseTransaction, ) @@ -73,34 +69,3 @@ def format_annotation[T](annotation: Annotation[T]) -> tuple[str, T]: encoded: bytes = rlp.encode(payload) logger.debug("Encoded payload: %s", encoded) return encoded - - -def parse_legacy_btl_extended_log(log_receipt: LogReceipt) -> ExtendEntityReturnType: - """ - Parse legacy BTL extended logs. - - For legacy extend ABI types, the type signature in the ABI does - not correspond to the actual data returned, so we need - to parse the data ourselves. - """ - # pylint: disable=line-too-long - # Take the first 64 bytes by masking the rest - # (shift 1 to the left 256 positions, then negate the number) - # Example: - # 0x 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 012f - # 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0143 - # mask this with: - # 0x 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 - # 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 - # to obtain 0x143 - # and then shift the original number to the right - # by 256 to obtain 0x12f - data_parsed = int.from_bytes(log_receipt["data"], byteorder="big", signed=False) - new_expiration_block = data_parsed & ((1 << 256) - 1) - old_expiration_block = data_parsed >> 256 - - return ExtendEntityReturnType( - old_expiration_block=old_expiration_block, - new_expiration_block=new_expiration_block, - entity_key=EntityKey(GenericBytes(log_receipt["topics"][1])), - )