Skip to content
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

docs: manual deployment document #17

Merged
merged 2 commits into from
Jul 29, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ broadcast

# Visual Studio Code
.vscode

volume
2 changes: 1 addition & 1 deletion docker/config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CHAIN_ID_L2 = 222222

MAX_TX_IN_CHUNK = 100
MAX_BLOCK_IN_CHUNK = 100
MAX_L1_MESSAGE_GAS_LIMIT = 10000
MAX_L1_MESSAGE_GAS_LIMIT = 10000000

L1_CONTRACT_DEPLOYMENT_BLOCK = 0

Expand Down
86 changes: 86 additions & 0 deletions docs/manual-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Manual Deployment @scroll-tech/scroll-contracts

## Overview

This document will guide you through manually deploying Scroll contracts to both layer 1 and layer 2 networks.

### Requirements

This repository requires `node` version>=20.12.2, `yarn` and `foundry` to be previously installed.

- **Node.js:** https://nodejs.org/en/download/package-manager
- **Yarn:** https://www.npmjs.com/package/yarn
- **Foundry:** https://book.getfoundry.sh/getting-started/installation

### Config

1. Create directory `volume` on the root directory of the repo (all config file will be put or generated under this directory)

```bash
mkdir volume
```

2. Create config file, and copy config variables from example file `./docker/config-example.toml`

```bash
cp ./docker/config-example.toml ./volume/config.toml
```

If you've previously launched Scroll chain cocomponents using Scroll-SDK, you may already have a config.toml file. If so directly copy it to `./volume/config.toml`.
**Important Note: If you are launching a scroll chain through scroll-sdk, make sure this config.toml file stay same as the one used in scroll-sdk.**

Details about the some important variables you may want to change:

| Configuration Variable | Description |
| -------------------------------- | ---------------------------------------------------------------------------------------- |
| L1_RPC_ENDPOINT | The RPC endpoint for the layer 1 network |
| L2_RPC_ENDPOINT | The RPC endpoint for the layer 2 network |
| CHAIN_ID_L1 | The chain ID of the layer 1 network |
| CHAIN_ID_L2 | The chain ID of the layer 2 network |
| DEPLOYER_PRIVATE_KEY | The private key of the deployer on both layer 1 and layer 2 |
| OWNER_PRIVATE_KEY | The private key of the owner of Scroll contracts on both layer 1 and layer 2 |
| L1_COMMIT_SENDER_PRIVATE_KEY | The private key of the commit sender (sequencer) on layer 1 |
| L1_FINALIZE_SENDER_PRIVATE_KEY | The private key of the finalize sender (prover) on layer 1 |
| L1_GAS_ORACLE_SENDER_PRIVATE_KEY | The private key of the gas oracle sender on layer 1 |
| L2_GAS_ORACLE_SENDER_PRIVATE_KEY | The private key of the gas oracle sender on layer 2 |
| DEPLOYER_ADDR | The address of the deployer on both layer 1 and layer 2 |
| OWNER_ADDR | The address of the owner of Scroll contracts on both layer 1 and layer 2 |
| L1_COMMIT_SENDER_ADDR | The address of the commit sender (sequencer) on layer 1 |
| L1_FINALIZE_SENDER_ADDR | The address of the finalize sender (prover) on layer 1 |
| L1_GAS_ORACLE_SENDER_ADDR | The address of the gas oracle sender on layer 1 |
| L2_GAS_ORACLE_SENDER_ADDR | The address of the gas oracle sender on layer 2 |
| DEPLOYMENT_SALT | The salt used to deploy contracts, make it unique to prevent contract address collisions |
| L1_CONTRACT_DEPLOYMENT_BLOCK | The block that l2-sequencer and bridge-history-fetcher start to sync contracts event |

### Deploy

1. Install packages

```bash
yarn install
```

2. Initialize git submodules.

```bash
git submodule update --init --recursive
```

3. Set and export environment variables (Change the RPCs to the one you are using)

```bash
export L1_RPC_ENDPOINT=http://l1-devnet.scrollsdk
export L2_RPC_ENDPOINT=http://l2-rpc.scrollsdk
```

4. Generate predicted contract addresses (This step required mainly because we are checking if every contracts deployed as we expected)

```bash
forge script scripts/deterministic/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config"
```

5. Deploy contracts on both layer1 and layer2 (Deployment may be interrupted by errors. Rerun the command to resume in such cases.)

```bash
./docker/scripts/deploy.sh
```
Loading