oasisprotocol / oasisprotocol/oasis-core
Fix `runtime.history.History.Watchblocks` to emit sequential blocks (no gaps)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 369
- Forks
- 151
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
Subscription to runtime.client.api.WatchBlocks (see) may return block sequence with missing rounds.
This may happen because runtime.history.History is not notifying blocks if they are Committ-ed via notify=false (during reindex)**.
Note this is only problematic if node !hasLocalStorage, as otherwise storage syncing (worker.storage.committee.Node) is responsible for notifying blocks via StorageSyncCheckpoint. This worker subscribes to roothash.ServiceClient.WatchBlocks, which may have gaps, however it fetches missing rounds.
As discussed in private, roothash.ServiceClient should probably not be responsible for reindexing, nor should roothash.BlockHistory know anything about storage, node types etc... Likely this code needs a thorough refactor.
** We are guaranteed to have at least two reindexes, possibly more if there are errors during subsequent event processing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with runtime/client/api/WatchBlocks in worker/client/service.go and trace how runtime.history.History handles blocks committed with notify=false during reindexing. Compare this with roothash.ServiceClient.WatchBlocks and worker.storage.committee.Node's StorageSyncCheckpoint path, including how missing rounds are fetched. Done means History.Watchblocks emits sequential blocks without gaps across the guaranteed reindexes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- blockchain, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100