MEDIUM severity: The vulnerability occurs when token amounts are scaled up twice, causing the amounts to be inflated . The vulnerability occurs when token amounts are scaled up twice, causing the amounts to be inflated in two token vaults. This inflation occurs when the `primaryAmount` and `secondaryAmount` are scaled up to `BALANCER_PRECISION` (1e18) in the `_validateSpotPriceAndPairPrice` function, and then scaled...

Vulnerable code:
```\nFile: Stable2TokenOracleMath.sol\n\nfunction _validateSpotPriceAndPairPrice(\n    StableOracleContext calldata oracleContext,\n    TwoTokenPoolContext calldata poolContext,\n    StrategyContext memory strategyContext,\n    uint256 oraclePrice,\n    uint256 primaryAmount,\n    uint256 secondaryAmount\n) internal view {\n    uint256 spotPrice = _getSpotPrice({\n        oracleContext: oracleContext,\n        poolContext: poolContext,\n        primaryBalance: poolContext.primaryBalance,\n        secondaryBalance: poolContext.secondaryBalance,\n        tokenIndex: 0\n    });\n\n    _checkPriceLimit(strategyContext, oraclePrice, spotPrice);\n\n    uint256 primaryPrecision = 10 ** poolContext.primaryDecimals;\n    uint256 secondaryPrecision = 10 ** poolContext.secondaryDecimals;\n    primaryAmount = primaryAmount * BalancerConstants.BALANCER_PRECISION / primaryPrecision;\n    secondaryAmount = secondaryAmount * BalancerConstants.BALANCER_PRECISION / secondaryPrecision;\n\n    uint256 calculatedPairPrice = _getSpotPrice({\n        oracleContext: oracleContext,\n        poolContext: poolContext,\n        primaryBalance: primaryAmount,\n        secondaryBalance: secondaryAmount,\n        tokenIndex: 0\n    });\n```\n```\nFile: Stable2TokenOracleMath.sol\n\nfunction _getSpotPrice(\n    StableOracleContext memory oracleContext, \n    TwoTokenPoolContext memory poolContext, \n    uint256 primaryBalance,\n    uint256 secondaryBalance,\n    uint256 tokenIndex\n) internal view returns (uint256 spotPrice) {\n    require(tokenIndex < 2);\n\n    uint256 scaledPrimaryBalance = primaryBalance * poolContext.primaryScaleFactor / BalancerConstants.BALANCER_PRECISION;\n    uint256 scaledSecondaryBalance = secondaryBalance * poolContext.secondaryScaleFactor / BalancerConstants.BALANCER_PRECISION;\n\n    (uint256 balanceX, uint256 balanceY) = tokenIndex == 0? \n        (scaledPrimaryBalance, scaledSecondaryBalance) : \n        (scaledSecondaryBalance, scaledPrimaryBalance);\n\n    uint256 invariant = StableMath._calculateInvariant(\n        oracleContext.ampParam, \n        StableMath._balances(balanceX, balanceY), \n        true // round up\n    );\n\n    spotPrice = StableMath._calcSpotPrice({\n        amplificationParameter: oracleContext.ampParam,\n        invariant: invariant,\n        balanceX: balanceX,\n        balanceY: balanceY\n    });\n\n    uint256 scaleFactor = tokenIndex == 0? \n        poolContext.secondaryScaleFactor * BalancerConstants.BALANCER_PRECISION / poolContext.primaryScaleFactor : \n        poolContext.primaryScaleFactor * BalancerConstants.BALANCER_PRECISION / poolContext.secondaryScaleFactor;\n    spotPrice = spotPrice * BalancerConstants.BALANCER_PRECISION / scaleFactor;\n}\n```\n```\nfunction _scalingFactors() internal view virtual override returns (uint256[] memory scalingFactors) {\n    scalingFactors = super._scalingFactors();\n    scalingFactors[0] = scalingFactors[0].mulDown(_priceRate(_token0));\n    scalingFactors[1] = scalingFactors[1].mulDown(_priceRate(_token1));\n}\n```\n```\nFixedPoint.ONE * 10 ** decimalsDifference\n1e18 * 1e12 = 1e30\n```\n```\n/**\n * @dev Returns a scaling factor that, when multiplied to a token amount for `token`, normalizes its balance as if\n * it had 18 decimals.\n */\nfunction _computeScalingFactor(IERC20 token) internal view returns (uint256) {\n    uint256 tokenDecimals = ERC20(address(token)).decimals();\n\n    // Tokens with more than 18 decimals are not supported.\n    uint256 decimalsDifference = 18 - tokenDecimals;\n    return FixedPoint.ONE * 10**decimalsDifference;\n}\n```