Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store Space Efficiency #1494

Open
oxnr opened this issue Jan 17, 2024 · 0 comments
Open

Store Space Efficiency #1494

oxnr opened this issue Jan 17, 2024 · 0 comments
Labels
bb-audit-issue P:nice-to-have Priority: Nice-To-Have T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@oxnr
Copy link

oxnr commented Jan 17, 2024

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
func getBlockKey(hash types.Hash) string {
@Manav-Aggarwal Manav-Aggarwal added bb-audit-issue T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. P:nice-to-have Priority: Nice-To-Have and removed needs-triage labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb-audit-issue P:nice-to-have Priority: Nice-To-Have T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
Status: No status
Development

No branches or pull requests

2 participants