📌 Description
commitment_core::get_commitments_created_between (line ~735) answers time-range
analytics queries by scanning the DataKey::AllCommitmentIds vector, which grows
unbounded with every create_commitment. As the protocol scales, this linear scan
plus per-id storage reads becomes a costly, potentially limit-exceeding operation.
This issue introduces a time-bucketed index so range queries are bounded.
🎯 Requirements and Context
- Maintain a time-bucketed index (e.g. per-day buckets of commitment IDs) updated on
create_commitment.
get_commitments_created_between must read only the relevant buckets, not the global list.
- Results must be identical to the current full-scan implementation (add an equivalence test).
- Index writes must not regress
create_commitment correctness or its reentrancy/fee paths.
🛠️ Suggested Execution
1. Fork the repo and create a branch
git checkout -b perf/core-time-bucket-index
2. Implement changes
- Add the bucketed index key and update
create_commitment + get_commitments_created_between in contracts/commitment_core/src/lib.rs with /// docs.
- Record before/after costs in
benchmarks/.
3. Test and commit
- Extend
contracts/commitment_core/src/tests.rs and benchmarks.rs.
- Run:
cargo test --target wasm32v1-none --release
- Edge cases: empty range, single-bucket range, multi-bucket range, boundary timestamps, equivalence vs full scan.
Example commit message
perf: time-bucketed index for commitment range queries
✅ Guidelines
- Minimum 95% test coverage on the indexed paths.
- Document the equivalence guarantee and measured savings.
- Timeframe: 96 hours.
🏷️ Labels
type-performance · area-contracts · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN
💬 Community & Support
- Join the CommitLabs contributor Discord to coordinate and get unblocked fast: https://discord.gg/WV7tdYkJk
- Introduce yourself before starting to avoid duplicate work.
- Maintainers triage actively and review fast.
📌 Description
commitment_core::get_commitments_created_between(line ~735) answers time-rangeanalytics queries by scanning the
DataKey::AllCommitmentIdsvector, which growsunbounded with every
create_commitment. As the protocol scales, this linear scanplus per-id storage reads becomes a costly, potentially limit-exceeding operation.
This issue introduces a time-bucketed index so range queries are bounded.
🎯 Requirements and Context
create_commitment.get_commitments_created_betweenmust read only the relevant buckets, not the global list.create_commitmentcorrectness or its reentrancy/fee paths.🛠️ Suggested Execution
1. Fork the repo and create a branch
2. Implement changes
create_commitment+get_commitments_created_betweenincontracts/commitment_core/src/lib.rswith///docs.benchmarks/.3. Test and commit
contracts/commitment_core/src/tests.rsandbenchmarks.rs.cargo test --target wasm32v1-none --releaseExample commit message
✅ Guidelines
🏷️ Labels
type-performance·area-contracts·MAYBE REWARDED·GRANTFOX OSS·OFFICIAL CAMPAIGN💬 Community & Support