perf: optimize Soroban persistent storage keys footprint - #614
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the work. Please fix up the merge conflict and updated the PT. Kindly ensure you offramp with Fundable at https://stellar.fundable.finance/offramp |
Utilitycoder
left a comment
There was a problem hiding this comment.
Please fix up the merge conflict and update your PR. Kindly ensure you offramp with Fundable at https://stellar.fundable.finance/offramp
Utilitycoder
left a comment
There was a problem hiding this comment.
Please fix up the merge conflict and update your PR. Kindly ensure you offramp with Fundable at https://stellar.fundable.finance/offramp
|
Fix your conflicts to get PR merged, and don't forget to use https://stellar.fundable.finance for your offramps |
1 similar comment
|
Fix your conflicts to get PR merged, and don't forget to use https://stellar.fundable.finance for your offramps |
Overview
This PR refactors the persistent storage key structures in the stream registry contract to minimize Soroban ledger footprint and reduce invocation gas fees. It introduces compact key encoding, explicit
require_auth()checks, a dedicatedErrorenum, storage TTL management, and comprehensive Rust unit tests — following Soroban SDK best practices while preserving existing contract behavior.Related Issue
Closes #
Changes
🔑 Storage Key Footprint Optimization
[MODIFY]
contracts/distributor/src/lib.rsSymbol-only persistent storage keys with a compactStorageKeyenum that usesSymbol+u32/u64encoded components to reduce ledger entry footprint.StorageKeyhelpers and removes unnecessary allocations from key generation.require_auth()checks on all mutating and admin functions.Errorenum withUnauthorized,InvalidKey,KeyNotFound, andStorageErrorvariants for precise failure handling.extend_ttlon persistent read/write paths and abump_contract_instancehelper for contract instance storage.[ADD]
#[cfg(test)]unit tests incontracts/distributor/src/lib.rsVerification Results
cargo build --target wasm32-unknown-unknown)cargo test)ErrorenumUnauthorized,InvalidKey,KeyNotFound,StorageErrorvariants addedCloses #506