Skip to content

test: add fork poc for vTUSDOLD borrow rate cap freeze - #716

Open
Debugger022 wants to merge 1 commit into
developfrom
fix/vtusdold-rate-cap
Open

Debugger022 wants to merge 1 commit into
developfrom
fix/vtusdold-rate-cap

Conversation

@Debugger022

@Debugger022 Debugger022 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

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 than borrowRateMaxMantissa (5e12 per block), accrueInterest reverts. 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 Shows
test_debtGrowsWhileBorrowsMinusReservesStayFixed One day of accrual takes borrows from 1.12M to 1.54M while borrows minus reserves stays the same
test_marketFreezesOnceRateCapIsReached The cap is hit after about 2 days at about 4.0M borrows; accrueInterest, repayBorrow and _setInterestRateModel from the Normal and Fast Track timelocks then revert with borrow rate is absurdly high
test_zeroRateModelStopsAccrualWhenSetBeforeCap A zero rate JumpRateModel set by the Fast Track timelock before the cap stops accrual; borrows and reserves are unchanged 30 days later

The 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_bscmainnet and skip without it, so the CI forge job is unaffected.

Run with:

forge test --match-path tests/foundry/fork/VTUSDOLDRateCap.t.sol -vv

Checklist

  • I have updated the documentation to account for the changes in the code.
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a test preventing this bug from silently reappearing again.
  • My contribution follows Venus contribution guidelines.

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.
@Debugger022 Debugger022 self-assigned this Oct 1, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100% ✔
contracts.Admin 88% 41% ✔
contracts.BStock 100% 97% ✔
contracts.Comptroller 100% 90% ✔
contracts.Comptroller.Diamond 95% 64% ✔
contracts.Comptroller.Diamond.facets 88% 74% ✔
contracts.Comptroller.Diamond.interfaces 100% 100% ✔
contracts.Comptroller.Types 100% 100% ✔
contracts.Comptroller.legacy 100% 100% ✔
contracts.Comptroller.legacy.Diamond 0% 0% ❌
contracts.Comptroller.legacy.Diamond.facets 0% 0% ❌
contracts.Comptroller.legacy.Diamond.interfaces 100% 100% ✔
contracts.DelegateBorrowers 100% 89% ✔
contracts.FlashLoan.interfaces 100% 100% ✔
contracts.Governance 68% 45% ➖
contracts.InterestRateModels 74% 59% ➖
contracts.Lens 44% 47% ❌
contracts.Liquidator 83% 60% ✔
contracts.Oracle 100% 100% ✔
contracts.PegStability 88% 84% ✔
contracts.Swap 87% 57% ✔
contracts.Swap.interfaces 100% 100% ✔
contracts.Swap.lib 81% 53% ✔
contracts.Tokens 100% 100% ✔
contracts.Tokens.Prime 97% 81% ✔
contracts.Tokens.Prime.Interfaces 100% 100% ✔
contracts.Tokens.Prime.libs 90% 77% ✔
contracts.Tokens.VAI 82% 52% ✔
contracts.Tokens.VRT 20% 9% ❌
contracts.Tokens.VTokens 71% 53% ➖
contracts.Tokens.VTokens.legacy 0% 0% ❌
contracts.Tokens.VTokens.legacy.Utils 0% 0% ❌
contracts.Tokens.XVS 19% 8% ❌
contracts.Tokens.test 100% 100% ✔
contracts.Utils 52% 31% ➖
contracts.VAIVault 50% 45% ➖
contracts.VRTVault 49% 36% ❌
contracts.XVSVault 63% 50% ➖
contracts.external 100% 100% ✔
contracts.lib 89% 71% ✔
Summary 62% (4516 / 7315) 48% (1750 / 3646) ➖

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.

1 participant