Skip to content

Storage Compaction Pass#601

Closed
oyinade247 wants to merge 1 commit into
Pulsefy:mainfrom
oyinade247:Storage-Compaction-Pass
Closed

Storage Compaction Pass#601
oyinade247 wants to merge 1 commit into
Pulsefy:mainfrom
oyinade247:Storage-Compaction-Pass

Conversation

@oyinade247

Copy link
Copy Markdown

Closes #567

File locations

File Monorepo path
Contract source app/contract/src/lib.rs
Cargo manifest app/contract/Cargo.toml
Integration & regression tests app/contract/tests/integration.rs
Criterion benchmarks app/contract/benches/storage_bench.rs
Audit document app/contract/STORAGE_COMPACTION.md

The two compile-time structural tests are the key regression guards: they make it impossible to accidentally re-introduce the redundant fields without a visible, intentional change.


Semantic invariants preserved

  • A username can only be claimed once βœ“
  • link_count is monotonically increasing and equals the next link_id βœ“
  • PaymentLink::creator matches UserRecord::owner at creation time βœ“
  • REVOKED flag is OR-ed in; no other flags are cleared βœ“
  • total_received accumulates correctly across multiple payments βœ“
  • total_links (global) matches sum of all per-user link_count values βœ“

Migration note

This is a breaking storage schema change. Existing testnet data encoded under the old String-keyed schema is not readable by the new contract. A fresh deploy to testnet is sufficient β€” no migration invocation is needed.

Mainnet is unaffected: X-Ray / ZK functionality went live on 22 Jan 2026 under the new schema, so no user data exists under the old one.


Checklist

  • Audit completed β€” all storage records reviewed for redundancy
  • DataKey variants compacted (String β†’ Symbol, sequence number inlined)
  • UserRecord compacted (username dropped, link_count narrowed)
  • PaymentLink compacted (username dropped, asset promoted to Symbol, booleans bitpacked)
  • Benchmarks added with before/after numbers documented
  • Regression tests cover all semantic behaviour
  • Compile-time structural guards prevent re-introduction of dropped fields
  • STORAGE_COMPACTION.md audit document committed alongside code
  • No breaking change to contract public API (function signatures unchanged)

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@oyinade247 Great news! πŸŽ‰ Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! πŸš€

Learn more about application limits

@Cedarich

Copy link
Copy Markdown
Contributor

@oyinade247 fix ci

@Cedarich Cedarich closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SC-W6-06: Storage Compaction Pass

2 participants