Resolve #123, #88, #64, #72: score history, compaction, migration doc…#170
Merged
AbelOsaretin merged 2 commits intoJun 30, 2026
Conversation
…e history, compaction, migration docs, circuit breaker ## Issue Heliobond#123 — Score history tracking - Added ScoreHistoryEntry struct and DataKey variants (ScoreHistorySlot, ScoreHistoryTotal) - Ring-buffer append_score_history (MAX_SCORE_HISTORY = 50) on every score update - get_score_history() returns entries in chronological order - No-op guard in update_credit_quality_score prevents spurious history entries ## Issue Heliobond#88 — Storage compaction - release_collateral and liquidate_collateral_internal now remove() zero entries instead of set(&key, &0) - compact_storage() admin function on both contracts cleans up zero-valued persistent entries - get_project_investment() public getter on vault ## Issue Heliobond#64 — Migration strategy - Added MIGRATION.md covering build order, pause→upgrade→migrate→unpause flow, rollback procedure, version history, and a hard prerequisite warning about the vault-before-registry upgrade risk ## Issue Heliobond#72 — Circuit breaker - pause/unpause/is_paused on ProjectRegistry; require_not_paused guards all state-mutating user ops - pause/unpause/is_paused on InvestmentVault - fund_project_internal checks registry.is_paused() and panics with RegistryPaused error ## Pre-existing build fixes (unblocked CI) - investment_vault/src/storage.rs: removed dead code referencing non-existent DataKey/VaultConfig types - {registry,vault}/src/wasm_test.rs: added extern crate std for std::fs/format! usage in no_std context - project_registry/src/test.rs: removed incorrect expected= string from #[should_panic] on contract error panics - investment_vault/src/test.rs: corrected test_vault_arithmetic_fuzz assertions to match insurance-in-NAV design
|
@JONAH-6 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
remove()on empty entries + explicitcompact_storageadmin functionon both contracts
MIGRATION.mdwith step-by-step procedure andversion history
pause/unpause/is_pausedon both contracts; registry pause blocks vaultfund_projectChanges
project_registry
types.rs:ScoreHistoryEntrystruct;DataKey::ScoreHistorySlot,ScoreHistoryTotal,Paused;RegistryError::Paused = 34events.rs:registry_paused/registry_unpausedeventslib.rs:require_not_pausedguard on all state-mutating user functionsappend_score_historyprivate helper (ring buffer, slot = total % 50)get_score_history(project_id)— returns entries in chronological orderpause/unpause/is_pausedpublic functionscompact_storage(project_ids, tokens)admin functionrelease_collateral/liquidate_collateral_internalnowremove()instead ofset(&key, &0i128)update_credit_quality_scorewhen value unchangedtest.rs: 13 new tests covering score history, circuit breaker, compaction, and migrationinvestment_vault
types.rs:VaultError::RegistryPaused = 35lib.rs:pause/unpause/is_pausedpublic functionscompact_storage()admin function (iteratesProjectInvestmententries, removes zeros)get_project_investment(project_id)public getterfund_project_internalchecksregistry.is_paused()and panics withRegistryPausedtest.rs: 7 new tests covering circuit breaker, compaction, and migration; correctedtest_vault_arithmetic_fuzzassertion to match insurance-in-NAV designPre-existing build fixes (unblocked CI)
investment_vault/src/storage.rs: removed dead code referencing non-existentDataKey/VaultConfigtypes(prevented
stellar contract build){registry,vault}/src/wasm_test.rs: addedextern crate stdand qualifiedstd::format!project_registry/src/test.rs: removed incorrectexpected=string from#[should_panic]onpanic_with_error!panicsMIGRATION.md: added hard prerequisite warning — upgrading vault before registry is a point of no returnNew file
MIGRATION.md: upgrade procedure (build → upload → pause → upgrade → migrate_state → verify → unpause),rollback guidance, version history table, storage pattern reference
Closes
Closes #123
Closes #88
Closes #64
Closes #72