fix: create Pool on demand in reward() to avoid null-Pool abort#246
Open
rickstaa wants to merge 1 commit into
Open
fix: create Pool on demand in reward() to avoid null-Pool abort#246rickstaa wants to merge 1 commit into
rickstaa wants to merge 1 commit into
Conversation
reward() loaded the round's Pool with `Pool.load()` and dereferenced it via `pool!`, which aborts the subgraph if the Pool is missing (observed at block 144056642: "unexpected null in handler `reward`" at bondingManager.ts:499). Pools are created per active transcoder in newRound() from on-chain calls (getFirstTranscoderInPool / getNextTranscoderInPool). If that set comes back empty — the call reverted, or an incomplete archive node on a resync — no Pool exists for a transcoder that later calls reward(). Create the Pool on demand so a missing Pool can never hard-halt indexing.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe reward handler now creates missing ChangesReward pool initialization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🚀 Subgraph Studio preview deployed
curl -H 'Content-Type: application/json' \
-d '{"query":"{ protocol(id: \"0\") { inflation } }"}' \
https://api.studio.thegraph.com/query/31909/livepeer-ci/pr-246-eba263b-29754235787 |
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
reward()loads the round'sPoolwithPool.load()and dereferences it withpool!, which hard-aborts the subgraph when the Pool is missing:Observed on the Subgraph Studio indexer for the Livepeer subgraph.
Root cause (as far as traced)
Pools are created only in
newRound(), built from on-chaineth_calls (getFirstTranscoderInPool/getNextTranscoderInPool). When that set comes out empty or short for a round, a transcoder that later callsreward()has no Pool →Pool.load()returns null →pool!aborts.This is non-deterministic: with identical code, one indexer aborted at 144056642 while the live network deployment indexed straight past it. That points to the pool-building
eth_calls resolving differently across archive environments/syncs. The precise reason the set is built short is not fully pinned down (deep-archiveeth_callbehavior vs a genuine on-chain edge case). Either way,reward()should never hard-halt on a missing Pool.Fix
Create the Pool on demand when it's missing, populating the same non-null fields
newRound()sets:Validation
Reproduced locally against an Arbitrum One archive RPC: the pre-fix build aborts at 144056642 (
unexpected null in handler reward); this build runs therewardhandler and indexes past it (Done processing trigger … handler: reward).Notes
to-bug block (485100965), so this guard is needed for a clean resync to even reach that fix. A combined PR ships this together with theTransaction.tonullable fix (fix: make Transaction.to nullable for contract-creation txs #245).🤖 Generated with Claude Code
Summary by CodeRabbit