Repository navigation
feat(escrow): paginate per-party escrow indexes - #1766
Merged
Merged
Conversation
Contributor
|
hey @OkeA-dev 👋 this PR scans clean and CI is green, but it now has merge conflicts with |
# Conflicts: # README.md # contracts/escrow/src/lib.rs # contracts/escrow/src/test.rs
Contributor
|
looks good — appreciate the work 🙏 |
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.
Implements issue #1708: index escrows by client/freelancer with bounded pages (max 50 per page) and expose paginated read/count APIs.
Closes #1708
Summary
create_contract, append escrow id toDataKey::ClientEscrows/DataKey::FreelancerEscrowsindexes.DataKey::ClientPage(Address, u32)/DataKey::FreelancerPage(Address, u32)) plus count keys.count_client_escrows/count_freelancer_escrowsandget_client_escrows/get_freelancer_escrows(limit clamped to 50;limit == 0→ empty;start >= count→ empty; creation order).Extra write cost of
create_contractcreate_contract: 1 client index page + count update, 1 freelancer index page + count update (each page write persists up to 50 ids; writes extend TTL). Compared to pre-upgrade,create_contractnow does 4 extra persistent writes/TTL extensions in the steady state (page + count for client, page + count for freelancer).WASM size
c970981):38,481bytes42,629bytes+4,148bytes (+10.8%) — under 128 KBFull
cargo testoutputTests
party_indices_paginate_in_creation_order: 120 escrows for one client across two freelancers → pages50, 50, 20, counts correct per party, order preserved.party_index_reads_clamp_and_bound_the_page:limit 0→ empty,limit 500→ clamped to 50,start >= countandstart == u32::MAX→ empty; cross-page read verified.party_index_pages_never_exceed_page_size: asserts no single index page holds > 50 ids.Docs
README.mdupdated: contract-interface table includes new functions, noteslimitclamped to 50, and documents no-backfill.Notes
cargo clippy --all-targets -- -D warningsclean.