From 434d53063cb684d41c30211e53a83ba62370e28e Mon Sep 17 00:00:00 2001 From: Goran Rojovic Date: Tue, 21 Jan 2025 12:41:19 +0100 Subject: [PATCH] fix: increase log level --- sync/evmdownloader.go | 15 ++++++++++----- sync/evmdriver.go | 2 +- test/helpers/e2e.go | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sync/evmdownloader.go b/sync/evmdownloader.go index 70bef5ffd..05f21883c 100644 --- a/sync/evmdownloader.go +++ b/sync/evmdownloader.go @@ -80,7 +80,6 @@ func NewEVMDownloader( func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, downloadedCh chan EVMBlock) { lastBlock := d.WaitForNewBlocks(ctx, 0) - toBlock := fromBlock for { select { @@ -91,13 +90,13 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download default: } - toBlock = fromBlock + d.syncBlockChunkSize + toBlock := fromBlock + d.syncBlockChunkSize if toBlock > lastBlock { toBlock = lastBlock } if fromBlock > toBlock { - d.log.Debugf( + d.log.Infof( "waiting for new blocks, last block processed: %d, last block seen on L1: %d", fromBlock-1, lastBlock, ) @@ -113,12 +112,12 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download lastFinalizedBlockNumber := lastFinalizedBlock.Number.Uint64() - d.log.Debugf("getting events from blocks %d to %d", fromBlock, toBlock) + d.log.Infof("getting events from blocks %d to %d. lastFinalizedBlock: %d", fromBlock, toBlock, lastFinalizedBlockNumber) blocks := d.GetEventsByBlockRange(ctx, fromBlock, toBlock) reportBlocksFn := func(numOfBlocksToReport int) { for i := 0; i < numOfBlocksToReport; i++ { - d.log.Debugf("sending block %d to the driver (with events)", blocks[i].Num) + d.log.Infof("sending block %d to the driver (with events)", blocks[i].Num) downloadedCh <- blocks[i] } } @@ -138,10 +137,12 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download if blocks.Len() == 0 { // we have no events, keep increasing the block range until we hit a log + d.log.Infof("no events found in blocks %d to %d", fromBlock, toBlock) if lastFinalizedBlockNumber > toBlock { // we might be behind a lot, so go until last finalized block toBlock = lastFinalizedBlockNumber lastBlock = lastFinalizedBlockNumber + d.log.Infof("setting toBlock to last finalized block %d", toBlock) } if lastFinalizedBlockNumber-fromBlock >= d.syncBlockChunkSize { @@ -150,6 +151,7 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download // this is mainly needed for tests reportEmptyBlockFn(lastFinalizedBlockNumber) fromBlock = lastFinalizedBlockNumber + d.log.Infof("setting fromBlock to last finalized block %d", fromBlock) } continue @@ -159,6 +161,7 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download // and we do not need to track it in the reorg detector reportBlocksFn(blocks.Len()) fromBlock = toBlock + 1 + d.log.Infof("got blocks that are lower than finalized block, setting fromBlock to %d", fromBlock) } else if blocks[blocks.Len()-1].Num < toBlock { // if we have logs in some of the blocks, and they are not all finalized, // check if we have finalized blocks in gotten range, report them and @@ -168,6 +171,7 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download if exists { reportBlocksFn(index + 1) // num of blocks to report is index + 1 since index is zero based fromBlock = lastFinalizedBlock + 1 + d.log.Infof("have some finalized blocks in the range, setting fromBlock to %d", fromBlock) continue } } else { @@ -176,6 +180,7 @@ func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, download // and we are not afraid to have missaligned hashes at this point reportBlocksFn(blocks.Len()) fromBlock = toBlock + 1 + d.log.Infof("have logs in the last block, setting fromBlock to %d", fromBlock) } } } diff --git a/sync/evmdriver.go b/sync/evmdriver.go index 8c614f49f..dc14e9436 100644 --- a/sync/evmdriver.go +++ b/sync/evmdriver.go @@ -96,7 +96,7 @@ reset: if ok { // when channel is closing, it is sending an empty block with num = 0, and empty hash // because it is not passing object by reference, but by value, so do not handle that since it is closing - d.log.Debugf("handleNewBlock, blockNum: %d, blockHash: %s", b.Num, b.Hash) + d.log.Infof("handleNewBlock, blockNum: %d, blockHash: %s", b.Num, b.Hash) d.handleNewBlock(ctx, cancel, b) } case firstReorgedBlock := <-d.reorgSub.ReorgedBlock: diff --git a/test/helpers/e2e.go b/test/helpers/e2e.go index c7fb908e1..71c923c56 100644 --- a/test/helpers/e2e.go +++ b/test/helpers/e2e.go @@ -128,7 +128,7 @@ func L1Setup(t *testing.T) *L1Environment { originNetwork = 1 initialBlock = 0 retryPeriod = 0 - retriesCount = 0 + retriesCount = 10 ) // Bridge sync