You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the heap size is changing at each insert, remove, and decrease operation. When it reaches _maxSortedUsers, it is divided by 2. The informal goal is to distribute high liquidity evenly on the branches of the heap, in order to maximize the total liquidity that is in the heap.
One other idea would be distribute the incoming liquidity "randomly" on the last nodes before _maxSortedUsers. This means that the size of the heap would only change up to _maxSortedUsers and then stay the same, potentially saving one SSTORE for each operation. Another potential benefit would be that the introduced randomness would mostly prevent worst case scenarios for the incoming liquidity.
Note that there is no real need for the randomness here to be truly random, and we could use a pseudo-random function instead.
The text was updated successfully, but these errors were encountered:
It has to be implemented ! I started something in #76, but it was far from being ready. I might go back to it when I will have a little bit more bandwidth.
Found by @MathisGD.
Currently the heap size is changing at each
insert
,remove
, anddecrease
operation. When it reaches_maxSortedUsers
, it is divided by 2. The informal goal is to distribute high liquidity evenly on the branches of the heap, in order to maximize the total liquidity that is in the heap.One other idea would be distribute the incoming liquidity "randomly" on the last nodes before
_maxSortedUsers
. This means that the size of the heap would only change up to_maxSortedUsers
and then stay the same, potentially saving oneSSTORE
for each operation. Another potential benefit would be that the introduced randomness would mostly prevent worst case scenarios for the incoming liquidity.Note that there is no real need for the randomness here to be truly random, and we could use a pseudo-random function instead.
The text was updated successfully, but these errors were encountered: