arkavo-org / arkavo-org/arkavo-node

Optimize AttributeStore Storage Keys

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Overview
Optimize attribute storage keys to reduce gas costs and prevent storage bloat.

## Background
Currently, `attribute_store` uses string-based keys: `Mapping<(AccountId, String, String), String>`. Strings vary in length, making gas costs unpredictable.

## Proposed Solutions
1. **Hash-based keys**: Use Blake2x256 to hash namespace and key into fixed-size [u8; 32]
2. **String length limits**: Enforce maximum string lengths (currently implemented: 256 bytes)
3. **Namespace IDs**: Use u32 IDs for common namespaces instead of strings

## Tasks
- [ ] Analyze storage patterns and common namespaces
- [ ] Design optimized storage schema
- [ ] Implement migration strategy
- [ ] Add backwards compatibility layer
- [ ] Measure gas savings
- [ ] Update documentation

## Related
- Code review recommendation #2
- Current TODO comment in attribute_store/lib.rs

## Priority
MEDIUM - Performance optimization

## Estimated Effort
2-3 days

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with attribute_store/lib.rs and the TODO comment referenced in the issue. Analyze current storage patterns and common namespaces before comparing the proposed key approaches. Done means an agreed schema, migration and compatibility strategy, measured gas savings, and updated documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.