Skip to content

Precision-Optimized Binary Storage #30

@hman38705

Description

@hman38705

Issue #19:

Developer Goal: Drastically reduce market creation and betting gas costs by minimizing the ledger footprint of the Market and Bet structs.

Technical Context: Ledger storage on Soroban is expensive. Default Rust serialization (XDR) can be verbose. Using bit-packing and Bytes instead of Vec<String> for metadata can save significant costs.

Detailed Requirements:

  1. Metadata Compression: Store the market description and options as a single Bytes object containing a compressed JSON or a custom binary format.
  2. Bit-Packing:
    • Combined MarketStatus (u8), WinningOutcome (u8), and Tier (u8) into a single u32 "Header" field.
    • Pack boolean flags (is_disputed, is_cancelled, has_oracle) into bit-flags (0x01, 0x02, etc.).
  3. Storage Pruning: Implement a "Garbage Collection" function that allows any user to delete Bet data for markets that have been Resolved for more than 180 days, rewarding the caller with a tiny "Clean-up Fee".

Verification Checklist:

  • Comparison of gas costs for create_market before and after optimization. Aim for >20% reduction.
  • git checkout -b features/issue-19-Precision-Optimized Binary Storage
  • Pr Request create your pr against develop branchv

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions