Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add entrypoints spec #484

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
8 changes: 4 additions & 4 deletions specs/interop/predeploys.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ function sendMessage(uint256 _destination, address _target, bytes calldata _mess
__Using Entrypoint:__ Can be relayed on the destination chain only by the `_entrypoint` address.

```solidity
function sendMessage(uint256 _destination, address _target, bytes calldata _message, address _entrypoint) external returns (bytes32);
function sendMessage(uint256 _destination, address _target, address _entrypoint, bytes calldata _message) external returns (bytes32);
```

Both functions return the hash of the message being sent,
which is used to track whether the message has successfully been relayed.
They emit a `SentMessage` event with the necessary metadata to execute when relayed on the destination chain.

```solidity
event SentMessage(uint256 indexed destination, address indexed target, uint256 indexed messageNonce, address sender, bytes message, address entrypoint);
event SentMessage(uint256 indexed destination, address indexed target, uint256 indexed messageNonce, address sender, address entrypoint, bytes message);
```

An explicit `_destination` chain and `nonce` are used to ensure that the message can only be played on a single remote
Expand Down Expand Up @@ -397,8 +397,8 @@ function relayMessage(ICrossL2Inbox.Identifier calldata _id, bytes calldata _sen
require(_destination == block.chainid);

// log data
(address _sender, bytes memory _message, address _entrypoint) =
abi.decode(_sentMessage[128:], (address,bytes,address));
(address _sender, address _entrypoint, bytes memory _message) =
abi.decode(_sentMessage[128:], (address,address,bytes));

bool success = SafeCall.call(_target, msg.value, _message);
require(success);
Expand Down