livepeer / livepeer/subgraph

Clarify block number source in helpers and consider renaming

Open
#176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5
Forks
7
Avg merge
4h 1m
Merged PRs (30d)
6

Description

As pointed out by @jmulq in [https://github.com/livepeer/subgraph/pull/175#discussion_r2619834285](https://github.com/livepeer/subgraph/pull/175#discussion_r2619834285), `event.block.number` and `RoundsManager.blockNum()` are equivalent today (since `blockNum()` returns `block.number`), but the helper name `getBlockNum()` is ambiguous. We should decide which source we want to rely on (event data vs. contract call) for clarity and efficiency, and rename the helper accordingly (e.g., `getRoundsManagerBlockNum`).

**Goal:** make the source of truth explicit, improve readability, and avoid unnecessary contract calls or confusion if the implementation diverges in the future.

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 by locating the getBlockNum helper and its callers, then compare the event.block.number source with RoundsManager.blockNum() as described in the issue. The work is done when the chosen source is explicit, unnecessary contract calls or ambiguity are addressed, and the helper name reflects that source.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.