Skip to content

Commit

Permalink
fix: slither fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamAg19 committed May 19, 2022
1 parent 0fdc25e commit dc17069
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion contracts/Core/BondManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ contract BondManager is Initializable, BondStorage, StateManager, Pause, BondMan
databondCollections.push(databonds[i].collectionId);
} else if (databonds[i].active) {
databonds[i].active = false;
// slither-disable-next-line calls-loop
collectionManager.setCollectionStatus(false, databonds[i].collectionId);
}
}
Expand All @@ -262,8 +263,8 @@ contract BondManager is Initializable, BondStorage, StateManager, Pause, BondMan
if (databonds[i].active && databonds[i].bond >= minBond) {
uint256 occurrence = (databonds[i].jobIds.length * depositPerJob) / databonds[i].bond;
if (occurrence == 0) occurrence = 1;
// slither-disable-next-line calls-loop
databonds[i].desiredOccurrence = uint16(occurrence);
// slither-disable-next-line calls-loop
collectionManager.setCollectionOccurrence(databonds[i].collectionId, uint16(occurrence));
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/Core/CollectionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
uint32[] memory medians
) external override onlyRole(COLLECTION_CONFIRMER_ROLE) {
bool toBeUpdated = false;
uint16 _numActiveCollections = numActiveCollections;
for (uint256 i = 0; i < blockIds.length; i++) {
uint16 collectionId = blockIds[i];
collections[collectionId].result = medians[i];
collections[collectionId].epochLastReported = epoch;
if (collections[collectionId].epochLastReported + collections[collectionId].occurrence != epoch + 1) {
// slither-disable-next-line costly-loop
numActiveCollections = numActiveCollections - 1;
_numActiveCollections = _numActiveCollections - 1;
collections[collectionId].active = false;
toBeUpdated = true;
}
Expand All @@ -258,8 +258,7 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
collections[collectionId].epochLastReported + collections[collectionId].occurrence == epoch + 1 &&
!collections[collectionId].active
) {
// slither-disable-next-line costly-loop
numActiveCollections = numActiveCollections + 1;
_numActiveCollections = _numActiveCollections + 1;
collections[collectionId].active = true;
toBeUpdated = true;
}
Expand All @@ -272,6 +271,7 @@ contract CollectionManager is Initializable, CollectionStorage, StateManager, Co
}
updateRegistryEpoch = epoch + 1;
_updateRegistry();
numActiveCollections = _numActiveCollections;
}
}

Expand Down

0 comments on commit dc17069

Please sign in to comment.