test: add fork poc for vTUSDOLD borrow rate cap freeze - #716
Open
Debugger022 wants to merge 1 commit into
Open
Debugger022 wants to merge 1 commit into
Debugger022 wants to merge 1 commit into
Conversation
With zero cash and a 100% reserve factor, vTUSDOLD utilization grows with its debt until the rate model exceeds borrowRateMaxMantissa. From then on accrueInterest reverts, which blocks repay and the rate model swap. Shows a zero rate model set before the cap stops accrual.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
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.
Description
Adds a BSC mainnet fork test showing that vTUSDOLD is about to stop working.
vTUSDOLD has zero cash and a 100% reserve factor, so every unit of interest goes to reserves and borrows minus reserves stays fixed at about 40K TUSDOLD. Utilization is
borrows / (cash + borrows - reserves)and is not capped, so it climbs with the debt (about 2,806% at the fork block) and the borrow rate climbs with it. Once the rate model returns more thanborrowRateMaxMantissa(5e12 per block),accrueInterestreverts. Every action that accrues first then reverts too, including repay, liquidate and_setInterestRateModel, so the rate model can no longer be swapped through governance.Tests, forked at block 125,064,000:
test_debtGrowsWhileBorrowsMinusReservesStayFixedtest_marketFreezesOnceRateCapIsReachedaccrueInterest,repayBorrowand_setInterestRateModelfrom the Normal and Fast Track timelocks then revert withborrow rate is absurdly hightest_zeroRateModelStopsAccrualWhenSetBeforeCapJumpRateModelset by the Fast Track timelock before the cap stops accrual; borrows and reserves are unchanged 30 days laterThe fix is a VIP that sets a zero rate model on vTUSDOLD before the cap is reached. The Fast Track timelock has the permission and a 6h delay; the Normal timelock's 48h delay is likely too slow.
The tests need
ARCHIVE_NODE_bscmainnetand skip without it, so the CI forge job is unaffected.Run with:
Checklist