Skip to content

RPC - return null result if requested block not found#9303

Merged
macfarla merged 12 commits intobesu-eth:mainfrom
macfarla:getblockreceipts-return-null
Nov 24, 2025
Merged

RPC - return null result if requested block not found#9303
macfarla merged 12 commits intobesu-eth:mainfrom
macfarla:getblockreceipts-return-null

Conversation

@macfarla
Copy link
Copy Markdown
Contributor

Signed-off-by: Sally MacFarlane macfarla.github@gmail.com

PR description

If block not found, return a Success response with null result, NOT an Error response.

This affects all RPC methods that use AbstractBlockParameterOrBlockHashMethod
including
debug_accountAt, debug_setHead, eth_call, eth_getBlockReceipts, eth_getProof, eth_simulateV1, eth_getBalance, eth_getCode, eth_getStorageAt, eth_getTransactionCount

I've included this as a breaking change in the changelog since it is a change in behavior. However this is what the hive tests expect and it's moving towards being more consistent with other clients.

Fixed Issue(s)

Fixes #9197

Fixes hive tests:

  • eth_getBlockReceipts/get-block-receipts-empty
  • eth_getBlockReceipts/get-block-receipts-future
  • eth_getBlockReceipts/get-block-receipts-not-found

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
@macfarla macfarla added RPC hive relating to hive tests labels Oct 14, 2025
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
@macfarla macfarla marked this pull request as draft October 14, 2025 07:01
@macfarla
Copy link
Copy Markdown
Contributor Author

macfarla commented Oct 14, 2025

draft bc this has unfortunately broken these hive tests:
eth_simulateV1/ethSimulate-empty-with-block-num-set-plus1
eth_simulateV1/ethSimulate-make-call-with-future-block

@macfarla
Copy link
Copy Markdown
Contributor Author

In Besu we have an abstract class AbstractBlockParameterOrBlockHashMethod that is used by several RPCs - so any RPC that gets a block by block number or hash will have the same error handling behavior. Including:
debug_accountAt, debug_setHead, eth_call, eth_getBlockReceipts, eth_getProof, eth_simulateV1, eth_getBalance, eth_getCode, eth_getStorageAt, eth_getTransactionCount

The spec, and the hive tests, are inconsistent with error handling expectations.

return null if block not found
so there’s hive tests for getBlockReceipts
but fixing those broke hive tests for eth_simulate that use a future block. Is it expected that we would want different behavior here or should eth_simulate also return null if the requested block is not found?
this PR fixes 3 hive tests and breaks 2

@macfarla macfarla added the breaking This can only be addressed/merged for a release that allows user-facing changes to be breaking. label Nov 3, 2025
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
@macfarla macfarla marked this pull request as ready for review November 4, 2025 05:41
Copilot AI review requested due to automatic review settings November 4, 2025 05:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jframe jframe self-assigned this Nov 10, 2025
@macfarla macfarla assigned macfarla and unassigned jframe Nov 11, 2025
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
jflo and others added 4 commits November 13, 2025 11:16
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
@macfarla macfarla merged commit 568842c into besu-eth:main Nov 24, 2025
46 checks passed
@macfarla macfarla deleted the getblockreceipts-return-null branch November 28, 2025 01:37
pinges pushed a commit to pinges/besu that referenced this pull request Dec 15, 2025
* null result if block not found

* changelog

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking This can only be addressed/merged for a release that allows user-facing changes to be breaking. hive relating to hive tests RPC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent response of JSON-RPC eth_getBlockReceipts

4 participants