diff --git a/src/utils/g/EnumerableSetLib.sol b/src/utils/g/EnumerableSetLib.sol index f5fef1e41..ca417a5f2 100644 --- a/src/utils/g/EnumerableSetLib.sol +++ b/src/utils/g/EnumerableSetLib.sol @@ -282,10 +282,14 @@ library EnumerableSetLib { let p := keccak256(0x00, 0x40) if iszero(sload(p)) { n := shr(1, n) - sstore(add(rootSlot, n), shl(96, value)) + result := 1 sstore(p, add(1, n)) + if iszero(n) { + sstore(rootSlot, or(3, shl(96, value))) + break + } + sstore(add(rootSlot, n), shl(96, value)) sstore(rootSlot, add(2, rootPacked)) - result := 1 break } break