rollmint icon indicating copy to clipboard operation
rollmint copied to clipboard

Store Space Efficiency

Open oxnr opened this issue 1 year ago • 0 comments

Finding 030 - Store Space Efficiency

ID 030
Finding Store Space Efficiency
Severity 0 - Informational
Description Store could favor storing information using uint64 (height) as key, and using the hash->height as a reverse index.This would yield lower key sizes, in fact:Storing uint64 as string:- best case: 1 byte- worst case: 20 byte (for 2^64-1)Storing hash (hex(sha256)):- constant 64bytes
Recommendation Depends on access patterns. But consider refactoring storage of blocks and commits to use height as the primary key, and then retain an index (hash->height) to do the reverse mapping.
Code References https://github.com/rollkit/rollkit/blob/eccdd0f1793a5ac532011ef4d896de9e0d8bcb9d/store/store.go#L212

oxnr avatar Jan 17 '24 22:01 oxnr