LayerZero-Labs / LayerZero-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing `verify` function in `DVN.sol`

abhi3700 opened this issue · comments

I see there is a function missing in DVN.sol which should call verify function of ReceiveUln302.sol contract.
Only then an EOA can call the DVN's function to call upon the verify function so that DVN is msg.sender.

I see this code in tests:

// dvn verify
vm.prank(address(fixtureV2.dvn));
receiveUln302.verify(header, payloadHash, 1);

which I don't think it's gonna work in real. How can a contract (DVN) call another contract (ReceiveUln302)?

  • Add this function in DVN.sol:
    /// @dev for dvn to verify the payload by calling `verify` fn of ReceiveUln302 contract
    /// @param _receiveLibRemote the receiveUln302 address on other side (mostly from src chain) as the message (to be verified)
    ///         is sent from src chain. DVN has to be the one deployed on the chain (src chain from where the message is sent).
    ///         E.g. If message is sent from Ethereum to Polygon, then DVN (on Ethereum) has to verify the sent message by calling `ReceiveUln302`
    ///         (on Polygon).
    function verify(
        address _receiveLibRemote,
        bytes calldata _packetHeader,
        bytes32 _payloadHash,
        uint64 _confirmations
    ) external onlySelfOrAdmin(ADMIN_ROLE) {
        IReceiveUlnE2(_receiveLibRemote).verify(_packetHeader, _payloadHash, _confirmations);
    }

Contracts can definitely call other contracts, not sure what you mean here. There is no need for DVN.sol to have this verify function because after verification the payload hash is sent to the messagelib (ReceiveUln302) and can be verified at this point in the flow.