Skip to content

Adds dencun / cancun info and precompile limits #216

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

Merged
merged 4 commits into from
Apr 15, 2024
Merged
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
4 changes: 4 additions & 0 deletions src/content/docs/en/developers/developer-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Use the table below to configure your Ethereum tools to the Scroll Sepolia Testn
Contracts](/developers/verifying-smart-contracts).
</Aside>

<Aside type="danger" title="">
Features from the Dencun upgrade are not yet available on Scroll. Please use `shanghai` as your EVM target and avoid using a Solidity version higher than `0.8.23`.
</Aside>

### Hardhat

Modify your Hardhat config file `hardhat.config.ts` to point at the Scroll Sepolia Testnet public RPC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For open-source contributors and infrastructure builders, please contact our tea

## EVM Opcodes


| Opcode | Solidity equivalent | Scroll Behavior |
| --------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------- |
| `BLOCKHASH` | `block.blockhash` | Returns `keccak(chain_id \|\| block_number)` for the last 256 blocks. |
Expand All @@ -28,19 +29,38 @@ For open-source contributors and infrastructure builders, please contact our tea
| `BASEFEE` | `block.basefee` | Disabled.[^eip1559] If the opcode is encountered, the transaction will be reverted. |
| `SELFDESTRUCT` | `selfdestruct` | Disabled. If the opcode is encountered, the transaction will be reverted.[^willadpot] |

<Aside type="caution" title="">
Opcodes from the Cancun upgrade are not yet available on Scroll, including `MCOPY`, `TSTORE`, `TLOAD`, `BLOBHASH` and `BLOBBASEFEE`. Additionally, [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) for accessing the Beacon Chain block root is not supported. We recommend using `shanghai` as your EVM target and avoiding using a Solidity version higher than `0.8.23`.
</Aside>

[^eip1559]: We have currently disabled EIP-1559 on Scroll.
[^willadpot]: Will change to adopt Ethereum’s solution in the future.

## EVM Precompiles

The `RIPEMD-160` (address `0x3`) and `blake2f` (address `0x9`) precompiles are currently not supported. The `SHA2-256` (address `0x2`) is currently supported on Scroll Sepolia, but will soon be supported on Scroll Mainnet. Calls to unsupported precompiled contracts will revert. We plan to enable these precompiles in future hard forks.
The `RIPEMD-160` (address `0x3`) `blake2f` (address `0x9`), and `point evaluation` (address `0x0a`) precompiles are currently not supported. The `SHA2-256` (address `0x2`) is currently supported on Scroll Sepolia, but will soon be supported on Scroll Mainnet. Calls to unsupported precompiled contracts will revert. We plan to enable these precompiles in future hard forks.

The `modexp` precompile is supported but only supports inputs of size less than or equal to 32 bytes (i.e. `u256`).

The `ecPairing` precompile is supported, but the number of points(sets, pairs) is limited to 4, instead of 6.

The other EVM precompiles are all supported: `ecRecover`, `identity`, `ecAdd`, `ecMul`.

### Precompile Limits

Because of a bounded size of the zkEVM circuits, there is an upper limit on the number of calls that can be made for some precompiles. These transactions will not revert, but simply be skipped by the sequencer if they cannot fit into the space of the circuit. Read more about the [Circuit Capacity Checker](/en/technology/sequencer/execution-node#circuit-capacity-checker).

| Precompile / Opcode | Limit |
| ------------------- | ----- |
| `keccak256` | 3157 |
| `ecRecover` | 119 |
| `modexp` | 23 |
| `ecAdd` | 50 |
| `ecMul` | 50 |
| `ecPairing` | 2 |
{/* TODO: Add SHA256 after upgrade */}


## State Account

### **Additional Fields**
Expand Down
8 changes: 8 additions & 0 deletions src/content/docs/en/technology/chain/differences.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ permalink: "technology/chain/differences"
whatsnext: { "Bridge": "/en/technology/bridge/cross-domain-messaging/" }
---

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

## Opcodes

| Opcode | Scroll Behavior |
Expand All @@ -26,6 +28,7 @@ whatsnext: { "Bridge": "/en/technology/bridge/cross-domain-messaging/" }
| `0x05` | `modexp` | Restrict the input values `B, E, M` to unsigned integers less than $2^{256}$. |
| `0x08` | `ecPairing` | The inputs are still multiple of 6 32-byte values, but limit the number of tuples to at most 4. |
| `0x09` | `blake2f` | Currently not supported. |
| `0x0a` | `point evaluation` | Currently not supported. |

The remaining precompiled contracts have the same behavior as Ethereum. However, their maximum usage within a block is constrained by a limit tied to the zkEVM circuit capacity.

Expand All @@ -44,3 +47,8 @@ EIPs imported from the Shanghai fork:
- [EIP-3651](https://eips.ethereum.org/EIPS/eip-3651): Warm `COINBASE`
- [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855): `PUSH0` instruction
- [EIP-3860](https://eips.ethereum.org/EIPS/eip-3860): Limit and meter initcode


<Aside type="tip" title="">
Opcodes from the Cancun upgrade are not yet available on Scroll, including `MCOPY`, `TSTORE`, `TLOAD`, `BLOBHASH` and `BLOBBASEFEE`. Additionally, [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) for accessing the Beacon Chain block root is not supported.
</Aside>