Skip to content
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

Fix BlockNumberOrHash usage #5125

Open
elmattic opened this issue Jan 10, 2025 · 0 comments
Open

Fix BlockNumberOrHash usage #5125

elmattic opened this issue Jan 10, 2025 · 0 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@elmattic
Copy link
Contributor

elmattic commented Jan 10, 2025

Describe the bug

getTipsetByEthBlockNumberOrHash is a function in Lotus used to retrieve a tipset. It accepts predefined strings such as "pending" or "latest". However, using "earliest" will result in an error.

This function is utilized in several Ethereum endpoints:

  • EthGetTransactionCount
  • EthGetBlockReceiptsLimited
  • EthGetCode
  • EthGetStorageAt
  • EthGetBalance
  • EthEstimateGas
  • EthCall

In Forest, a similar function exists called tipset_by_block_number_or_hash. The key difference is that Forest also supports additional predefined strings such as "safe" and "finalized".

This function is used by:

  • EthGetTransactionCount
  • EthGetCode
  • EthGetStorageAt
  • EthGetBalance
  • EthEstimateGas
  • EthCall

And

  • EthFeeHistory
  • EthGetBlockByHash
  • EthGetBlockByNumber
  • EthGetTransactionByBlockNumberAndIndex
  • EthTraceBlock

For the second list of functions, support for "safe" and "finalized" might be required. However, Forest is likely to diverge from Lotus in the first list.

To address these differences, we should:

  1. Use clear types: Split the Predefined type into subtypes where necessary. For instance, functions like EthGetBlockByNumber should only accept the required subtype (e.g., a hexadecimal block number).

  2. Expand API coverage: Ensure the API supports all possible values for predefined strings, including both accepted and rejected values, to improve robustness and compliance with the specification. This is especially important for defining a Common Node API and an OpenRPC specification.

Environment (please complete the following information):

  • OS:
  • Branch/commit
  • Hardware

Other information and links

@elmattic elmattic added the Type: Bug Something isn't working label Jan 10, 2025
@LesnyRumcajs LesnyRumcajs moved this from New to Ready in Forest Backlog 🌲 Jan 16, 2025
@sudo-shashank sudo-shashank self-assigned this Jan 17, 2025
@sudo-shashank sudo-shashank moved this from Ready to In progress in Forest Backlog 🌲 Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
Status: In progress
Development

No branches or pull requests

2 participants