Skip to content

Commit

Permalink
Curie updates (#289)
Browse files Browse the repository at this point in the history
* Curie updates (#271)

* curie-update-libzkp-version

* security nit

* move contact info into highlight

* change Aside type

* Update running-a-scroll-node.mdx (#278)

* nodeKey hashing are done with domain 512 not 256

Am currently making a storage prover in noir and found this error

In the zktrie repo nodekeys are hashed with ToSecureKey() in type/util.go (afaik)
https://github.com/scroll-tech/zktrie/blob/23181f209e94137f74337b150179aeb80c72e7c8/types/util.go#L107

ToSecureKey() uses Hash()  in types/bytes32.go which uses HASH_DOMAIN_BYTE32 as domain which is 256 *2 (512)
see here: https://github.com/scroll-tech/zktrie/blob/23181f209e94137f74337b150179aeb80c72e7c8/types/hash.go#L16

and here is where i did my test in noir :D (account leaf is lower in same file)
https://github.com/jimjimvalkema/scrollZkStorageProofs/blob/bcdd922405e046e99787b8b47f374befac170779/ScrollStorageProver/src/main.nr#L168

* add get in touch button

* Revert "add get in touch button"

This reverts commit 5c695f2.

* Curie update details (#286)

* remove legacy flag for foundry

* update Curie details

* fix typo

* oops

* Add PR descriptions

---------

Co-authored-by: colinlyguo <[email protected]>
Co-authored-by: colin <[email protected]>
Co-authored-by: Sina Pilehchiha <[email protected]>
Co-authored-by: Péter Garamvölgyi <[email protected]>
Co-authored-by: jimjimvalkema <[email protected]>
Co-authored-by: Daniel Helm <[email protected]>
Co-authored-by: zhengqi zhang <[email protected]>
  • Loading branch information
8 people authored Jul 5, 2024
1 parent ae172a2 commit 4071770
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/en/developers/developer-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const config: HardhatUserConfig = {
To deploy using the Scroll Sepolia Testnet Public RPC, run:

```bash
forge create ... --rpc-url=https://sepolia-rpc.scroll.io/ --legacy
forge create ... --rpc-url=https://sepolia-rpc.scroll.io/
```

### Remix Web IDE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ The Scroll Sepolia Testnet allows anyone to deploy a smart contract on Scroll. I
--value <lock_amount> \
--constructor-args <unlock_time> \
--private-key <your_private_key> \
--legacy \
contracts/Lock.sol:Lock
```

Expand All @@ -77,7 +76,7 @@ The Scroll Sepolia Testnet allows anyone to deploy a smart contract on Scroll. I
--value 0.00000000002ether \
--constructor-args 1696118400 \
--private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \
--legacy contracts/Lock.sol:Lock
contracts/Lock.sol:Lock
```

## Questions and Feedback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ For most developers, using [our official RPC endpoint](/en/developers/developer-

### Finding the latest version

We recommend using the latest release at https://github.com/scroll-tech/go-ethereum/releases. The required version for Scroll Mainnet is `scroll-v5.4.2` or higher, and for Scroll Sepolia it is `scroll-v5.4.2` or higher. If you'd like to keep up with new node releases, go to https://github.com/scroll-tech/go-ethereum, click on **Watch**, **Custom**, and make sure that **Releases** is selected.
We recommend using the latest release at https://github.com/scroll-tech/go-ethereum/releases. The required version for Scroll Mainnet is `scroll-v5.5.0` or higher, and for Scroll Sepolia it is `scroll-v5.4.2` or higher. If you'd like to keep up with new node releases, go to https://github.com/scroll-tech/go-ethereum, click on **Watch**, **Custom**, and make sure that **Releases** is selected.

For the remainder of this guide, `VERSION` will denote the version tag. For example, `scroll-v5.4.2`.
For the remainder of this guide, `VERSION` will denote the version tag. For example, `scroll-v5.5.0`.

### Hardware Requirements

Expand Down Expand Up @@ -176,7 +176,7 @@ enode://c7b2d94e95da343db6e667a01cef90376a592f2d277fbcbf6e9c9186734ed8003d013895
"archimedesBlock": 0,
"shanghaiBlock": 0,
"bernoulliBlock": 5220340,
"curieBlock": 6924036,
"curieBlock": 7096836,
"clique": {
"period": 3,
"epoch": 30000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Sends ERC20 tokens from L1 to L2.
| token | The token address on L1. |
| to | The address of recipient's account on L2. |
| amount | The amount of token to transfer, in wei. |
| gasLimit | Gas limit required to complete the deposit on L2. 20000 should be enough to process the transaction, depending on the Gateway, but unused funds are refunded. |
| gasLimit | Gas limit required to complete the deposit on L2. 200000 should be enough to process the transaction, depending on the Gateway, but unused funds are refunded. |

### getL2ERC20Address

Expand Down
161 changes: 86 additions & 75 deletions src/content/docs/en/technology/chain/rollup.mdx

Large diffs are not rendered by default.

69 changes: 66 additions & 3 deletions src/content/docs/en/technology/overview/scroll-upgrades.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,71 @@ The following contracts are used to initiate upgrades and execute upgrades after

You can join our [Telegram channel for technical updates](https://t.me/scroll_tech_updates), which includes future upgrade announcements and on-chain operation events.

## 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).

## Bernoulli Upgrade

### Overview
Expand Down Expand Up @@ -54,7 +119,7 @@ The new version of zkevm circuits is `v0.10.3`. See [here](https://github.com/sc
#### Audits

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

### Compatibility

Expand Down Expand Up @@ -87,14 +152,12 @@ To reduce bridging costs, we implemented several gas optimizations on our bridge

### 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ permalink: "technology/security/audits-and-bug-bounty"

import Aside from "../../../../../components/Aside.astro"

<Aside>
For any discoveries of critical vulnerabilities outside of the scope of the bug bounty program, please also send reports to [email protected].
</Aside>

Scroll treats security as a top priority.

Aside from rigorous testing, an internal security team, and comprehensive code reviews, we have also engaged with multiple security audit firms to conduct audits on our codebase. We have also launched a bug bounty program to encourage the community to participate in the security of our protocol.
Expand Down Expand Up @@ -78,4 +82,4 @@ Rewards depend on the severity of reported vulnerabilities:

The scope of the bug bounty program covers the blockchain infrastructure and the smart contracts for bridging and rollup. For a detailed breakdown of bug categories, please refer to the bug bounty page.

Besides the listed scopes in the bug bounty program, we also encourage reporting any vulnerabilities identified to Immunefi, which we will still consider for rewards. For any discoveries of critical vulnerabilities outside of the scope of the bug bounty program, please also send reports to [email protected].
Besides the listed scopes in the bug bounty program, we also encourage reporting any vulnerabilities identified to Immunefi, which we will still consider for rewards.
4 changes: 2 additions & 2 deletions src/content/docs/en/technology/sequencer/zktrie.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ An Ethereum Account Leaf Node consists of an Ethereum address and a state accoun
var address byte[20] // 20 bytes in big-endian
valHi := address[0:16]
valLo := address[16:20] * 2^96 // padding 12 bytes of 0 at the end
nodeKey := h{256}(valHi, valLo)
nodeKey := h{512}(valHi, valLo)
```

A state account struct in the Scroll consists of the following fields (`Fr` indicates the finite field and is a 254-bit value)
Expand Down Expand Up @@ -182,7 +182,7 @@ A Storage Leaf Node encodes a key-value pair where both key and value are `u256`
var storageKey byte[32] // 32 bytes in big-endian
valHi := storageKey[0:16]
valLo := storageKey[16:32]
nodeKey := h{256}(valHi, valLo)
nodeKey := h{512}(valHi, valLo)
```

The storage value is a `u256` value. The `flag` for the storage value is 1, shown below.
Expand Down

0 comments on commit 4071770

Please sign in to comment.