Skip to content

Commit

Permalink
Prepare docs and action for mainnet release (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar authored Mar 27, 2023
1 parent b4136fa commit bd4ff0e
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 10 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ jobs:
uses: olegtarasov/[email protected]
id: tagName

- name: Put testnet artifacts into a single zip
- name: Put testnet and mainnet artifacts into a single zip
run: |
# TESTNET
mkdir -p testnet/config/environments/public
mkdir -p testnet/db/scripts
cp config/environments/public/* testnet/config/environments/public
Expand All @@ -44,11 +45,20 @@ jobs:
mv testnet/config/environments/public/example.env testnet
sed -i -e "s/image: zkevm-node/image: hermeznetwork\/zkevm-node:$GIT_TAG_NAME/g" testnet/docker-compose.yml
zip -r testnet.zip testnet
# MAINNET
mkdir -p mainnet/config/environments/public
mkdir -p mainnet/db/scripts
cp config/environments/public/* mainnet/config/environments/public
cp docker-compose.yml mainnet
cp db/scripts/init_prover_db.sql mainnet/db/scripts
mv mainnet/config/environments/public/example.env mainnet
sed -i -e "s/image: zkevm-node/image: hermeznetwork\/zkevm-node:$GIT_TAG_NAME/g" mainnet/docker-compose.yml
zip -r mainnet.zip mainnet
- name: Publish testnet zip into release
- name: Publish testnet and mainnet zip into release
uses: AButler/[email protected]
with:
files: 'testnet.zip'
files: 'testnet.zip;mainnet.zip'
repo-token: ${{ secrets.TOKEN_RELEASE }}
release-tag: ${{ steps.tagName.outputs.tag }}

8 changes: 8 additions & 0 deletions config/environments/mainnet/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# URL of a JSON RPC for Ethereum mainnet
ZKEVM_NODE_ETHERMAN_URL = "http://your.L1node.url"
# PATH WHERE THE STATEDB POSTGRES CONTAINER WILL STORE PERSISTENT DATA
ZKEVM_NODE_STATEDB_DATA_DIR = "/path/to/persistent/data/statedb"
# PATH WHERE THE POOLDB POSTGRES CONTAINER WILL STORE PERSISTENT DATA
ZKEVM_NODE_POOLDB_DATA_DIR = "/path/to/persistent/data/pooldb"
# OPTIONAL, UNCOMENT IF YOU WANT TO DO ADVANCED CONFIG
# ZKEVM_ADVANCED_CONFIG_DIR = "/should/be/same/path/as/ZKEVM_CONFIG_DIR"
107 changes: 107 additions & 0 deletions config/environments/mainnet/public.prover.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"runProverServer": false,
"runProverServerMock": false,
"runProverClient": false,

"runExecutorServer": true,
"runExecutorClient": false,
"runExecutorClientMultithread": false,

"runStateDBServer": true,
"runStateDBTest": false,

"runAggregatorServer": false,
"runAggregatorClient": false,

"runFileGenProof": false,
"runFileGenBatchProof": false,
"runFileGenAggregatedProof": false,
"runFileGenFinalProof": false,
"runFileProcessBatch": false,
"runFileProcessBatchMultithread": false,

"runKeccakScriptGenerator": false,
"runKeccakTest": false,
"runStorageSMTest": false,
"runBinarySMTest": false,
"runMemAlignSMTest": false,
"runSHA256Test": false,
"runBlakeTest": false,

"executeInParallel": true,
"useMainExecGenerated": false,
"saveRequestToFile": false,
"saveInputToFile": false,
"saveDbReadsToFile": false,
"saveDbReadsToFileOnChange": false,
"saveOutputToFile": false,
"saveResponseToFile": false,
"loadDBToMemCache": true,
"opcodeTracer": false,
"logRemoteDbReads": false,
"logExecutorServerResponses": false,

"proverServerPort": 50051,
"proverServerMockPort": 50052,
"proverServerMockTimeout": 10000000,
"proverClientPort": 50051,
"proverClientHost": "127.0.0.1",

"executorServerPort": 50071,
"executorROMLineTraces": false,
"executorClientPort": 50071,
"executorClientHost": "127.0.0.1",

"stateDBServerPort": 50061,
"stateDBURL": "local",

"aggregatorServerPort": 50081,
"aggregatorClientPort": 50081,
"aggregatorClientHost": "127.0.0.1",

"inputFile": "input_executor.json",
"outputPath": "output",
"cmPolsFile_disabled": "zkevm.commit",
"cmPolsFileC12a_disabled": "zkevm.c12a.commit",
"cmPolsFileRecursive1_disabled": "zkevm.recursive1.commit",
"constPolsFile": "zkevm.const",
"constPolsC12aFile": "zkevm.c12a.const",
"constPolsRecursive1File": "zkevm.recursive1.const",
"mapConstPolsFile": false,
"constantsTreeFile": "zkevm.consttree",
"constantsTreeC12aFile": "zkevm.c12a.consttree",
"constantsTreeRecursive1File": "zkevm.recursive1.consttree",
"mapConstantsTreeFile": false,
"starkFile": "zkevm.prove.json",
"starkZkIn": "zkevm.proof.zkin.json",
"starkZkInC12a":"zkevm.c12a.zkin.proof.json",
"starkFileRecursive1": "zkevm.recursive1.proof.json",
"verifierFile": "zkevm.verifier.dat",
"verifierFileRecursive1": "zkevm.recursive1.verifier.dat",
"witnessFile_disabled": "zkevm.witness.wtns",
"witnessFileRecursive1": "zkevm.recursive1.witness.wtns",
"execC12aFile": "zkevm.c12a.exec",
"execRecursive1File": "zkevm.recursive1.exec",
"starkVerifierFile": "zkevm.g16.0001.zkey",
"publicStarkFile": "zkevm.public.json",
"publicFile": "public.json",
"proofFile": "proof.json",
"keccakScriptFile": "keccak_script.json",
"keccakPolsFile_DISABLED": "keccak_pols.json",
"keccakConnectionsFile": "keccak_connections.json",
"starkInfoFile": "zkevm.starkinfo.json",
"starkInfoC12aFile": "zkevm.c12a.starkinfo.json",
"starkInfoRecursive1File": "zkevm.recursive1.starkinfo.json",
"databaseURL": "postgresql://prover_user:prover_pass@zkevm-state-db:5432/prover_db",
"dbNodesTableName": "state.nodes",
"dbProgramTableName": "state.program",
"dbAsyncWrite": false,
"dbMultiWrite": true,
"dbMTCacheSize": 8192,
"dbProgramCacheSize": 1024,
"cleanerPollingPeriod": 600,
"requestsPersistence": 3600,
"maxExecutorThreads": 20,
"maxProverThreads": 8,
"maxStateDBThreads": 8
}
2 changes: 1 addition & 1 deletion config/environments/public/example.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# URL of a JSON RPC for Goerli
ZKEVM_NODE_ETHERMAN_URL = "http://your.L1node.url"
# PATH WHERE THE STATEDB POSTGRES CONTAINER WILL STORE PERSISTENT DATA
ZKEVM_NODE_STATEDB_DATA_DIR = "/path/to/persistent/data/stetedb"
ZKEVM_NODE_STATEDB_DATA_DIR = "/path/to/persistent/data/statedb"
# PATH WHERE THE POOLDB POSTGRES CONTAINER WILL STORE PERSISTENT DATA
ZKEVM_NODE_POOLDB_DATA_DIR = "/path/to/persistent/data/pooldb"
# OPTIONAL, UNCOMENT IF YOU WANT TO DO ADVANCED CONFIG
Expand Down
12 changes: 6 additions & 6 deletions docs/production-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ Note that sequencing and proving functionalities are not covered in this documen
## Requirements

- A machine to run the zkEVM node with the following requirements:
- Hardware: 16G RAM, 4 cores, 20G Disk (as the network is super young the current disk requirements are quite low, but they will increase overtime). Currently ARM-based CPUs are not supported
- Hardware: 32G RAM, 4 cores, 20G Disk (as the network is super young the current disk requirements are quite low, but they will increase overtime). Currently ARM-based CPUs are not supported
- Software: Ubuntu 22.04, Docker
- A L1 node: we recommend using geth, but what it's actually needed is access to a JSON RPC interface for the L1 network (Goerli for zkEVM testnet, Ethereum mainnet for zkEVM mainnet)

## Setup

This is the most straightforward path to run a zkEVM node, and it's perfectly fine for most use cases, however if you are interested in providing service to many users it's recommended to do some tweaking over the default configuration. Furthermore, this is quite opinionated, feel free to run this software in a different way, for instance it's not needed to use Docker, you could use the Go binaries directly.
This is the most straightforward path to run a zkEVM node, and it's perfectly fine for most use cases, however if you are interested in providing service to many users it's recommended to do some tweaking over the default configuration. Furthermore, this is quite opinionated, feel free to run this software in a different way, for instance it's not needed to use Docker, you could use the Go and C++ binaries directly.

tl;dr:

```bash
# DOWNLOAD ARTIFACTS
ZKEVM_NET=testnet
ZKEVM_NET=mainnet
ZKEVM_DIR=./path/to/install # CHANGE THIS
ZKEVM_CONFIG_DIR=./path/to/config # CHANGE THIS
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
Expand All @@ -37,7 +37,7 @@ docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker

Explained step by step:

1. Define network (currently only testnet is supported, mainnet coming very soon!): `ZKEVM_NET=testnet`
1. Define network: `ZKEVM_NET=testnet` or `ZKEVM_NET=mainnet`
2. Define installation path: `ZKEVM_DIR=./path/to/install`
3. Define a config directory: `ZKEVM_CONFIG_DIR=./path/to/config`
4. It's recommended to source this env vars in your `~/.bashrc`, `~/.zshrc` or whatever you're using
Expand All @@ -61,7 +61,7 @@ If everything has gone as expected you should be able to run queries to the JSON

## Troubleshooting

- It's possible that the machine you're using already uses some of the necessary ports. In this case you can change them directly at `$ZKEVM_DIR/testnet/docker-compose.yml`
- It's possible that the machine you're using already uses some of the necessary ports. In this case you can change them directly at `$ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml`
- If one or more containers are crashing please check the logs using `docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs <cointainer_name>`

## Stop
Expand All @@ -72,7 +72,7 @@ sudo docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/d

## Updating

In order to update the software, you have to repeat the steps of the setup, but taking care of not overriding the config that you have modified. Basically, instead of running `cp $ZKEVM_DIR/testnet/example.env $ZKEVM_CONFIG_DIR/.env`, check if the variables of `$ZKEVM_DIR/testnet/example.env` have been renamed or there are new ones, and update `$ZKEVM_CONFIG_DIR/.env` accordingly.
In order to update the software, you have to repeat the steps of the setup, but taking care of not overriding the config that you have modified. Basically, instead of running `cp $ZKEVM_DIR/$ZKEVM_NET/example.env $ZKEVM_CONFIG_DIR/.env`, check if the variables of `$ZKEVM_DIR/$ZKEVM_NET/example.env` have been renamed or there are new ones, and update `$ZKEVM_CONFIG_DIR/.env` accordingly.

## Advanced setup

Expand Down

0 comments on commit bd4ff0e

Please sign in to comment.