Skip to content

Commit

Permalink
Fix outbox message hash
Browse files Browse the repository at this point in the history
* Alter outbox message table
* Added MICHELSON_OUTBOX_INTERFACE
* Added rate limits for Etherlink Node Datasource
* Added unknown Tickets support
* Added separate parisnet config
  • Loading branch information
igorsereda committed Dec 16, 2024
1 parent b0cab80 commit cebf8a5
Show file tree
Hide file tree
Showing 9 changed files with 1,165 additions and 606 deletions.
136 changes: 136 additions & 0 deletions bridge_indexer/configs/parisnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
contracts:
tezos_smart_rollup:
kind: tezos
address: ${SMART_ROLLUP_ADDRESS}
typename: rollup

etherlink_rollup_kernel:
kind: evm
address: '0x0000000000000000000000000000000000000000'
typename: kernel

etherlink_rollup_kernel_native:
kind: evm
address: '0x0000000000000000000000000000000000000000'
typename: kernel_native

l2_tzbtc_token:
kind: evm
address: 0x87dcbf128677ba36e79d47daf4eb4e51610e0150
typename: l2_token
l2_sirs_token:
kind: evm
address: 0xcb5d40c6b1bdf5cd51b3801351b0a68d101a561b
typename: l2_token
l2_usdt_token:
kind: evm
address: 0x8554cd57c0c3e5ab9d1782c9063279fa9bfa4680
typename: l2_token


indexes:
tezos_head:
kind: tezos.head
datasources:
- tzkt
callback: tezos.on_head

tezos_rollup_cement:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- sr_cement
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_cement_commitment
pattern:
- type: sr_cement
destination: tezos_smart_rollup


tezos_deposit_operations:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- transaction
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_rollup_call
pattern:
- type: transaction
destination: tezos_smart_rollup
entrypoint: default

etherlink_deposit_events:
kind: evm.events
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_deposit
contract: etherlink_rollup_kernel
name: Deposit

etherlink_xtz_deposit_transactions:
kind: evm.transactions
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_xtz_deposit
from_: etherlink_rollup_kernel


etherlink_withdrawal_events:
kind: evm.events
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_withdraw
contract: etherlink_rollup_kernel
name: Withdrawal
- callback: etherlink.on_xtz_withdraw
contract: etherlink_rollup_kernel_native
name: Withdrawal

tezos_withdrawal_operations:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- sr_execute
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_rollup_execute
pattern:
- type: sr_execute
destination: tezos_smart_rollup


etherlink_token_balance_update_events:
kind: evm.events
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_transfer
contract: l2_tzbtc_token
name: Transfer
- callback: etherlink.on_transfer
contract: l2_sirs_token
name: Transfer
- callback: etherlink.on_transfer
contract: l2_usdt_token
name: Transfer
153 changes: 12 additions & 141 deletions bridge_indexer/dipdup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ datasources:

metadata:
kind: tzip_metadata
network: parisnet
network: ${NETWORK}
url: ${METADATA_URL}

tezos_node:
Expand All @@ -35,6 +35,10 @@ datasources:
etherlink_node:
kind: evm.node
url: ${ETHERLINK_NODE_URL}
http:
ratelimit_rate: 1000
ratelimit_period: 60
ratelimit_sleep: 10

etherlink_subsquid:
kind: evm.subsquid
Expand All @@ -45,145 +49,12 @@ datasources:
url: ${ROLLUP_NODE_URL}


contracts:
tezos_smart_rollup:
kind: tezos
address: ${SMART_ROLLUP_ADDRESS}
typename: rollup

etherlink_rollup_kernel:
kind: evm
address: '0x0000000000000000000000000000000000000000'
typename: kernel

etherlink_rollup_kernel_native:
kind: evm
address: '0x0000000000000000000000000000000000000000'
typename: kernel_native

l2_tzbtc_token:
kind: evm
address: 0x87dcbf128677ba36e79d47daf4eb4e51610e0150
typename: l2_token
l2_sirs_token:
kind: evm
address: 0xcb5d40c6b1bdf5cd51b3801351b0a68d101a561b
typename: l2_token
l2_usdt_token:
kind: evm
address: 0x8554cd57c0c3e5ab9d1782c9063279fa9bfa4680
typename: l2_token


indexes:
tezos_head:
kind: tezos.head
datasources:
- tzkt
callback: tezos.on_head

tezos_rollup_cement:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- sr_cement
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_cement_commitment
pattern:
- type: sr_cement
destination: tezos_smart_rollup


tezos_deposit_operations:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- transaction
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_rollup_call
pattern:
- type: transaction
destination: tezos_smart_rollup
entrypoint: default

etherlink_deposit_events:
kind: evm.events
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_deposit
contract: etherlink_rollup_kernel
name: Deposit

etherlink_xtz_deposit_transactions:
kind: evm.transactions
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_xtz_deposit
from_: etherlink_rollup_kernel


etherlink_withdrawal_events:
kind: evm.events
first_level: ${L2_FIRST_LEVEL}
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_withdraw
contract: etherlink_rollup_kernel
name: Withdrawal
- callback: etherlink.on_xtz_withdraw
contract: etherlink_rollup_kernel_native
name: Withdrawal

tezos_withdrawal_operations:
kind: tezos.operations
first_level: ${L1_FIRST_LEVEL}
datasources:
- tzkt
types:
- sr_execute
contracts:
- tezos_smart_rollup
handlers:
- callback: tezos.on_rollup_execute
pattern:
- type: sr_execute
destination: tezos_smart_rollup


etherlink_token_balance_update_events:
kind: evm.events
datasources:
- etherlink_subsquid
- etherlink_node
handlers:
- callback: etherlink.on_transfer
contract: l2_tzbtc_token
name: Transfer
- callback: etherlink.on_transfer
contract: l2_sirs_token
name: Transfer
- callback: etherlink.on_transfer
contract: l2_usdt_token
name: Transfer


advanced:
reindex:
config_modified: ignore
schema_modified: ignore
config_modified: exception
schema_modified: exception
migration: exception

rollback: ignore

manual: wipe
4 changes: 3 additions & 1 deletion bridge_indexer/handlers/etherlink/on_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ async def on_withdraw(
) -> None:
ctx.logger.info(f'Etherlink FA Withdraw Event found: {event.data.transaction_hash}')
token_contract = event.payload.ticket_owner.removeprefix('0x')
etherlink_token = await EtherlinkToken.get_or_none(id=token_contract)
etherlink_token = await EtherlinkToken.get_or_none(id=token_contract).prefetch_related('ticket')
if not etherlink_token:
if event.payload.sender == event.payload.ticket_owner:
ctx.logger.warning('Uncommon Withdraw Routing Info: `ticket_owner == sender`. Mark Operation as `Deposit Revert`.')
else:
ctx.logger.warning(f'Incorrect Withdraw Routing Info: Specified `proxy` contract address not whitelisted: {token_contract}.')
if etherlink_token and event.payload.proxy != etherlink_token.ticket.ticketer_address:
ctx.logger.warning('Uncommon Withdraw Routing Info: `proxy != ticketer_address`.')

withdrawal = await EtherlinkWithdrawOperation.create(
timestamp=datetime.fromtimestamp(event.data.timestamp, tz=UTC),
Expand Down
Loading

0 comments on commit cebf8a5

Please sign in to comment.