From ceea890abf4737447d872ec7efd8f8b0f19684e7 Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:11:03 -0700 Subject: [PATCH] Verifying committee member --- carnot/carnot-vote-aggregation.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/carnot/carnot-vote-aggregation.py b/carnot/carnot-vote-aggregation.py index ddb9e54..39c232d 100644 --- a/carnot/carnot-vote-aggregation.py +++ b/carnot/carnot-vote-aggregation.py @@ -15,7 +15,7 @@ def int_to_id(i: int) -> Id: class StandardQc: block: Id view_num: View # Changed the variable name to avoid conflict with the class name - root_qc: bool # Determines if the QC is build by the leader and is collection of 2/3+1 votes. + Comm_No: int # This committee position in the set of committees # If it is false then the QC is built by the committees with 2/3 collection of votes from subtree of the collector # committee. @@ -24,6 +24,9 @@ class StandardQc: return self.view_num # Changed the method name to view_num + + + @dataclass class AggregateQc: qcs: List[View] @@ -314,13 +317,17 @@ class Carnot: def approve_block(self, block: Block, votes: Set[Vote]) -> Event: # Assertions for input validation assert block.id() in self.safe_blocks - assert len(votes) == self.overlay.super_majority_threshold(self.id) - assert all(self.overlay.is_member_of_child_committee(self.id, vote.voter) for vote in votes) + # This assertion will be moved outside as the approve_block will be called in two cases: + #1st the fast path when len(votes) == self.overlay.super_majority_threshold(self.id) and the second + #When there is the first timeout t1 for the fast path and the protocol operates in the slower path + # in this case the node will prepare a QC from votes it has received. + # assert len(votes) == self.overlay.super_majority_threshold(self.id) + assert all(self.overlay.is_member_of_my_committee(self.id, vote.voter) for vote in votes) assert all(vote.block == block.id() for vote in votes) assert self.highest_voted_view < block.view # Create a QC based on committee membership - qc = self.build_qc(block.view, block, None) if self.overlay.is_member_of_root_committee(self.id) else None + qc = self.build_qc(block.view, block, None) #if self.overlay.is_member_of_root_committee(self.id) else None # Create a new vote vote = Vote( @@ -341,3 +348,4 @@ class Carnot: # Return a Send event to the appropriate recipient return Send(to=recipient, payload=vote) +