Assessment reports>warpdotgreen-cli>Threat Model>receiveMessage

Function: receiveMessage(byte[32], byte[3] _source_chain, byte[32] _source, byte[32][] _contents)

This function is used to receive messages from the portal contract and process them. This function transfers tokens to the receiver and the transfer tip to the portal. This function is called by the portal contract.

Inputs

  • nonce

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Not used in the function.

  • _source_chain

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Source chain ID.

  • _source

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: Source puzzle hash (address of sender).

  • _contents

    • Control: Arbitrary.

    • Constraints: None.

    • Impact: The data being relayed; can be (receiver, amount) or (asset contract, receiver and amount)

Branches and code coverage

Intended branches

  • Calculate the correct transfer tip.

  • Mint the amount of tokens minus the transferTip.

  • Mint transferTip amount of tokens to the portal.

Negative behavior

  • Revert if msg.sender is not the portal.

  • Revert if source is not the lockerPuzzleHash.

  • Revert if source chain is not the otherChain.

  • Revert if transferTip is less than zero.

  • Revert if the amount is less than the transfer tip.

Zellic © 2024Back to top ↑