Add capped, paginated verifier management - #253
Open
holystrings wants to merge 1 commit into
Open
Conversation
Caps the Verifiers set at MAX_VERIFIERS (50); add_verifier now rejects new entries at capacity with VerifierLimitReached. Adds a paginated get_verifiers_page(offset, limit) -> VerifierPage. The existing get_verifiers(env) -> Vec<Verifier> is left unchanged for source-compat with its existing internal callers. Closes DelegoLabs#116
|
@holystrings Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Caps the
Verifiersset withMAX_VERIFIERSand adds offset/limitpagination, closing off unbounded storage growth from
add_verifierand unbounded read cost from
get_verifiers.Changes
MAX_VERIFIERS: u32 = 50add_verifierrejects new entries at capacity with the newMarketplaceError::VerifierLimitReachedget_verifiers_page(offset: u32, limit: u32) -> VerifierPagereturns a correct slice plus
totalandnext_offset(Noneonceexhausted)
get_verifiers(env) -> Vec<Verifier>is left unchanged forsource-compat — it's called internally by
add_verifier,remove_verifier, and merchant verification, so this avoidstouching those paths
Testing
add_verifier_rejects_when_at_capacity— fills toMAX_VERIFIERS,confirms the next add is rejected
get_verifiers_page_returns_correct_slice— asserts items,total,and
next_offsetacross a multi-page walkget_verifiers_page_offset_beyond_total_returns_empty— boundary casecargo test(full existing suite) andcargo clippy --all-targets -- -D warningspassAcceptance criteria
Closes #116