Skip to content

Add storage key registry to prevent key collision across contract versions #312

Description

@Kingsman-99

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsstorageStorage layout and TTL optimisation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions