diff --git a/polygon/bor/bor.go b/polygon/bor/bor.go index 4329f4425ae..80e4779c754 100644 --- a/polygon/bor/bor.go +++ b/polygon/bor/bor.go @@ -385,9 +385,9 @@ func New( execCtx: context.Background(), logger: logger, closeCh: make(chan struct{}), - useBridgeReader: bridgeReader != nil && !reflect.ValueOf(bridgeReader).IsNil(), + useBridgeReader: bridgeReader != nil && !reflect.ValueOf(bridgeReader).IsNil(), // needed for interface nil caveat bridgeReader: bridgeReader, - useSpanReader: spanReader != nil && !reflect.ValueOf(spanReader).IsNil(), + useSpanReader: spanReader != nil && !reflect.ValueOf(spanReader).IsNil(), // needed for interface nil caveat spanReader: spanReader, } diff --git a/polygon/bridge/reader.go b/polygon/bridge/reader.go index cd5454faa5f..6cb9e965a8a 100644 --- a/polygon/bridge/reader.go +++ b/polygon/bridge/reader.go @@ -166,6 +166,7 @@ func (r *RemoteReader) EventTxnLookup(ctx context.Context, borTxHash libcommon.H } func (r *RemoteReader) Close() { + // no-op as there is no attached store } func (r *RemoteReader) EnsureVersionCompatibility() bool { diff --git a/polygon/sync/sync.go b/polygon/sync/sync.go index 8802519739b..042742c4ccf 100644 --- a/polygon/sync/sync.go +++ b/polygon/sync/sync.go @@ -123,7 +123,7 @@ func (s *Sync) commitExecution(ctx context.Context, newTip *types.Header, finali return nil } -func (s *Sync) handleMilestoneTipMismatch(ctx context.Context, ccb *CanonicalChainBuilder, ms EventNewMilestone) error { +func (s *Sync) handleMilestoneTipMismatch(ctx context.Context, ccb *CanonicalChainBuilder, event EventNewMilestone) error { // the milestone doesn't correspond to the tip of the chain // unwind to the previous verified milestone // and download the blocks of the new milestone @@ -132,10 +132,10 @@ func (s *Sync) handleMilestoneTipMismatch(ctx context.Context, ccb *CanonicalCha s.logger.Debug( syncLogPrefix("local chain tip does not match the milestone, unwinding to the previous verified root"), "rootNum", rootNum, - "milestoneId", ms.Id, - "milestoneStart", ms.StartBlock(), - "milestoneEnd", ms.EndBlock(), - "milestoneRootHash", ms.RootHash(), + "milestoneId", event.Id, + "milestoneStart", event.StartBlock(), + "milestoneEnd", event.EndBlock(), + "milestoneRootHash", event.RootHash(), ) if err := s.bridgeSync.Unwind(ctx, rootNum); err != nil { @@ -150,7 +150,7 @@ func (s *Sync) handleMilestoneTipMismatch(ctx context.Context, ccb *CanonicalCha err = errors.New("unexpected empty headers from p2p since new milestone") return fmt.Errorf( "%w: rootNum=%d, milestoneId=%d, milestoneStart=%d, milestoneEnd=%d, milestoneRootHash=%s", - err, rootNum, ms.Id, ms.StartBlock(), ms.EndBlock(), ms.RootHash(), + err, rootNum, event.Id, event.StartBlock(), event.EndBlock(), event.RootHash(), ) } @@ -367,8 +367,8 @@ func (s *Sync) applyNewBlockOnTip(ctx context.Context, event EventNewBlock, ccb return nil } -func (s *Sync) applyNewBlockHashesOnTip(ctx context.Context, e EventNewBlockHashes, ccb *CanonicalChainBuilder) error { - for _, hashOrNum := range e.NewBlockHashes { +func (s *Sync) applyNewBlockHashesOnTip(ctx context.Context, event EventNewBlockHashes, ccb *CanonicalChainBuilder) error { + for _, hashOrNum := range event.NewBlockHashes { if (hashOrNum.Number <= ccb.Root().Number.Uint64()) || ccb.ContainsHash(hashOrNum.Hash) { continue } @@ -379,7 +379,7 @@ func (s *Sync) applyNewBlockHashesOnTip(ctx context.Context, e EventNewBlockHash s.logger.Warn(syncLogPrefix("bad block hash received from peer"), "blockHash", hashOrNum.Hash, "blockNum", hashOrNum.Number, - "peerId", e.PeerId, + "peerId", event.PeerId, ) return nil } @@ -391,13 +391,13 @@ func (s *Sync) applyNewBlockHashesOnTip(ctx context.Context, e EventNewBlockHash ) fetchOpts := []p2p.FetcherOption{p2p.WithMaxRetries(0), p2p.WithResponseTimeout(time.Second)} - newBlocks, err := s.p2pService.FetchBlocksBackwardsByHash(ctx, hashOrNum.Hash, 1, e.PeerId, fetchOpts...) + newBlocks, err := s.p2pService.FetchBlocksBackwardsByHash(ctx, hashOrNum.Hash, 1, event.PeerId, fetchOpts...) if err != nil { if s.ignoreFetchBlocksErrOnTipEvent(err) { s.logger.Debug( syncLogPrefix("applyNewBlockHashesOnTip: failed to fetch complete blocks, ignoring event"), "err", err, - "peerId", e.PeerId, + "peerId", event.PeerId, "lastBlockNum", hashOrNum.Number, ) @@ -409,7 +409,7 @@ func (s *Sync) applyNewBlockHashesOnTip(ctx context.Context, e EventNewBlockHash newBlockEvent := EventNewBlock{ NewBlock: newBlocks.Data[0], - PeerId: e.PeerId, + PeerId: event.PeerId, Source: EventSourceP2PNewBlockHashes, } diff --git a/turbo/jsonrpc/bor_api.go b/turbo/jsonrpc/bor_api.go index ad4630229de..fd8ead50e29 100644 --- a/turbo/jsonrpc/bor_api.go +++ b/turbo/jsonrpc/bor_api.go @@ -61,7 +61,7 @@ func NewBorAPI(base *BaseAPI, db kv.RoDB, spanProducersReader spanProducersReade return &BorImpl{ BaseAPI: base, db: db, - useSpanProducersReader: spanProducersReader != nil && !reflect.ValueOf(spanProducersReader).IsNil(), + useSpanProducersReader: spanProducersReader != nil && !reflect.ValueOf(spanProducersReader).IsNil(), // needed for interface nil caveat spanProducersReader: spanProducersReader, } } diff --git a/turbo/jsonrpc/eth_api.go b/turbo/jsonrpc/eth_api.go index 2896fa212bb..06bf3599bf6 100644 --- a/turbo/jsonrpc/eth_api.go +++ b/turbo/jsonrpc/eth_api.go @@ -175,7 +175,7 @@ func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader serv receiptsGenerator: receipts.NewGenerator(receiptsCacheLimit, blockReader, engine), borReceiptGenerator: receipts.NewBorGenerator(receiptsCacheLimit, blockReader, engine), dirs: dirs, - useBridgeReader: bridgeReader != nil && !reflect.ValueOf(bridgeReader).IsNil(), + useBridgeReader: bridgeReader != nil && !reflect.ValueOf(bridgeReader).IsNil(), // needed for interface nil caveat bridgeReader: bridgeReader, } }