Assessment reports>warpdotgreen-cli>Threat Model>receiveMessage

Function: receiveMessage(byte[32] _nonce, byte[3] _source_chain, byte[32] _source, address _destination, byte[32][] _contents, bytes _sigs)

This function is used to receive and relay a cross-chain message from another blockchain. It verifies the message signatures, checks for replay, and if valid, forwards the message to the destination contract. Normally called by the user that sent the message.

Inputs

  • _nonce

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Nonce of the message.

  • _source_chain

    • Control: Arbitrary.

    • Constraints: Valid mapping of supported chains.

    • Impact: Chain ID of the source chain.

  • _source

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of the source.

  • _destination

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Address of the destination contract.

  • _contents

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Content of the message being processed.

  • _sigs

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Signatures verifying the message.

Branches and code coverage

Intended branches

  • Mark the nonce as used.

  • Check the signatures of the message.

  • Forward the message to the destination contract by calling the receiveMessage function of the destination contract.

Negative behavior

  • Revert if the source chain is not supported.

  • Revert if the length of the signatures is not equal to the signature threshold.

  • Revert if the nonce has been used before.

  • Revert if the signatures are not in order.

  • Revert if the signer is not authorized.

Function call analysis

  • IPortalMessageReceiver(_destination).receiveMessage(_nonce, _source_chain, _source, _contents)

    • Destination contract is expected as the bridge contract address. The bridge contract will execute token transfer using _contents params.

Zellic © 2024Back to top ↑