Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions components/AutorelayCallout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* The AutorelayCallout function renders a callout component with a message about autorelays
*
* @param {Props} props - Expected to be empty, ignored.
* @returns {ReactElement} The AutorelayCallout component, a callout that explains about autorelays.
*/
import type { ReactElement } from 'react';
import { useState } from 'react';

interface Props {
context?: string;
}
export function AutorelayCallout({ context }: Props): ReactElement {
return (
<div
className="custom-callouts nx-w-full nx-mt-6 nx-flex nx-justify-center nx-items-center nx-bg-white dark:nx-bg-black"
>
<div className="nx-w-full nx-px-4 nx-text-center nx-font-medium nx-text-sm nx-text-left">
<div className="nx-text-left">
Normally we expect Superchain blockchains to run an autorelayer and relay your messages automatically.
However, for performance reasons or reliability, you might decide to submit the executing message manually.
See below to learn how to do that.
</div>
</div>
</div>
);
}
7 changes: 3 additions & 4 deletions pages/stack/interop/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sequenceDiagram
```mermaid

sequenceDiagram
participant app as Application
participant app as Autorelayer
box rgba(0,0,0,0.1) Source Chain
participant log as Event Log
end
Expand All @@ -88,7 +88,7 @@ sequenceDiagram

1. Before the executing message is processed, the log event of the initiating message has to get to `op-supervisor` on the destination chain.

2. The application (or a contract calling on the application's behalf) calls [`L2ToL2CrossDomainMessenger.SendMessage.relayMessage`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol#L156-L216).
2. The autorelayer, the application, or a contract calling on the application's behalf calls [`L2ToL2CrossDomainMessenger.SendMessage.relayMessage`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol#L156-L216).
This call includes the message that was sent (`_sendMessage`), as well as the [fields required to find that message (`_id`)](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/interfaces/L2/ICrossL2Inbox.sol#L4-L10).

3. The `L2ToL2CrossDomainMessenger` uses `CrossL2Inbox` to verify the message was sent from the source.
Expand All @@ -107,10 +107,9 @@ sequenceDiagram
## Next steps

* Build a [revolutionary app](/app-developers/get-started) that uses multiple blockchains within the Superchain
* Actually [pass messages between blockchains](/stack/interop/tutorials/message-passing).
* Deploy a [SuperchainERC20](/stack/interop/tutorials/deploy-superchain-erc20) to the Superchain
* Practice how to use [Superchain interop message passing](/stack/interop/message-passing)
* Read how [messages get from one blockchain to another (`CrossL2Inbox`)](explainer#how-messages-get-from-one-chain-to-the-other).
* Try [Supersim](tools/supersim) for testing cross-chain messages locally.
* Learn about [manually relaying messages](/stack/interop/tutorials/relay-messages-viem)

{/* After the tutorial for L2ToL2CrossDomainMessenger is written, need to add a link here */}
8 changes: 4 additions & 4 deletions pages/stack/interop/superchain-weth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ sequenceDiagram

4. An off-chain entity submits a transaction to execute the message.
Any address can submit this transaction, but it must have ETH on the destination chain.
Typically, a relayer submits the transaction, since the user does not yet have ETH on the destination chain.
Typically, this would be the chain's autorelayer.

5. `L2ToL2CrossDomainMessenger` on the destination chain calls `SuperchainWETH` with the following details:

* Source of the ETH
* Destination address
* Amount of ETH
* Source of the ETH
* Destination address
* Amount of ETH

`SuperchainWETH` performs several sanity checks:

Expand Down
5 changes: 2 additions & 3 deletions pages/stack/interop/tutorials/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: Learn to implement cross-chain communication in the Superchain by b
import { Callout } from 'nextra/components'
import { Steps } from 'nextra/components'
import { InteropCallout } from '@/components/WipCallout'
import { AutorelayCallout } from '@/components/AutorelayCallout'

<InteropCallout />

Expand Down Expand Up @@ -362,9 +363,7 @@ In this section we change `Greeter.sol` to emit a separate event in it receives

## Implement manual message relaying

So far we relied on `--interop.autorelay` to send the executing messages to chain B.
But we only have it because we're using a development system.
In production we will not have this, we need to create our own executing messages.
<AutorelayCallout />

<Steps>
### Set up
Expand Down