From 475f821a30c94320679b55b956f18eb3cd056564 Mon Sep 17 00:00:00 2001 From: Mauro Piazza Date: Fri, 24 Nov 2023 12:51:41 +0100 Subject: [PATCH] chore(RegistrationManager): remove not needed for loop + improve comment --- contracts/core/RegistrationManager.sol | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/contracts/core/RegistrationManager.sol b/contracts/core/RegistrationManager.sol index 88f17d3..de2a37e 100644 --- a/contracts/core/RegistrationManager.sol +++ b/contracts/core/RegistrationManager.sol @@ -521,15 +521,10 @@ contract RegistrationManager is IRegistrationManager, Initializable, UUPSUpgrade uint16 startEpoch = currentEpoch + 1; uint16 endEpoch = startEpoch + numberOfEpochs - 1; - // NOTE: reset _epochsTotalNumberOfGuardians if the guardian was already registered and if the current epoch is less than the - // epoch in which the current registration ends. + // NOTE: don't consider the epochs where the Guardian is + // registered already, but start from the new added ones if (currentRegistration.owner != address(0) && currentEpoch < currentRegistrationEndEpoch) { - for (uint16 epoch = startEpoch; epoch <= currentRegistrationEndEpoch; ) { - unchecked { - --_epochsTotalNumberOfGuardians[epoch]; - ++epoch; - } - } + startEpoch = currentRegistrationEndEpoch; } _ownersGuardian[owner] = guardian;