-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: fix GetBlock for null rounds by returning nil #12529
feat: fix GetBlock for null rounds by returning nil #12529
Conversation
@aarshkshah1992 Can you please give this a view |
Can you add something in itests for this? |
6f1be63
to
bbe9f57
Compare
I have reverted back to the original state, I'll make the changes in |
Null rounds essentially gaps in the blockchain where no blocks are successfully mined for a particular epoch. These occur naturally in the protocol with a designed 0.7% probability due to the network's winner selection mechanism, though they can also happen if all Storage Providers who were selected as potential block miners for that epoch fail to produce or publish blocks. During a null round, while no blockchain data is created, the network's epoch clock continues to advance. This creates a gap in the chain's sequence. When a null round occurs, the next successful block will link back to the last valid tipset before the null round, effectively skipping over the empty epoch. This ensures network progression even when block production temporarily fails. And also null rounds differ from empty tipsets in that they don't exist in the chain state at all. Null rounds -> when no block gets mined at a given epoch |
@virajbhartiya Great ! One more question -> given an epoch -> how can determine if it's a null round or not in Lotus ? |
That can be done by Since null rounds don't exist in the chain state, we need to look for gaps in the chain. These gaps can be found by failing to find a tipset at that epoch |
To be able to return null values when a block is a null round - func (a EthModule) EthGetBlockByNumber(ctx context.Context, blkParam string, fullTxInfo bool) (ethtypes.EthBlock, error)
+ func (a EthModule) EthGetBlockByNumber(ctx context.Context, blkParam string, fullTxInfo bool) (*ethtypes.EthBlock, error) which will result in - return newEthBlockFromFilecoinTipSet(ctx, ts, fullTxInfo, a.Chain, a.StateAPI)
+ return &block, nil So the function of the definition of |
@virajbhartiya Yes, we need to change the function signature. Document this in the |
I have updated |
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.
@virajbhartiya Reviewed.
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.
lgtm
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.
@virajbhartiya Last set of comments.
@aarshkshah1992 I have made the changes suggested in you review and modified the tests. |
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.
lgtm
c674554
into
filecoin-project:master
…#12529) * update pb version * docs: update changelog * fix: remove redundant code in sectors.go * feat: Update EthGetBlockByNumber to return pointer to EthBlock * fix TestGetBlockByNumber * fix: Remove unnecessary assertions tests * Update eth_api_test.go * feat: Refactor EthGetBlockByNumber test in fevm_test.go --------- Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
…-project#12529)" This reverts commit 866bc6e.
sorry, reverts aren't fun to have done to you |
Related Issues
fixes #10909
Proposed Changes
fix GetBlock for non-existent blocks by returning
nil
Additional Info
https://github.com/ethereum/go-ethereum
https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_getblockbynumber
Checklist
Before you mark the PR ready for review, please make sure that: