Skip to content

Commit

Permalink
Merge pull request #241 from Layr-Labs/avs-unstable
Browse files Browse the repository at this point in the history
make totalOperatorsForQuorum work in the empty case
  • Loading branch information
gpsanant authored Oct 13, 2023
2 parents 1be4928 + dd27549 commit 94cf0f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/contracts/middleware/IndexRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ contract IndexRegistry is IndexRegistryStorage {

/// @notice Returns the total number of operators for a given `quorumNumber`
function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32){
return _totalOperatorsHistory[quorumNumber][_totalOperatorsHistory[quorumNumber].length - 1].index;
uint256 totalOperatorsHistoryLength = _totalOperatorsHistory[quorumNumber].length;
if (totalOperatorsHistoryLength == 0) {
return 0;
}
return _totalOperatorsHistory[quorumNumber][totalOperatorsHistoryLength - 1].index;
}

/**
Expand Down

0 comments on commit 94cf0f6

Please sign in to comment.