From 73a421cc733c01fb95e371fc4448d4502c6d06ae Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Sun, 17 Sep 2023 11:42:17 -0700 Subject: [PATCH] Data classes --- carnot/carnot-vote-aggregation.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/carnot/carnot-vote-aggregation.py b/carnot/carnot-vote-aggregation.py index cd12f1e..87fb675 100644 --- a/carnot/carnot-vote-aggregation.py +++ b/carnot/carnot-vote-aggregation.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Union, List, Set, Optional, Type +from typing import Union, List, Set, Optional, Type, TypeAlias from abc import ABC, abstractmethod Id = bytes @@ -84,8 +84,22 @@ class TimeoutQc: sender_ids: Set[Id] sender: Id + class Timeout: view: View high_qc: Qc sender: Id - timeout_qc: Type[TimeoutQc] \ No newline at end of file + timeout_qc: Type[TimeoutQc] + + +@dataclass +class NewView: + view: View + high_qc: Qc + sender: Id + timeout_qc: Type[TimeoutQc] + + +Quorum: TypeAlias = Union[Set[Vote], Set[NewView]] + +Payload: TypeAlias = Union [Block, Vote, Timeout, NewView, TimeoutQc]