Skip to content

Commit

Permalink
feat(relayer): support L2-L2 bridging (#14711)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Sep 18, 2023
1 parent 1103695 commit 1410217
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/relayer/indexer/handle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ func (i *Indexer) handleEvent(
) error {
slog.Info("event found for msgHash", "msgHash", common.Hash(event.MsgHash).Hex(), "txHash", event.Raw.TxHash.Hex())

if event.Message.DestChainId.Cmp(i.destChainId) != 0 {
slog.Info("skipping event, wrong chainID",
"messageDestChainID",
event.Message.DestChainId.Uint64(),
"indexerDestChainID",
i.destChainId.Uint64(),
)

return nil
}

if err := i.detectAndHandleReorg(ctx, relayer.EventNameMessageSent, common.Hash(event.MsgHash).Hex()); err != nil {
return errors.Wrap(err, "svc.detectAndHandleReorg")
}
Expand Down Expand Up @@ -71,7 +82,6 @@ func (i *Indexer) handleEvent(
return errors.Wrap(err, "svc.eventRepo.Save")
}

// TODO: add to queue
msg := queue.QueueMessageBody{
ID: e.ID,
Event: event,
Expand Down
3 changes: 2 additions & 1 deletion packages/relayer/mock/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func (b *Bridge) WatchMessageSent(

sink <- &bridge.BridgeMessageSent{
Message: bridge.IBridgeMessage{
SrcChainId: big.NewInt(1),
SrcChainId: big.NewInt(1),
DestChainId: MockChainID,
},
}
b.MessagesSent++
Expand Down

0 comments on commit 1410217

Please sign in to comment.