Repository navigation
Description
Overview
investment_vault/src/lib.rs:1831-1848:
pub fn get_compliance_events(env: Env, from: u64, to: u64) -> Vec<ComplianceEventData> {
require_current_state(&env);
if from > to {
return Vec::new(&env);
}
let max = if to - from > 100 { from + 100 } else { to };
let mut events_vec = Vec::new(&env);
for seq in from..=max {
...
}
events_vec
}When the requested range exceeds 100 entries, max is set to from + 100, and the loop for seq in from..=max is an inclusive range — it iterates max - from + 1 = 101 values (from, from+1, ..., from+100), not 100. The intended 100-entry cap is off by one.
This is directly caught by the codebase's own regression test, test_get_compliance_events_range_caps_at_100 (investment_vault/src/test.rs), which records 120 compliance events and asserts get_compliance_events(&1, &200).len() == 100. Once the workspace's compile errors are fixed and the suite can actually run, this test fails — not on the length assertion, but earlier: the Soroban test-host's per-invocation ledger-entry-footprint budget (100 entries) is exceeded by the 101st storage read, and the call panics with HostError: Error(Budget, ExceededLimit) ("invocation resource limits are exceeded: total footprint ledger entries: 102 > 100") before the function even returns. So on a real network with a stricter footprint budget, any caller requesting a wide range against a vault with >100 compliance events would have their get_compliance_events call fail outright with a resource-limit error, rather than the graceful 100-item cap the function is documented (and tested) to provide.
Why it matters
- The 100-item cap this function is supposed to provide (per its own test's name and the doc comment above
take_reporting_snapshot/regulatory-reporting context) doesn't actually hold — it silently returns 101 items in a low-footprint test environment, and can outright fail the call once the vault has accumulated enough compliance history, on a real network with default resource limits. - This is a genuine, reproducible bug independent of the several compile errors currently blocking the test suite — once those are fixed, this test fails for its own, distinct reason.
Suggested fix
Either cap with an exclusive range:
let max = if to - from > 100 { from + 99 } else { to };
for seq in from..=max { ... }or keep from + 100 and switch to an exclusive loop bound (from..max_exclusive), whichever reads more clearly. Add an assertion in the existing test on the returned events' actual seq values (e.g. first == 1, last == 100) so a future off-by-one regresses loudly rather than merely tripping a resource-budget panic in CI.
Activity
Isaacayomide28 commentedon Sep 30, 2026
@Isaacayomide28 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Isaacayomide28 to this issue.
Johnsource-hub commentedon Sep 30, 2026
@Johnsource-hub has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Johnsource-hub to this issue.
Joyyyb commentedon Sep 30, 2026
@Joyyyb has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Joyyyb to this issue.
Chris-Alex491 commentedon Sep 30, 2026
@Chris-Alex491 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Chris-Alex491 to this issue.
rhemy-arc commentedon Sep 30, 2026
@rhemy-arc has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @rhemy-arc to this issue.
Vivianndev commentedon Sep 30, 2026
@Vivianndev has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Vivianndev to this issue.
madisonsc52-del commentedon Sep 30, 2026
@madisonsc52-del has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @madisonsc52-del to this issue.
drips-wave commentedon Sep 30, 2026
Congratulations, @rhemy-arc! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.
🧑💻 @rhemy-arc: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
drips-wave commentedon Sep 30, 2026
This issue has been completed by @rhemy-arc as part of the Stellar Wave Program's 9th Wave 🥳
😎 @rhemy-arc: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.