code-423n4 / 2024-05-olas-findings

12 stars 3 forks source link

Upgraded Q -> 2 from #7 [1720019193236] #119

Closed c4-judge closed 2 months ago

c4-judge commented 2 months ago

Judge has assessed an item in Issue #7 as 2 risk. The relevant finding follows:

3. syncWithheldAmount needs to normalize according to bridging decimals.

The withheldAmount received from L2 -> L1 transaction can be unnormalized according to the bridging decimals.

For example for the Wormhole bridge, if the limitAmount for a target on the L2 is not a multiple of 1e10, the withheldAmount sent from L2 -> L1 will also not be multiple of 1e10, so it should be normalized here:

    function syncWithheldAmount(uint256 chainId, uint256 amount) external {
        address depositProcessor = mapChainIdDepositProcessors[chainId];

        // Check L1 deposit processor address
        if (msg.sender != depositProcessor) {
            revert DepositProcessorOnly(msg.sender, depositProcessor);
        }

        // The overall amount is bound by the OLAS projected maximum amount for years to come
        uint256 withheldAmount = mapChainIdWithheldAmounts[chainId] + amount;
        if (withheldAmount > type(uint96).max) {
            revert Overflow(withheldAmount, type(uint96).max);
        }

        // Update the withheld amount
        mapChainIdWithheldAmounts[chainId] = withheldAmount;

        emit WithheldAmountSynced(chainId, amount, withheldAmount);
    }
c4-judge commented 2 months ago

0xA5DF marked the issue as duplicate of #26

c4-judge commented 2 months ago

0xA5DF marked the issue as satisfactory