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

Allow nodes to mark tipsets as checkpointed #3680

Merged
merged 8 commits into from Sep 9, 2020
Merged

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Sep 9, 2020

Such tipsets are never forked away

Fixes #3290

// SyncMarkBad marks a blocks as bad, meaning that it won't ever by synced.
// Use with extreme caution.
SyncMarkBad(ctx context.Context, bcid cid.Cid) error

// SyncUnmarkBad unmarks a blocks as bad, making it possible to be validated and synced again.
SyncUnmarkBad(ctx context.Context, bcid cid.Cid) error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A ListBad call would be really nice for complectess / debugging (for a followup PR)

chain/sync.go Outdated
return nil, xerrors.Errorf("failed to retrieve checkpoint tipset: %w", err)
}

if chkTs.Height() > nts.Height() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i would also explicitly check that we're leaving the checkpoint tipset behind for more robustness; ideally comparing heights reflects this but there could be some corner cases (e.g., direct manipulation of chain by plumbing commands) that could be caught with that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we definitely should be checking specific hashes here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potentially bad edge case here is if we mark a block as our checkpoint, but are currently synced to a different chain. This would prevent us from switching to that checkpoint.

Copy link
Contributor

@schomatis schomatis Sep 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potentially bad edge case here is if we mark a block as our checkpoint, but are currently synced to a different chain.

That case is explicitly checked by the syncer when setting a checkpoint (that's why I marked this only as a nit, but still nice to have as an integrity check).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to explicitly check the tipsetkeys we're forking away from

@whyrusleeping As Schomatis said, the potentially bad edge case should never happen, because we only allow you to mark tipsets currently in your heaviest chain as checkpointed -- we said that was okay for v0 of this, can you confirm it's still okay?

(pretty easy to change that, we can simply call SetHead when setting a checkpoint, but it's risky)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arajasek Thats sufficient for a first release of this, I guess the flow would be:
run a checkpoint import, then mark the checkpoint head as your checkpoint.

@arajasek arajasek merged commit 7027992 into master Sep 9, 2020
@arajasek arajasek deleted the asr/checkpoint branch September 9, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement a command to "follow checkpoint"
4 participants