Skip to content

node/evm: return per-element error in batch poller#4895

Open
peaktwilight wants to merge 1 commit into
wormhole-foundation:mainfrom
peaktwilight:fix/evm-batch-poller-per-element-error
Open

node/evm: return per-element error in batch poller#4895
peaktwilight wants to merge 1 commit into
wormhole-foundation:mainfrom
peaktwilight:fix/evm-batch-poller-per-element-error

Conversation

@peaktwilight

Copy link
Copy Markdown

When a batched eth_getBlockByNumber call succeeds at the transport level but an individual element fails, getBlocks and getBlockRange logged the per-element error but then returned the outer err, which is nil on that path, so a failed block fetch was reported as an empty success instead of an error.

Note: geth records per-element failures on batch[idx].Error; the previously-referenced results[idx].err field is never populated, so the error branch never fired. This fix reads batch[idx].Error at both sites and removes the dead field.

Worst case previously was downstream nil/len handling of the empty result leading to a watcher restart, so this is a correctness cleanup, not a security fix. Adds a table-driven test proving the per-element error now propagates.

When a batched eth_getBlockByNumber call succeeds at the transport level
but an individual element fails, RawBatchCallContext records the failure
on that batch element (batch[idx].Error). getBlocks and getBlockRange
instead inspected results[idx].err, a field that is never populated,
and on a hit returned the outer transport error, which is nil on this
path. A failed block fetch was therefore reported as an empty success
rather than an error.

Read the per-element error from batch[idx].Error and return it so callers
observe the real failure. The unused err field on BatchResult and the
no-op Error assignments that fed it are removed. Worst case previously
was downstream len/nil handling of the empty result leading to a watcher
restart, so this is a correctness cleanup, not a security fix.

Add table-driven coverage for getBlocks and getBlockRange that injects a
per-element error and asserts the error propagates, alongside the
success case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant