Skip to content

Improve InitStorageData structure for better usability #1860

@partylikeits1983

Description

@partylikeits1983

Problem

The current InitStorageData uses BTreeMap<StorageValueName, String> which has limitations:

  • All values are strings, requiring parsing during reconciliation
  • Keys are generic placeholder names rather than typed storage slot references

Proposed Improvements

1. Structured Values

Support direct Word/Map values instead of string-only:

// Current
InitStorageData::new([("balance", "1000".to_string())])

// Proposed  
InitStorageData::new([("balance", StorageValue::Word(Word::from(1000)))])

Benefits: Type safety, reduced parsing overhead, better error messages

2. Named Storage Slot Keys

Once named storage slots are available, support slot names as keys:

// Instead of generic strings
"some_placeholder" -> "value"

// Use typed storage slot names
StorageSlotName::Balance -> StorageValue::Word(balance)

Benefits: Type-safe references & compile-time validation

Context: #1802 (review)

Metadata

Metadata

Assignees

Labels

rustIssues that affect or pull requests that update Rust code

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions