Skip to content

Commit

Permalink
fix panic on block poller missing IsBlockAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Feb 23, 2024
1 parent 9c1f76b commit 331adb1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 3 additions & 4 deletions blockfetcher/optimism.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 }
4 changes: 4 additions & 0 deletions blockfetcher/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 331adb1

Please sign in to comment.