Skip to content

Commit

Permalink
fix: _epochs_to_process is set now
Browse files Browse the repository at this point in the history
  • Loading branch information
vgorkavenko committed Oct 30, 2024
1 parent 8cdfaee commit 54b5f3a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/csm/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class State:

data: defaultdict[ValidatorIndex, AttestationsAccumulator]

_epochs_to_process: tuple[EpochNumber, ...]
_epochs_to_process: set[EpochNumber]
_processed_epochs: set[EpochNumber]

def __init__(self, data: dict[ValidatorIndex, AttestationsAccumulator] | None = None) -> None:
self.data = defaultdict(AttestationsAccumulator, data or {})
self._epochs_to_process = tuple()
self._epochs_to_process = set()
self._processed_epochs = set()

EXTENSION = ".pkl"
Expand Down Expand Up @@ -89,7 +89,7 @@ def buffer(self) -> Path:

def clear(self) -> None:
self.data = defaultdict(AttestationsAccumulator)
self._epochs_to_process = tuple()
self._epochs_to_process.clear()
self._processed_epochs.clear()
assert self.is_empty

Expand All @@ -110,7 +110,7 @@ def migrate(self, l_epoch: EpochNumber, r_epoch: EpochNumber):
self.clear()
break

self._epochs_to_process = tuple(sequence(l_epoch, r_epoch))
self._epochs_to_process = set(sequence(l_epoch, r_epoch))
self.commit()

def validate(self, l_epoch: EpochNumber, r_epoch: EpochNumber) -> None:
Expand All @@ -133,7 +133,7 @@ def is_empty(self) -> bool:
def unprocessed_epochs(self) -> set[EpochNumber]:
if not self._epochs_to_process:
raise ValueError("Epochs to process are not set")
diff = set(self._epochs_to_process) - self._processed_epochs
diff = self._epochs_to_process - self._processed_epochs
return diff

@property
Expand Down

0 comments on commit 54b5f3a

Please sign in to comment.