-
Notifications
You must be signed in to change notification settings - Fork 1
docs: L2 bridging doc #97
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
Open
unknownunknown1
wants to merge
3
commits into
master
Choose a base branch
from
docs/bridging-doc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Manual Actions for L2 → L1 Bridging | ||
| For Reality Cross-chain proxies L1 → L2 bridging is automatic for every bridge. | ||
| However, L2 → L1 bridging requires manual steps, which differ by chain. | ||
| Use this guide until bots are configured to handle everything automatically. | ||
|
|
||
|
|
||
| ## Gnosis | ||
| After sending a transaction from L2 (e.g., `handleNotifiedRequest`), refer to this page: | ||
| https://docs.gnosischain.com/bridges/using-amb | ||
|
|
||
| It's recommended to use **Blockscout** instead of GnosisScan due to possible encoding issues. | ||
|
|
||
| Before using `getSignatures` on the `AMBHelper` contract, wait until the message is processed | ||
| (usually within an hour). After that, `getSignatures` will return a result you can pass into | ||
| `executeSignatures`. | ||
|
|
||
|
|
||
| ## Polygon | ||
| After sending the L2 transaction you'll need to manually call `receiveMessage` | ||
| on `foreignProxy` contract. | ||
|
|
||
| The argument for the function can be obtained from this template URL (usually generated in **1–3 hours**): | ||
|
|
||
| ``` | ||
| https://proof-generator.polygon.technology/api/v1/matic/exit-payload/<your_L2_tx_hash>?eventSignature=0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036 | ||
| ``` | ||
|
|
||
| This URL contains: | ||
| - Your L2 tx hash that you need to manually insert | ||
| - The event signature required by Polygon API (same for every tx, belongs to `messageSent` event) | ||
|
|
||
| More details: | ||
| https://github.com/0xPolygon/fx-portal?tab=readme-ov-file#proof-generation | ||
|
|
||
|
|
||
| ## zkSync | ||
| After sending the tx to L1, check its status on zkSync Etherscan. | ||
| When the status becomes **"Executed"** (usually in 2-4 hours), use the script: | ||
|
|
||
| https://github.com/kleros/cross-chain-realitio-proxy/blob/master/contracts/scripts/execute_proof.js | ||
|
|
||
| Steps: | ||
| 1. Insert your `txHash` into the script. | ||
| 2. Run `yarn zksync:proof:production` from `contracts` folder. | ||
|
|
||
| This script retrieves the proof and executes the tx on L1 automatically. | ||
|
|
||
| Requirements: | ||
| - `yarn install` | ||
| - `.env` file setup (`PRIVATE_KEY`, `INFURA_API_KEY`) | ||
|
|
||
| zkSync docs: | ||
| https://code.zksync.io/tutorials/how-to-send-l2-l1-message | ||
|
|
||
| If the status is "Executed" but proof is `null`, wait longer. | ||
| Once executed successfully, a dispute will be created on KlerosCourt with `ForeignProxy` as arbitrable. | ||
|
|
||
|
|
||
| ## Arbitrum | ||
| Execution occurs only after the **one-week challenge period** has passed, thus a week after sending a tx to L1, navigate to `contracts` folder and run: | ||
|
|
||
| ``` | ||
| yarn relay:production --txhash <your_tx_hash> | ||
| ``` | ||
|
|
||
| Requirements: | ||
| - `yarn install` | ||
| - `.env` file setup (`PRIVATE_KEY`, `INFURA_API_KEY`) | ||
|
|
||
| Note: this task currently works only with **ethers v5** | ||
|
|
||
| Official docs page: | ||
| https://docs.arbitrum.io/build-decentralized-apps/cross-chain-messaging | ||
| https://github.com/OffchainLabs/arbitrum-tutorials/blob/master/packages/outbox-execute/scripts/exec.js | ||
|
|
||
|
|
||
| ## Optimism (Base, Redstone, Unichain, etc.) | ||
| After sending the L2 tx run the command corresponding to the chosen chain, e.g.: | ||
|
|
||
| ``` | ||
| yarn relay-op:base --txhash <your_tx_hash> | ||
| ``` | ||
|
|
||
| You must run this command **twice**: | ||
| 1. Shortly after sending the tx (usually within an hour), to prove the message. Console should show `Proven` if successful | ||
| 2. One week later, to finalize it | ||
|
|
||
| Requirements: | ||
| - `yarn install` | ||
| - `.env` file setup (`PRIVATE_KEY`, `INFURA_API_KEY`, `ALCHEMY_API_KEY`) | ||
|
|
||
| Extra notes: | ||
| - Optimism stack requires `eth_getProof`, unsupported by Infura therefore **Alchemy** is used for L2 RPC. | ||
| - L1 RPC can still use Infura. | ||
|
|
||
| Official docs page: | ||
| https://docs.optimism.io/app-developers/tutorials/bridging/cross-dom-solidity#interact-with-the-l2-greeter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use optional chaining or default values instead of non-null assertions.
The non-null assertion operator (
!) on lines 267-270 will throw runtime errors if the environment variables are undefined. This can cause Hardhat to fail even for tasks that don't require Etherscan verification.Consider using optional chaining with fallback values:
etherscan: { apiKey: { // These are separate from Ethereum's etherscan API key - optimisticEthereum: process.env.OPTIMISM_API_KEY!, - mainnet: process.env.ETHERSCAN_API_KEY!, - polygon: process.env.ETHERSCAN_API_KEY!, - base: process.env.ETHERSCAN_API_KEY! + optimisticEthereum: process.env.OPTIMISM_API_KEY || "", + mainnet: process.env.ETHERSCAN_API_KEY || "", + polygon: process.env.ETHERSCAN_API_KEY || "", + base: process.env.ETHERSCAN_API_KEY || "" },📝 Committable suggestion
🤖 Prompt for AI Agents