From 331adb1961ca1de64f7091a1be92199e2e5bc15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Duchesneau?= Date: Fri, 23 Feb 2024 16:07:14 -0500 Subject: [PATCH] fix panic on block poller missing IsBlockAvailable --- CHANGELOG.md | 15 +++++++++++++++ blockfetcher/optimism.go | 7 +++---- blockfetcher/rpc.go | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74aa4b4a..b894463a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See [MAINTAINERS.md](./MAINTAINERS.md) for instructions to keep up to date. +## v2.3.3 + +### Known issues ### + +* The block decoding to JSON is broken in the client tools (firehose-client, print merged-blocks, etc.). Use version v2.3.1 + +### Hotfix + +* Fix block poller panic on v2.3.2 + ## v2.3.2 +### Known issues ### + +* This release has a broken RPC poller component. Upgrade to v2.3.3. +* The block decoding to JSON is broken in the client tools (firehose-client, print merged-blocks, etc.). Use version v2.3.1 + ### Auth and metering * Add missing metering events for `sf.firehose.v2.Fetch/Block` responses. diff --git a/blockfetcher/optimism.go b/blockfetcher/optimism.go index 5e8cdad2..58ac64c6 100644 --- a/blockfetcher/optimism.go +++ b/blockfetcher/optimism.go @@ -15,9 +15,8 @@ type OptimismBlockFetcher struct { fetcher *BlockFetcher } -func (f *OptimismBlockFetcher) IsBlockAvailable(requestedSlot uint64) bool { - //TODO implement me - panic("implement me") +func (f *OptimismBlockFetcher) IsBlockAvailable(requested uint64) bool { + return f.fetcher.IsBlockAvailable(requested) } func (f *OptimismBlockFetcher) Fetch(ctx context.Context, blockNum uint64) (b *pbbstream.Block, skipped bool, err error) { @@ -32,4 +31,4 @@ func NewOptimismBlockFetcher(rpcClient *rpc.Client, intervalBetweenFetch time.Du } } -func (f *OptimismBlockFetcher) PollingInterval() time.Duration { return 1 * time.Second } +func (f *OptimismBlockFetcher) PollingInterval() time.Duration { return 5 * time.Second } diff --git a/blockfetcher/rpc.go b/blockfetcher/rpc.go index 1b18d060..da8f9c14 100644 --- a/blockfetcher/rpc.go +++ b/blockfetcher/rpc.go @@ -37,6 +37,10 @@ func NewBlockFetcher(rpcClient *rpc.Client, intervalBetweenFetch, latestBlockRet } } +func (f *BlockFetcher) IsBlockAvailable(blockNum uint64) bool { + return blockNum <= f.latest +} + func (f *BlockFetcher) Fetch(ctx context.Context, blockNum uint64) (block *pbbstream.Block, err error) { f.logger.Debug("fetching block", zap.Uint64("block_num", blockNum)) for f.latest < blockNum {