fix(empty_blocks_sanitizer): handle nil block result, flag for refetch#20
Merged
rymcol merged 1 commit intosignet-mainfrom Apr 17, 2026
Merged
fix(empty_blocks_sanitizer): handle nil block result, flag for refetch#20rymcol merged 1 commit intosignet-mainfrom
rymcol merged 1 commit intosignet-mainfrom
Conversation
When the JSON-RPC returns \`result: null\` for a block (pruned, reorged
out, or genuinely missing), \`classify_blocks_from_result/1\` crashed
with \`BadMapError\` on \`Map.get(nil, "transactions", nil)\`. Because the
fetcher is \`restart: :permanent\`, each crash exhausted the supervisor's
restart intensity and brought down the \`indexer\` application + BEAM VM,
producing a K8s crashloop against Signet's sidecar RPC.
- Add a \`%{id: _, result: nil}\` match clause that skips without
crashing.
- Reconcile requested vs. returned block numbers in the caller and
flag the missing ones with \`Block.set_refetch_needed/1\` so
\`consensus_blocks_with_nil_is_empty_query\` stops re-selecting them
every cycle.
- Regression test stubs a nil batch response and uses
\`wait_for_results\` to assert \`refetch_needed == true\`; on the
un-fixed code the GenServer crashes and the assertion times out.
Merged equivalent of master PR #19 onto signet-main. Preserves the
existing defensive \`Map.get(block, "transactions") || []\` guard from
this branch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rymcol
approved these changes
Apr 17, 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.
Summary
Merge resolution notes
`signet-main` already had a defensive `Map.get(block, "transactions") || []` + `block_fields/2` signature for the case where `block` is a map but the `transactions` field is missing. That handles a different edge case than `result: nil`, so both guards are preserved in this patch.
Why this branch, not master
Master PR #19 was merged, but the daily `sync-upstream.yml` will `git reset --hard upstream/master` on init4tech/master and wipe that merge. `signet-main` is the deploy branch that actually triggers `publish-init4-docker.yml`, so the fix has to land here.
Test plan
🤖 Generated with Claude Code