@@ -1071,10 +1071,12 @@ contract ExtendedJurisdiction is Ownable, Pausable, AttributeRegistryInterface,
10711071
10721072 /**
10731073 * @notice Check if an attribute of the type with ID `attributeTypeID` has
1074- * been assigned to the account at `account` and is still valid.
1074+ * been assigned to the account at `account` and is currently valid.
10751075 * @param account address The account to check for a valid attribute.
10761076 * @param attributeTypeID uint256 The ID of the attribute type to check for.
10771077 * @return True if the attribute is assigned and valid, false otherwise.
1078+ * @dev This function MUST return either true or false - i.e. calling this
1079+ * function MUST NOT cause the caller to revert.
10781080 */
10791081 function hasAttribute (
10801082 address account ,
@@ -1103,6 +1105,9 @@ contract ExtendedJurisdiction is Ownable, Pausable, AttributeRegistryInterface,
11031105 * @param account address The account to check for the given attribute value.
11041106 * @param attributeTypeID uint256 The ID of the attribute type to check for.
11051107 * @return The attribute value if the attribute is valid, reverts otherwise.
1108+ * @dev This function MUST revert if a directly preceding or subsequent
1109+ * function call to `hasAttribute` with identical `account` and
1110+ * `attributeTypeID` parameters would return false.
11061111 */
11071112 function getAttributeValue (
11081113 address account ,
@@ -1247,8 +1252,10 @@ contract ExtendedJurisdiction is Ownable, Pausable, AttributeRegistryInterface,
12471252 }
12481253
12491254 /**
1250- * @notice Count the number of attribute types defined by the jurisdiction .
1255+ * @notice Count the number of attribute types defined by the registry .
12511256 * @return The number of available attribute types.
1257+ * @dev This function MUST return a positive integer value - i.e. calling
1258+ * this function MUST NOT cause the caller to revert.
12521259 */
12531260 function countAttributeTypes () external view returns (uint256 ) {
12541261 return _attributeIDs.length ;
@@ -1258,8 +1265,17 @@ contract ExtendedJurisdiction is Ownable, Pausable, AttributeRegistryInterface,
12581265 * @notice Get the ID of the attribute type at index `index`.
12591266 * @param index uint256 The index of the attribute type in question.
12601267 * @return The ID of the attribute type.
1268+ * @dev This function MUST revert if the provided `index` value falls outside
1269+ * of the range of the value returned from a directly preceding or subsequent
1270+ * function call to `countAttributeTypes`. It MUST NOT revert if the provided
1271+ * `index` value falls inside said range.
12611272 */
12621273 function getAttributeTypeID (uint256 index ) external view returns (uint256 ) {
1274+ require (
1275+ index < _attributeIDs.length ,
1276+ "provided index is outside of the range of defined attribute type IDs "
1277+ );
1278+
12631279 return _attributeIDs[index];
12641280 }
12651281
0 commit comments