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(sync): enforce ForkLengthThreshold for synced chain #5182

Merged
merged 1 commit into from
Dec 22, 2020

Conversation

schomatis
Copy link
Contributor

In syncFork, we currently only apply ForkLengthThreshold to the tipsets being fetched for the forked chain (by means of GetBlocks, if we walk back the fork chain without finding a common ancestor syncFork will fail). We do not apply the threshold for our synced chain, that is, the tipsets that would be "walked back" if the fork is selected as our new head.

This fix introduces a variable (forkLengthInHead) to track the tipsets walked back from our synced head to find the common ancestor with the fork. Before we allowed to freely walk back our chain (nts.Parents()) to match the next tipset height in the fork chain being traversed (to perform the common ancestor check).

We left the previous check in place for the fork chain (in the GetBlocks call) to minimize changes at this time, so we will now enforce the threshold on both sides of the fork. It should be later revisited what do we mean exactly by fork length (a term presently missing in the spec).

In theory this is a protocol breaking change but in practice forks in the chain are orders of magnitude smaller than the current limit of 900 enforced here.

@schomatis schomatis added area/chain Area: Chain impact/consensus Impact: Consensus labels Dec 11, 2020
@schomatis schomatis self-assigned this Dec 11, 2020
@schomatis schomatis merged commit 461a3cd into master Dec 22, 2020
@schomatis schomatis deleted the schomatis/fix/sync/enforce-fork-len-head branch December 22, 2020 15:29
bibibong pushed a commit to EpiK-Protocol/go-epik that referenced this pull request Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/chain Area: Chain impact/consensus Impact: Consensus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants