Set Trusted Remotes
For a contract using LayerZero, a trusted remote is another contract it will accept messages from.
A trusted remote is the 40 bytes (for evm-to-evm messaging) that identifies another contract which you will receive messages from within your LayerZero User Application contract. The 40 bytes object is the packed bytes of the
remoteAddress + localAddress
The reason to care about Trusted Remotes is that from a security perspective contracts should only receive messages from known contracts. Hence, contracts are securely connected by "setting trusted remotes".
The team has produced this github repository as an example of how to automate setting trusted remotes.
for EVM <> EVM, A Trusted Remote is 40 bytes. It is the REMOTE contract address concatenated with the LOCAL contract address.
For NON-evm chains with addresses that are not 20 bytes obviously the Trusted Remotes will not be exactly 40 bytes, but we will regularly use "40 byte" Trusted Remotes in the nomenclature.
// the trusted remote (or sometimes referred to as the path or pathData)
// is the packed 40 bytes object of the REMOTE + LOCAL user application contract addresses
let trustedRemote = hre.ethers.utils.solidityPack(
['address','address'],
[remoteContract.address, localContract.address]
)
The Trusted Remote is now used in a few places. Here is a list of which functions expect the trusted remote format:
Last modified 5mo ago