onflow / onflow/flow-go

[DataAvailability] Implement fork-aware Events Endpoints

Open
#7,652 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Preserve S-Access
Dominant language
Go
Stars
575
Forks
217
Avg merge
4d 20h
Merged PRs (30d)
9

Description

Update Events endpoints to use caching layer to get data from local storage.

  • GetEventsForHeightRange
  • GetEventsForBlockIDs

Implementation tasks

  1. Add arguments to backend implementation that specify the user query criteria
  2. Update grpc handler to extract and pass the criteria from the protobuf request
  3. Update rest handler to extract and pass the criteria
  4. In the backend implementation:
    a. Get the block(s) the request relates to
    b. Lookup the execution result for the provided block
    c. Get the snapshot for the result, then get the storage reader(s) required for the endpoint
    d. Use the reader as usual
  5. Update error handling to use the new framework
  6. Ensure godocs are up to standard for all methods that are interacted with during the code paths.

Notes:
Both of these methods allow querying a set of blocks. Since there can be forks, the API needs to ensure that all results are from the same fork. This can be done by finding the block from the range with the highest height and using it to get the result. This will be the newest descendant in the fork. From there, the snapshot will ensure that querying for additional blocks will return only data from the fork.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the implementations of GetEventsForHeightRange and GetEventsForBlockIDs, then trace the corresponding gRPC and REST handlers and their protobuf requests. Follow how backend criteria, blocks, execution results, snapshots, and storage readers are passed through the endpoints, and review the linked error framework. Done means both endpoints return fork-consistent data, use the updated error handling, and have the required godoc coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.