Skip to content

Commit

Permalink
Fix logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsereda committed Mar 13, 2024
1 parent d72069a commit 80581d7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions bridge_indexer/handlers/etherlink/on_deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ async def on_deposit(
event: SubsquidEvent[Deposit],
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(f'Etherlink Deposit Event found: {event.data.transaction_hash}')
ctx.logger.debug(f'https://blockscout.dipdup.net/tx/0x{event.data.transaction_hash}')
ctx.logger.info(f'Etherlink Deposit Event found: 0x{event.data.transaction_hash}')
try:
await _validate_ticket(event.payload.ticket_hash)

Expand Down
3 changes: 1 addition & 2 deletions bridge_indexer/handlers/etherlink/on_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ async def on_transfer(
event: SubsquidEvent[Transfer],
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(f'Etherlink Token Transfer Event found: {event.data.transaction_hash}')
ctx.logger.debug(f'https://blockscout.dipdup.net/tx/0x{event.data.transaction_hash}')
ctx.logger.info(f'Etherlink Token Transfer Event found: 0x{event.data.transaction_hash}')

amount = event.payload.value
if not amount:
Expand Down
3 changes: 1 addition & 2 deletions bridge_indexer/handlers/etherlink/on_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ async def on_withdraw(
event: SubsquidEvent[Withdrawal],
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(f'Etherlink Withdraw Event found: {event.data.transaction_hash}')
ctx.logger.debug(f'https://blockscout.dipdup.net/tx/0x{event.data.transaction_hash}')
ctx.logger.info(f'Etherlink Withdraw Event found: 0x{event.data.transaction_hash}')
token_contract = event.payload.ticket_owner.removeprefix('0x')
etherlink_token = await EtherlinkToken.get_or_none(id=token_contract)
if not etherlink_token:
Expand Down
3 changes: 1 addition & 2 deletions bridge_indexer/handlers/etherlink/on_xtz_deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ async def on_xtz_deposit(
transaction: SubsquidTransactionData | EvmNodeTransactionData,
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(f'Etherlink XTZ Deposit Transaction found: {transaction.hash}')
ctx.logger.debug(f'https://blockscout.dipdup.net/tx/0x{transaction.hash}')
ctx.logger.info(f'Etherlink XTZ Deposit Transaction found: 0x{transaction.hash}')

try:
await _validate_xtz_transaction(transaction)
Expand Down
5 changes: 3 additions & 2 deletions bridge_indexer/handlers/tezos/on_rollup_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ async def on_rollup_call(
default: TzktTransaction[DefaultParameter, RollupStorage],
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(f'Tezos Deposit Transaction found: {default.data.hash}')
parameter = default.parameter.__root__.LL

routing_info = bytes.fromhex(parameter.bytes)
Expand All @@ -24,7 +25,7 @@ async def on_rollup_call(

inbox_message = await ctx.container.inbox_message_service.match_transaction_with_inbox(default.data)

await TezosDepositOperation.create(
deposit = await TezosDepositOperation.create(
timestamp=default.data.timestamp,
level=default.data.level,
operation_hash=default.data.hash,
Expand All @@ -40,7 +41,7 @@ async def on_rollup_call(
inbox_message=inbox_message,
)

ctx.logger.info(f'Deposit Call registered: {default}')
ctx.logger.info(f'Tezos Deposit Transaction registered: {deposit.id}')

status = await Index.get(name='tezos_rollup_operations').only('status').values_list('status', flat=True)
if status == IndexStatus.realtime:
Expand Down
12 changes: 5 additions & 7 deletions bridge_indexer/handlers/tezos/on_rollup_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ async def on_rollup_execute(
withdraw: TzktTransaction[WithdrawParameter, TicketerStorage],
) -> None:
setup_handler_logger(ctx)
ctx.logger.info(
'Smart rollup %s has been called by contract %s with commitment %s',
execute.data.target_address,
execute.data.initiator_address,
execute.commitment,
)
ctx.logger.info(f'Tezos Withdraw Transaction found: {execute.data.hash}')

rpc = ctx.get_http_datasource('tezos_node')
block_operations = await rpc.request('GET', f'chains/main/blocks/{execute.data.level}/operations')
for group in block_operations[3]:
Expand All @@ -51,7 +47,7 @@ async def on_rollup_execute(
)
return

await TezosWithdrawOperation.create(
withdrawal = await TezosWithdrawOperation.create(
timestamp=execute.data.timestamp,
level=execute.data.level,
operation_hash=execute.data.hash,
Expand All @@ -63,6 +59,8 @@ async def on_rollup_execute(
outbox_message=outbox_message,
)

ctx.logger.info(f'Tezos Withdraw Transaction registered: {withdrawal.id}')

status = await Index.get(name='tezos_rollup_operations').only('status').values_list('status', flat=True)
if status == IndexStatus.realtime:
await BridgeMatcher.check_pending_tezos_withdrawals()

0 comments on commit 80581d7

Please sign in to comment.