Skip to content

Commit

Permalink
Merge branch 'main' into remove_unused_code
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Feb 24, 2024
2 parents 61c53f9 + d54172c commit 64fcb88
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages/branding": "0.3.0",
"packages/bridge-ui": "2.9.1",
"packages/bridge-ui": "2.9.2",
"packages/eventindexer": "0.13.0",
"packages/fork-diff": "0.4.0",
"packages/guardian-prover-health-check": "0.1.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/bridge-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [2.9.2](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v2.9.1...bridge-ui-v2.9.2) (2024-02-23)


### Bug Fixes

* **bridge-ui:** add injected provider to connectors ([#16008](https://github.com/taikoxyz/taiko-mono/issues/16008)) ([0496ff4](https://github.com/taikoxyz/taiko-mono/commit/0496ff40e374354b83d17121e4760391fed90a31))
* **bridge-ui:** renamed configuredCustomToken to configuredCustomTokens ([#15905](https://github.com/taikoxyz/taiko-mono/issues/15905)) ([a9f60b8](https://github.com/taikoxyz/taiko-mono/commit/a9f60b8c114dfd277e8dc227e7fbbe8716698d53))

## [2.9.1](https://github.com/taikoxyz/taiko-mono/compare/bridge-ui-v2.9.0...bridge-ui-v2.9.1) (2024-02-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge-ui",
"version": "2.9.1",
"version": "2.9.2",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
8 changes: 8 additions & 0 deletions packages/relayer/cmd/flags/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ var (
Category: indexerCategory,
EnvVars: []string{"NUM_LATEST_BLOCKS_TO_IGNORE_WHEN_CRAWLING"},
}
TargetBlockNumber = &cli.Uint64Flag{
Name: "targetBlockNumber",
Usage: "Specify the target block number to process transactions in",
Required: false,
Category: indexerCategory,
EnvVars: []string{"TARGET_BLOCK_NUMBER"},
}
)

var IndexerFlags = MergeFlags(CommonFlags, QueueFlags, []cli.Flag{
Expand All @@ -89,4 +96,5 @@ var IndexerFlags = MergeFlags(CommonFlags, QueueFlags, []cli.Flag{
SyncMode,
WatchMode,
NumLatestBlocksToIgnoreWhenCrawling,
TargetBlockNumber,
})
8 changes: 8 additions & 0 deletions packages/relayer/indexer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Config struct {
SyncMode SyncMode
WatchMode WatchMode
NumLatestBlocksToIgnoreWhenCrawling uint64
TargetBlockNumber *uint64
OpenQueueFunc func() (queue.Queue, error)
OpenDBFunc func() (DB, error)
}
Expand Down Expand Up @@ -70,6 +71,13 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
SyncMode: SyncMode(c.String(flags.SyncMode.Name)),
ETHClientTimeout: c.Uint64(flags.ETHClientTimeout.Name),
NumLatestBlocksToIgnoreWhenCrawling: c.Uint64(flags.NumLatestBlocksToIgnoreWhenCrawling.Name),
TargetBlockNumber: func() *uint64 {
if c.IsSet(flags.TargetBlockNumber.Name) {
value := c.Uint64(flags.TargetBlockNumber.Name)
return &value
}
return nil
}(),
OpenDBFunc: func() (DB, error) {
return db.OpenDBConnection(db.DBConnectionOpts{
Name: c.String(flags.DatabaseUsername.Name),
Expand Down
27 changes: 19 additions & 8 deletions packages/relayer/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ type Indexer struct {

numLatestBlocksToIgnoreWhenCrawling uint64

targetBlockNumber *uint64

ctx context.Context

mu *sync.Mutex
Expand Down Expand Up @@ -194,6 +196,8 @@ func InitFromConfig(ctx context.Context, i *Indexer, cfg *Config) (err error) {

i.numLatestBlocksToIgnoreWhenCrawling = cfg.NumLatestBlocksToIgnoreWhenCrawling

i.targetBlockNumber = cfg.TargetBlockNumber

i.mu = &sync.Mutex{}

return nil
Expand Down Expand Up @@ -273,21 +277,28 @@ func (i *Indexer) filter(ctx context.Context) error {
return i.subscribe(ctx, i.srcChainId)
}

slog.Info("fetching batch block events",
"chainID", i.srcChainId.Uint64(),
"startblock", i.processingBlockHeight,
"endblock", header.Number.Int64(),
"batchsize", i.blockBatchSize,
)

endBlockID := header.Number.Uint64()

// ignore latest N blocks, they are probably in queue already
// and are not "missed".
if i.watchMode == CrawlPastBlocks {
endBlockID -= i.numLatestBlocksToIgnoreWhenCrawling
if i.targetBlockNumber != nil {
slog.Info("targetBlockNumber is set", "targetBlockNumber", *i.targetBlockNumber)
i.processingBlockHeight = *i.targetBlockNumber
endBlockID = i.processingBlockHeight + 1
} else {
endBlockID = i.numLatestBlocksToIgnoreWhenCrawling
}
}

slog.Info("fetching batch block events",
"chainID", i.srcChainId.Uint64(),
"processingBlockHeight", i.processingBlockHeight,
"endblock", endBlockID,
"batchsize", i.blockBatchSize,
"watchMode", i.watchMode,
)

for j := i.processingBlockHeight; j < endBlockID; j += i.blockBatchSize {
end := i.processingBlockHeight + i.blockBatchSize
// if the end of the batch is greater than the latest block number, set end
Expand Down
2 changes: 0 additions & 2 deletions packages/relayer/pkg/queue/rabbitmq/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ func (r *RabbitMQ) Ack(ctx context.Context, msg queue.Message) error {

err := rmqMsg.Ack(false)

slog.Info("attempted acknowledge rabbitmq message")

if err != nil {
slog.Error("error acknowledging rabbitmq message", "err", err.Error())
return err
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/processor/process_single.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func (p *Processor) processSingle(ctx context.Context) error {
slog.Info("processing tx", "estimateGas", common.Hash(*p.targetTxHash).Hex())
slog.Info("processing single", "txHash", common.Hash(*p.targetTxHash).Hex())

bridgeAbi, err := abi.JSON(strings.NewReader(bridge.BridgeABI))
if err != nil {
Expand Down

0 comments on commit 64fcb88

Please sign in to comment.