Skip to content

Resolve #123, #88, #64, #72: score history, compaction, migration doc…#170

Merged
AbelOsaretin merged 2 commits into
Heliobond:mainfrom
JONAH-6:feat/score-history-compaction-migration-circuit-breaker
Jun 30, 2026
Merged

Resolve #123, #88, #64, #72: score history, compaction, migration doc…#170
AbelOsaretin merged 2 commits into
Heliobond:mainfrom
JONAH-6:feat/score-history-compaction-migration-circuit-breaker

Conversation

@JONAH-6

@JONAH-6 JONAH-6 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes

project_registry

  • types.rs: ScoreHistoryEntry struct; DataKey::ScoreHistorySlot, ScoreHistoryTotal, Paused;
    RegistryError::Paused = 34
  • events.rs: registry_paused / registry_unpaused events
  • lib.rs:
    • require_not_paused guard on all state-mutating user functions
    • append_score_history private helper (ring buffer, slot = total % 50)
    • get_score_history(project_id) — returns entries in chronological order
    • pause / unpause / is_paused public functions
    • compact_storage(project_ids, tokens) admin function
    • release_collateral / liquidate_collateral_internal now remove() instead of set(&key, &0i128)
    • No-op early return in update_credit_quality_score when value unchanged
  • test.rs: 13 new tests covering score history, circuit breaker, compaction, and migration

investment_vault

  • types.rs: VaultError::RegistryPaused = 35
  • lib.rs:
    • pause / unpause / is_paused public functions
    • compact_storage() admin function (iterates ProjectInvestment entries, removes zeros)
    • get_project_investment(project_id) public getter
    • fund_project_internal checks registry.is_paused() and panics with RegistryPaused
  • test.rs: 7 new tests covering circuit breaker, compaction, and migration; corrected
    test_vault_arithmetic_fuzz assertion to match insurance-in-NAV design

Pre-existing build fixes (unblocked CI)

  • investment_vault/src/storage.rs: removed dead code referencing non-existent DataKey/VaultConfig types
    (prevented stellar contract build)
  • {registry,vault}/src/wasm_test.rs: added extern crate std and qualified std::format!
  • project_registry/src/test.rs: removed incorrect expected= string from #[should_panic] on
    panic_with_error! panics
  • MIGRATION.md: added hard prerequisite warning — upgrading vault before registry is a point of no return

New 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

…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
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@AbelOsaretin AbelOsaretin merged commit d2b4958 into Heliobond:main Jun 30, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants