Summary
The return value of the burn function does not match the deconstruction of the withdraw function, resulting in an error in the calculation of burnedScaledAmount.
Vulnerability Details
        
      ➡️  (uint256 burnedScaledAmount, uint256 newTotalSupply, uint256 amountUnderlying) = IRToken(reserve.reserveRTokenAddress).burn(
            recipient,              
            recipient,              
            amount,                 
            reserve.liquidityIndex  
        );
        amountWithdrawn = burnedScaledAmount;
    uint256 amountScaled = amount.rayMul(index);
    _userState[from].index = index.toUint128();
    _burn(from, amount.toUint128());
    if (receiverOfUnderlying != address(this)) {
        IERC20(_assetAddress).safeTransfer(receiverOfUnderlying, amount);
    }
    emit Burn(from, receiverOfUnderlying, amount, index);
   ❌ return (amount, totalSupply(), amount);
In this code, the first parameter returned by IRToken(reserve.reserveRTokenAddress).burn should be burnedScaledAmount, but in the RToken contract, the first value returned by the burn function is amount, which leads to inconsistent matching results.
Impact
The return value of the burn function does not match the deconstruction of the withdraw function, resulting in an error in the calculation of burnedScaledAmount.
Tools Used
Manual review
Recommendations
The return value of the first parameter in the burn function should be amountScaled, not amount.
     * @return A tuple containing:
     *         - uint256: The amount of scaled tokens burned
     *         - uint256: The new total supply after burning
     *         - uint256: The amount of underlying asset transferred
    function burn(
        address from,
        address receiverOfUnderlying,
        uint256 amount,
        uint256 index
    ) external override onlyReservePool returns (uint256, uint256, uint256) {
......
......
......
        uint256 amountScaled = amount.rayMul(index);
        _userState[from].index = index.toUint128();
        _burn(from, amount.toUint128());
        if (receiverOfUnderlying != address(this)) {
            IERC20(_assetAddress).safeTransfer(receiverOfUnderlying, amount);
        }
        emit Burn(from, receiverOfUnderlying, amount, index);
➡️        return (amountScaled, totalSupply(), amount);