-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(eth): update Ethereum API methods to return pointers for consistent nil handling #13150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(eth): update Ethereum API methods to return pointers for consistent nil handling #13150
Conversation
…dling - addresses issue 13043 (partial)
Hey @rvagg
Just wanted to check if this is heading in the right direction before I continue with |
@virajbhartiya Please review the failing CI workflows. Looks like we are missing a |
…turn pointers for nil handling
Hey @masih , I've fixed the |
At the very least, some CI workflows are failing because of the changes made in this PR. I would:
Make sure tests pass locally before investigating any further false negative CI workflow failures. |
…dereference pointers for correct comparisons
@virajbhartiya : there were some itest fixes that checked into master. Can you update your fork to pull those in? I tried rerunning the failed jobs, but I'm still seeing a couple that I believe have been fixed. |
@virajbhartiya : it looks like there are a couple of tests consistently failing even after you updated from filecoin-project:master: https://github.com/filecoin-project/lotus/actions/runs/15552300377/job/44641706836?pr=13150 Are you able to look into this? |
Sorry for the delay in getting to look at this. It's looking fairly good @virajbhartiya. I think the next steps before landing this would be:
|
Hi @virajbhartiya. I know this has been open for a bit and maintainers were delayed in responding. Did you see #13150 (comment) ? |
…ve error handling in tipset resolver
…story and EthEstimateGas
… returning nil or an error if the requested block height does not match the current height.
@virajbhartiya : I looked into this and couldn't figure it out (but also no surprise since I'm no expert here). I think we'll need @rvagg eyes. |
@virajbhartiya the failing test is fevm_test, run |
…l rounds in EthFeeHistory and EthEstimateGas
@rvagg tests are passing now |
In the original issue I suggested you'd need to do a bit of digging in go-ethereum to confirm which should and shouldn't be able to return
So @virajbhartiya would you mind backing out the eth_estimateGas and eth_feeHistory changes from here please? Sorry for taking so long. |
…le nil cases in gateway/proxy_eth_v1.go and gateway/proxy_v2.go. Update tests in itests/eth_api_f3_test.go and itests/eth_fee_history_test.go to reflect changes in return types. Adjust gas.go to return pointers for EthFeeHistory and EthEstimateGas results.
… improved accuracy in gas limit overestimation checks.
@virajbhartiya : please re-request review when you're ready for this to be checked over. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates several Ethereum API methods to return pointers instead of values, enabling proper nil handling when blocks or transactions are not found. The changes align with go-ethereum patterns where "not found" scenarios return (nil, nil) rather than zero values with errors. Key changes include updating method signatures, error handling patterns, and comprehensive test updates.
- Updated method signatures to return pointers for better nil handling
- Implemented go-ethereum compatible error handling patterns
- Enhanced fallback error handling in tipset resolver
- Updated all tests to handle pointer return types
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
node/impl/eth/transaction.go | Core methods updated to return pointers with proper nil handling for not-found scenarios |
node/impl/eth/gas.go | Gas estimation and fee history methods updated with pointer returns and fallback error handling |
node/impl/eth/lookup.go | Balance lookup method updated to return pointer with proper error handling |
node/impl/eth/tipsetresolver.go | Enhanced error handling with fallback to EC safe/finalized tipsets |
node/impl/eth/api.go | Interface definitions updated to match new pointer return types |
gateway/proxy_*.go | Proxy methods updated to handle both pointer and value returns |
itests/*.go | All integration tests updated to dereference pointer returns |
api/v2api/*.go | Generated API stubs and mocks updated for new signatures |
build/openrpc/*.json | OpenRPC specifications updated to reflect pointer return types |
Also @virajbhartiya : please review the @copilot review as well and then re-request review when ready. |
@BigLep Yes I'll work on those |
@rvagg |
This PR partially addresses issue #13043 by updating several Ethereum API methods to return pointers instead of values, enabling proper nil handling when blocks or transactions are not found. This change aligns with go-ethereum patterns and improves error handling for not found scenarios. Methods updated: EthGetBalance, EthGetBlockByHash, EthGetBlockByNumber, EthGetBlockTransactionCountByHash, EthGetBlockTransactionCountByNumber, EthGetTransactionCount, and EthFeeHistory. Note: This is a partial implementation - additional methods will be addressed in follow-up PRs.