From 80581d78c651ead2898bd3ee360f959346293f3a Mon Sep 17 00:00:00 2001 From: Igor Sereda Date: Wed, 13 Mar 2024 03:19:17 +0300 Subject: [PATCH] Fix logging messages --- bridge_indexer/handlers/etherlink/on_deposit.py | 3 +-- bridge_indexer/handlers/etherlink/on_transfer.py | 3 +-- bridge_indexer/handlers/etherlink/on_withdraw.py | 3 +-- bridge_indexer/handlers/etherlink/on_xtz_deposit.py | 3 +-- bridge_indexer/handlers/tezos/on_rollup_call.py | 5 +++-- bridge_indexer/handlers/tezos/on_rollup_execute.py | 12 +++++------- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bridge_indexer/handlers/etherlink/on_deposit.py b/bridge_indexer/handlers/etherlink/on_deposit.py index a7590ff..dacd000 100644 --- a/bridge_indexer/handlers/etherlink/on_deposit.py +++ b/bridge_indexer/handlers/etherlink/on_deposit.py @@ -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) diff --git a/bridge_indexer/handlers/etherlink/on_transfer.py b/bridge_indexer/handlers/etherlink/on_transfer.py index af420bb..11fce80 100644 --- a/bridge_indexer/handlers/etherlink/on_transfer.py +++ b/bridge_indexer/handlers/etherlink/on_transfer.py @@ -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: diff --git a/bridge_indexer/handlers/etherlink/on_withdraw.py b/bridge_indexer/handlers/etherlink/on_withdraw.py index e01c59b..f033fc9 100644 --- a/bridge_indexer/handlers/etherlink/on_withdraw.py +++ b/bridge_indexer/handlers/etherlink/on_withdraw.py @@ -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: diff --git a/bridge_indexer/handlers/etherlink/on_xtz_deposit.py b/bridge_indexer/handlers/etherlink/on_xtz_deposit.py index 8881d0e..5533526 100644 --- a/bridge_indexer/handlers/etherlink/on_xtz_deposit.py +++ b/bridge_indexer/handlers/etherlink/on_xtz_deposit.py @@ -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) diff --git a/bridge_indexer/handlers/tezos/on_rollup_call.py b/bridge_indexer/handlers/tezos/on_rollup_call.py index 5dd2dd5..643b95e 100644 --- a/bridge_indexer/handlers/tezos/on_rollup_call.py +++ b/bridge_indexer/handlers/tezos/on_rollup_call.py @@ -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) @@ -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, @@ -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: diff --git a/bridge_indexer/handlers/tezos/on_rollup_execute.py b/bridge_indexer/handlers/tezos/on_rollup_execute.py index 1f8051e..9ccfd89 100644 --- a/bridge_indexer/handlers/tezos/on_rollup_execute.py +++ b/bridge_indexer/handlers/tezos/on_rollup_execute.py @@ -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]: @@ -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, @@ -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()