diff --git a/CHANGELOG.md b/CHANGELOG.md index b647cabe1..3b7923b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased * Enumerables: Improve gas cost of removal in `EnumerableSet` and `EnumerableMap`. + * Enumerables: Improve gas cost of lookup in `EnumerableSet` and `EnumerableMap`. ## Unreleased diff --git a/contracts/utils/structs/EnumerableSet.sol b/contracts/utils/structs/EnumerableSet.sol index 0b9903bee..ca1dac159 100644 --- a/contracts/utils/structs/EnumerableSet.sol +++ b/contracts/utils/structs/EnumerableSet.sol @@ -127,7 +127,6 @@ library EnumerableSet { * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { - require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } diff --git a/test/utils/structs/EnumerableSet.behavior.js b/test/utils/structs/EnumerableSet.behavior.js index 985071a27..be3f52a5e 100644 --- a/test/utils/structs/EnumerableSet.behavior.js +++ b/test/utils/structs/EnumerableSet.behavior.js @@ -51,7 +51,7 @@ function shouldBehaveLikeSet (valueA, valueB, valueC) { describe('at', function () { it('reverts when retrieving non-existent elements', async function () { - await expectRevert(this.set.at(0), 'EnumerableSet: index out of bounds'); + await expectRevert.unspecified(this.set.at(0)); }); });