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

getBlock return an Error #10909

Closed
5 of 11 tasks
amncjf opened this issue May 23, 2023 · 4 comments · Fixed by #12529
Closed
5 of 11 tasks

getBlock return an Error #10909

amncjf opened this issue May 23, 2023 · 4 comments · Fixed by #12529
Assignees
Labels

Comments

@amncjf
Copy link

amncjf commented May 23, 2023

Checklist

  • This is not a security-related bug/issue. If it is, please follow please follow the security policy.
  • I have searched on the issue tracker and the lotus forum, and there is no existing related issue or discussion.
  • I am running the Latest release, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • I did not make any code changes to lotus.

Lotus component

  • lotus daemon - chain sync
  • lotus fvm/fevm - Lotus FVM and FEVM interactions
  • lotus miner/worker - sealing
  • lotus miner - proving(WindowPoSt/WinningPoSt)
  • lotus JSON-RPC API
  • lotus message management (mpool)
  • Other

Lotus Version

All versions

Repro Steps

  1. curl --data '{"jsonrpc": "2.0", "id":1, "method": "eth_getBlockByNumber", "params": ["0x47C87",true] }' -H 'Content-Type:application/json' https://api.node.glif.io/rpc/v1

Describe the Bug

I in https://api.hyperspace.node.glif.io/rpc/v1 call getBlock (294023) interface, return an Error: Error: requested epoch was a null round, Recommended return:
{
...prevBlock,
parentHash: prevBlock.hash,
blockNumber: prevBlock.blockNumber+1,
}

Logging Information

N/A
@maciejwitowski
Copy link
Contributor

maciejwitowski commented May 23, 2023

Can you elaborate on the benefits of the recommended response?

I'm afraid that returning info about the previous block wouldn't be clear enough for the users so it's better to return explicit error.

@amncjf
Copy link
Author

amncjf commented May 24, 2023

There will be no such errors in Ethereum. Most software and libraries are developed according to this setting, such as ethers, web3js, graph_node..., and they are also used to this setting when calling ethereum rpc.
If you follow the current practice of filecoin, these The software needs to be modified. Returning an exception just obviously gives us the information that filecoin is empty. Most of the time we don’t need this information.
If we return
{
...prevBlock,
parentHash: prevBlock.hash,
blockNumber: prevBlock. blockNumber+1,
}
We can also judge whether a block is a filecoin empty block (hash == parentHash)
Thanks!

@aarshkshah1992
Copy link
Contributor

@virajbhartiya

Want to take this one ?
Note that this API now supports returning "null" responses if no such block exists and so we should change the signature of the RPC methods accordingly and simply return a "null" value if the requested epoch is a null round.

See https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getblockbynumber and the implementation in go-ethereum.

@virajbhartiya
Copy link
Member

@aarshkshah1992 Yes I would like to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ☑️ Done (Archive)
Development

Successfully merging a pull request may close this issue.

5 participants