Target is hidden
This information is not publicly available.
OverlayerWrapCore uses totalBridgedOut to account for OFT burns that reduce the hub chain supply. However, this accounting is currently performed in the shared _debit() / _credit() hooks on every chain instance, instead of being restricted to the hub chain. On a fresh destination non-hub chain, the local totalBridgedOut starts at zero. When it receives an inbound OFT transfer from the hub chain, the subtraction in _credit() underflows and reverts, causing the destination-side mint to fail. Because the source-side debit/burn has already succeeded, the destination-side failure can lock bridged user funds and break the destination bridge path.
hubChainId is a core part of this design, and mint() / redeem() are only allowed on the hub chain. The deployment documentation also lists EURS+ deployments on Ethereum Sepolia, Optimism Sepolia, and Arbitrum Sepolia, showing that this OFT operates across multiple chain instances.
totalBridgedOut is local state maintained by each deployed instance. However, OverlayerWrapCore currently updates it unconditionally in both _debit() and _credit() on every chain:
OverlayerWrapCore.sol#L510-L528
function _debit(
address from_,
uint256 amountLD_,
uint256 minAmountLD_,
uint32 dstEid_
)
internal
virtual
override
returns (uint256 amountSentLD, uint256 amountReceivedLD)
{
(amountSentLD, amountReceivedLD) = super._debit(
from_,
amountLD_,
minAmountLD_,
dstEid_
);
@> totalBridgedOut += amountSentLD;
}
OverlayerWrapCore.sol#L537-L544
function _credit(
address to_,
uint256 amountLD_,
uint32 srcEid_
) internal virtual override returns (uint256 amountReceivedLD) {
amountReceivedLD = super._credit(to_, amountLD_, srcEid_);
@> totalBridgedOut -= amountReceivedLD;
}
As a result, when OFT assets are sent from the hub chain to a destination chain, the destination _credit() reads the destination instance's local totalBridgedOut, not the hub chain's value. On a fresh destination instance this value is zero, so the inbound credit path hits 0 - amountReceivedLD and reverts.
Attack path:
OverlayerWrap token ("OW") on the hub chain and holds the tokens there.send() to bridge OW from the hub chain to a deployed destination non-hub chain._debit() succeeds, the user's OW is burned on the source chain, and the source instance's local totalBridgedOut is increased._credit()._credit() tries to decrement the destination instance's local totalBridgedOut. Because this value is zero and smaller than amountReceivedLD, the subtraction underflows and reverts.More importantly, this is not limited to the first inbound transfer. Any cross-chain transfer where destination.totalBridgedOut < amountReceivedLD will fail in the same way.
This issue directly breaks the multi-chain OFT receive path. The affected user has already been debited/burned on the source chain, while the destination chain fails to mint the bridged amount. According to LayerZero's documentation, the failed message can be retried, but retries do not recover the funds while this state accounting bug remains unchanged. They only hit the same revert again. As a result, bridged user funds can become permanently locked.
The attached PoC.ts reproduces the issue.
This PoC uses two OverlayerWrapMock instances to simulate a hub instance and a fresh destination instance. It keeps only the minimum steps needed to demonstrate the issue: mint on the hub, call testDebit() on the hub, assert that the destination-local totalBridgedOut is still zero, and then call testCredit() on the destination and observe the revert.
Restrict totalBridgedOut to hub-chain-only accounting. The most direct fix is to update _debit() / _credit() only when block.chainid == hubChainId, so that totalBridgedOut is updated only when the hub chain acts as the source or destination. A non-hub chain should not maintain this state.
git clone https://github.com/Overlayerfi/contracts.gitcd contractsgit checkout 519c9e92fd9d80d11e35e9868130f6334b88d676npm i --forcetest/PoC.ts.npx hardhat test test/PoC.ts --network hardhathub.testDebit(...) succeedsdestination.totalBridgedOut() remains 0destination.testCredit(...) revertsAttachments are hidden
This information is not publicly available.
Comments are hidden
This information is not publicly available.