Overview
Storage keys are currently defined ad-hoc as string literals scattered across the codebase. Centralise them in a key registry to prevent collisions and make key migration between contract versions explicit.
Acceptance Criteria
StorageKey enum covers all persistent, instance, and temporary storage keys used by the contract
- All
env.storage() calls use StorageKey variants — no raw string literals remaining
- Key variants namespaced:
StorageKey::Invoice(u64), StorageKey::Config, StorageKey::Counter, etc.
STORAGE_KEY_REGISTRY.md documents every key, its type, its TTL, and which contract version introduced it
- Migration utility function:
migrate_key(old_key, new_key) for use in upgrade procedures
- No two
StorageKey variants serialize to the same XDR value (verified by test)
- Unit tests assert key uniqueness across all variants
Overview
Storage keys are currently defined ad-hoc as string literals scattered across the codebase. Centralise them in a key registry to prevent collisions and make key migration between contract versions explicit.
Acceptance Criteria
StorageKeyenum covers all persistent, instance, and temporary storage keys used by the contractenv.storage()calls useStorageKeyvariants — no raw string literals remainingStorageKey::Invoice(u64),StorageKey::Config,StorageKey::Counter, etc.STORAGE_KEY_REGISTRY.mddocuments every key, its type, its TTL, and which contract version introduced itmigrate_key(old_key, new_key)for use in upgrade proceduresStorageKeyvariants serialize to the same XDR value (verified by test)