|
| 1 | +--- |
| 2 | +section: technology |
| 3 | +date: Last Modified |
| 4 | +title: "Bernoulli Upgrade" |
| 5 | +lang: "en" |
| 6 | +permalink: "technology/overview/scroll-upgrades/bernoulli-upgrade" |
| 7 | +--- |
| 8 | + |
| 9 | +### Overview |
| 10 | + |
| 11 | +This upgrade features a significant reduction in transaction costs by introducing support for EIP-4844 data blobs and supporting the SHA2-256 precompile. |
| 12 | + |
| 13 | +### Timeline |
| 14 | + |
| 15 | +- **Scroll Sepolia** |
| 16 | + - Network Upgrade: April 15th, 2024 |
| 17 | +- **Scroll Mainnet** |
| 18 | + - Upgrade Initiation: April 15th, 2024 |
| 19 | + - Timelock Completion & Upgrade: April 29th, 2024 |
| 20 | + |
| 21 | +### Technical Details |
| 22 | + |
| 23 | +#### Contract changes |
| 24 | + |
| 25 | +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: |
| 26 | + |
| 27 | +- `ScrollChain` now accepts batches with either calldata or blob encoding in `commitBatch`. |
| 28 | +- `ScrollChain` now supports finalizing blob-encoded batches through `finalizeBatchWithProof4844`. |
| 29 | +- `MultipleVersionRollupVerifier` can now manage different on-chain verifiers for each batch encoding version. |
| 30 | + |
| 31 | +#### Node changes |
| 32 | + |
| 33 | +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. |
| 34 | + |
| 35 | +#### zkEVM circuit changes |
| 36 | + |
| 37 | +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. |
| 38 | + |
| 39 | +#### Audits |
| 40 | + |
| 41 | +- [OpenZeppelin](https://blog.openzeppelin.com/scroll-eip-4844-support-audit) |
| 42 | +- [TrailofBits](https://github.com/trailofbits/publications/blob/master/reviews/2024-04-scroll-4844-blob-securityreview.pdf) |
| 43 | + |
| 44 | +### Compatibility |
| 45 | + |
| 46 | +#### Sequencer and follower nodes (l2geth) |
| 47 | + |
| 48 | +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. |
| 49 | + |
| 50 | +#### Indexers and Bridges |
| 51 | + |
| 52 | +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: |
| 53 | + |
| 54 | +- The format of [`BlockContext`](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L125) will not change. |
| 55 | +- `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. |
| 56 | +- `BatchHeader` now contains one new field, [`BlobVersionedHash`](https://github.com/scroll-tech/scroll/blob/5362e28f744093495c1c09a6b68fc96a3264278b/common/types/encoding/codecv1/codecv1.go#L405). |
| 57 | + |
| 58 | +#### Provers |
| 59 | + |
| 60 | +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. |
| 61 | + |
| 62 | + |
| 63 | +## Bridge Upgrade |
| 64 | + |
| 65 | +### Overview |
| 66 | + |
| 67 | +To reduce bridging costs, we implemented several gas optimizations on our bridge and rollup contract suite. The optimization techniques used include the following: |
| 68 | + |
| 69 | +- 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. |
| 70 | +- 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. |
| 71 | +- We merged two contracts `L1MessageQueue` and `L2GasPriceOracle` to save on call costs from one contract to the other. |
| 72 | + |
| 73 | +### Timeline |
| 74 | + |
| 75 | +- **Scroll Sepolia:** |
| 76 | + - Network Upgrade: January 19, 2024 |
| 77 | +- **Scroll Mainnet:** |
| 78 | + - Upgrade Initiation: February 7, 2024 |
| 79 | + - Timelock Completion & Upgrade: February 21, 2024 |
| 80 | + |
| 81 | +### Technical Details |
| 82 | + |
| 83 | +#### Code Changes |
| 84 | +- [Bridge Cost Optimization](https://github.com/scroll-tech/scroll/pull/1011) |
| 85 | +- [Audit Fixes](https://github.com/scroll-tech/scroll/pulls?q=OZ+is%3Apr+created%3A2024-01-27..2024-02-10) |
| 86 | +- [Previously deployed version](https://github.com/scroll-tech/scroll/tree/ff380141a8cbcc214dc65f17ffa44faf4be646b6) (commit `ff380141a8cbcc214dc65f17ffa44faf4be646b6`) |
| 87 | +- [Version deployed](https://github.com/scroll-tech/scroll/tree/6030927680a92d0285c2c13e6bb27ed27d1f32d1) (commit `6030927680a92d0285c2c13e6bb27ed27d1f32d1`) |
| 88 | + |
| 89 | +#### Audits |
| 90 | + |
| 91 | +- [OpenZeppelin](https://blog.openzeppelin.com/scroll-bridge-gas-optimizations-audit) |
| 92 | + |
| 93 | +#### List of Changes |
| 94 | + |
| 95 | +**Changes to L1 contracts:** |
| 96 | + |
| 97 | +- In `ScrollChain`, change `messageQueue` and `verifier` to `immutable`. |
| 98 | +- In `L1ScrollMessenger`, change `counterpart`, `rollup`, and `messageQueue` to `immutable`. |
| 99 | +- In all token gateways, change `counterpart`, `router`, and `messenger` to `immutable`. |
| 100 | +- 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`. |
| 101 | + |
| 102 | +**Changes to L2 contracts:** |
| 103 | + |
| 104 | +- In `L2ScrollMessenger`, change `counterpart` to `immutable`. |
| 105 | +- In all token gateways, change `counterpart`, `router`, and `messenger` to `immutable`. |
| 106 | + |
| 107 | +**Contracts affected:** |
| 108 | + |
| 109 | +- **L1:** `L1MessageQueue`, `L2GasPriceOracle`, `ScrollChain`, `L1WETHGateway`, `L1StandardERC20Gateway`, `L1GatewayRouter`, `L1ScrollMessenger`, `L1CustomERC20Gateway`, `L1ERC721Gateway`, `L1ERC1155Gateway`. |
| 110 | +- **L2:** `L2ScrollMessenger`, `L2WETHGateway`, `L2StandardERC20Gateway`, `L2GatewayRouter`, `L2CustomERC20Gateway`, `L2ERC721Gateway`, `L2ERC1155Gateway`. |
| 111 | + |
| 112 | +#### Compatibility |
| 113 | + |
| 114 | +##### Sequencer and follower nodes (l2geth) |
| 115 | + |
| 116 | +Operators running an `l2geth` node do not need to upgrade. The changes in this upgrade will not affect `l2geth`. |
| 117 | + |
| 118 | +##### Dapps and indexers |
| 119 | + |
| 120 | +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. |
| 121 | + |
| 122 | +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). |
| 123 | + |
| 124 | +The original gas price oracle contract will be deprecated: it will no longer be updated or used by the Scroll bridge. |
| 125 | + |
| 126 | +- Ethereum: |
| 127 | + - `L2GasPriceOracle`: [`0x987e300fDfb06093859358522a79098848C33852`](https://etherscan.io/address/0x987e300fDfb06093859358522a79098848C33852) |
| 128 | + - `L1MessageQueueWithGasPriceOracle`: [`0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B`](https://etherscan.io/address/0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B) |
| 129 | +- Sepolia: |
| 130 | + - `L2GasPriceOracle`: [`0x247969F4fad93a33d4826046bc3eAE0D36BdE548`](https://sepolia.etherscan.io/address/0x247969F4fad93a33d4826046bc3eAE0D36BdE548) |
| 131 | + - `L1MessageQueueWithGasPriceOracle`: [`0xF0B2293F5D834eAe920c6974D50957A1732de763`](https://sepolia.etherscan.io/address/0xF0B2293F5D834eAe920c6974D50957A1732de763) |
0 commit comments