ChainSafe / ChainSafe/forest

Filecoin V2 APIs

Open
#5,636 0 comments 0 reactions 0 assignees View on GitHub
Type: Epic
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

# Summary

The V2 API introduces ergonomic improvements related to the recent addition of F3:

For detailed documentation and motivation, refer to the following document:

https://www.notion.so/filecoindev/Filecoin-V2-APIs-1d0dc41950c1808b914de5966d501658#1e4dc41950c180498371f45fd6e6eb91

In general, the API methods remain mostly similar to those in the V1 API. The main differences involve how tipsets are resolved and slight changes to method interfaces.

Some methods now accept a new type (`TipSetSelector`), which will require adjustments. One approach could be to introduce a new set of methods for those with updated signatures, but we can keep this decision open for now.

# Tasks

- [ ] Implement a Tipset resolver (baked by the F3 APIs)
- [ ] Implement the "selector" pattern
- [ ] Extend `api compare` test framework to support the V2 APIs

# List of V2 methods to support

- Chain
- [x] ChainGetTipSet

- EthBasic
- [x] EthChainId
- [x] EthProtocolVersion
- [x] EthSyncing
- [x] EthAccounts
- [x] Web3ClientVersion
- [x] NetListening
- [x] NetVersion

- EthSend
- [x] EthSendRawTransaction
- [ ] EthSendRawTransactionUntrusted

- EthTransaction
- [x] EthBlockNumber

- [ ] EthGetBlockTransactionCountByNumber
- [ ] EthGetBlockTransactionCountByHash
- [x] EthGetBlockByHash
- [ ] EthGetBlockByNumber

- [x] EthGetTransactionByHash
- [x] EthGetTransactionByHashLimited
- [x] EthGetTransactionByBlockHashAndIndex
- [ ] EthGetTransactionByBlockNumberAndIndex

- [x] EthGetMessageCidByTransactionHash
- [x] EthGetTransactionHashByCid
- [ ] EthGetTransactionCount

- [x] EthGetTransactionReceipt
- [x] EthGetTransactionReceiptLimited
- [ ] EthGetBlockReceipts
- [ ] EthGetBlockReceiptsLimited

- EthLookup
- [ ] EthGetCode
- [ ] EthGetStorageAt
- [ ] EthGetBalance

- EthTrace
- [ ] EthTraceBlock
- [ ] EthTraceReplayBlockTransactions
- [x] EthTraceTransaction
- [ ] EthTraceFilter

- EthGas
- [x] EthGasPrice
- [ ] EthFeeHistory
- [x] EthMaxPriorityFeePerGas
- [ ] EthEstimateGas
- [ ] EthCall

- EthEvents
- [ ] EthGetLogs
- [x] EthNewBlockFilter
- [x] EthNewPendingTransactionFilter
- [ ] EthNewFilter
- [x] EthUninstallFilter
- [x] EthGetFilterChanges
- [x] EthGetFilterLogs
- [x] EthSubscribe
- [x] EthUnsubscribe

- Filecoin
- [x] EthAddressToFilecoinAddress
- [ ] FilecoinAddressToEthAddress

- State
- [x] StateGetActor
- [x] StateGetID

# Risks & Dependencies

F3 should work.

# Additional Links & Resources

- [F3 Aware Lotus APIs and what it means for you](https://www.youtube.com/watch?v=CZ_QTWQP3Os)
- https://github.com/filecoin-project/lotus/issues/12990
- https://github.com/filecoin-project/lotus/pull/13003

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.