feat(contract): bounded claim status_history + get_claim_history - #247
Merged
Conversation
- Add ClaimStatusHistoryEntry { status, ledger } and CLAIM_STATUS_HISTORY_MAX (24)
with FIFO eviction of oldest entries on overflow (documented incompleteness).
- Claim.status_history: seeded on file_claim; append on vote/finalize/process_claim
transitions without reverting when the cap is exceeded.
- New entrypoint get_claim_history(claim_id) returns the same Vec as on Claim.
- Lib: remove duplicate Result claim entrypoints; fix admin events import;
get_claim returns Claim; file_claim uses soroban_sdk::String.
- Tests: lib fifo cap, integration approve/payout + finalize/reject sequences;
update Claim literals (asset + status_history) in fixtures.
- Frontend OnChainClaimStatusHistoryEntry; optional backend Claim.status_history.
Made-with: Cursor
|
@aji70 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! 🚀 |
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
Adds an append-only, bounded per-claim status timeline so the Next.js timeline can render lifecycle steps from chain state without relying only on indexer events (which can lag during reindex).
closes #193
Contract
ClaimStatusHistoryEntry { status, ledger }(Soroban-friendly stand-in for(ClaimStatus, u32)tuples).CLAIM_STATUS_HISTORY_MAX = 24: FIFO eviction of oldest entries when exceeded; documented that early history may be missing whilestatusstays canonical.Claim.status_history: initialized onfile_claim(Processing); appended on real transitions invote_on_claim,finalize_claim, andprocess_claim(Paid). Overflow handling never reverts the underlying transition.get_claim_history(claim_id)returning the sameVecas onClaim.Build fixes (on
main)Result/ panicfile_claim/vote_on_claim/finalize_claim/get_claimdefinitions; singleget_claim→Claim;file_claimusessoroban_sdk::String.admin.rs: drop invalideventsimport.Tests
cargo test --lib fifo_cap_drops_oldest(FIFO cap).cargo test --test claim_status_history(approve→pay sequence +get_claim_historyparity; finalize reject sequence).Types (app / API)
OnChainClaimStatusHistoryEntryinclaim.ts.status_historyonClaiminpolicy.ts.Migration / deploy
Claimlayout changes: existing persisted claims will not decode until migration or redeploy; coordinate WASM upgrade.Notes
set_and_get_claim_round_trip.