Eth APIs should (mostly?) return nil
when block or transaction not found
#13043
Labels
nil
when block or transaction not found
#13043
Related to #12999, but there's more. I've done a partial fix in #13026 where I'm deciding not to fully fix this but to defer it to a separate issue because the breakage is a bit large.
go-ethereum seems to mostly be happy returning
nil
whenever you ask for something that doesn't exist. In fact, the pattern it uses a lot in internal/ethapi/api.go is:if thing != nil && err == nil { return thing } return nil, err
. That means two things for us:ipld.IsNotFound
but also cases where the block number is beyond the heaviest epoch).nil
Some of the empty types we return are pretty large and when they go through JSON encoding they end up looking like they might be a thing you requested, just with values zeroed. Such as
EthBlock
.These are the current APIs that can't return
nil
that may need to. Investigation is needed into exactly which APIs (more than just these) should returnnil
but the place to start is all of the transaction and block lookup APIs (mainly in transaction.go).The text was updated successfully, but these errors were encountered: