You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/en/sdk/technical-stack/contracts.mdx
+14-18Lines changed: 14 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ import Aside from "../../../../../components/Aside.astro"
13
13
14
14
## Overview
15
15
16
-
Contracts deployed for a Scroll SDK chain include both contracts on the L1 (or basechain), and contracts deployed on the L2. Additionally, the L2 has "pre-deployed" contracts, matching those on [Scroll](/en/developers/scroll-contracts#l2-predeploys).
16
+
Contracts deployed for a Scroll SDK chain include both contracts on the L1 (or basechain), and contracts deployed on the L2 (or SDK chain). Additionally, the L2 has "pre-deployed" contracts, matching those on [Scroll](/en/developers/scroll-contracts#l2-predeploys).
17
17
18
18
## Primary Contracts
19
19
@@ -49,30 +49,23 @@ Although there are many contracts deployed during a new chain deployment, the mo
49
49
50
50
## Deployment Process
51
51
52
-
All contracts are available in the [scroll-contracts repo](https://github.com/scroll-tech/scroll-contracts), and [Docker files](https://github.com/scroll-tech/scroll-contracts/tree/feat-deterministic-deployment/docker) and [Foundry scripts](https://github.com/scroll-tech/scroll-contracts/tree/feat-deterministic-deployment/scripts/deterministic) used for deployment available in the `feat-deterministic-deployment` branch.
53
-
54
-
Contracts are deployed using deterministic addresses, with a salt used to generate the address of the contract. For every new deployment, a unique salt should be configured in `config.toml`.
55
-
56
-
During deployment, a simulation is first done to determine what address a contract will deploy to. This step is done during the creation the config files for each service's chart and when the `genesis.json` file is created. Contract addresses are then used to set each service's configuration (see [`gen-configs.sh`](https://github.com/scroll-tech/scroll-contracts/blob/feat-robust-deployment/docker/scripts/gen-configs.sh)).
52
+
Contracts are deployed by the `contracts` chart. Deterministic addresses are used, with a salt used to generate the address of the contract. For every new deployment, a unique salt should be configured in `config.toml`.
57
53
58
-
{/* <!-- TODO: modify URL to develop branch --> */}
54
+
During the configuration generation step, a simulation is first done to determine what address a contract will deploy to. This step is done during the creation of the config files for each service's chart and when the `genesis.json` file is created. Contract addresses are then used to set each service's configuration (see [`gen-configs.sh`](https://github.com/scroll-tech/scroll-contracts/blob/feat-robust-deployment/docker/scripts/gen-configs.sh)).
59
55
60
56
Then, before the `contracts` chart is installed, you will need to fund your SDK `DEPLOYER` account to deploy all contracts on L1 and L2 using actual transactions.
61
57
62
-
The `contracts` pod will connect to the cluster's RPCs and deploy the necessary contracts.
58
+
The `contracts` pod will connect to the L2 RPC and deploy the necessary contracts from the `DEPLOYER` account.
63
59
64
-
{/* TODO: is this still true? */}
65
-
{/* To view the complete logs from the deployment process, see the `broadcast` folder in `/charts/scroll-stack/`. */}
66
-
67
-
{/* TODO: check again once we do this. */}
68
60
<Asidetype="tip">
61
+
All contracts are available in the [scroll-contracts repo](https://github.com/scroll-tech/scroll-contracts), and [Docker files](https://github.com/scroll-tech/scroll-contracts/tree/feat-deterministic-deployment/docker) and [Foundry scripts](https://github.com/scroll-tech/scroll-contracts/tree/feat-deterministic-deployment/scripts/deterministic) used for deployment available in the `feat-deterministic-deployment` branch.
62
+
69
63
For manually deploying contracts without the reliance on a docker container, please review [this guide](https://github.com/scroll-tech/scroll-contracts/blob/feat-deterministic-deployment/docs/manual-deployment.md).
70
-
{/* TODO: Link to develop branch once merged. */}
71
64
</Aside>
72
65
73
66
### Funding Deployment Accounts
74
67
75
-
You will need to manually fund the following wallet addresses from `config.toml`:
68
+
In production deployments, you will need to manually fund the following wallet addresses from `config.toml`:
To fund an L1 addresses when using Anvil, you can run the command below, replacing the first param with the address.
85
+
To fund an L1 addresses when using Anvil in a devnet, run `scrollsdk helper fund-accounts --dev`. Or, to manually set individual account balances, you can also run the command below, replacing the first param with the address.
To fund an L2 address directly via the L1 bridge, you can run the command below, replacing the RPC and setting a private key of an account funded on L1 and a recipient address on L2.
You can also use the interactive `scrollsdk helper fund-accounts --layer=2 [--private-key=<private-key>]` command to fund an L2 address, optionally passing a private key as funder.
Generating ZK Proofs is a key component for any ZK Rollup, and it can often be the most painful part of operating a zk rollup.
13
14
14
-
{/* Info about running the Ansible script for proof generation (and eventually using external prover partners) will go here. */}
15
+
## Proof Generation Flow
15
16
16
-
Currently, Scroll SDK requires that you run your own provers. We're actively working with proof generation platforms to make proof generation as easy as providing an API key.
17
17
18
18
## Mock Finalization
19
19
20
-
In its default configuration, testnets can run without a ZK provers and simulate finalization. The L1 contract allows finalizing a batch without a valid proof, and the `rollup-relay` is configured to call the finalize method after 1 hour without a proof in the default configuration.
20
+
Scroll SDK supports being run in two modes -- one using mock finalization, the other requiring valid zk proofs to finalize. Mock finalization is useful for devnets and testnets, where the zk proof generation is an unnecessary cost beyond brief testing periods.
21
21
22
-
To change this mock finalization delay, adjust `config.toml` to change `TEST_ENV_MOCK_FINALIZE_TIMEOUT` from `3600` to the number of seconds you want to delay.
22
+
In its default configuration, testnets are without a ZK provers and simulate finalization. The L1 contract allows finalizing a batch without a valid proof, and the `rollup-relay` is configured to call the finalize method after 1 hour without a proof in the default configuration.
23
+
24
+
To change this mock finalization delay, adjust `config.toml` to change `rollup.TEST_ENV_MOCK_FINALIZE_TIMEOUT` from `3600` to the number of seconds you want to delay.
23
25
24
26
To disable mock finalization entirely, adjust `config.toml` to change `TEST_ENV_MOCK_FINALIZE_ENABLED` to `false`.
25
27
26
-
## Deploy a Prover
28
+
<Asidetype="danger">
29
+
30
+
Because different "testnet" contracts are deployed depending on if `TEST_ENV_MOCK_FINALIZE_ENABLED` is true, it should be set to true from the genesis block for any production environments intended to secure user funds.
31
+
32
+
</Aside>
33
+
34
+
## Outsourcing Proof Generation to External Service Providers
35
+
36
+
Teams shouldn't need to become ZK infrastructure experts (or professional GPU sourcers) to run a chain. We've partnered with proof generation specialists to make outsoucing proof generation as easy as deploying one more chart.
37
+
38
+
Using a proof generation service offers the following benefits:
39
+
- Generate proofs on-demand through API-based services
40
+
- Choose between enterprise solutions or proof marketplaces
41
+
- Scale proof generation elastically based on your actual usage instead of reserving a specific capacity
42
+
- Maintain flexibility to switch between providers, distribute load between them, or run your own GPUs
43
+
44
+
The following providers already support generating Scroll SDK proofs:
45
+
- Sindri
46
+
- Chart
47
+
- Docs
48
+
- Snarkify
49
+
- Chart
50
+
- Docs
51
+
52
+
{/* TODO: Add links to charts and docs */}
53
+
54
+
<Asidetype="caution">
55
+
These Helm Charts are not maintained by Scroll, but we have collaborated with the teams to integrate the [`scroll-proving-sdk`](https://github.com/scroll-tech/scroll-proving-sdk).
56
+
</Aside>
57
+
58
+
See the [Enable Proof Generation using External Providers](/en/sdk/guides/digital-ocean-alt-gas-token#enable-proof-generation-using-external-providers) section of the Digital Ocean guide for an example of how to enable chunk, batch and bundle proofs using external providers.
59
+
60
+
## Self-host a Prover
61
+
62
+
<Asidetype="danger">
63
+
As of Oct. 31, 2024, these instructions are out-of-date. We are working on updating them.
64
+
</Aside>
27
65
28
66
<Asidetype="caution">
29
67
These instructions are an outline of the process, but our testing of the SDK has focused on working with external proving service providers, so may be out of date with out current SDK implementation.
0 commit comments