Skip to content

refactor(refund-vault): move yield keys to persistent storage (#131) - #253

Open
fredericklamar342-prog wants to merge 5 commits into
accensa:mainfrom
fredericklamar342-prog:fix/issue-131
Open

refactor(refund-vault): move yield keys to persistent storage (#131)#253
fredericklamar342-prog wants to merge 5 commits into
accensa:mainfrom
fredericklamar342-prog:fix/issue-131

Conversation

@fredericklamar342-prog

Copy link
Copy Markdown

Summary

Moves yield-related storage keys from Instance to Persistent storage in RefundVault in response to Issue #131 (Optimize Storage Layout and Instance Data Footprint).

Problem

Yield-related keys (YieldStrategy, DeployedPrincipal, HarvestedYield, ReserveRatio, MaxDeployRatio) were stored in Instance storage, which is loaded on every contract invocation — including non-yield calls like deposit, refund, withdraw, pause, and admin transfers. This led to unnecessarily high read/write byte fees on the most common operations.

Fix

  • Moved all five yield-related keys from Instance to Persistent storage.
  • Non-yield calls no longer load these keys, reducing per-invocation byte fees.
  • Persistent entries receive TTL bumping on every write via a new persist_yield_ttl helper.
  • get_yield_info() reads from Persistent storage.

Acceptance criteria

  • ✅ Storage types are appropriately segregated based on data lifecycle.
  • ✅ TTL bumping logic is implemented for Persistent storage.
  • ✅ Non-yield operations no longer touch yield storage keys.

Files changed


Fixes #131

…a#131)

Move yield-related storage keys (YieldStrategy, DeployedPrincipal,
HarvestedYield, ReserveRatio, MaxDeployRatio) from Instance to Persistent
storage so non-yield calls (deposit, refund, withdraw, pause) no longer
pay the read/write byte cost of loading them. Persistent entries receive
TTL bumping on every write via the new persist_yield_ttl helper. This
reduces the Instance storage footprint and lowers per-invocation fees for
the most common operations.

Fixes accensa#131

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@mergekeeper

mergekeeper Bot commented Aug 27, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #131.
Verdict: clean

Successfully migrated RefundVault yield keys from instance to persistent storage with TTL bumping and documentation updates satisfying issue 131.

Reviewed commit: 172b483eb6bcd433242e96a2453d7867fd4a0be2.
CI and merge eligibility are checked separately.

@mergekeeper

mergekeeper Bot commented Aug 27, 2026

Copy link
Copy Markdown

MergeKeeper merge status

Status: blocked
PR state: open
Mergeability: unknown
Checked commit: 172b483eb6bcd433242e96a2453d7867fd4a0be2.

Reason: One or more required CI checks failed.

Failing checks:

Next steps:

  1. Open the failing check details above and fix the reported error.
  2. Run the same checks locally where possible.
  3. Commit and push the fix.
  4. MergeKeeper will automatically re-review the updated PR.

victor-134 and others added 2 commits August 27, 2026 22:58
- Add missing Events trait imports for self-transfer tests
- Prefix unused variable with underscore in set_token test

Fixes accensa#131

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…storage audit (accensa#131)

Add 7 tests to yield_tests.rs verifying yield-related keys (YieldStrategy,
DeployedPrincipal, HarvestedYield, ReserveRatio, MaxDeployRatio) are stored
in Persistent storage with proper TTL extension via persist_yield_ttl, and
that non-yield calls (deposit, refund) never create or mutate them.

Update docs/storage-audit.md to document all yield keys as Persistent entries,
explain their TTL strategy, and add them to the rent cost section.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@mergekeeper

mergekeeper Bot commented Aug 28, 2026

Copy link
Copy Markdown

MergeKeeper review unavailable

AI provider review response did not contain valid JSON

No approval or merge action was taken.

fredericklamar342-prog and others added 2 commits August 28, 2026 15:23
- Move soroban-sdk testutils feature from dependencies to dev-dependencies
  in contracts/testutils/Cargo.toml, fixing the build-wasm failure where
  soroban-sdk's testutils module compiled for wasm32v1-none and pulled in
  `rand` (which doesn't support wasm32).

- Fix unclosed delimiter in test_process_batch_exceeds_max_size_fails (test.rs)
  where the assert_eq! macro and closing brace were missing due to a bad merge.

- Fix import ordering in test.rs (cargo fmt).

- Apply cargo fmt to yield_tests.rs for consistent formatting.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize Storage Layout and Instance Data Footprint in RefundVault

1 participant