It uses relative indices in the maintenance of a dynamic sorted list. For a list of length n, in addition to the absolute indices [0..n-1] indicating the ordering of every values after the list gets sorted, it also arranges a relative index for every value in the list, which can be an arbitrary and unique integer, only to ensure that a value x has a smaller relative index than a value y if x<y. After introducing relative indices, it becomes easier to maintain the ordering of a dynamic sorted list with the help of Dynamic Labelling implemented by some advanced data structures.
In practice, due to the gas limit of the FHE.sol library, it only supports a short sorted list and it is not feasible to build any advanced data structure on FHE.sol. Therefore, in the project the maintenance of the sorted list and relative indices of elements is done in a brute-force manner, in which the whole list gets manually sorted and all the relative indices are recalculated with balanced gaps in case of a congestion of the relative index at the insertion points occurs.
The Fhenix FHE.sol library is still under construction and some unpredicted bugs were also detected during the development and testing of this project. There are two major bugs of the library found.
Besides the bugs, the limitation of the FHE.sol library also restricts the scalability of projects developed on it. For instance, the values capable to be encrypted by FHE.sol are most 32-bit integers, but a dynamic labelling algorithm usually requires a much larger space of relative indices to ensure its robustness and efficiency. Another restriction due to the FHE.sol library is that it has yet supported a universal if-else statement, and a branch statement can only be implemented via a ternary assignment operation.
Tracks Applied (2)
Fhenix
Technologies used
Discussion