Skip to content

Commit

Permalink
feat(relayer): use new protocl synced snippet for much faster syncing (
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Nov 8, 2023
1 parent 1ddceb6 commit 11fa49d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/relayer/.l1indexer.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ QUEUE_USER=guest
QUEUE_PASSWORD=guest
QUEUE_HOST=localhost
QUEUE_PORT=5672
SRC_BRIDGE_ADDRESS=0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE
SRC_BRIDGE_ADDRESS=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
DEST_BRIDGE_ADDRESS=0x1000777700000000000000000000000000000004
SRC_TAIKO_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
SRC_RPC_URL=wss://l1ws.internal.taiko.xyz
Expand Down
17 changes: 14 additions & 3 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,23 @@ func (p *Processor) processMessage(
// todo: instead of latest, need way to find out which block num on the hop chain
// the previous blockHash was synced in, and then wait for that header to be synced
// on the next hop chain.
latestBlock, err := hop.ethClient.BlockByNumber(ctx, nil)
snippet, err := hop.headerSyncer.GetSyncedSnippet(&bind.CallOpts{
Context: ctx,
},
hop.blockNum,
)

slog.Info("hop synced snippet",
"syncedInBlock", snippet.SyncedInBlock,
"blockNum", hop.blockNum,
"blockHash", common.Bytes2Hex(snippet.BlockHash[:]),
)

if err != nil {
return errors.Wrap(err, "hop.ethClient.BlockByNumber(ctx, nil)")
return errors.Wrap(err, "hop.headerSyncer.GetSyncedSnippet")
}

blockNum = latestBlock.NumberU64()
blockNum = snippet.SyncedInBlock

hopEthClient = hop.ethClient
}
Expand Down

0 comments on commit 11fa49d

Please sign in to comment.