You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling eth_getLogs with fromBlock or toBlock greater than the node's chain head, a response is returned. However, this seems semantically inaccurate because the execution client (EC) does not have all the blocks specified in the request to provide a complete answer.
Imagine a eth_getLogs request between fromBlock=50 and toBlock=150 and EC head is at block 100, the returned response may suffer from:
incompleteness: 50 blocks are missing to provide a complete response until block 150.
inconsistency: the same request may yield different responses. If logs are emitted after block 100, the same request will yield different results depending on when in time the EC handles the request. The same request should yield the same results (except when reorgs happen). Also, this is not in line with other methods that use specific block numbers, e.g eth_getStorageAt returns error block does not exist, Geth "error":{"code":-32000,"message":"header not found"}, Besu "error":{"code":-32000,"message":"Block not found"}.
Furthermore, the response does not have enough information to allow the API client to easily infer whether the response may be invalid/incomplete and needs to be retried later. It would be easy to identify if the response had EC's current head block number. However, adding an extra field (e.g. lastBlockNumber) would require breaking backward compatibility and significant changes in all the tooling.
Proposed Solution
Return an error "error":{"code":-32000,"message":"Block not found"} when the specified fromBlock or toBlock are greater than EC chain head block.
Expected Behaviour
Imagine the EC chain head is at block 300. eth_getLogs should behave as
fromBlock
toBlock
expected response
earliest
latest
result - keep current behaviour
200
latest
result - keep current behaviour
301
latest
error - block not found
200
301
error - block not found
earliest
301
error - block not found
The text was updated successfully, but these errors were encountered:
Description
When calling
eth_getLogs
withfromBlock
ortoBlock
greater than the node's chain head, a response is returned. However, this seems semantically inaccurate because the execution client (EC) does not have all the blocks specified in the request to provide a complete answer.Imagine a
eth_getLogs
request betweenfromBlock=50
andtoBlock=150
and EC head is at block 100, the returned response may suffer from:eth_getStorageAt
returns error block does not exist, Geth"error":{"code":-32000,"message":"header not found"}
, Besu"error":{"code":-32000,"message":"Block not found"}
.Furthermore, the response does not have enough information to allow the API client to easily infer whether the response may be invalid/incomplete and needs to be retried later. It would be easy to identify if the response had EC's current head block number. However, adding an extra field (e.g.
lastBlockNumber
) would require breaking backward compatibility and significant changes in all the tooling.Proposed Solution
Return an error
"error":{"code":-32000,"message":"Block not found"}
when the specifiedfromBlock
ortoBlock
are greater than EC chain head block.Expected Behaviour
Imagine the EC chain head is at block 300.
eth_getLogs
should behave asfromBlock
toBlock
The text was updated successfully, but these errors were encountered: