Skip to content

Commit

Permalink
fixes around ETHGateway change and updating dates
Browse files Browse the repository at this point in the history
  • Loading branch information
dghelm committed Feb 7, 2024
1 parent 62487f4 commit 32d7207
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 50 deletions.
16 changes: 1 addition & 15 deletions src/content/docs/en/developers/l1-and-l2-bridging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,10 @@ In addition to token transfers, the Scroll Messenger contract enables cross-chai

There are many entry points from the user to the Scroll bridge. This will depend on what you want to do and how you want to do it. If you want to send ETH or ERC20 tokens, you should use the `GatewayRouter` . If you want to send NFTs, you should use the `L1ERC721Gateway` or `L1ERC1155Gateway`. If you want to send arbitrary data, you should use the `L1ScrollMessenger`. All Gateway transfers use the Scroll Messenger to send assets cross-chain, whose job is to append the transactions to the Message Queue for L2 inclusion.

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, minor changes will be made to the above flow. Most notably, `L1GatewayRouter` will now bypass `L1ETHGateway` when bridging ETH to improve gas efficiency.

The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).

</Aside>

## L2 Gateway architecture

<ClickToZoom src={withdrawWHITE} />

Regarding possible permissionlessly callable entry points, the L2 Gateway Architecture is very similar to L1. The difference is that when sending a message from L2, calling the `appendMessage` function will store the message in an append-only binary merkle tree (aka withdraw tree) in the `L2MessageQueue`. When a new message is sent to the `L2MessageQueue`, the relayer will detect it and store it in the database. When the block is finalized, it will generate a proof of the new merkle path and pass it to the L1geth node to execute on `L1ScrollMessenger` . All finalized withdraw roots will be stored in the rollup contract so we can verify the proof against them. In the next Scroll versions, the Relayer won't be needed since all users will be able to finalize the transaction on L1.

In the upcoming sections, we will explore the technical aspects of the bridge, including the smart contract API required to utilize its capabilities. Detailed guides with code examples are provided in the Developer Guides section to assist developers and users in understanding and implementing these functionalities.

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, minor changes will be made to the above flow. Most notably, `L2GatewayRouter` will now bypass `L2ETHGateway` when bridging ETH to improve gas efficiency.

The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).

</Aside>
In the upcoming sections, we will explore the technical aspects of the bridge, including the smart contract API required to utilize its capabilities. Detailed guides with code examples are provided in the Developer Guides section to assist developers and users in understanding and implementing these functionalities.
2 changes: 1 addition & 1 deletion src/content/docs/en/developers/scroll-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Use the table below to configure your Ethereum tools to the Scroll mainnet.
- L2 ERC1155 Gateway: [`0x62597Cc19703aF10B58feF87B0d5D29eFE263bcc`](https://scrollscan.com/address/0x62597Cc19703aF10B58feF87B0d5D29eFE263bcc)
- Gas Oracle (deployed on Mainnet)
- L2 Gas Oracle (*soon to be deprecated*): [`0x987e300fDfb06093859358522a79098848C33852`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852)
- *after [Feb '24 Bridge Upgrade](https://scroll.io/blog/to-replace-slug)*
- *after [Feb '24 Bridge Upgrade](https://scroll.io/blog/protocol-upgrade-bridging-cost-reduction)*
- L2 Message Queue With Gas Price Oracle: [`0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B)

### L2 Predeploys
Expand Down
6 changes: 4 additions & 2 deletions src/content/docs/en/developers/transaction-fees-on-scroll.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ Computes the amount of L1 gas used for a transaction. Adds the overhead which re

## L1 Originated Transactions

When messaging from L1 to L2, the user does not pay the L1 fee but may need to know how much L2 gas to pay. Contracts on L1 can use an L2 Gas Price Oracle deployed to the L1 to get the gas fee for a given transaction. The oracle also exposes the current l2BaseFee and estimated cross-domain message fee for a given gas limit.
When messaging from L1 to L2, the user pays all transaction fees on L1. The user pays L1 gas fees, but because of this, doesn't need to pay Scroll an L1 Data Fee. They will need to account for L2 Execution Fees in their L1 transaction though, and will need to know how much L2 gas to pay.
Contracts on L1 can use an L2 Gas Price Oracle deployed to the L1 to get the gas fee for a given transaction. The oracle also exposes the current l2BaseFee and estimated cross-domain message fee for a given gas limit.
On mainnet, the `L2GasPriceOracle` is deployed at [`0x987e300fDfb06093859358522a79098848C33852`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852).
Expand All @@ -176,7 +178,7 @@ On Sepolia, an upgraded `L1MessageQueueWithGasPriceOracle` should be used, deplo
<Aside type="danger" title="Upgrade Notice">
After the February 2024 Bridge Upgrade, `L1GasPriceOracle` will be deprecated in favor of `L1MessageQueueWithGasPriceOracle`, which will be available at [`0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B).
The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).
The upgrade is expected to be finalized on February 21, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/protocol-upgrade-bridging-cost-reduction).
</Aside>
{/* TODO: Add full documentation of key methods */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ The contract `L2GasPriceOracle` deployed on L1 computes the relay fee of a messa
<Aside type="tip" title="Upgrade Notice">
During the February 2024 Bridge Upgrade, `L2GasPriceOracle` will be deprecated, with its functionality moved into the `L1MessageQueueWithGasPriceOracle` contract.

The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).
The upgrade is expected to be finalized on February 21, 2024, after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/protocol-upgrade-bridging-cost-reduction).

</Aside>

Expand Down
12 changes: 0 additions & 12 deletions src/content/docs/en/technology/bridge/deposit-gateways.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ This document describes how users and developers can utilize gateways to deposit
| `L1ERC721Gateway` | The gateway for ERC-721 token deposits. |
| `L1ERC1155Gateway` | The gateway for ERC-1155 token deposits. |

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, `L1GatewayRouter` will now bypass `L1ETHGateway` when bridging ETH to improve gas efficiency.

The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).

</Aside>

## Overview

<ClickToZoom src={DepositWorkflow} alt="Deposit Workflow" />
Expand Down Expand Up @@ -66,11 +59,6 @@ Scroll treats ETH as its native token. We pre-allocate a sufficient amount of ET

6. If the user calls `depositETHAndCall` on L1, `finalizeDepositETH` in the `L2ETHGateway` contract will forward the additional data to the target L2 contract.

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, step 3 will change. `L1GatewayRouter` will now bypass `L1ETHGateway` when depositing ETH to improve gas efficiency.
</Aside>


## Depositing ERC20 Tokens

Several ERC20 gateway contracts are provided to bridge different kinds of ERC20 tokens, such as standard ERC20 tokens, custom ERC20 tokens, and Wrapped ETH token. `L1GatewayRouter` records the canonical mapping of ERC20 tokens to the corresponding ERC20 gateway on the L1. The `L1GatewayRouter` uses `StandardERC20Gateway` as the default ERC20 gateway for new ERC20 tokens unless a custom gateway is already set up.
Expand Down
11 changes: 0 additions & 11 deletions src/content/docs/en/technology/bridge/withdraw-gateways.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ This document describes how users and developers can utilize gateways to withdra
| `L2ERC721Gateway` | The gateway for ERC-721 token withdrawals. |
| `L2ERC1155Gateway` | The gateway for ERC-1155 token withdrawals. |

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, `L2GatewayRouter` will now bypass `L2ETHGateway` when bridging ETH to improve gas efficiency.

The upgrade is expected to be finalized on February 19th, 2024 after a two-week timelock. Scroll Sepolia has already undergone this upgrade. Read more [here](https://scroll.io/blog/to-do-slug).

</Aside>

## Overview

<ClickToZoom src={WithdrawWorkflow} alt="Withdraw Workflow" />
Expand Down Expand Up @@ -62,10 +55,6 @@ The withdrawal of ETH token works as follows.
4. The withdrawal execution transaction on L1 calls the `L1ScrollMessenger.relayMessageWithProof` function to finalize the withdrawal. In the case of ETH withdrawal, the `relayMessageWithProof` function calls `L1ETHGateway.finalizeWithdrawETH` to send back ETH to the recipient account on L1.
5. If the user calls `withdrawETHAndCall` on L2, the `finalizeWithdrawETH` in the `L1ETHGateway` contract will forward the additional data to the target L1 contract.

<Aside type="tip" title="Upgrade Notice">
With the February 2024 Bridge Upgrade, step 2 will change. `L2GatewayRouter` will now bypass `L2ETHGateway` when depositing ETH to improve gas efficiency.
</Aside>

## Withdrawing ERC20 Tokens

The withdraw of ERC20 tokens works as follows.
Expand Down
11 changes: 4 additions & 7 deletions src/content/docs/en/technology/overview/scroll-upgrades.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ The following contracts are used to initiate upgrades and execute upgrades after

### Overview

To reduce bridging costs, we implemented a number of gas optimizations on our bridge and rollup contract suite. The optimization techniques used include the following:
To reduce bridging costs, we implemented several gas optimizations on our bridge and rollup contract suite. The optimization techniques used include the following:

- We will now use constants to store some companion contract addresses, instead of using storage variables. This is possible since these values should (almost) never change. With this change we can save on a few storage load operations.
- We updated the intrinsic gas estimation in `L1MessageQueue` to use a simple upper bound instead of an exact calculation. The two results will be similar for most bridge transactions but the new implementation is significantly cheaper.
- The gateway router contracts will now bridge ETH directly through the messenger contracts, skipping `ETHGateway`.
- We merged two contracts `L1MessageQueue` and `L2GasPriceOracle` to save on call costs from one contract to the other.

### Timeline
Expand All @@ -34,15 +33,15 @@ To reduce bridging costs, we implemented a number of gas optimizations on our br
- **Scroll Sepolia:**
- Network Upgrade: January 19, 2024
- **Scroll Mainnet:**
- Upgrade Initiation: February 5, 2024
- Timelock Completion & Upgrade: February 19, 2024
- Upgrade Initiation: February 7, 2024
- Timelock Completion & Upgrade: February 21, 2024


### Technical Details

#### Code Changes
- [Bridge Cost Optimization](https://github.com/scroll-tech/scroll/pull/1011)
- [Audit Fixes](https://github.com/scroll-tech/scroll/pulls?q=is%3Apr+created%3A%3E2024-01-27+created%3A%3C2024-02-19+state%3Aopen+OZ+)
- [Audit Fixes](https://github.com/scroll-tech/scroll/pulls?q=OZ+is%3Apr+created%3A2024-01-27..2024-02-10)
- [Previously deployed version](https://github.com/scroll-tech/scroll/tree/ff380141a8cbcc214dc65f17ffa44faf4be646b6) (commit `ff380141a8cbcc214dc65f17ffa44faf4be646b6`)
- [Version deployed](https://github.com/scroll-tech/scroll/tree/) (commit `TBA`)
{/* TODO: add commit and link for deployed version */}
Expand All @@ -62,14 +61,12 @@ To reduce bridging costs, we implemented a number of gas optimizations on our br
- In `ScrollChain`, change `messageQueue` and `verifier` to `immutable`.
- In `L1ScrollMessenger`, change `counterpart`, `rollup`, and `messageQueue` to `immutable`.
- In all token gateways, change `counterpart`, `router`, and `messenger` to `immutable`.
- In `L1GatewayRouter`, skip `L1ETHGateway` and bridge directly through `L1ScrollMessenger` for ETH deposits.
- Merge `L1MessageQueue` and `L2GasPriceOracle` into a single contract `L1MessageQueueWithGasPriceOracle` (deployed on the same address as the previous `L1MessageQueue`). In this contract we also change `messenger` and `scrollChain` to `immutable`, and simplify `calculateIntrinsicGasFee`.

**Changes to L2 contracts:**

- In `L2ScrollMessenger`, change `counterpart` to `immutable`.
- In all token gateways, change `counterpart`, `router`, and `messenger` to `immutable`.
- In `L2GatewayRouter`, skip `L2ETHGateway` and bridge directly through `L2ScrollMessenger` for ETH withdrawals.

**Contracts affected:**

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/zh/developers/scroll-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import ToggleElement from "../../../../components/ToggleElement.astro"
- L2 ERC1155 Gateway: [`0x62597Cc19703aF10B58feF87B0d5D29eFE263bcc`](https://scrollscan.com/address/0x62597Cc19703aF10B58feF87B0d5D29eFE263bcc)
- Gas Oracle (deployed on Mainnet)
- L2 Gas Oracle (*soon to be deprecated*): [`0x987e300fDfb06093859358522a79098848C33852`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852)
- *after [Feb '24 Bridge Upgrade](https://scroll.io/blog/to-replace-slug)*
- *after [Feb '24 Bridge Upgrade](https://scroll.io/blog/protocol-upgrade-bridging-cost-reduction)*
- L2 Message Queue With Gas Price Oracle: [`0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B)

### L2 预部署合约
Expand Down

0 comments on commit 32d7207

Please sign in to comment.