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

[reconfig] Tolerate redundant committee insert #6926

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Dec 19, 2022

We could be inserting the same committee several times from different sources, e.g. from state sync and from reconfiguration flow. This should be ok.

@vercel
Copy link

vercel bot commented Dec 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
explorer-storybook ⬜️ Ignored (Inspect) Dec 19, 2022 at 11:18PM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Dec 19, 2022 at 11:18PM (UTC)

);
if let Some(old_committee) = self.get_committee(&new_committee.epoch)? {
// If somehow we already have this committee in the store, they must be the same.
assert_eq!(&old_committee, new_committee);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we return from the function after this assert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an assert, which would panic?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean do we still need the insert below if the existing committee in the db is same as what we are going to insert again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When this happens, we probably have a fork. So it probably doesn't matte which committee we keep for this epoch.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @sadhansood is referring to a fact that if we did have a committee and it does match current value, we could have a separate branch for this case and just skip call to insert(which will save some serialization/io).

@lxfind lxfind enabled auto-merge (squash) December 19, 2022 23:31
@lxfind lxfind merged commit cd84c8f into main Dec 19, 2022
@lxfind lxfind deleted the reconfig-insert-committee-no-assert branch December 19, 2022 23:37
lxfind added a commit that referenced this pull request Dec 20, 2022
lxfind added a commit that referenced this pull request Dec 20, 2022
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.

3 participants