Conversation
|
This is tempting. Lemme marinate. |
|
@0xLightt Are you using this in your project or planning to use this in an upcoming project? |
|
Taste wise, I think this should be Another problem is the audit has concluded, and |
|
I am not using exactly this. It's slightly modified because we only have one instance per contract and don't have any zero addresses or values. So we can skip the whole zero sentinel logic and also just have 3 functions: 'values' and both 'addOrUpdate' and 'remove' functions that return the previous values. I will gladly share it, but it's too tailored to add to solady. Appreciate the naming suggestion! ❤️ It goes without saying, but it's totally up to you. In my opinion, if there is to be an address to uint96 enumerable map it will eventually be optimized to use 1 slot. If the risk or effort isn't worth optimizing it at the moment, then I think that what already exists is more than enough. |
Description
This pull request introduces an optimized version of
EnurableMapLibdesigned for scenarios where both the key and value can fit into a single slot. Currently, it supportsaddresskeys mapped touint96values.If this functionality is deemed useful, I am open to adding more tests and functions to ensure it aligns with the existing
EnurableMapLib. Any input or feedback would be greatly appreciated!It is also possible to add a new entry to prep, allowing for combinations that fit within a single slot.
Checklist
forge fmt?forge test?