Junior Deposit Quote Overflow at Near-Zero Junior Principal in TrancheVault Lets an LP Freeze HousePool Redemption Funding
A Junior deposit epoch whose share quote overflows the integer range makes every LP epoch settlement that reaches the Junior deposit phase revert, rolling back the Senior redemption funding done earlier in the same call. An attacker can inflate Junior share supply through repeated deposits priced against near-zero Junior principal, then queue an overflowing deposit so matured Senior redemptions stay unfunded and Junior deposit escrows stay locked.
Originally disclosed on Immunefi
- Disclosed after under an hour
#98140 [SC-High] Junior Deposit Quote Overflow at Near-Zero Junior Principal in TrancheVault Lets an LP Freeze HousePool Redemption Funding
Submitted on Nov 5th 2026 at 12:33:43 UTC by @zer0luck_xint for Audit Competition | Plether
- Report ID: #98140
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol
- Impacts:
- Temporary freezing of funds for at least 1 hour
Description
Brief/Intro
HousePool._settleLpEpoch funds matured redemptions before activating deposits. However, it does not reject a Junior deposit epoch whose share quote exceeds the available integer range. Repeated deposits priced against near-zero Junior principal can inflate Junior share supply until a later deposit quote reverts the entire settlement.
From then on, a queued Junior deposit epoch whose quote overflows makes every live-market LP epoch settlement that reaches the Junior deposit phase revert with Panic(0x11), and the Senior redemption funding that runs earlier in the same call is rolled back with it. A matured Junior deposit cannot be cancelled while Junior pricing assets are nonzero and Senior is unimpaired, so matured Senior redemptions stay unfunded and Junior deposit escrows stay locked. Without trading revenue, coupon depletion of the stored Junior residual allows settlement to skip Junior deposit activation. Trading revenue can keep the calculated Junior pricing assets nonzero after that point. Redemption funding can resume when the quote and mint become representable or when a pause, the Senior work limit, a Junior wipe, or an oracle-frozen window causes settlement to skip deposit activation.
Vulnerability Details
Settlement order. By design, HousePool reconciles once, funds Senior redemptions before Junior redemptions, and then activates Junior deposits before Senior deposits (ACCOUNTING_SPEC.md:299-301). _settleLpEpoch performs all of these phases in one call frame:
Near-zero Junior principal is priced like any other. Deposit activation is blocked for zero tranche NAV with nonzero supply (ACCOUNTING_SPEC.md:307-308). _settleLpEpoch skips the Junior deposit phase only when Junior pricing assets are exactly zero:
bool juniorActivationDeferred = juniorDepositPhase.pricingAssets == 0 && juniorDepositPhase.pricingSupply != 0;
if (!juniorActivationDeferred) {
juniorDepositPhase = _settleDepositPhase(juniorVault, result.cutoffEpoch, juniorDepositPhase, 0, false);
}
With nonzero Junior pricing assets, _settleDepositPhase quotes the cumulative epoch through quoteDepositFromState. This function calls Math.mulDiv without first converting an unrepresentable result into a zero quote, so the arithmetic range check reverts instead of allowing epoch rejection:
uint256 denominator = pricingAssets + assets + 1 - netAssets;
shares = Math.mulDiv(netAssets, pricingSupply + VIRTUAL_SHARES, denominator, Math.Rounding.Floor);
Junior deposit requests have no size limit. maxRequestDeposit returns type(uint256).max for Junior unless the tranche is wiped or tranche deposits are closed (TrancheVault.sol:1313-1325), and _canAcceptTrancheDeposits closes Junior deposits for zero Junior principal with nonzero supply, not for near-zero principal (HousePool.sol:494-498).
Junior share supply growth. The Senior coupon is funded from Junior principal and capped by it (SECURITY.md:1186; ACCOUNTING_SPEC.md:345-351), so every reconcile moves the elapsed coupon out of Junior principal. A Junior deposit a priced at Junior principal p mints floor(a * (supply + VIRTUAL_SHARES) / (p + 1)) share units. Here a and p are USDG base-unit amounts, and 1 atom equals 1e-6 USDG. supply is the current Junior share supply. VIRTUAL_SHARES is a constant set to 1000 share units. When a equals the coupon that accrues until the next settlement plus a few atoms, the next settlement again prices the following deposit at a few atoms of Junior principal, and the supply grows by a factor of about a / p per settlement. The deposits are paid to Senior LPs as coupon, and the minted shares are worth what was deposited, so the share price falls without any transfer of value to the depositor.
The overflow reverts the whole settlement. Math.mulDiv reverts with Panic(0x11) when the result does not fit in 256 bits, and finalizeDepositEpochFromPool mints the quoted shares with an overflow-checked _mint (TrancheVault.sol:1474). _settleDepositPhase already handles an epoch it cannot price: a zero quote rejects the epoch, and the depositors of a rejected epoch can cancel for a refund.
An unrepresentable quote reverts instead, and the revert rolls back the Senior and Junior redemption funding performed earlier in the same call. By design, redemption funding proceeds while entry activation is deferred (SECURITY.md:1388), and a pause of deposit activation does not block reconciled funding of matured redemptions (SECURITY.md:1150-1152). Here a deposit epoch that cannot be priced blocks that funding.
The epoch stays at the head of the queue. A matured Junior deposit can be cancelled only after rejection, a projected terminal wipe or Senior impairment, and the projected terminal wipe requires pricing assets of exactly zero:
Later deposit epochs wait behind the head, and deposits requested for the same epoch are quoted together with it, which only enlarges the quote. A matured redemption cannot be cancelled either (TrancheVault.sol:894-896), so a redeeming LP waits for a settlement that succeeds.
Trigger. Deposit requests and LP epoch settlement are permissionless. With no open positions, any address can call HousePool.settleLpEpoch on the cached state (HousePool.sol:794-821), and OrderRouter.settleLpEpoch runs the same settlement body. The attacker uses only Junior deposit requests and permissionless settlement calls: hourly deposits that become Senior coupon, and one refundable deposit large enough to overflow.
Impact Details
Severity: Medium, Temporary freezing of funds for at least 1 hour.
An LP can inflate Junior share supply through repeated deposits priced against near-zero Junior principal, then queue a deposit epoch whose share quote overflows. Each settlement that reaches this epoch reverts and rolls back redemption funding. Affected Senior LPs cannot claim their matured redemptions, and Junior depositors cannot recover their escrowed assets while the cancellation conditions remain unmet.
The freeze does not need the attacker to keep paying. Each attempt reconciles from the Junior principal stored at the last successful settlement: the coupon is capped by that stored principal, and revenue accrued since then is distributed after the coupon; with Senior at its high-water mark, all of it is credited to Junior (HousePoolReconcilePlanLib.sol:57-60, :95-99). Without revenue, Junior pricing assets reach zero once the coupon has consumed the stored residual, activation is deferred and the settlement succeeds. With revenue, Junior pricing assets stay above zero and the settlement keeps reverting until accrued revenue lifts Junior principal above the level at which the queued epoch's quote fits in 256 bits (11,859.31 USDG in the test) and its shares fit beside the existing supply.
In the release deployment with release parameters, the honest sequence and the attack start from the same pool state after the coupon drain and use the same request and settlement times. The honest sequence has no attacker deposits after the drain.
| Honest sequence | Attack | |
|---|---|---|
| Junior principal / Senior principal after the coupon drain | 101.42 / 5,001,188.52 | same |
| Hourly settlements of attacker Junior deposits before the trigger epoch | 0 | 24 |
| Settlement of Senior LP B's full redemption, Wed 2027-04-21 08:00:03 UTC | succeeds | reverts with Panic(0x11) |
| USDG Senior LP B receives from that settlement | 4,988,785.46 | 0.00 |
| Honest Junior LP E's 10,000.00 USDG deposit | request refused, Junior is wiped | locked, not cancellable |
| Attacker USDG spent, net | 3,447.81 (1,286.93 top-up, 1.00 at the end of the coupon drain, 2,159.88 hourly and residual deposits) | |
| Attacker refundable deposit | 1,000,000.00 |
From the first failed settlement, the freeze ends as follows in each case:
| Continuation | First successful settlement | B's redemption unfunded | USDG B receives |
|---|---|---|---|
| No trading and no other action; the coupon consumes the 1,119.35 USDG residual | Thu 2027-04-22 09:00:03 UTC | 25 hours | 4,990,939.94 |
| A trader opens a 400,000-unit LONG at a basket price of 1.20 and closes at 1.203 each live morning; no other action | Fri 2027-04-23 21:00:45 UTC, oracle frozen | 61 hours 42 seconds | 4,978,462.59, after the frozen exit fee |
| An independent Senior LP requests a redemption in each of 16 consecutive epochs | Thu 2027-04-22 00:00:03 UTC | 16 hours | 4,990,552.49 |
The owner calls HousePool.pause() |
Wed 2027-04-21 09:00:03 UTC | 1 hour | 4,989,868.96 |
| A trader holds a LONG of 1,000,000 units and the basket moves from 1.20 to 1.195 | Wed 2027-04-21 08:01:10 UTC | 67 s | 3,801,888.82, limited by the reserve for the open position |
These settlements fund matured redemptions without removing the blocked Junior deposit epoch, so settlement reverts again once the oracle-frozen window ends, after unpause, or once the Senior redemption backlog falls below the work limit. Matured Junior deposits stay locked until Junior pricing assets reach zero or Senior is impaired: in the no-trading case E's 10,000.00 USDG cannot be cancelled at any attempt through Thu 2027-04-22 08:00:03 UTC. After the 24 hourly settlements, any Junior deposit epoch above 95,329.32 USDG overflows, including an honest one.
The continuations correspond to these mechanisms. Deposit activation does not run while the oracle is frozen, so a frozen-window settlement funds redemptions with the frozen exit fee (HousePool.sol:908-912, :1143). Settlement returns before deposit activation when Senior redemption processing reaches the constant MAX_LP_EPOCHS_PER_PHASE limit of 16 and a Senior backlog remains (HousePool.sol:869-875). A pause skips deposit activation (HousePool.sol:903-907). An open position's marked profit above the Junior residual takes Junior pricing assets to zero; the trader's profit above the residual is charged to Senior principal, and the time needed depends on the basket moving by at least the residual divided by the position size.
Prerequisites:
- The attacker needs Junior principal close to depletion by the Senior coupon while Senior principal remains positive. The coupon is funded only from Junior principal and capped by it (SECURITY.md:1186, :1391). Junior depletion through coupon payments is a supported protocol state (WHITEPAPER.md:1617). When Senior is at its share limit, the withdrawal check prevents Junior redemptions that would breach that limit (ACCOUNTING_SPEC.md:442-443).
- For about 1 day (24 hourly settlements), Junior principal changes only through the coupon and the attacker's deposits: no net open units, no trading revenue or fees, and no other Junior deposits. Each of these settlements runs within the first 10 seconds of its epoch; settlement is permissionless, so the attacker can submit it, and each deposit is sized from stored state before the settlement second is known.
- The sequence also works with an open book whose units net to zero. Reconciliation adds the book's marked price delta to distributable value (HousePoolAccountingLib.sol:60-78), and that delta is a sum of per-position lines whose LONG and SHORT slopes cancel when the units match (TerminalNavBookV2.sol:349, :580-598), so while both positions stay open and neither trader's marked loss exceeds its pledged margin, the mark does not move Junior principal. The attacker can therefore offset an open book with a position of its own, opened before the hourly settlements: with a background LONG of 400,000 basket units held open and an attacker SHORT of the same size, the same deposit sizing takes the Junior share supply from about 2^51 to about 2^249 in 25 settlements, and the next 25 hourly
OrderRouter.settleLpEpochcalls revert with Panic(0x11) while Senior LP B stays unfunded (test_offsetOpenBookDoesNotPreventFreeze). - The hourly settlements and the freeze fall inside the live market window, because deposit activation does not run while the oracle is frozen. The attacker first deposits 1,286.93 USDG of Junior principal so that the end of the coupon drain falls on a Tuesday.
- No privileged role, oracle premise or basket move is involved. A pause by the owner or pauser, a manual emergency action, lets settlements fund matured redemptions while it lasts; it does not release matured Junior deposits, and the next settlement after unpause reverts again.
Recommendation
The defect occurs because quoteDepositFromState propagates an overflow revert instead of returning zero for an unrepresentable deposit quote. Before calling Math.mulDiv, use Math.mul512 to return zero when the product's high word is at least denominator. Also return zero when the quoted shares exceed type(uint256).max - (pricingSupply + VIRTUAL_SHARES). The existing zero-share branch can then reject the epoch, allowing depositors to recover their assets through cancelPendingDeposit. Treating Junior principal below a dust threshold relative to its share supply like a wiped tranche, in both the activation check of _settleLpEpoch and _projectedTerminalWipe, also removes the repeated pricing at a few atoms of principal that inflates the supply.
References
- Audit commit: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8
- LP epoch settlement order and deposit activation conditions:
packages/perps/ACCOUNTING_SPEC.md:299-308 - Senior coupon funded from Junior principal:
packages/perps/SECURITY.md:1183-1188,packages/perps/ACCOUNTING_SPEC.md:345-351 - Redemption funding while entry activation is deferred, and pool pause:
packages/perps/SECURITY.md:1150-1152,:1380-1395 - Historical replay of tranche principal:
packages/perps/WHITEPAPER.mdsection 8.6 - Release parameters:
packages/perps/DEPLOYMENT.md(Initial release parameters) andscript/DeployPerpsArbitrumSepolia.s.sol
Proof of Concept
Proof of Concept
The test deploys the release contracts with script/DeployPerpsArbitrumSepolia.s.sol inside Forge. In-scope contracts are unmodified. Only out-of-scope components are mocked:
- Pyth: the repository's
test/mocks/MockPyth.sol, etched at the release Pyth address. - USDG: the release
MockUSDG. - The ArbSys block-number precompile.
The PoC is a single file with 2 tests. Steps in test_juniorQuoteOverflowFreezesSeniorRedemptionFunding, all through public entry points:
- Junior LP A deposits 1,000,000 USDG, and Senior LPs B and D deposit 3,990,000 and 10,000 USDG, which brings Senior to 3 USDG below the 80% share limit (each tranche also holds a 1 USDG seed position). No position is opened.
- The attacker deposits 1,286.93 USDG of Junior principal so that the end of the coupon drain falls on a Tuesday. After 3.1 years of coupon, a 1 USDG Junior deposit by the attacker settles and leaves Junior principal at 101.42 USDG, about 2 hours of coupon. The test takes a snapshot.
- Attack: for 24 consecutive epochs the attacker requests a Junior deposit 10 minutes before the epoch starts, sized from stored pool state and the test's fixed parameters. An address with no role (the test's
keeper) settles each epoch at a second within the first 10 seconds that the sizing does not use. The test checks that every mint equalsdeposit * (supply + 1000) / (principal + 1). - For the next epoch, B requests redemption of all its Senior shares, honest Junior LP E requests a 10,000 USDG deposit, and the attacker requests a 1,000,000 USDG Junior deposit.
- 3 seconds after that epoch starts,
HousePool.settleLpEpochandOrderRouter.settleLpEpochboth revert with Panic(0x11). B cannot cancel its redemption, and E and the attacker cannot cancel their deposits. - From a snapshot of that state, 5 continuations run: (a) hourly settlement attempts with no other action until one succeeds, each failure checking the Panic(0x11) revert data, B's pending shares, nothing claimable for B, no USDG reaching the Senior vault and E unable to cancel; (b) Senior LP D requests a redemption of 1/20 of its shares in each of 16 epochs; (c) the owner calls
HousePool.pause()1 hour later andunpause()after the settlement; (d) a trader opens a LONG of 1,000,000 basket units at 1.20; a settlement attempt at 1.20 still reverts, and the attempt 60 seconds later runs at a basket of 1.195; (e) every live day at 09:00 UTC a trader opens a LONG of 400,000 basket units at 1.20 and closes it at 1.203, with hourly settlement attempts until one succeeds, followed by Senior LP D's redemption request for the next live Monday 10:00 UTC epoch. - Honest sequence: from the snapshot of step 2, B's redemption request and the settlement happen at the same times without any attacker deposit; E's deposit request is refused because the coupon has wiped Junior.
test_offsetOpenBookDoesNotPreventFreeze repeats the funding and coupon drain of steps 1-2, then opens a background LONG of 400,000 basket units and an attacker SHORT of the same size, so the open book has no net units. From then on every settlement refreshes the mark through OrderRouter.settleLpEpoch along a fixed hourly basket path, and a stale mark is refreshed at the last price through OrderRouter.updateMarkPrice before each LP request. A preliminary settlement with an additional attacker Junior deposit reconciles the pool after the 2 opens. The test then runs the collapse of step 3, which checks the same mint formula at each of its 25 settlements, and the trigger epoch of step 4, and checks that every failed attempt reverts with Panic(0x11) while B has nothing claimable.
On a fresh clone of the audit commit, run git submodule update --init --recursive. Create test/poc/ at the repository root, place JuniorNearWipeQuoteOverflow.t.sol (source at the end of this section) in it, then run from the repository root with Forge 1.5.1:
forge test --match-path test/poc/JuniorNearWipeQuoteOverflow.t.sol -vv
Excerpt from the output of the command above (deployment lines omitted; the coupon-drain and per-settlement lines are excerpted below):
[PASS] test_juniorQuoteOverflowFreezesSeniorRedemptionFunding() (gas: 73849248)
Logs:
ATTACK: collapse settlements 24
ATTACK: Junior principal left for the next settlement 1165055211
ATTACK: Junior deposit epoch assets (E + attacker) 1010000000000
ATTACK: Junior principal at pricing (atoms) 1119346866
ATTACK: Junior share supply 1359618558597628650065905645519250190994657627832183014719565118843962342327
ATTACK: Junior epoch assets above which the quote overflows at this state 95329319750
ATTACK: Junior principal above which the 1,010,000 USDG epoch quote fits 11859313993
ATTACK: HousePool.settleLpEpoch and OrderRouter.settleLpEpoch revert with
0x4e487b710000000000000000000000000000000000000000000000000000000000000011
ATTACK: first failed settlement at 1808294403
UTC weekday (0 = Sunday) / hour / second of hour 3 8 3
ATTACK: B cannot cancel its matured redemption; E and the attacker cannot cancel their deposits
NO OTHER ACTION: consecutive failed hourly settlements 25
NO OTHER ACTION: last failed settlement at 1808380803
UTC weekday (0 = Sunday) / hour / second of hour 4 8 3
NO OTHER ACTION: first successful settlement at 1808384403
UTC weekday (0 = Sunday) / hour / second of hour 4 9 3
NO OTHER ACTION: seconds from the first to the last failed settlement 86400
NO OTHER ACTION: seconds B's matured redemption stays unfunded 90000
NO OTHER ACTION: Junior principal at the successful settlement 0
NO OTHER ACTION: USDG Senior LP B receives 4990939939373
NO OTHER ACTION: E's deposit refunded after the Junior wipe 10000000000
NO OTHER ACTION: attacker's deposit refunded after the Junior wipe 1000000000000
attacker USDG deposited in total 1003447811660
of which top-up that places the end of the coupon drain on a Tuesday 1286930897
of which collapse and residual deposits 2159880763
attacker net USDG cost (paid to Senior as coupon) 3447811660
SENIOR LP D QUEUES HOURLY REDEMPTIONS: first successful settlement at 1808352003
UTC weekday (0 = Sunday) / hour / second of hour 4 0 3
SENIOR LP D QUEUES HOURLY REDEMPTIONS: seconds B's redemption stays unfunded 57600
SENIOR LP D QUEUES HOURLY REDEMPTIONS: USDG Senior LP B receives 4990552491105
SENIOR LP D QUEUES HOURLY REDEMPTIONS: the next settlement reverts again
PAUSE: USDG Senior LP B receives one hour after the first failed settlement 4989868959900
PAUSE: after unpause the next settlement reverts again
TRADER POSITION: first successful settlement at 1808294470
UTC weekday (0 = Sunday) / hour / second of hour 3 8 70
TRADER POSITION: seconds B's redemption stays unfunded 67
TRADER POSITION: Junior principal after the settlement 0
TRADER POSITION: Senior principal / high-water mark after the settlement 1198000000000 1198585235105
TRADER POSITION: USDG Senior LP B receives 3801888818799
REVENUE: time at which the coupon alone would consume the stored Junior principal 1808382612
UTC weekday (0 = Sunday) / hour / second of hour 4 8 1812
REVENUE: losing round trips by the trader 3
REVENUE: consecutive failed hourly settlements 61
REVENUE: first successful settlement at 1808514045
UTC weekday (0 = Sunday) / hour / second of hour 5 21 45
REVENUE: oracle frozen at the successful settlement true
REVENUE: seconds B's matured redemption stays unfunded 219642
REVENUE: Junior principal after the settlement 4177441411
REVENUE: USDG Senior LP B receives 4978462589524
REVENUE: E still cannot cancel its deposit
REVENUE: after the weekend, Senior LP D's redemption settlement reverts again at 1808733603
UTC weekday (0 = Sunday) / hour / second of hour 1 10 3
HONEST SEQUENCE: Junior principal is zero, E's deposit request is refused (TrancheVault__TerminallyWiped)
HONEST SEQUENCE: settlement at 1808294403
UTC weekday (0 = Sunday) / hour / second of hour 3 8 3
HONEST SEQUENCE: USDG Senior LP B receives at the first settlement 4988785458850
Excerpt from the same output for test_juniorQuoteOverflowFreezesSeniorRedemptionFunding: the pool after the coupon drain and the first 3 and last 2 of the 24 hourly settlements of attacker deposits:
Junior principal after the coupon drain 101415092
Senior principal after the coupon drain 5001188515805
Junior share supply after the coupon drain 1011268568472696
settlement 1 second of hour 0
Junior principal at pricing (atoms) / attacker deposit (atoms) 55780199 1000000
Junior share supply after 1029398094155172
settlement 2 second of hour 7
Junior principal at pricing (atoms) / attacker deposit (atoms) 11018019 34719208
Junior share supply after 4273164809573343
settlement 3 second of hour 4
Junior principal at pricing (atoms) / attacker deposit (atoms) 101500 45674207
Junior share supply after 1927144999152231287
settlement 23 second of hour 4
Junior principal at pricing (atoms) / attacker deposit (atoms) 101519 49923346
Junior share supply after 5111907176654244410133235957707973643338650930604398538251745079247306666
settlement 24 second of hour 1
Junior principal at pricing (atoms) / attacker deposit (atoms) 4380385 1160674826
Junior share supply after 1359618558597628650065905645519250190994657627832183014719565118843962342327
Excerpt from the same output for test_offsetOpenBookDoesNotPreventFreeze (deployment and per-settlement lines omitted):
[PASS] test_offsetOpenBookDoesNotPreventFreeze() (gas: 51940893)
Logs:
OFFSET BOOK: open interest LONG / SHORT (units, 18 decimals) 400000000000000000000000 400000000000000000000000
OFFSET BOOK: after the coupon drain and the 2 opens
Junior principal / Senior principal 101415092 5001188515805
Junior share supply (log2) 49
OFFSET BOOK: collapse settlements 25
OFFSET BOOK: Junior share supply log2 before / after 51 249
OFFSET BOOK: consecutive OrderRouter.settleLpEpoch attempts reverting with Panic(0x11) 25
OFFSET BOOK: first successful settlement timestamp (0 = none in the window) 1808391603
OFFSET BOOK: hours from the trigger epoch to the first successful settlement 25
OFFSET BOOK: Junior principal after the first successful settlement 0
OFFSET BOOK: Senior LP B claimable redemption shares 3615248280496272
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 134.30ms (220.33ms CPU time)
Source files
JuniorNearWipeQuoteOverflow.t.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {DeployPerpsArbitrumSepolia} from "../../script/DeployPerpsArbitrumSepolia.s.sol";
import {MockPyth} from "../mocks/MockPyth.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {PletherOracle} from "@plether/perps/PletherOracle.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Test, console2} from "forge-std/Test.sol";
// Release deployment fixture: deploys the release contracts with script/DeployPerpsArbitrumSepolia.s.sol inside
// the local Forge EVM, as test/scripts/MockUSDGPerpsLifecycle.t.sol does: release wrappers (Senior cap 40M/80%),
// release risk and pool parameters (8% Senior coupon, hourly LP epochs with a 300 s request cutoff), six Pyth feeds.
// Only out-of-scope components are mocked: Pyth (MockPyth etched at the release Pyth address), USDG (the release
// MockUSDG), ArbSys (address(100)).
/// @dev Mirrors the Arbitrum precompile's block-number view inside the local test EVM.
contract ReleaseFixtureArbSys {
function arbBlockNumber() external view returns (uint256) {
return block.number;
}
}
abstract contract ReleaseFixture is Test {
address internal constant RELEASE_PYTH = 0x0B73614636C855Bf23F342F307FB981A3e47f42B;
uint256 internal constant DEPLOYER_KEY = 0xA11CE;
uint256 internal constant MONDAY_MORNING = 1_709_532_000; // Mon 2024-03-04 06:00 UTC (live market)
uint256 internal constant BASKET_1_20 = 120_000_000; // normalized basket mark 1.20 (8 decimals)
DeployPerpsArbitrumSepolia.DeployedContracts internal d;
address internal owner;
address internal keeper = makeAddr("keeper");
function setUp() public virtual {
vm.chainId(421_614);
vm.warp(MONDAY_MORNING);
ReleaseFixtureArbSys arbSys = new ReleaseFixtureArbSys();
vm.etch(address(100), address(arbSys).code);
MockPyth pyth = new MockPyth();
vm.etch(RELEASE_PYTH, address(pyth).code);
vm.setEnv("TEST_PRIVATE_KEY", vm.toString(DEPLOYER_KEY));
d = DeployPerpsArbitrumSepolia(deployCode("DeployPerpsArbitrumSepolia.s.sol:DeployPerpsArbitrumSepolia")).run();
owner = vm.addr(DEPLOYER_KEY);
// Permanent 1 USDG seed positions per tranche (release values), then activation.
d.settlementToken.mint(owner, 2e6);
vm.startPrank(owner);
d.settlementToken.approve(address(d.housePool), 2e6);
d.housePool.initializeSeedPosition(false, 1e6, owner);
d.housePool.initializeSeedPosition(true, 1e6, owner);
d.housePool.activateTrading();
vm.stopPrank();
_setBasketPrices(BASKET_1_20);
d.router.updateMarkPrice(_updateData());
}
function _setBasketPrices(
uint256 basketPrice
) internal {
lastSetPrice = basketPrice;
PletherOracle oracle = PletherOracle(d.pletherOracle);
for (uint256 i; i < 6; ++i) {
uint256 normalizedPrice = oracle.basePrices(i) * basketPrice / 1e8;
uint256 feedPrice = oracle.inversions(i) ? 1e16 / normalizedPrice : normalizedPrice;
MockPyth(RELEASE_PYTH)
.setPrice(oracle.pythFeedIds(i), int64(uint64(feedPrice)), int32(-8), vm.getBlockTimestamp());
}
}
/// @dev A non-encoded payload makes the MockPyth double use the configured per-feed prices.
function _updateData() internal pure returns (bytes[] memory data) {
data = new bytes[](1);
data[0] = "";
}
function _warp(
uint256 dt
) internal {
vm.warp(vm.getBlockTimestamp() + dt);
vm.roll(vm.getBlockNumber() + 1 + dt / 4);
}
function _warpTo(
uint256 t
) internal {
uin
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the deposit quote function lets an arithmetic overflow revert instead of returning a zero quote, so an unpriceable epoch blocks the whole settlement rather than being rejected.
Impact
Matured Senior redemptions stay unfunded and Junior deposit escrows stay locked, though a pause, the Senior work limit, a Junior wipe or an oracle-frozen window can let funding resume temporarily.
What the attacker needed
Junior principal near depletion by coupon; Senior principal remains positive; No net open units or trading revenue; No other Junior deposits during the attack
The fix
The quote function should return zero for an unrepresentable result so the existing zero-share branch rejects the epoch, and Junior principal below a dust threshold relative to supply should be treated like a wiped tranche.
How it was found
- Deposit Junior and Senior principal so Senior sits just below its share limit, with no position opened.
- Deposit a small Junior amount so the coupon drain ends on a chosen weekday, then let coupon payments reduce Junior principal to near zero.
- For 24 consecutive epochs, request a Junior deposit shortly before each epoch and have a role-less address settle it.
- In the next epoch, queue a Senior redemption, an honest Junior deposit and a large attacker Junior deposit.
- Settle a few seconds into that epoch and observe both settlement entry points revert with Panic(0x11), with no cancellation possible.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vault splits money into a Junior part and a Senior part, and it processes deposits and withdrawals in a fixed order during a periodic settlement. If one queued deposit produces a share number too large for the computer to store, the whole settlement crashes and everything done earlier in that same run is undone. Because anyone can queue deposits and trigger settlements, someone can deliberately create that oversized number and stop other people from getting their money out for a while.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.