Skip to content

Conversation

@macfarla
Copy link
Contributor

Signed-off-by: Sally MacFarlane [email protected]

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?

@macfarla macfarla added RPC hive relating to hive tests labels Oct 14, 2025
Signed-off-by: Sally MacFarlane <[email protected]>
@macfarla macfarla marked this pull request as draft October 14, 2025 07:01
@macfarla
Copy link
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
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 <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
@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

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
jframe
jframe previously approved these changes Nov 11, 2025
} else if (blockParameterOrBlockHash.isNumeric() || blockParameterOrBlockHash.isEarliest()) {
final OptionalLong blockNumber = blockParameterOrBlockHash.getNumber();
if (blockNumber.isEmpty() || blockNumber.getAsLong() < 0) {
// TODO should this be null result or invalid params?
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still not clear on this either even after going through #9197. Looks like some clients return an error and some a null response. Think we should just leave this as is returning an error until we know otherwise.

@macfarla macfarla assigned macfarla and unassigned jframe Nov 11, 2025
Signed-off-by: Sally MacFarlane <[email protected]>
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

3 participants