Skip to content

Commit

Permalink
Merge branch 'fix/outbox-message-index'
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsereda committed Oct 9, 2024
2 parents 0469a1a + 4fb9220 commit f2b361b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bridge_indexer/handlers/etherlink/on_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ async def on_withdraw(
kernel_withdrawal_id=event.payload.withdrawal_id,
)

ctx.logger.info(f'Etherlink Withdraw Event registered: {withdrawal.id}')
ctx.logger.info(f'Etherlink FA Token Withdraw Event registered: {withdrawal.id}')

BridgeMatcherLocks.set_pending_etherlink_withdrawals()
2 changes: 1 addition & 1 deletion bridge_indexer/handlers/etherlink/on_xtz_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ async def on_xtz_withdraw(
kernel_withdrawal_id=event.payload.withdrawal_id,
)

ctx.logger.info(f'Etherlink Native Withdraw Event registered: {withdrawal.id}')
ctx.logger.info(f'Etherlink Native Token Withdraw Event registered: {withdrawal.id}')

BridgeMatcherLocks.set_pending_etherlink_withdrawals()
6 changes: 3 additions & 3 deletions bridge_indexer/handlers/tezos/on_rollup_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ async def on_rollup_execute(
continue
if int(operation['counter']) != execute.data.counter:
continue
message_hex = operation['output_proof']
output_proof_hex = operation['output_proof']
break

try:
assert message_hex
assert output_proof_hex
except AssertionError:
ctx.logger.error('Outbox Message execution not found in block operations.')
return

decoder = OutputProofData(bytes.fromhex(message_hex))
decoder = OutputProofData(bytes.fromhex(output_proof_hex))
output_proof, _ = decoder.unpack()

try:
Expand Down
20 changes: 20 additions & 0 deletions bridge_indexer/hasura/00_untracked_foreign_key_relationships.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,26 @@
},
"source": "default"
}
},
{
"type": "pg_create_array_relationship",
"args": {
"name": "l1_withdrawals",
"table": {
"name": "rollup_outbox_message",
"schema": "public"
},
"using": {
"foreign_key_constraint_on": {
"table": {
"name": "l1_withdrawal",
"schema": "public"
},
"column": "outbox_message_id"
}
},
"source": "default"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@
}
]
}

1 change: 1 addition & 0 deletions bridge_indexer/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class Meta:
source_field='outbox_message_id',
to_field='id',
index=True,
unique=True,
)

bridge_withdrawals: fields.ReverseRelation['BridgeWithdrawOperation']
Expand Down
14 changes: 13 additions & 1 deletion bridge_indexer/types/output_proof/micheline_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,22 @@ def unpack(self):
return int(bits_array, 2), self._size


class Nat(BaseBinarySchema):
def unpack(self):
r, i = 0, 0
for i, e in enumerate(self._packed):
s = ((e & 0x7f) << (i * 7))
if s == 0:
break
r += s
self._size = i + 1
return r, self._size


class OutputProofOutput(BaseBinarySchema):
_schema = [
('outbox_level', 4, 'int32'),
('message_index', None, 'Zarith'),
('message_index', 1, 'uint8'),
('message', None, 'Message'),
]

Expand Down

0 comments on commit f2b361b

Please sign in to comment.