Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsereda committed Dec 21, 2024
1 parent 65f6635 commit e9f42dd
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 25 deletions.
6 changes: 2 additions & 4 deletions bridge_indexer/handlers/rollup_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion bridge_indexer/handlers/service_container.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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')
Expand Down
5 changes: 4 additions & 1 deletion bridge_indexer/handlers/tezos/on_head.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
9 changes: 5 additions & 4 deletions bridge_indexer/types/kernel/evm_events/deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions bridge_indexer/types/kernel/evm_events/withdrawal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions bridge_indexer/types/kernel_native/evm_events/withdrawal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bridge_indexer/types/output_proof/micheline_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions bridge_indexer/types/ticketer/tezos_parameters/withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@

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


class Ticket(BaseModel):
class Config:
forbid: Literal[forbid] = 'forbid'
forbid: Literal['forbid'] = 'forbid'

ticketer: ForgedTezosAccount
content: TicketContent
Expand All @@ -29,7 +31,7 @@ class Config:

class WithdrawParameter(BaseModel):
class Config:
forbid: Literal[forbid] = 'forbid'
forbid: Literal['forbid'] = 'forbid'

receiver: ForgedTezosAccount
ticket: Ticket

0 comments on commit e9f42dd

Please sign in to comment.