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

approval-voting: Make importing of duplicate assignment idempotent #6971

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexggh
Copy link
Contributor

@alexggh alexggh commented Dec 20, 2024

Normally, approval-voting wouldn't receive duplicate assignments because approval-distribution makes sure of it, however in the situation where we restart we might receive the same assignment again and since approval-voting already persisted it we will end up inserting it twice in ApprovalEntry.tranches.assignments because that's an array.

Fix this by making sure duplicate assignments are a noop if the validator already had an assignment imported at the same tranche.

Signed-off-by: Alexandru Gheorghe <[email protected]>
@alexggh alexggh requested review from sandreim, ordian and AndreiEres and removed request for sandreim December 20, 2024 10:16
@@ -214,7 +215,14 @@ impl ApprovalEntry {
},
};

self.tranches[idx].assignments.push((validator_index, tick_now));
if !is_duplicate ||
Copy link
Member

Choose a reason for hiding this comment

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

I am not getting the !is_duplicate part. Can you give me your line of reasoning here, that would help I think. Thanks!

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.

2 participants