Skip to content

Commit 987580f

Browse files
add new file
1 parent 1bee703 commit 987580f

File tree

5 files changed

+243
-336
lines changed

5 files changed

+243
-336
lines changed

docs/cdk/get-started/deploy-rollup/configure-node-deployment.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@
1717
curl -L https://github.com/0xPolygonHermez/zkevm-node/releases/latest/download/$ZKEVM_NET.zip > $ZKEVM_NET.zip && unzip -o $ZKEVM_NET.zip -d $ZKEVM_DIR && rm $ZKEVM_NET.zip
1818
```
1919

20-
3. Go to the `zkevm/zkevm-config` directory and copy the `example.env` file into `.env` file and open it for editing.
21-
22-
!!! warning
23-
- There is no `zkevm/mainnet` dir!
24-
- Stopped here today.
25-
- Last week, I hacked this and got the node up but it was also failing on lack of verified contracts.
20+
3. Go to the `zkevm/zkevm-config` directory and create an `.env` file and open it for editing.
2621

2722
```sh
2823
cd ../zkevm-config/
29-
cp ~/$ZKEVM_DIR/$ZKEVM_NET/example.env $ZKEVM_CONFIG_DIR/.env
30-
vim $ZKEVM_CONFIG_DIR/.env
24+
nano .env
3125
```
3226

3327
4. In the `.env` file, set the following:
@@ -38,6 +32,11 @@
3832
ZKEVM_NODE_POOLDB_DATA_DIR = "~/zkevm/data/pooldb"
3933
```
4034

35+
!!! warning
36+
- You may have to hardcode these variables into the `mainnet/docker-compose.yaml` file.
37+
- Also, the `ZKEVM_NETWORK` variable which you can set to `mainnet`.
38+
- Note, there are more than one references to hardcode in.
39+
4140
## Approve MATIC token for sequencer
4241

4342
1. Launch a Hardhat console connected to the Goerli network.
@@ -47,20 +46,20 @@
4746
npx hardhat console --network goerli
4847
```
4948

50-
2. Add the extra data and copy/paste the following code into the open console.
49+
2. Add the missing data as directed and copy/paste the following code into the open console.
5150

5251
```js
5352
const provider = ethers.getDefaultProvider("<GOERLI_RPC_NODE>"); // set Goerli RPC node
54-
const privateKey = "<TRUSTED_SEQUENCER_PK>"; // from wallet.txt
53+
const privateKey = "<TRUSTED_SEQUENCER_PK>"; // from wallets.txt
5554
const wallet = new ethers.Wallet(privateKey, provider);
5655
5756
const maticTokenFactory = await ethers.getContractFactory(
5857
"ERC20PermitMock",
5958
provider
6059
);
61-
maticTokenContract = maticTokenFactory.attach("<maticTokenAddress>"); // from ~/zkevm-contracts/deployments/goerli_*/deploy_output.json
60+
maticTokenContract = maticTokenFactory.attach("<maticTokenAddress>"); // from ~/zkevm-contracts/deployments/deploy_output.json
6261
maticTokenContractWallet = maticTokenContract.connect(wallet);
63-
await maticTokenContractWallet.approve("<polygonZkEVMAddress>", ethers.utils.parseEther("100.0")); // from ~/zkevm-contracts/deployments/goerli_*/deploy_output.json
62+
await maticTokenContractWallet.approve("<polygonZkEVMAddress>", ethers.utils.parseEther("100.0")); // from ~/zkevm-contracts/deployments/deploy_output.json
6463
```
6564

6665
## Configure genesis
@@ -71,7 +70,7 @@
7170
cp ~/zkevm-contracts/deployment/genesis.json ~/zkevm/mainnet/config/environments/mainnet/public.genesis.config.json
7271
```
7372

74-
2. Copy/paste the json below to the head of the file inputting the data from `~/zkevm/zkevm-contracts/deployments/deploy_output.json`.
73+
2. Copy/paste the json below to the head of the `public.genesis.config.json` file inputting the data from `~/zkevm/zkevm-contracts/deployments/deploy_output.json`.
7574

7675
!!! important
7776
The `genesisBlockNumber` is called `deploymentBlockNumber` in `deploy_output.json`.
@@ -90,8 +89,11 @@
9089

9190
Add the missing parameters in the `~/zkevm/mainnet/config/environments/mainnet/public.node.config.toml` file.
9291

92+
!!! warning
93+
Rename the file if necessary.
94+
9395
- `ApiKey` # for Etherscan
94-
- `URL` # for Goerli node
96+
- `URL` # for Goerli node, under [ETHERMAN]
9597

9698
## Add wallet keystores
9799

Lines changed: 17 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,28 @@
11
## Configure prover DB
22

3-
Edit `~/zkevm/mainnet/db/scripts/init_prover_db.sql` to set up the node databases.
3+
1. Copy/paste the following script into `~/zkevm/mainnet/db/scripts/init_prover_db.sql` to replace what's there.
44

5-
```sql
6-
CREATE DATABASE prover_db;
7-
\connect prover_db;
5+
```sql
6+
CREATE DATABASE prover_db;
7+
\connect prover_db;
88

9-
CREATE SCHEMA state;
9+
CREATE SCHEMA state;
1010

11-
CREATE TABLE state.nodes (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);
12-
CREATE TABLE state.program (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);
11+
CREATE TABLE state.nodes (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);
12+
CREATE TABLE state.program (hash BYTEA PRIMARY KEY, data BYTEA NOT NULL);
1313

14-
CREATE USER prover_user with password 'prover_pass';
15-
GRANT CONNECT ON DATABASE prover_db TO prover_user;
16-
ALTER USER prover_user SET SEARCH_PATH=state;
17-
GRANT ALL PRIVILEGES ON SCHEMA state TO prover_user;
18-
GRANT ALL PRIVILEGES ON TABLE state.nodes TO prover_user;
19-
GRANT ALL PRIVILEGES ON TABLE state.program TO prover_user;
20-
```
14+
CREATE USER prover_user with password 'prover_pass';
15+
GRANT CONNECT ON DATABASE prover_db TO prover_user;
16+
ALTER USER prover_user SET SEARCH_PATH=state;
17+
GRANT ALL PRIVILEGES ON SCHEMA state TO prover_user;
18+
GRANT ALL PRIVILEGES ON TABLE state.nodes TO prover_user;
19+
GRANT ALL PRIVILEGES ON TABLE state.program TO prover_user;
20+
```
2121

22-
Save and exit the file.
22+
2. Save and exit the file.
2323

2424
## Configure the prover
2525

26-
Create the `~/zkevm/config.json` and paste the configs below.
26+
1. Create a file called `config.json` and copy/paste the mock prover configuration from here: https://github.com/0xPolygonHermez/zkevm-node/blob/develop/test/config/test.prover.config.json.
2727

28-
!!! info
29-
`aggregatorClientHost` only required when running the full prover.
30-
31-
??? "Click to expand the <code>config.json</code> file"
32-
```json
33-
{
34-
"runExecutorServer": false,
35-
"runExecutorClient": false,
36-
"runExecutorClientMultithread": false,
37-
38-
"runStateDBServer": false,
39-
"runStateDBTest": false,
40-
41-
"runAggregatorServer": false,
42-
"runAggregatorClient": true,
43-
"proverName": "static_prover",
44-
45-
"runFileGenBatchProof": false,
46-
"runFileGenAggregatedProof": false,
47-
"runFileGenFinalProof": false,
48-
"runFileProcessBatch": false,
49-
"runFileProcessBatchMultithread": false,
50-
"runFileExecutor": false,
51-
52-
"runKeccakScriptGenerator": false,
53-
"runKeccakTest": false,
54-
"runStorageSMTest": false,
55-
"runBinarySMTest": false,
56-
"runMemAlignSMTest": false,
57-
"runSHA256Test": false,
58-
"runBlakeTest": false,
59-
60-
"executeInParallel": true,
61-
"useMainExecGenerated": true,
62-
"useProcessBatchCache": true,
63-
"saveRequestToFile": false,
64-
"saveInputToFile": true,
65-
"saveDbReadsToFile": true,
66-
"saveDbReadsToFileOnChange": false,
67-
"saveOutputToFile": true,
68-
"saveFilesInSubfolders": false,
69-
"saveProofToFile": true,
70-
"saveResponseToFile": false,
71-
"loadDBToMemCache": true,
72-
"loadDBToMemCacheInParallel": false,
73-
"dbMTCacheSize": 16384,
74-
"dbProgramCacheSize": 16384,
75-
"dbMultiWrite": true,
76-
"dbFlushInParallel": true,
77-
78-
"opcodeTracer": false,
79-
"logRemoteDbReads": false,
80-
"logExecutorServerResponses": false,
81-
82-
"executorServerPort": 50071,
83-
"executorROMLineTraces": false,
84-
"executorClientPort": 50071,
85-
"executorClientHost": "127.0.0.1",
86-
87-
"stateDBServerPort": 5432,
88-
"stateDBURL": "local",
89-
90-
"aggregatorServerPort": 50081,
91-
"aggregatorClientPort": 50081,
92-
"aggregatorClientHost": "", // YOUR PUBLIC IP ADDRESS
93-
"aggregatorClientMockTimeout": 10000000,
94-
95-
"mapConstPolsFile": false,
96-
"mapConstantsTreeFile": false,
97-
98-
"inputFile": "testvectors/aggregatedProof/recursive1.zkin.proof_0.json",
99-
"inputFile2": "testvectors/aggregatedProof/recursive1.zkin.proof_1.json",
100-
101-
"outputPath": "/output/",
102-
"configPath": "/mnt/prover/config/",
103-
"zkevmCmPols_disabled": "/mnt/prover/runtime/zkevm.commit",
104-
"c12aCmPols": "runtime/c12a.commit",
105-
"recursive1CmPols_disabled": "runtime/recursive1.commit",
106-
"recursive2CmPols_disabled": "runtime/recursive2.commit",
107-
"recursivefCmPols_disabled": "runtime/recursivef.commit",
108-
"finalCmPols_disabled": "runtime/final.commit",
109-
110-
"publicsOutput": "public.json",
111-
"proofFile": "proof.json",
112-
113-
"databaseURL": "postgresql://prover_user:prover_pass@zkevm-state-db:5432/prover_db",
114-
"databaseURL_disabled": "local",
115-
"dbNodesTableName": "state.nodes",
116-
"dbProgramTableName": "state.program",
117-
"dbConnectionsPool": true,
118-
"cleanerPollingPeriod": 600,
119-
"requestsPersistence": 3600,
120-
"maxExecutorThreads": 20,
121-
"maxProverThreads": 8,
122-
"maxStateDBThreads": 8
123-
}
124-
```
28+
2. Save it to the `~/zkevm/` directory.

0 commit comments

Comments
 (0)