Cyfrin Savings Fix — audit remediation (L-1, L-2, I-3, I-4) - #29
Merged
FabienCoutant merged 6 commits intoJun 10, 2026
Conversation
added 6 commits
June 5, 2026 12:10
FabienCoutant
merged commit Jun 10, 2026
61942aa
into
feat/savings-donation-and-pause-refactor
4 checks passed
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.
Remediation of the Cyfrin "Parallel Savings Fix" report (v1.0, 2026-06-04), stacked on top of the audited branch (#27). One commit per finding.
Code findings
initializeStoredAssets()now revertsStaleAccrual()whenblock.timestamp - lastUpdate > 30 min. With a fresh accrual there is no unaccrued-interest delta to compound against an inflatedstoredAssets. Pre-upgrade step: callsetRateto refresh accrual right before the upgrade, otherwise the upgrade tx itself reverts.unpause()advanceslastUpdateto the unpause timestamp instead of_accrue()-ing the paused span, so the paused interval is dropped rather than minted. Pausing now halts emission (pause()still settles yield up to the pause moment).initializeStoredAssets()gains therestrictedmodifier — only governance can seedstoredAssets, independent of whether the upgrade runs atomically.initialize()setslastUpdate = block.timestamp, bounding the first accrual window to "since deployment" rather than "since epoch". Defense-in-depth for future fresh deployments (inert for the existing proxy, sinceinitializeis not re-run on upgrade).Operational (no code change)
setRate(0)while the vault is still a minter (final_accruesucceeds), then revoke the minter role. Reverse order traps the rate.totalAssets()and routes torecoverSurplus— it never reaches savers.Tests
MAX_STORED_ASSETS_INIT_STALENESS(30 min) andStaleAccrual()added. New coverage for access control + staleness oninitializeStoredAssets; pause/unpause andlastUpdateassertions updated for the new behavior. Local CI green: solhint,forge build --sizes,test:unit(222/222).