Skip to content

feat: add bounded batch contribution read view#597

Open
webmirroring wants to merge 2 commits into
Liquifact:mainfrom
webmirroring:feature/batch-contribution-view-553
Open

feat: add bounded batch contribution read view#597
webmirroring wants to merge 2 commits into
Liquifact:mainfrom
webmirroring:feature/batch-contribution-view-553

Conversation

@webmirroring

@webmirroring webmirroring commented Jul 3, 2026

Copy link
Copy Markdown

Closes #553.

Summary

  • Added MAX_INVESTOR_READ_BATCH and a pure read-only get_contributions(Vec<Address>) -> Vec<i128> view.
  • The new view preserves input order, mirrors get_contribution storage reads, returns 0 for unknown addresses, and rejects oversized batches with EscrowError::ContributionReadBatchTooLarge.
  • Added funding tests for order preservation, unknown/duplicate addresses, empty input, exact cap, and over-cap typed error handling.
  • Documented the new read API and error code.

CI unblock notes

  • Ran cargo fmt -p liquifact_escrow because CI checks the whole escrow package and main currently contains rustfmt diffs.
  • Removed duplicate trailing guard_status_eq / guard_status_in helper definitions and added missing operational-pause typed errors so whole-package clippy can compile this branch.
  • Moved HorizonNotRaised to a non-conflicting code (204) to avoid the existing duplicate discriminant with LegalHoldBlocksPartialSettle.
  • Derived tier event fields from a single expression instead of reassignment so clippy does not fail on immutable/unused assignment diagnostics.

Security notes

  • No authorization is required because the entrypoint only reads existing contribution records.
  • The function does not write storage, emit events, or bump TTL.
  • The input vector is bounded at 50 entries to cap per-call persistent reads.
  • Unknown addresses are handled with the same 0 default as get_contribution, so the view cannot panic on absent contribution storage.

Validation

  • cargo fmt -p liquifact_escrow -- --check
  • git diff --check
  • Attempted cargo test -p liquifact_escrow get_contributions -- --nocapture, but this local machine has Cargo 1.84.0 and fails before compiling because base64ct v1.8.3 requires edition2024 / Cargo 1.85+.

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.

Add a batch contribution read view returning many investors' funded amounts in one call

2 participants