diff --git a/components/AutorelayCallout.tsx b/components/AutorelayCallout.tsx new file mode 100644 index 000000000..47c289c91 --- /dev/null +++ b/components/AutorelayCallout.tsx @@ -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 ( +
+
+
+ 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. +
+
+
+ ); +} diff --git a/pages/stack/interop/message-passing.mdx b/pages/stack/interop/message-passing.mdx index e4e247dfc..f6eab30bb 100644 --- a/pages/stack/interop/message-passing.mdx +++ b/pages/stack/interop/message-passing.mdx @@ -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 @@ -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. @@ -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 */} diff --git a/pages/stack/interop/superchain-weth.mdx b/pages/stack/interop/superchain-weth.mdx index fabd575e0..7dc21e86a 100644 --- a/pages/stack/interop/superchain-weth.mdx +++ b/pages/stack/interop/superchain-weth.mdx @@ -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: diff --git a/pages/stack/interop/tutorials/message-passing.mdx b/pages/stack/interop/tutorials/message-passing.mdx index 49b0690e0..555f5e9e4 100644 --- a/pages/stack/interop/tutorials/message-passing.mdx +++ b/pages/stack/interop/tutorials/message-passing.mdx @@ -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' @@ -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. + ### Set up