diff --git a/bridge_indexer/handlers/rollup_message.py b/bridge_indexer/handlers/rollup_message.py index ff07389..349ae6b 100644 --- a/bridge_indexer/handlers/rollup_message.py +++ b/bridge_indexer/handlers/rollup_message.py @@ -353,9 +353,8 @@ async def from_transaction(self) -> str: @staticmethod def _hash_from_dto(dto) -> str: - parameters_hash = uuid5(NAMESPACE_OID, orjson.dumps(dto, option=orjson.OPT_SORT_KEYS)).hex + return uuid5(NAMESPACE_OID, orjson.dumps(dto, option=orjson.OPT_SORT_KEYS)).hex - return parameters_hash class ComparableDTO(BaseModel): @@ -457,6 +456,5 @@ async def _from_fa_event(self) -> str: @staticmethod def _hash_from_dto(dto: ComparableDTO) -> str: - parameters_hash = uuid5(NAMESPACE_OID, orjson.dumps(dto.model_dump(), option=orjson.OPT_SORT_KEYS)).hex + return uuid5(NAMESPACE_OID, orjson.dumps(dto.model_dump(), option=orjson.OPT_SORT_KEYS)).hex - return parameters_hash diff --git a/bridge_indexer/handlers/service_container.py b/bridge_indexer/handlers/service_container.py index 8ffc415..e8c54c5 100644 --- a/bridge_indexer/handlers/service_container.py +++ b/bridge_indexer/handlers/service_container.py @@ -1,5 +1,6 @@ +from typing import TYPE_CHECKING + from dipdup.context import DipDupContext -from dipdup.datasources.http import HttpDatasource from dipdup.datasources.tezos_tzkt import TezosTzktDatasource from dipdup.datasources.tzip_metadata import TzipMetadataDatasource from pydantic import BaseModel @@ -10,6 +11,9 @@ from bridge_indexer.handlers.rollup_message import RollupMessageIndex from bridge_indexer.handlers.ticket import TicketService +if TYPE_CHECKING: + from dipdup.datasources.http import HttpDatasource + class BridgeConstantStorage(BaseSettings): smart_rollup_address: str = Field(alias='SMART_ROLLUP_ADDRESS') diff --git a/bridge_indexer/handlers/tezos/on_head.py b/bridge_indexer/handlers/tezos/on_head.py index 3c9ac73..cf331cf 100644 --- a/bridge_indexer/handlers/tezos/on_head.py +++ b/bridge_indexer/handlers/tezos/on_head.py @@ -1,7 +1,10 @@ +from typing import TYPE_CHECKING + from dipdup.context import HandlerContext from dipdup.models.tezos import TezosHeadBlockData -from bridge_indexer.handlers.rollup_message import RollupMessageIndex +if TYPE_CHECKING: + from bridge_indexer.handlers.rollup_message import RollupMessageIndex async def on_head( diff --git a/bridge_indexer/types/kernel/evm_events/deposit.py b/bridge_indexer/types/kernel/evm_events/deposit.py index 0792216..c7edaad 100644 --- a/bridge_indexer/types/kernel/evm_events/deposit.py +++ b/bridge_indexer/types/kernel/evm_events/deposit.py @@ -2,14 +2,15 @@ from __future__ import annotations +from typing import Literal + from pydantic import BaseModel -from pydantic import ConfigDict class DepositPayload(BaseModel): - model_config: ConfigDict = ConfigDict( - extra='forbid', - ) + class Config: + forbid: Literal['forbid'] = 'forbid' + ticket_hash: int ticket_owner: str receiver: str diff --git a/bridge_indexer/types/kernel/evm_events/withdrawal.py b/bridge_indexer/types/kernel/evm_events/withdrawal.py index 9757aaa..f93c003 100644 --- a/bridge_indexer/types/kernel/evm_events/withdrawal.py +++ b/bridge_indexer/types/kernel/evm_events/withdrawal.py @@ -2,16 +2,19 @@ from __future__ import annotations +from typing import TYPE_CHECKING +from typing import Literal + from pydantic import BaseModel -from pydantic import ConfigDict -from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount +if TYPE_CHECKING: + from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount class WithdrawalPayload(BaseModel): - model_config: ConfigDict = ConfigDict( - extra='forbid', - ) + class Config: + forbid: Literal['forbid'] = 'forbid' + ticket_hash: int sender: str ticket_owner: str diff --git a/bridge_indexer/types/kernel_native/evm_events/withdrawal.py b/bridge_indexer/types/kernel_native/evm_events/withdrawal.py index 86d56fb..a00ea5d 100644 --- a/bridge_indexer/types/kernel_native/evm_events/withdrawal.py +++ b/bridge_indexer/types/kernel_native/evm_events/withdrawal.py @@ -2,16 +2,19 @@ from __future__ import annotations +from typing import TYPE_CHECKING +from typing import Literal + from pydantic import BaseModel -from pydantic import ConfigDict -from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount +if TYPE_CHECKING: + from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount class WithdrawalPayload(BaseModel): - model_config: ConfigDict = ConfigDict( - extra='forbid', - ) + class Config: + forbid: Literal['forbid'] = 'forbid' + amount: int sender: str receiver: ForgedTezosAccount diff --git a/bridge_indexer/types/output_proof/micheline_expression.py b/bridge_indexer/types/output_proof/micheline_expression.py index 7e24880..dcbb4f5 100644 --- a/bridge_indexer/types/output_proof/micheline_expression.py +++ b/bridge_indexer/types/output_proof/micheline_expression.py @@ -121,7 +121,7 @@ def unpack(self): if is_positive is None: sign_bit, bits = bits[0], bits[1:] is_positive = sign_bit == '0' - bits_array = [bits] + bits_array + bits_array = [bits, *bits_array] if leading_bit == '0': break diff --git a/bridge_indexer/types/ticketer/tezos_parameters/withdraw.py b/bridge_indexer/types/ticketer/tezos_parameters/withdraw.py index 8e3758e..984061e 100644 --- a/bridge_indexer/types/ticketer/tezos_parameters/withdraw.py +++ b/bridge_indexer/types/ticketer/tezos_parameters/withdraw.py @@ -3,16 +3,18 @@ from __future__ import annotations +from typing import TYPE_CHECKING from typing import Literal from pydantic import BaseModel -from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount +if TYPE_CHECKING: + from bridge_indexer.types.tezos.forged_tezos_account import ForgedTezosAccount class TicketContent(BaseModel): class Config: - forbid: Literal[forbid] = 'forbid' + forbid: Literal['forbid'] = 'forbid' ticket_id: int metadata: bytes | None @@ -20,7 +22,7 @@ class Config: class Ticket(BaseModel): class Config: - forbid: Literal[forbid] = 'forbid' + forbid: Literal['forbid'] = 'forbid' ticketer: ForgedTezosAccount content: TicketContent @@ -29,7 +31,7 @@ class Config: class WithdrawParameter(BaseModel): class Config: - forbid: Literal[forbid] = 'forbid' + forbid: Literal['forbid'] = 'forbid' receiver: ForgedTezosAccount ticket: Ticket