Skip to content

Initial Euclid docs changes #424

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
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@
"cpuProverRepo": "CPU Prover Repo",
"security": "Security",
"auditsAndBugBounty": "Audits & Bug Bounty",
"l2BeatAssessment": "L2Beat Assessment"
"l2BeatAssessment": "L2Beat Assessment",
"euclidUpgrade": "Euclid Upgrade",
"darwinV2Upgrade": "Darwin v2 Upgrade",
"darwinUpgrade": "Darwin Upgrade",
"curieUpgrade": "Curie Upgrade",
"bernoulliUpgrade": "Bernoulli Upgrade"
},
"learn": {
"ethereumAndProtocols": "Ethereum & Protocols",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@

"security": "Seguridad",
"auditsAndBugBounty": "Auditorías y recompenzas por encontrar bugs",
"l2BeatAssessment": "Análisis de L2Beat"
"l2BeatAssessment": "Análisis de L2Beat",

"euclidUpgrade": "Actualización de Euclid",
"darwinV2Upgrade": "Actualización de Darwin v2",
"darwinUpgrade": "Actualización de Darwin",
"curieUpgrade": "Actualización de Curie",
"bernoulliUpgrade": "Actualización de Bernoulli"
},
"learn": {
"ethereumAndProtocols": "Ethereum y Protocolos",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/tr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@

"security": "Güvenlik",
"auditsAndBugBounty": "Denetimler ve Hata Ödül Programı",
"l2BeatAssessment": "L2Beat Değerlendirmesi"
"l2BeatAssessment": "L2Beat Değerlendirmesi",

"euclidUpgrade": "Euclid Yükseltmesi",
"darwinV2Upgrade": "Darwin v2 Yükseltmesi",
"darwinUpgrade": "Darwin Yükseltmesi",
"curieUpgrade": "Curie Yükseltmesi",
"bernoulliUpgrade": "Bernoulli Yükseltmesi"
},
"learn": {
"ethereumAndProtocols": "Ethereum & Protokoller",
Expand Down
8 changes: 7 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@

"security": "安全",
"auditsAndBugBounty": "审计和漏洞赏金",
"l2BeatAssessment": "L2Beat 评估"
"l2BeatAssessment": "L2Beat 评估",

"euclidUpgrade": "Euclid 升级",
"darwinV2Upgrade": "Darwin v2 升级",
"darwinUpgrade": "Darwin 升级",
"curieUpgrade": "Curie 升级",
"bernoulliUpgrade": "Bernoulli 升级"
},
"learn": {
"ethereumAndProtocols": "以太坊与协议",
Expand Down
24 changes: 23 additions & 1 deletion src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,29 @@ export const getSidebar = () => {
{ title: t("sidebar.technology.scrollArchitecture"), url: formatUrl("technology") },
{
title: t("sidebar.technology.scrollUpgrades"),
url: "technology/overview/scroll-upgrades",
url: formatUrl("technology/overview/scroll-upgrades"),
children: [
{
title: t("sidebar.technology.euclidUpgrade"),
url: formatUrl("technology/overview/scroll-upgrades/euclid-upgrade"),
},
{
title: t("sidebar.technology.darwinV2Upgrade"),
url: formatUrl("technology/overview/scroll-upgrades/darwin-v2-upgrade"),
},
{
title: t("sidebar.technology.darwinUpgrade"),
url: formatUrl("technology/overview/scroll-upgrades/darwin-upgrade"),
},
{
title: t("sidebar.technology.curieUpgrade"),
url: formatUrl("technology/overview/scroll-upgrades/curie-upgrade"),
},
{
title: t("sidebar.technology.bernoulliUpgrade"),
url: formatUrl("technology/overview/scroll-upgrades/bernoulli-upgrade"),
},
],
},
],
},
Expand Down
428 changes: 1 addition & 427 deletions src/content/docs/en/technology/overview/scroll-upgrades.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
section: technology
date: Last Modified
title: "Bernoulli Upgrade"
lang: "en"
permalink: "technology/overview/scroll-upgrades/bernoulli-upgrade"
---

### Overview

This upgrade features a significant reduction in transaction costs by introducing support for EIP-4844 data blobs and supporting the SHA2-256 precompile.

### Timeline

- **Scroll Sepolia**
- Network Upgrade: April 15th, 2024
- **Scroll Mainnet**
- Upgrade Initiation: April 15th, 2024
- Timelock Completion & Upgrade: April 29th, 2024

### Technical Details

#### Contract changes

The contract changes for this upgrade are in [this PR](https://github.com/scroll-tech/scroll/pull/1179), along with the audit fixes [here](https://github.com/scroll-tech/scroll/pulls?q=is%3Apr+created%3A2024-04-10..2024-04-11+fix+in%3Atitle+label%3Abug). The main changes are as follows:

- `ScrollChain` now accepts batches with either calldata or blob encoding in `commitBatch`.
- `ScrollChain` now supports finalizing blob-encoded batches through `finalizeBatchWithProof4844`.
- `MultipleVersionRollupVerifier` can now manage different on-chain verifiers for each batch encoding version.

#### Node changes

The new node version is `v5.3.0`. See [here](https://github.com/scroll-tech/go-ethereum/releases/tag/scroll-v5.3.0) for the release log.

#### zkEVM circuit changes

The new version of zkevm circuits is `v0.10.3`. See [here](https://github.com/scroll-tech/zkevm-circuits/releases/tag/v0.10.3) for the release log.

#### Audits

- [OpenZeppelin](https://blog.openzeppelin.com/scroll-eip-4844-support-audit)
- [TrailofBits](https://github.com/trailofbits/publications/blob/master/reviews/2024-04-scroll-4844-blob-securityreview.pdf)

### Compatibility

#### Sequencer and follower nodes (l2geth)

This upgrade is a hard fork as it introduces the new blob data type and the SHA2-256 precompiled contract. Operators running an `l2geth` node are required to upgrade before the hard fork block. See the [node releases](https://github.com/scroll-tech/go-ethereum/releases) for more information.

#### Indexers and Bridges

This upgrade changes the format that Scroll uses to publish data to Ethereum. Projects that rely on this data should carefully review [the new data format](/en/technology/chain/rollup/#codec), and check whether their decoders need to be adjusted. A summary of the new format:

- The format of [`BlockContext`](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L125) will not change.
- `Chunks` will [no longer include](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L162) the L2 transaction data. This will instead be [stored in a blob](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L284) attached to the `commitBatch` transaction.
- `BatchHeader` now contains one new field, [`BlobVersionedHash`](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L405).

#### Provers

This upgrade involves a breaking change in [zkevm-circuits](https://github.com/scroll-tech/zkevm-circuits). Operators running a prover node are required to upgrade.


## Bridge Upgrade

### Overview

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.
- We merged two contracts `L1MessageQueue` and `L2GasPriceOracle` to save on call costs from one contract to the other.

### Timeline

- **Scroll Sepolia:**
- Network Upgrade: January 19, 2024
- **Scroll Mainnet:**
- 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=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/6030927680a92d0285c2c13e6bb27ed27d1f32d1) (commit `6030927680a92d0285c2c13e6bb27ed27d1f32d1`)

#### Audits

- [OpenZeppelin](https://blog.openzeppelin.com/scroll-bridge-gas-optimizations-audit)

#### List of Changes

**Changes to L1 contracts:**

- 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`.
- 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`.

**Contracts affected:**

- **L1:** `L1MessageQueue`, `L2GasPriceOracle`, `ScrollChain`, `L1WETHGateway`, `L1StandardERC20Gateway`, `L1GatewayRouter`, `L1ScrollMessenger`, `L1CustomERC20Gateway`, `L1ERC721Gateway`, `L1ERC1155Gateway`.
- **L2:** `L2ScrollMessenger`, `L2WETHGateway`, `L2StandardERC20Gateway`, `L2GatewayRouter`, `L2CustomERC20Gateway`, `L2ERC721Gateway`, `L2ERC1155Gateway`.

#### Compatibility

##### Sequencer and follower nodes (l2geth)

Operators running an `l2geth` node do not need to upgrade. The changes in this upgrade will not affect `l2geth`.

##### Dapps and indexers

Dapps and indexers (and similar off-chain infrastructure) that query contracts or rely on contract interfaces would, in most cases, not need to be changed. The majority of the contract changes are internal and/or backward compatible.

If your application depends on [`L2GasPriceOracle`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852) to monitor how Scroll keeps track of the L2 gas price on L1, from the upgrade block number you will need to start monitoring [`L1MessageQueueWithGasPriceOracle`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B).

The original gas price oracle contract will be deprecated: it will no longer be updated or used by the Scroll bridge.

- Ethereum:
- `L2GasPriceOracle`: [`0x987e300fDfb06093859358522a79098848C33852`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852)
- `L1MessageQueueWithGasPriceOracle`: [`0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B)
- Sepolia:
- `L2GasPriceOracle`: [`0x247969F4fad93a33d4826046bc3eAE0D36BdE548`](https://sepolia.etherscan.io/address/0x247969F4fad93a33d4826046bc3eAE0D36BdE548)
- `L1MessageQueueWithGasPriceOracle`: [`0xF0B2293F5D834eAe920c6974D50957A1732de763`](https://sepolia.etherscan.io/address/0xF0B2293F5D834eAe920c6974D50957A1732de763)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
section: technology
date: Last Modified
title: "Curie Upgrade"
lang: "en"
permalink: "technology/overview/scroll-upgrades/curie-upgrade"
---

### Overview

This significant upgrade will reduce gas fees on the Scroll chain by 1.5x. Highlights include:

- Compresses the data stored in blobs using the [zstd](https://github.com/scroll-tech/da-codec/tree/main/libzstd) algorithm. This compression reduces the data size, allowing each blob to store more transactions, thereby reducing data availability cost per transaction.
- Adopts a modified version of the EIP-1559 pricing model which is compatible with the EIP-1559 transaction interface, bringing beneftis such as more accurate transaction pricing and a more predictable and stable fee structure.
- Support for new EVM opcodes `TLOAD`, `TSTORE`, and `MCOPY`. Users can safely use the latest Solidity compiler version `0.8.26` to build the contracts.
- Introduces a dynamic block time. During periods of traffic congestion, a block will be packed when the number of transactions reaches the circuit limit instead of waiting for the 3-second interval.

### Timeline

- **Scroll Sepolia**
- Network Upgrade: June 17th, 2024
- **Scroll Mainnet**
- Upgrade Initiation: June 20th, 2024
- Timelock Completion & Upgrade: July 3rd, 2024

### Technical Details

#### Contract Changes

The code changes for this upgrade are documented in the following PRs:

- [Accept compressed batches](https://github.com/scroll-tech/scroll/pull/1317)
- [Update `L1GasPriceOracle`](https://github.com/scroll-tech/scroll/pull/1343)
- [Change `MAX_COMMIT_SCALAR` and `MAX_BLOB_SCALAR` to 1e18](https://github.com/scroll-tech/scroll/pull/1354)
- [Remove batch index check when updating a verifier](https://github.com/scroll-tech/scroll/pull/1372)

The main changes are as follows:

- The rollup contract (`ScrollChain`) will now accept batches with both versions 1 and 2. [Version 1](https://github.com/scroll-tech/da-codec/tree/main/encoding/codecv1) is used for uncompressed blobs (pre-Curie), while [version 2](https://github.com/scroll-tech/da-codec/tree/main/encoding/codecv2) is used for compressed blobs (post-Curie).
- The `L1GasPriceOracle` contract will be updated to change the data fee formula to account for blob DA, providing a more accurate estimation of DA costs:
- Original formula: `(l1GasUsed(txRlp) + overhead) * l1BaseFee * scalar`
- New formula: `l1BaseFee * commitScalar + len(txRlp) * l1BlobBaseFee * blobScalar`

#### Node Changes

The new node version is `v5.5.0`. See the [release notes](https://github.com/scroll-tech/go-ethereum/releases/tag/scroll-v5.5.0) for the list of changes.

#### zkEVM circuit changes

The new version of zkevm circuits is `v0.11.4`. See [here](https://github.com/scroll-tech/zkevm-circuits/releases/tag/v0.11.4) for the release log.

#### Audits

- TrailofBits: coming soon!
- [Zellic](https://github.com/Zellic/publications/blob/master/Scroll%20zkEVM%20-%20Zellic%20Audit%20Report.pdf)

### Compatibility

#### Sequencer and Follower Nodes (l2geth)

This upgrade is a hard fork, introducing the `TLOAD`, `TSTORE`, and `MCOPY` opcodes. Operators running an `l2geth` node are required to upgrade before the hard fork block. For more information, see the [node release note](https://github.com/scroll-tech/go-ethereum/releases/tag/scroll-v5.4.2).

#### Dapps and Indexers

For dApps, this upgrade is backward compatible. Developers should adjust the gas fee settings to incorporate the EIP-1559 pricing model. Note that dApps can no longer rely on the fixed 3-second block time in the application logic.

For indexers, the [data format](https://docs.scroll.io/en/technology/chain/rollup/#codec) remains the same. The will be however changes to the data content:

- The `version` field in `BatchHeader` will be changed to 2 since Curie block.
- The data stored in blob will be compressed and can be decompressed by [zstd v1.5.6](https://github.com/facebook/zstd/releases/tag/v1.5.6).
Loading