From 6c584fc6266836ed6b5495db1da7b905e3e6b085 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 25 Jan 2024 11:45:17 +0100 Subject: [PATCH 01/26] restructure menu and add page --- docs/cdk/get-started/{ => deploy-validium}/deploy-validium.md | 0 mkdocs.yml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename docs/cdk/get-started/{ => deploy-validium}/deploy-validium.md (100%) diff --git a/docs/cdk/get-started/deploy-validium.md b/docs/cdk/get-started/deploy-validium/deploy-validium.md similarity index 100% rename from docs/cdk/get-started/deploy-validium.md rename to docs/cdk/get-started/deploy-validium/deploy-validium.md diff --git a/mkdocs.yml b/mkdocs.yml index 3a91b13f3..132fa56b9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,7 +47,8 @@ nav: - Validium: cdk/get-started/quickstart-validium.md - Rollup: cdk/get-started/quickstart-rollup.md - Deploy: - - Validium: cdk/get-started/deploy-validium.md + - Validium: + - Introduction: cdk/get-started/deploy-validium.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 0310423ba2396e02db2b51be8025f6fe5a5b98d6 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 25 Jan 2024 14:11:40 +0100 Subject: [PATCH 02/26] add prerequisite page --- .../deploy-validium/deploy-validium.md | 274 ++++++++++++++++-- .../deploy-validium/prerequisites.md | 39 +++ mkdocs.yml | 3 +- 3 files changed, 295 insertions(+), 21 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/prerequisites.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-validium.md b/docs/cdk/get-started/deploy-validium/deploy-validium.md index db74c8d6d..be19da2cc 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-validium.md +++ b/docs/cdk/get-started/deploy-validium/deploy-validium.md @@ -1,33 +1,267 @@ -!!! important "Recommendation" - Follow the [quickstart](quickstart-validium.md) for a hands-on introduction to CDK in validium mode. +# Setup & Deployment -!!! note - - The documentation describes standard deployments. - - Edit the configuration files to implement your own custom setups. +## 1. Downloading cdk-validium-contracts -Follow the steps below to deploy a CDK validium instance. +To begin the setup, we first create a new directory `cdk-validium/` that we can download the components and work out of. Initially this directory will house `cdk-validium-contracts`, but we will add the `cdk-validium-node` and it's additional components later on. -## 1. Deploy validium-specific contracts +```bash +mkdir cdk-validium +cd cdk-validium/ +``` -!!! important - - Follow this step if you are deploying to a public testnet. - - For a local deploy, follow step 2 instead which deploys a local L1 network plus CDK contracts. +Download the ***`0.0.2`*** release from the [cdk-validium-contracts github](https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2-RC1) -First, deploy the relevant contracts. +It is available in both `.tar.gz` and `.zip` formats -Follow the steps in the [CDK validium contracts repository's README](https://github.com/0xPolygon/cdk-validium-contracts). +Downloading the `tar.gz` and extracting -## 2. Run the CDK validium node +```bash +~/cdk-validium % curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz -!!! important - - If you are deploying to a public testnet, follow the previous step 1. +tar -xzf cdk-validium-contracts.tar.gz +``` -Next, set up and run the CDK validium node. +Now we have a new directory in `cdk-validium/` named `cdk-validium-contracts-0.0.2` -Follow the instructions in the [CDK validium node repository's README](https://github.com/0xPolygon/cdk-validium-node). +## 2. Preparing the environment -## 3. Run the data availability (DA) node (optional step) +Navigate into the recently downloaded directory `cdk-validium-contracts-0.0.2/` -Finally, once the CDK validium node is operational, set up and run the data availability node. +```bash +~/cdk-validium % cd cdk-validium-contracts-0.0.2/ +``` -Check for instructions here: [CDK DA Node GitHub running instructions](https://github.com/0xPolygon/cdk-data-availability/blob/main/docs/running.md). +### Install the dependencies + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2 % npm install +``` + +### Create the .env configuration + +Copy the environment configuration example into a new `.env` file + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2 % cp .env.example .env +``` + +There are a few environment variables we have to fill in here: + +```bash +# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env +MNEMONIC="" +INFURA_PROJECT_ID="" +ETHERSCAN_API_KEY="" +``` + +First we will generate a new mnemonic using `cast`: + +```bash +cast wallet new-mnemonic --words 12 +``` + +*note: if command **`new-mnemonic`** is not found, update foundry using **`foundryup`*** + +The output should look like this: + +```bash +Phrase: +island debris exhaust typical clap debate exhaust little verify mean sausage entire +Accounts: +- Account 0: +Address: 0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE +Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 +``` + +Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `.env` + +For this guide we are using Infura as our node provider. You can grab a `Project ID` from Infura [here](https://www.infura.io). Then copy and paste the value into `INFURA_PROJECT_ID`. If you want to use another node provider, see the "Using a different node provider" section below. + +**Optionally**, we can verify our contracts using [Etherscan](https://etherscan.io). For this, an API key is required. + +You can grab an API key from [here](https://etherscan.io/myapikey), copy and paste the value into ***`ETHERSCAN_API_KEY`*** + +Your final `.env` should look similar to this: + +```bash +# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env +MNEMONIC="island debris exhaust typical clap debate exhaust little verify mean sausage entire" +INFURA_PROJECT_ID="1234567890abcdefghijklmnop" # or blank if not using Infura +ETHERSCAN_API_KEY="1234567890abcdefghijklmnopqr" # or blank if not verify contracts +``` + +**Additionally we will load these variables into `/tmp/cdk.env`** this is an important step and allows us to use `jq` and `tomlq` later on for setup of our configuration files. + +```bash +# /tmp/cdk/.env +TEST_ADDRESS=0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE +TEST_PRIVATE_KEY=0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 +L1_URL=https://sepolia.infura.io/v3/ +L1_WS_URL=wss://sepolia.infura.io/ws/v3/ +``` + +## 3. Deploying the contracts + +First, we must navigate into the `deployment/` directory and create a new `deploy_parameters.json` by copying the example + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2 % cd deployment +~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % cp deploy_parameters.json.example deploy_parameters.json +``` + +### Configure deployment parameters + +There are several fields that need to be changed inside `deploy_parameters.json`. + - trustedSequencer + - trustedAggregator + - admin + - cdkValidiumOwner + - initialCDKValidiumDeployerOwner + - trustedSequencerURL + - forkID + +We can run this `jq` script to streamline the process of replacing these fields: + +```bash +source /tmp/cdk/.env +jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json +``` + +Your complete `deploy_parameters.json` should look similar to this: + +```bash +cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json +# ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json +{ + "realVerifier": false, + "trustedSequencerURL": "http://127.0.0.1:8123, + "networkName": "cdk-validium", + "version":"0.0.1", + "trustedSequencer":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "chainID": 1001, + "trustedAggregator":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedAggregatorTimeout": 604799, + "pendingStateTimeout": 604799, + "forkID": 6, + "admin":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "cdkValidiumOwner": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "timelockAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "minDelayTimelock": 3600, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialCDKValidiumDeployerOwner" :"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "maticTokenAddress":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "cdkValidiumDeployerAddress":"", + "deployerPvtKey": "", + "maxFeePerGas":"", + "maxPriorityFeePerGas":"", + "multiplierGas": "", + "setupEmptyCommittee": true, + "committeeTimelock": false +} +``` + +Now we have set the configuration for our contracts, lets deploy! + +The first step is deploying and verifying the `CDKValidiumDeployer`, this will be the factory for deterministic contracts, the address of the contracts will depend on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run deploy:deployer:CDKValidium:sepolia +``` + +On successful deployment of `CDKValidiumDeployer`, you should see something similar to this: + +```bash +cdkValidiumDeployer deployed on: 0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF +``` + +Now we can move forward and deploy the rest of the contract suite: + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run deploy:testnet:CDKValidium:sepolia +``` + +Please note this can take several minutes depending on network conditions. + +On successful deployment, a new directory named `deployments` should have been created. Inside that directory, another was created with information about your deployment. + +```bash +# ~/cdk-validium/cdk-validium-contracts-0.0.2/deployments/sepolia_1705429054/deploy_output.json +{ + "cdkValidiumAddress": "0x37eEBCa90363b0952e03a64979B64AAE3b8C9631", + "polygonZkEVMBridgeAddress": "0x3485bfA6F27e54a8FF9782032fdbC7C555c178E4", + "polygonZkEVMGlobalExitRootAddress": "0x8330E90c82F4BDDfa038041B898DE2d900e6246C", + "cdkDataCommitteeContract": "0xb49d901748c3E278a634c05E0c500b23db992fb0", + "maticTokenAddress": "0x20db28Bb7C779a06E4081e55808cc5DE35cca303", + "verifierAddress": "0xb01Be1534d1eF82Ba98DCd5B33A3A331B6d119D0", + "cdkValidiumDeployerContract": "0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF", + "deployerAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "timelockContractAddress": "0xDa476BD0B6A660cd08239dEb620F701877688c6F", + "deploymentBlockNumber": 5097689, + "genesisRoot": "0xf07cd7c4f7df7092241ccb2072d9ac9e800a87513df628245657950b3af78f94", + "trustedSequencer": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedSequencerURL": "http://127.0.0.1:8123", + "chainID": 1001, + "networkName": "cdk-validium", + "admin": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedAggregator": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "proxyAdminAddress": "0x828E55268524c13dB25FD33f2Be45D2771f1EeA4", + "forkID": 6, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "version": "0.0.1" +} +``` + +In addition to `deploy_output.json`, a `genesis.json` should have been generated in `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` +We will take the outputs of `genesis.json` and `deploy_output.json` and use them to configure our node in the next steps of setup and deployment of `cdk-validium-node`. + + +Congrats! You’ve deployed the CDK Validium contracts! + +### Verifying contracts + +If deploying to Sepolia, the contracts should be automatically verified based on other live deployments on the network with similar bytecode. If you see that the contracts have not been verified on Etherscan. Run the following commands: + +To verify the contract factory: + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run verify:deployer:CDKValidium:sepolia +``` + +To verify the rest of the contract suite: + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run verify:CDKValidium:sepolia +``` + +### Using a different node provider + +If you prefer to use a different node provider than Infura, the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `.env` can be modified to fit your provider. + +For example using Alchemy: + +```bash +# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env +MNEMONIC="island debris exhaust typical clap debate exhaust little verify mean sausage entire" +INFURA_PROJECT_ID="" # or blank if not using Infura +ETHERSCAN_API_KEY="1234567890abcdefghijklmnopqr" # or blank if not verify contracts +ALCHEMY_PROJECT_ID="dGPpsDzM9KpFTEnqMO44rvIXcc0fmgxr" # add this line +``` + +```bash +# ~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js +sepolia: { + url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_PROJECT_ID}`, # rpc value changed here + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, +``` + +### Deployment failure + +- Since there are deterministic address you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. + +- It's mandatory to delete the `~/cdk-validium/cdk-validium-contracts-0.0.2/.openzeppelin` upgradability information in order to make a new deployment \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/prerequisites.md b/docs/cdk/get-started/deploy-validium/prerequisites.md new file mode 100644 index 000000000..973c096f5 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/prerequisites.md @@ -0,0 +1,39 @@ +## Dependency Checking +Dependencies required for this section: + +| Dependency | Version | Version Check Command | +| --- | --- | --- | +| node | ^20 | git —version | +| npm | ^10 | npm —version | +| foundry | ^0.2 | forge —version | +| jq | ^1.6 | jq -V | + +## Sepolia Access + +For Polygon CDK to function properly, it needs connection to a layer 1 EVM blockchain. For the purpose of this guide, we will be deploying the CDK contracts to [Sepolia testnet](https://www.alchemy.com/overviews/sepolia-testnet). + +You have a couple options on connecting to the Sepolia testnet + +1. Node Provider (easiest) +2. Run your own node (recommended for a production setup) + +For the sake of simplicity, we will use a node provider ([Infura](https://www.infura.io)) for this guide. + +You can use a different provider by modifying your hardhat config (see here) + +The deployment is expected to use up to **2 Sepolia ETH**. You can get Sepolia ETH from public faucets such as the ones listed here: + +[Infura Faucet](https://www.infura.io/faucet/sepolia) + +[Chainstack Faucet](https://chainstack.com/sepolia-faucet/) + +[Quicknode Faucet](https://faucet.quicknode.com/ethereum/sepoli) + +## Configuration Environment + +For this guide we will create a new folder inside `/tmp/` named `/cdk/` this will store all our configuration files along with a `.env` to store important values. This will also allow us to streamline the processs using `jq` and `tomlq` + +```bash +mkdir /tmp/cdk/ +touch /tmp/cdk/.env +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 132fa56b9..4d817c84d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,7 +48,8 @@ nav: - Rollup: cdk/get-started/quickstart-rollup.md - Deploy: - Validium: - - Introduction: cdk/get-started/deploy-validium.md + - Introduction: cdk/get-started/deploy-validium/deploy-validium.md + - Prerequisites: cdk/get-started/deploy-validium/prerequisites.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 387c9b1292236732358a3a362a7ec6f7fb1d686f Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 25 Jan 2024 15:16:31 +0100 Subject: [PATCH 03/26] add file and commit changes --- .../deploy-validium/deploy-validium.md | 99 ------------------- .../deploy-validium/prerequisites.md | 54 +++++----- .../cdk/get-started/deploy-validium/set-up.md | 82 +++++++++++++++ mkdocs.yml | 1 + 4 files changed, 112 insertions(+), 124 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/set-up.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-validium.md b/docs/cdk/get-started/deploy-validium/deploy-validium.md index be19da2cc..066127c51 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-validium.md +++ b/docs/cdk/get-started/deploy-validium/deploy-validium.md @@ -1,104 +1,5 @@ # Setup & Deployment -## 1. Downloading cdk-validium-contracts - -To begin the setup, we first create a new directory `cdk-validium/` that we can download the components and work out of. Initially this directory will house `cdk-validium-contracts`, but we will add the `cdk-validium-node` and it's additional components later on. - -```bash -mkdir cdk-validium -cd cdk-validium/ -``` - -Download the ***`0.0.2`*** release from the [cdk-validium-contracts github](https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2-RC1) - -It is available in both `.tar.gz` and `.zip` formats - -Downloading the `tar.gz` and extracting - -```bash -~/cdk-validium % curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz - -tar -xzf cdk-validium-contracts.tar.gz -``` - -Now we have a new directory in `cdk-validium/` named `cdk-validium-contracts-0.0.2` - -## 2. Preparing the environment - -Navigate into the recently downloaded directory `cdk-validium-contracts-0.0.2/` - -```bash -~/cdk-validium % cd cdk-validium-contracts-0.0.2/ -``` - -### Install the dependencies - -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2 % npm install -``` - -### Create the .env configuration - -Copy the environment configuration example into a new `.env` file - -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2 % cp .env.example .env -``` - -There are a few environment variables we have to fill in here: - -```bash -# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env -MNEMONIC="" -INFURA_PROJECT_ID="" -ETHERSCAN_API_KEY="" -``` - -First we will generate a new mnemonic using `cast`: - -```bash -cast wallet new-mnemonic --words 12 -``` - -*note: if command **`new-mnemonic`** is not found, update foundry using **`foundryup`*** - -The output should look like this: - -```bash -Phrase: -island debris exhaust typical clap debate exhaust little verify mean sausage entire -Accounts: -- Account 0: -Address: 0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE -Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 -``` - -Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `.env` - -For this guide we are using Infura as our node provider. You can grab a `Project ID` from Infura [here](https://www.infura.io). Then copy and paste the value into `INFURA_PROJECT_ID`. If you want to use another node provider, see the "Using a different node provider" section below. - -**Optionally**, we can verify our contracts using [Etherscan](https://etherscan.io). For this, an API key is required. - -You can grab an API key from [here](https://etherscan.io/myapikey), copy and paste the value into ***`ETHERSCAN_API_KEY`*** - -Your final `.env` should look similar to this: - -```bash -# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env -MNEMONIC="island debris exhaust typical clap debate exhaust little verify mean sausage entire" -INFURA_PROJECT_ID="1234567890abcdefghijklmnop" # or blank if not using Infura -ETHERSCAN_API_KEY="1234567890abcdefghijklmnopqr" # or blank if not verify contracts -``` - -**Additionally we will load these variables into `/tmp/cdk.env`** this is an important step and allows us to use `jq` and `tomlq` later on for setup of our configuration files. - -```bash -# /tmp/cdk/.env -TEST_ADDRESS=0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE -TEST_PRIVATE_KEY=0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 -L1_URL=https://sepolia.infura.io/v3/ -L1_WS_URL=wss://sepolia.infura.io/ws/v3/ -``` ## 3. Deploying the contracts diff --git a/docs/cdk/get-started/deploy-validium/prerequisites.md b/docs/cdk/get-started/deploy-validium/prerequisites.md index 973c096f5..937940aee 100644 --- a/docs/cdk/get-started/deploy-validium/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/prerequisites.md @@ -1,39 +1,43 @@ -## Dependency Checking -Dependencies required for this section: +## Hardware -| Dependency | Version | Version Check Command | -| --- | --- | --- | -| node | ^20 | git —version | -| npm | ^10 | npm —version | -| foundry | ^0.2 | forge —version | -| jq | ^1.6 | jq -V | +- A Linux-based OS (e.g., Ubuntu Server 22.04 LTS). +- At least 16GB RAM with a 4-core CPU. +- An AMD64 architecture system. -## Sepolia Access +## Software -For Polygon CDK to function properly, it needs connection to a layer 1 EVM blockchain. For the purpose of this guide, we will be deploying the CDK contracts to [Sepolia testnet](https://www.alchemy.com/overviews/sepolia-testnet). +Make sure you have the following software: -You have a couple options on connecting to the Sepolia testnet +| Download link | Version | Check version | +| --- | --- | --- | +| [Node](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) | ^20 | `node --version` | +| npm | ^10 | `npm --version` | +| [Foundry](https://book.getfoundry.sh/getting-started/installation) | ^0.2 | `forge --version` | +| [jq](https://jqlang.github.io/jq/download/) | ^1.6 | `jq -V` | -1. Node Provider (easiest) -2. Run your own node (recommended for a production setup) +## Sepolia access -For the sake of simplicity, we will use a node provider ([Infura](https://www.infura.io)) for this guide. +You will need the following: -You can use a different provider by modifying your hardhat config (see here) +- A Sepolia node RPC URL: e.g. https://goerli.infura.io/v3/YOUR-INFURA-API-KEY +- An account address holding minimum 2 Sepolia ETH. -The deployment is expected to use up to **2 Sepolia ETH**. You can get Sepolia ETH from public faucets such as the ones listed here: +Use a public faucet to get Sepolia test ETH: -[Infura Faucet](https://www.infura.io/faucet/sepolia) +- [Infura faucet](https://www.infura.io/faucet/sepolia) +- [Chainstack faucet](https://chainstack.com/sepolia-faucet/) +- [Quicknode faucet](https://faucet.quicknode.com/ethereum/sepoli) -[Chainstack Faucet](https://chainstack.com/sepolia-faucet/) +## Configuration files and environment variables -[Quicknode Faucet](https://faucet.quicknode.com/ethereum/sepoli) +1. Create a folder inside `/tmp/` named `/cdk/` to store all configuration files. -## Configuration Environment + ```bash + mkdir /tmp/cdk/ + ``` -For this guide we will create a new folder inside `/tmp/` named `/cdk/` this will store all our configuration files along with a `.env` to store important values. This will also allow us to streamline the processs using `jq` and `tomlq` +2. Create a `.env` file to store environment variables. -```bash -mkdir /tmp/cdk/ -touch /tmp/cdk/.env -``` \ No newline at end of file + ```bash + nano /tmp/cdk/.env + ``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/set-up.md b/docs/cdk/get-started/deploy-validium/set-up.md new file mode 100644 index 000000000..c52237ee4 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/set-up.md @@ -0,0 +1,82 @@ +## Download the `cdk-validium-contracts` + +1. Create a new directory to store the `cdk-validium-contracts` and the `cdk-validium-node` and cd into it. + + ```bash + mkdir cdk-validium + cd cdk-validium/ + ``` + +2. Download the `0.0.2` release from the [cdk-validium-contracts github repo](https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2-RC1). + + !!! note + It is available in both `.tar.gz` and `.zip` formats + + ```bash + ~/cdk-validium % curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz + + tar -xzf cdk-validium-contracts.tar.gz + ``` + +## Prepare the environment + +`cd` into `cdk-validium-contracts-0.0.2/` + +```bash +~/cdk-validium % cd cdk-validium-contracts-0.0.2/ +``` + +### Install the dependencies + +```bash +~/cdk-validium/cdk-validium-contracts-0.0.2 % npm install +``` + +### Create the .env configuration + +1. Copy the environment configuration example file into a new `.env` file. + + ```bash + ~/cdk-validium/cdk-validium-contracts-0.0.2 % cp .env.example .env + ``` + +2. The file requires the following environment variables. + + ```bash + # ~/cdk-validium/cdk-validium-contracts-0.0.2/.env + MNEMONIC="" # see instructions below + INFURA_PROJECT_ID="" # Generate a project id on [Infura](https://www.infura.io/) + ETHERSCAN_API_KEY="" # Generate a project id on [Etherscan](https://etherscan.io) + ``` + +3. Generate a new mnemonic using `cast`. + + ```bash + cast wallet new-mnemonic --words 12 + ``` + + *note: if command **`new-mnemonic`** is not found, update foundry using **`foundryup`*** + + The output should look something like this: + + ```bash + Phrase: + island debris exhaust typical clap debate exhaust little verify mean sausage entire + Accounts: + - Account 0: + Address: 0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE + Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 + ``` + +4. Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `.env` + + +5. Load the variables into `/tmp/cdk.env`. This is an important step and allows us to use `jq` and `tomlq` later on to setup our configuration files. + + ```bash + # /tmp/cdk/.env + TEST_ADDRESS=0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE + TEST_PRIVATE_KEY=0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 + L1_URL=https://sepolia.infura.io/v3/ + L1_WS_URL=wss://sepolia.infura.io/ws/v3/ + ``` diff --git a/mkdocs.yml b/mkdocs.yml index 4d817c84d..0b2c392ba 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -50,6 +50,7 @@ nav: - Validium: - Introduction: cdk/get-started/deploy-validium/deploy-validium.md - Prerequisites: cdk/get-started/deploy-validium/prerequisites.md + - Set up: cdk/get-started/deploy-validium/set-up.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 8097b456bc95b31518c23210ec28f1385f79644a Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 25 Jan 2024 17:09:05 +0100 Subject: [PATCH 04/26] add new file --- ...deploy-validium.md => deploy-contracts.md} | 0 docs/cdk/get-started/deploy-validium/intro.md | 1 + .../deploy-validium/prerequisites.md | 30 +++++++++++-------- mkdocs.yml | 3 +- 4 files changed, 20 insertions(+), 14 deletions(-) rename docs/cdk/get-started/deploy-validium/{deploy-validium.md => deploy-contracts.md} (100%) create mode 100644 docs/cdk/get-started/deploy-validium/intro.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-validium.md b/docs/cdk/get-started/deploy-validium/deploy-contracts.md similarity index 100% rename from docs/cdk/get-started/deploy-validium/deploy-validium.md rename to docs/cdk/get-started/deploy-validium/deploy-contracts.md diff --git a/docs/cdk/get-started/deploy-validium/intro.md b/docs/cdk/get-started/deploy-validium/intro.md new file mode 100644 index 000000000..6d3f66599 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/intro.md @@ -0,0 +1 @@ +WIP \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/prerequisites.md b/docs/cdk/get-started/deploy-validium/prerequisites.md index 937940aee..e5ec233a4 100644 --- a/docs/cdk/get-started/deploy-validium/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/prerequisites.md @@ -22,22 +22,26 @@ You will need the following: - A Sepolia node RPC URL: e.g. https://goerli.infura.io/v3/YOUR-INFURA-API-KEY - An account address holding minimum 2 Sepolia ETH. -Use a public faucet to get Sepolia test ETH: +### Faucets -- [Infura faucet](https://www.infura.io/faucet/sepolia) -- [Chainstack faucet](https://chainstack.com/sepolia-faucet/) -- [Quicknode faucet](https://faucet.quicknode.com/ethereum/sepoli) +Use a public faucet to get Sepolia test ETH. -## Configuration files and environment variables +- [Infura faucet](https://www.infura.io/faucet/sepolia). +- [Chainstack faucet](https://chainstack.com/sepolia-faucet/). +- [Quicknode faucet](https://faucet.quicknode.com/ethereum/sepoli). -1. Create a folder inside `/tmp/` named `/cdk/` to store all configuration files. +## Configuration files - ```bash - mkdir /tmp/cdk/ - ``` +Create a folder inside `/tmp/` named `/cdk/` that will store all the configuration files. -2. Create a `.env` file to store environment variables. +```bash +mkdir /tmp/cdk/ +``` - ```bash - nano /tmp/cdk/.env - ``` \ No newline at end of file +## Environment variables + +Create a `.env` file to store environment variables. + +```bash +nano /tmp/cdk/.env +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 0b2c392ba..6fb1a310d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,9 +48,10 @@ nav: - Rollup: cdk/get-started/quickstart-rollup.md - Deploy: - Validium: - - Introduction: cdk/get-started/deploy-validium/deploy-validium.md + - Introduction: cdk/get-started/deploy-validium/intro.md - Prerequisites: cdk/get-started/deploy-validium/prerequisites.md - Set up: cdk/get-started/deploy-validium/set-up.md + - Deploy contracts: cdk/get-started/deploy-validium/deploy-contracts.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 6480fd5e40ace5e063dd4c2dc7e030e7650672de Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 25 Jan 2024 17:11:15 +0100 Subject: [PATCH 05/26] split pages --- docs/cdk/get-started/deploy-validium/deploy-contracts.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/deploy-contracts.md index 066127c51..da84b9215 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/deploy-contracts.md @@ -1,8 +1,3 @@ -# Setup & Deployment - - -## 3. Deploying the contracts - First, we must navigate into the `deployment/` directory and create a new `deploy_parameters.json` by copying the example ```bash @@ -118,7 +113,7 @@ We will take the outputs of `genesis.json` and `deploy_output.json` and use them Congrats! You’ve deployed the CDK Validium contracts! -### Verifying contracts +### 2. Verifying contracts If deploying to Sepolia, the contracts should be automatically verified based on other live deployments on the network with similar bytecode. If you see that the contracts have not been verified on Etherscan. Run the following commands: From fac89dff260ca4005b5c104a0313900fdbb98662 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Fri, 26 Jan 2024 11:07:55 +0100 Subject: [PATCH 06/26] pushing so i can see it --- docs/cdk/get-started/deploy-rollup/intro.md | 4 ++-- docs/cdk/get-started/deploy-validium/intro.md | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/cdk/get-started/deploy-rollup/intro.md b/docs/cdk/get-started/deploy-rollup/intro.md index 8959c100f..cacfaf687 100644 --- a/docs/cdk/get-started/deploy-rollup/intro.md +++ b/docs/cdk/get-started/deploy-rollup/intro.md @@ -2,13 +2,13 @@ This quick start takes you through the process of deploying a full CDK zkRollup, !!! warning - These instructions are subject to frequent updates as the software remains at an early development stage. - - Report any issues on our docs repo: https://github.com/0xPolygon/polygon-docs + - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs The process is split into the following sections: 1. [Overview of the full environment](environment-overview.md). -2. [Prerequisites steps](prerequisites.md): Preliminary setup, checking system requirements, and prerequisite variables. +2. [Prerequisite steps](prerequisites.md): Preliminary setup, checking system requirements, and prerequisite variables. 3. [Install dependencies](install-dependencies.md): Install required dependencies and downloading mainnet files. diff --git a/docs/cdk/get-started/deploy-validium/intro.md b/docs/cdk/get-started/deploy-validium/intro.md index 6d3f66599..e157e44a1 100644 --- a/docs/cdk/get-started/deploy-validium/intro.md +++ b/docs/cdk/get-started/deploy-validium/intro.md @@ -1 +1,15 @@ -WIP \ No newline at end of file +This quick start takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia. + +!!! warning + - These instructions are subject to frequent updates as the software remains at an early development stage. + - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs + +The process is split into the following sections: + +1. [Prerequisite steps](prerequisites.md): Checking system requirements, prepare configuration and environment variables. + +2. [Set up](set-up.md): Install required dependencies and downloading mainnet files. + +3. [Deploy wallets](deploy-contracts.md): Create wallets and deploy contracts. + +4. [Deploy node](): Deploy the zkRollup EVM-compatible node. From 96b4cc82b10a30ed039b5726457006feb8d53006 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Fri, 26 Jan 2024 16:43:59 +0100 Subject: [PATCH 07/26] committing up to deploy problem --- .../deploy-validium/deploy-contracts.md | 163 +++++++++--------- .../deploy-validium/prerequisites.md | 8 +- .../cdk/get-started/deploy-validium/set-up.md | 52 +++--- 3 files changed, 113 insertions(+), 110 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/deploy-contracts.md index da84b9215..0321ecdc6 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/deploy-contracts.md @@ -1,29 +1,29 @@ -First, we must navigate into the `deployment/` directory and create a new `deploy_parameters.json` by copying the example +## Configure deployment parameters + +1. `cd` to the `deployment/` directory and create a new `deploy_parameters.json` by copying the example ```bash -~/cdk-validium/cdk-validium-contracts-0.0.2 % cd deployment -~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % cp deploy_parameters.json.example deploy_parameters.json +cd /cdk-validium/cdk-validium-contracts-0.0.2/deployment +cp deploy_parameters.json.example deploy_parameters.json ``` -### Configure deployment parameters - -There are several fields that need to be changed inside `deploy_parameters.json`. - - trustedSequencer - - trustedAggregator - - admin - - cdkValidiumOwner - - initialCDKValidiumDeployerOwner - - trustedSequencerURL - - forkID +!!! info "Parameters that need to be updated in `deploy_parameters.json`" + - `trustedSequencer` + - `trustedAggregator` + - `admin` + - `cdkValidiumOwner` + - `initialCDKValidiumDeployerOwner` + - `trustedSequencerURL` + - `forkID` -We can run this `jq` script to streamline the process of replacing these fields: +2. Run the following `jq` script to streamline the process of replacing these fields: ```bash source /tmp/cdk/.env jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json ``` -Your complete `deploy_parameters.json` should look similar to this: +3. The complete `deploy_parameters.json` should look something like this: ```bash cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json @@ -56,87 +56,95 @@ cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.jso } ``` -Now we have set the configuration for our contracts, lets deploy! +## Deploy and verify contracts -The first step is deploying and verifying the `CDKValidiumDeployer`, this will be the factory for deterministic contracts, the address of the contracts will depend on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. +### `CDKValidiumDeployer` -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run deploy:deployer:CDKValidium:sepolia -``` +This contract is a factory that deploys the deterministic contracts required by the system and must be deployed first. -On successful deployment of `CDKValidiumDeployer`, you should see something similar to this: +The address of the contracts it creates depends on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. -```bash -cdkValidiumDeployer deployed on: 0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF -``` +1. Run the deploy script. -Now we can move forward and deploy the rest of the contract suite: + ```bash + npm run deploy:deployer:CDKValidium:sepolia + ``` -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run deploy:testnet:CDKValidium:sepolia -``` + You should see something similar to this: -Please note this can take several minutes depending on network conditions. + ```bash + cdkValidiumDeployer deployed on: 0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF + ``` -On successful deployment, a new directory named `deployments` should have been created. Inside that directory, another was created with information about your deployment. +2. Now we can deploy the rest of the contract suite. -```bash -# ~/cdk-validium/cdk-validium-contracts-0.0.2/deployments/sepolia_1705429054/deploy_output.json -{ - "cdkValidiumAddress": "0x37eEBCa90363b0952e03a64979B64AAE3b8C9631", - "polygonZkEVMBridgeAddress": "0x3485bfA6F27e54a8FF9782032fdbC7C555c178E4", - "polygonZkEVMGlobalExitRootAddress": "0x8330E90c82F4BDDfa038041B898DE2d900e6246C", - "cdkDataCommitteeContract": "0xb49d901748c3E278a634c05E0c500b23db992fb0", - "maticTokenAddress": "0x20db28Bb7C779a06E4081e55808cc5DE35cca303", - "verifierAddress": "0xb01Be1534d1eF82Ba98DCd5B33A3A331B6d119D0", - "cdkValidiumDeployerContract": "0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF", - "deployerAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "timelockContractAddress": "0xDa476BD0B6A660cd08239dEb620F701877688c6F", - "deploymentBlockNumber": 5097689, - "genesisRoot": "0xf07cd7c4f7df7092241ccb2072d9ac9e800a87513df628245657950b3af78f94", - "trustedSequencer": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "trustedSequencerURL": "http://127.0.0.1:8123", - "chainID": 1001, - "networkName": "cdk-validium", - "admin": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "trustedAggregator": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "proxyAdminAddress": "0x828E55268524c13dB25FD33f2Be45D2771f1EeA4", - "forkID": 6, - "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", - "version": "0.0.1" -} -``` + ```bash + npm run deploy:testnet:CDKValidium:sepolia + ``` -In addition to `deploy_output.json`, a `genesis.json` should have been generated in `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` -We will take the outputs of `genesis.json` and `deploy_output.json` and use them to configure our node in the next steps of setup and deployment of `cdk-validium-node`. + !!! info + This may take several minutes depending on network conditions. +3. On successful deployment, you should see a new directory named `deployments` containing a directory storing the information about your deployment. For example: -Congrats! You’ve deployed the CDK Validium contracts! + ```bash + # ~/cdk-validium/cdk-validium-contracts-0.0.2/deployments/sepolia_1705429054/deploy_output.json + { + "cdkValidiumAddress": "0x37eEBCa90363b0952e03a64979B64AAE3b8C9631", + "polygonZkEVMBridgeAddress": "0x3485bfA6F27e54a8FF9782032fdbC7C555c178E4", + "polygonZkEVMGlobalExitRootAddress": "0x8330E90c82F4BDDfa038041B898DE2d900e6246C", + "cdkDataCommitteeContract": "0xb49d901748c3E278a634c05E0c500b23db992fb0", + "maticTokenAddress": "0x20db28Bb7C779a06E4081e55808cc5DE35cca303", + "verifierAddress": "0xb01Be1534d1eF82Ba98DCd5B33A3A331B6d119D0", + "cdkValidiumDeployerContract": "0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF", + "deployerAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "timelockContractAddress": "0xDa476BD0B6A660cd08239dEb620F701877688c6F", + "deploymentBlockNumber": 5097689, + "genesisRoot": "0xf07cd7c4f7df7092241ccb2072d9ac9e800a87513df628245657950b3af78f94", + "trustedSequencer": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedSequencerURL": "http://127.0.0.1:8123", + "chainID": 1001, + "networkName": "cdk-validium", + "admin": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedAggregator": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "proxyAdminAddress": "0x828E55268524c13dB25FD33f2Be45D2771f1EeA4", + "forkID": 6, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "version": "0.0.1" + } + ``` -### 2. Verifying contracts +4. In addition to the `deploy_output.json` file, you should see a `genesis.json` file in `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/`. -If deploying to Sepolia, the contracts should be automatically verified based on other live deployments on the network with similar bytecode. If you see that the contracts have not been verified on Etherscan. Run the following commands: + We will take the outputs of `genesis.json` and `deploy_output.json` and use them to configure the `cdk-validium-node` node. -To verify the contract factory: +!!! warning "Deployment failure" + - Since there are deterministic addresses, you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. + - It's mandatory to delete the `~/cdk-validium/cdk-validium-contracts-0.0.2/.openzeppelin` upgradability information in order to make a new deployment. -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run verify:deployer:CDKValidium:sepolia -``` +## Verifying contracts -To verify the rest of the contract suite: +When deploying to Sepolia, the contracts should automatically verify based on other live deployments on the network with similar bytecode. If the contracts have not been verified on Etherscan, run the following commands from the `/cdk-validium/cdk-validium-contracts-0.0.2/deployment` directory. -```bash -~/cdk-validium/cdk-validium-contracts-0.0.2/deployment % npm run verify:CDKValidium:sepolia -``` +1. To verify the contract factory: + + ```bash + npm run verify:deployer:CDKValidium:sepolia + ``` + +2. To verify the rest of the contract suite: -### Using a different node provider + ```bash + npm run verify:CDKValidium:sepolia + ``` -If you prefer to use a different node provider than Infura, the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `.env` can be modified to fit your provider. +## Using a different node provider -For example using Alchemy: +Modify the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `cdk-validium-contracts-0.0.2/.env` if you prefer to use a different node provider than Infura. + +For example, using Alchemy: ```bash -# ~/cdk-validium/cdk-validium-contracts-0.0.2/.env MNEMONIC="island debris exhaust typical clap debate exhaust little verify mean sausage entire" INFURA_PROJECT_ID="" # or blank if not using Infura ETHERSCAN_API_KEY="1234567890abcdefghijklmnopqr" # or blank if not verify contracts @@ -144,7 +152,6 @@ ALCHEMY_PROJECT_ID="dGPpsDzM9KpFTEnqMO44rvIXcc0fmgxr" # add this line ``` ```bash -# ~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js sepolia: { url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_PROJECT_ID}`, # rpc value changed here accounts: { @@ -154,10 +161,4 @@ sepolia: { count: 20, }, }, -``` - -### Deployment failure - -- Since there are deterministic address you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. - -- It's mandatory to delete the `~/cdk-validium/cdk-validium-contracts-0.0.2/.openzeppelin` upgradability information in order to make a new deployment \ No newline at end of file +``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/prerequisites.md b/docs/cdk/get-started/deploy-validium/prerequisites.md index e5ec233a4..9f9d5ee33 100644 --- a/docs/cdk/get-started/deploy-validium/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/prerequisites.md @@ -19,8 +19,8 @@ Make sure you have the following software: You will need the following: -- A Sepolia node RPC URL: e.g. https://goerli.infura.io/v3/YOUR-INFURA-API-KEY -- An account address holding minimum 2 Sepolia ETH. +- A Sepolia node RPC URL: e.g. https://sepolia.infura.io/v3/YOUR-INFURA-API-KEY +- An account holding minimum 2 Sepolia ETH that you can send to a generated address within CDK. ### Faucets @@ -32,7 +32,7 @@ Use a public faucet to get Sepolia test ETH. ## Configuration files -Create a folder inside `/tmp/` named `/cdk/` that will store all the configuration files. +Create a folder in `/tmp/cdk/` to store configuration files. ```bash mkdir /tmp/cdk/ @@ -40,7 +40,7 @@ mkdir /tmp/cdk/ ## Environment variables -Create a `.env` file to store environment variables. +Create a `.env` file to store environment variables we will use later on. ```bash nano /tmp/cdk/.env diff --git a/docs/cdk/get-started/deploy-validium/set-up.md b/docs/cdk/get-started/deploy-validium/set-up.md index c52237ee4..1b119ac02 100644 --- a/docs/cdk/get-started/deploy-validium/set-up.md +++ b/docs/cdk/get-started/deploy-validium/set-up.md @@ -1,6 +1,6 @@ -## Download the `cdk-validium-contracts` +## Download the validium repo -1. Create a new directory to store the `cdk-validium-contracts` and the `cdk-validium-node` and cd into it. +1. Create a new directory and cd into it. ```bash mkdir cdk-validium @@ -10,43 +10,40 @@ 2. Download the `0.0.2` release from the [cdk-validium-contracts github repo](https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2-RC1). !!! note - It is available in both `.tar.gz` and `.zip` formats + The download is available in both `.tar.gz` and `.zip` formats. ```bash - ~/cdk-validium % curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz - - tar -xzf cdk-validium-contracts.tar.gz + curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz ``` -## Prepare the environment - -`cd` into `cdk-validium-contracts-0.0.2/` +3. Extract the files and cd into the repo. -```bash -~/cdk-validium % cd cdk-validium-contracts-0.0.2/ -``` + ```bash + tar -xzf cdk-validium-contracts.tar.gz + cd cdk-validium-contracts-0.0.2/ + ``` -### Install the dependencies +## Install the dependencies ```bash -~/cdk-validium/cdk-validium-contracts-0.0.2 % npm install +npm install ``` -### Create the .env configuration +## Create the .env configuration 1. Copy the environment configuration example file into a new `.env` file. ```bash - ~/cdk-validium/cdk-validium-contracts-0.0.2 % cp .env.example .env + cp .env.example .env + nano .env ``` -2. The file requires the following environment variables. +2. Add the environment variables. ```bash - # ~/cdk-validium/cdk-validium-contracts-0.0.2/.env - MNEMONIC="" # see instructions below + MNEMONIC="" # see instructions below in step 3 INFURA_PROJECT_ID="" # Generate a project id on [Infura](https://www.infura.io/) - ETHERSCAN_API_KEY="" # Generate a project id on [Etherscan](https://etherscan.io) + ETHERSCAN_API_KEY="" # Generate an API key on [Etherscan](https://etherscan.io) ``` 3. Generate a new mnemonic using `cast`. @@ -55,7 +52,8 @@ cast wallet new-mnemonic --words 12 ``` - *note: if command **`new-mnemonic`** is not found, update foundry using **`foundryup`*** + !!! important + If the command `new-mnemonic` is not found, update foundry with `foundryup` and try again. The output should look something like this: @@ -68,15 +66,19 @@ Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 ``` -4. Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `.env` +4. Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `cdk-validium-contracts-0.0.2/.env` +5. Send 2 Sepolia ETH to the generated address. -5. Load the variables into `/tmp/cdk.env`. This is an important step and allows us to use `jq` and `tomlq` later on to setup our configuration files. +6. Add the following variables to `/tmp/cdk/.env`. ```bash # /tmp/cdk/.env - TEST_ADDRESS=0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE - TEST_PRIVATE_KEY=0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 + TEST_ADDRESS= + TEST_PRIVATE_KEY= L1_URL=https://sepolia.infura.io/v3/ L1_WS_URL=wss://sepolia.infura.io/ws/v3/ ``` +!!! important + This step allows us to use `jq` and `tomlq` later on to setup our configuration files. + From 6eb798762a61d07c297b727546563a20d7b1773b Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Fri, 26 Jan 2024 17:12:53 +0100 Subject: [PATCH 08/26] updates to contract --- docs/cdk/get-started/deploy-validium/deploy-contracts.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/deploy-contracts.md index 0321ecdc6..f94cc07a6 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/deploy-contracts.md @@ -114,9 +114,10 @@ The address of the contracts it creates depends on the salt and the `initialCDKV } ``` -4. In addition to the `deploy_output.json` file, you should see a `genesis.json` file in `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/`. +4. In the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` folder, you should also see a `genesis.json` file. - We will take the outputs of `genesis.json` and `deploy_output.json` and use them to configure the `cdk-validium-node` node. +!!! info + We use the info in `genesis.json` and `deploy_output.json` to configure the `cdk-validium-node` node. !!! warning "Deployment failure" - Since there are deterministic addresses, you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. From cdbdbbe0bc8fee99de6b5b6b8a52a7e43ea2ee53 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 10:13:37 +0100 Subject: [PATCH 09/26] commit new pages --- .../deploy-validium/deploy-contracts.md | 200 +++++++++--------- .../deploy-validium/deploy-node.md | 0 .../deploy-validium/environment-overview.md | 21 ++ docs/cdk/get-started/deploy-validium/intro.md | 2 +- .../cdk/get-started/deploy-validium/set-up.md | 3 + mkdocs.yml | 1 + 6 files changed, 126 insertions(+), 101 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/deploy-node.md create mode 100644 docs/cdk/get-started/deploy-validium/environment-overview.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/deploy-contracts.md index f94cc07a6..1a61b1051 100644 --- a/docs/cdk/get-started/deploy-validium/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/deploy-contracts.md @@ -2,61 +2,61 @@ 1. `cd` to the `deployment/` directory and create a new `deploy_parameters.json` by copying the example -```bash -cd /cdk-validium/cdk-validium-contracts-0.0.2/deployment -cp deploy_parameters.json.example deploy_parameters.json -``` - -!!! info "Parameters that need to be updated in `deploy_parameters.json`" - - `trustedSequencer` - - `trustedAggregator` - - `admin` - - `cdkValidiumOwner` - - `initialCDKValidiumDeployerOwner` - - `trustedSequencerURL` - - `forkID` + ```bash + cd /cdk-validium/cdk-validium-contracts-0.0.2/deployment + cp deploy_parameters.json.example deploy_parameters.json + ``` + + !!! info "Parameters updates at step 3 in `deploy_parameters.json`" + - `trustedSequencer` + - `trustedAggregator` + - `admin` + - `cdkValidiumOwner` + - `initialCDKValidiumDeployerOwner` + - `trustedSequencerURL` + - `forkID` 2. Run the following `jq` script to streamline the process of replacing these fields: -```bash -source /tmp/cdk/.env -jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json -``` + ```bash + source /tmp/cdk/.env + jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json + ``` 3. The complete `deploy_parameters.json` should look something like this: -```bash -cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json -# ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json -{ - "realVerifier": false, - "trustedSequencerURL": "http://127.0.0.1:8123, - "networkName": "cdk-validium", - "version":"0.0.1", - "trustedSequencer":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "chainID": 1001, - "trustedAggregator":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "trustedAggregatorTimeout": 604799, - "pendingStateTimeout": 604799, - "forkID": 6, - "admin":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "cdkValidiumOwner": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "timelockAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", - "minDelayTimelock": 3600, - "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", - "initialCDKValidiumDeployerOwner" :"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "maticTokenAddress":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", - "cdkValidiumDeployerAddress":"", - "deployerPvtKey": "", - "maxFeePerGas":"", - "maxPriorityFeePerGas":"", - "multiplierGas": "", - "setupEmptyCommittee": true, - "committeeTimelock": false -} -``` - -## Deploy and verify contracts + ```bash + cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json + # ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json + { + "realVerifier": false, + "trustedSequencerURL": "http://127.0.0.1:8123, + "networkName": "cdk-validium", + "version":"0.0.1", + "trustedSequencer":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "chainID": 1001, + "trustedAggregator":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedAggregatorTimeout": 604799, + "pendingStateTimeout": 604799, + "forkID": 6, + "admin":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "cdkValidiumOwner": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "timelockAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "minDelayTimelock": 3600, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialCDKValidiumDeployerOwner" :"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "maticTokenAddress":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "cdkValidiumDeployerAddress":"", + "deployerPvtKey": "", + "maxFeePerGas":"", + "maxPriorityFeePerGas":"", + "multiplierGas": "", + "setupEmptyCommittee": true, + "committeeTimelock": false + } + ``` + +## Deploy contracts ### `CDKValidiumDeployer` @@ -66,80 +66,80 @@ The address of the contracts it creates depends on the salt and the `initialCDKV 1. Run the deploy script. - ```bash - npm run deploy:deployer:CDKValidium:sepolia - ``` + ```bash + npm run deploy:deployer:CDKValidium:sepolia + ``` - You should see something similar to this: + You should see something similar to this: - ```bash - cdkValidiumDeployer deployed on: 0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF - ``` + ```bash + cdkValidiumDeployer deployed on: 0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF + ``` 2. Now we can deploy the rest of the contract suite. - ```bash - npm run deploy:testnet:CDKValidium:sepolia - ``` + ```bash + npm run deploy:testnet:CDKValidium:sepolia + ``` - !!! info - This may take several minutes depending on network conditions. + !!! info + This may take several minutes depending on network conditions. 3. On successful deployment, you should see a new directory named `deployments` containing a directory storing the information about your deployment. For example: - ```bash - # ~/cdk-validium/cdk-validium-contracts-0.0.2/deployments/sepolia_1705429054/deploy_output.json - { - "cdkValidiumAddress": "0x37eEBCa90363b0952e03a64979B64AAE3b8C9631", - "polygonZkEVMBridgeAddress": "0x3485bfA6F27e54a8FF9782032fdbC7C555c178E4", - "polygonZkEVMGlobalExitRootAddress": "0x8330E90c82F4BDDfa038041B898DE2d900e6246C", - "cdkDataCommitteeContract": "0xb49d901748c3E278a634c05E0c500b23db992fb0", - "maticTokenAddress": "0x20db28Bb7C779a06E4081e55808cc5DE35cca303", - "verifierAddress": "0xb01Be1534d1eF82Ba98DCd5B33A3A331B6d119D0", - "cdkValidiumDeployerContract": "0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF", - "deployerAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "timelockContractAddress": "0xDa476BD0B6A660cd08239dEb620F701877688c6F", - "deploymentBlockNumber": 5097689, - "genesisRoot": "0xf07cd7c4f7df7092241ccb2072d9ac9e800a87513df628245657950b3af78f94", - "trustedSequencer": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "trustedSequencerURL": "http://127.0.0.1:8123", - "chainID": 1001, - "networkName": "cdk-validium", - "admin": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "trustedAggregator": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "proxyAdminAddress": "0x828E55268524c13dB25FD33f2Be45D2771f1EeA4", - "forkID": 6, - "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", - "version": "0.0.1" - } - ``` + ```bash + # ~/cdk-validium/cdk-validium-contracts-0.0.2/deployments/sepolia_1705429054/deploy_output.json + { + "cdkValidiumAddress": "0x37eEBCa90363b0952e03a64979B64AAE3b8C9631", + "polygonZkEVMBridgeAddress": "0x3485bfA6F27e54a8FF9782032fdbC7C555c178E4", + "polygonZkEVMGlobalExitRootAddress": "0x8330E90c82F4BDDfa038041B898DE2d900e6246C", + "cdkDataCommitteeContract": "0xb49d901748c3E278a634c05E0c500b23db992fb0", + "maticTokenAddress": "0x20db28Bb7C779a06E4081e55808cc5DE35cca303", + "verifierAddress": "0xb01Be1534d1eF82Ba98DCd5B33A3A331B6d119D0", + "cdkValidiumDeployerContract": "0x87572242776ccb6c98F4Cf1ff20f7e5a4e4142fF", + "deployerAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "timelockContractAddress": "0xDa476BD0B6A660cd08239dEb620F701877688c6F", + "deploymentBlockNumber": 5097689, + "genesisRoot": "0xf07cd7c4f7df7092241ccb2072d9ac9e800a87513df628245657950b3af78f94", + "trustedSequencer": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedSequencerURL": "http://127.0.0.1:8123", + "chainID": 1001, + "networkName": "cdk-validium", + "admin": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "trustedAggregator": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", + "proxyAdminAddress": "0x828E55268524c13dB25FD33f2Be45D2771f1EeA4", + "forkID": 6, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "version": "0.0.1" + } + ``` 4. In the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` folder, you should also see a `genesis.json` file. -!!! info - We use the info in `genesis.json` and `deploy_output.json` to configure the `cdk-validium-node` node. + !!! info + We use the info in `genesis.json` and `deploy_output.json` to configure the `cdk-validium-node` node. -!!! warning "Deployment failure" - - Since there are deterministic addresses, you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. - - It's mandatory to delete the `~/cdk-validium/cdk-validium-contracts-0.0.2/.openzeppelin` upgradability information in order to make a new deployment. + !!! warning "Deployment failure" + - Since there are deterministic addresses, you cannot deploy twice on the same network using the same `salt` and `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. Changing one of them is enough to make a new deployment. + - It's mandatory to delete the `~/cdk-validium/cdk-validium-contracts-0.0.2/.openzeppelin` upgradability information in order to make a new deployment. -## Verifying contracts +## Verify contracts When deploying to Sepolia, the contracts should automatically verify based on other live deployments on the network with similar bytecode. If the contracts have not been verified on Etherscan, run the following commands from the `/cdk-validium/cdk-validium-contracts-0.0.2/deployment` directory. 1. To verify the contract factory: - ```bash - npm run verify:deployer:CDKValidium:sepolia - ``` + ```bash + npm run verify:deployer:CDKValidium:sepolia + ``` 2. To verify the rest of the contract suite: - ```bash - npm run verify:CDKValidium:sepolia - ``` + ```bash + npm run verify:CDKValidium:sepolia + ``` -## Using a different node provider +## Use a different node provider Modify the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `cdk-validium-contracts-0.0.2/.env` if you prefer to use a different node provider than Infura. diff --git a/docs/cdk/get-started/deploy-validium/deploy-node.md b/docs/cdk/get-started/deploy-validium/deploy-node.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/cdk/get-started/deploy-validium/environment-overview.md b/docs/cdk/get-started/deploy-validium/environment-overview.md new file mode 100644 index 000000000..9a1b7ed3b --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/environment-overview.md @@ -0,0 +1,21 @@ +Deploying the full stack Polygon CDK validium EVM-compatible network requires installing and deploying a number of different components. + +| Component | Container | Description | +| :---------------- | :------------------- | ------------------------------------------------------------ | +| Sequencer | `zkevm-sequencer` | Fetches txs from the pool DB, checks if valid, then puts valid ones into a batch. | +| Aggregator | `zkevm-aggregator` | Validates sequenced batches by generating verifiable zero-knowledge proofs. | +| Synchronizer | `zkevm-sync` | Updates the state by fetching data from Ethereum through the Etherman. | +| JSON RPC | `zkevm-rpc` | An interface for interacting with the network. e.g., Metamask, Etherscan or Bridge. | +| State DB | `zkevm-state-db` | A database for permanently storing state data (apart from the Merkle tree). | +| Prover | `zkevm-prover-server` | Used by the aggregator to create zk-proofs. The full prover is extremely resource-heavy and runs on an external cloud server. Use the mock prover for evaluation/test purposes. | +| Pool DB | `zkevm-pool-db` | Stores txs from the RPC nodes, waiting to be put in a batch by the sequencer. | +| Executor | `zkevm-executor` | Executes all processes. Collects results’ metadata (state root, receipts, logs) | +| Etherman | `zkevm-eth-tx-manager` | Implements methods for all interactions with the L1 network and smart contracts. | +| Bridge UI | `zkevm-bridge-ui` | User-interface for bridging ERC-20 tokens between L2 and L1 or another L2. | +| Bridge DB | `zkevm-bridge-db` | A database for storing bridge-related transactions data. | +| Bridge service | `zkevm-bridge-service` | A backend service enabling clients like the web UI to interact with bridge smart contracts. | +| zkEVM explorer | `zkevm-explorer-l2` | L2 network's block explorer. i.e., The zkRollup Etherscan [explorer](https://zkevm.polygonscan.com). | +| zkEVM explorer DB | `zkevm-explorer-l2-db` | Database for the L2 network's Block explorer. i.e., Where all the zkRollup Etherscan explorer queries are made. | +| Gas pricer | `zkevm-l2gaspricer` | Responsible for suggesting the gas price for the L2 network fees. | +| Goërli execution | `goerli-execution` | L1 node's execution layer. | +| Goërli consensus | `goerli-consensus` | L1 node's consensus layer. \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/intro.md b/docs/cdk/get-started/deploy-validium/intro.md index e157e44a1..2586caa0b 100644 --- a/docs/cdk/get-started/deploy-validium/intro.md +++ b/docs/cdk/get-started/deploy-validium/intro.md @@ -12,4 +12,4 @@ The process is split into the following sections: 3. [Deploy wallets](deploy-contracts.md): Create wallets and deploy contracts. -4. [Deploy node](): Deploy the zkRollup EVM-compatible node. +4. [Deploy node](deploy-node.md): Deploy the zkRollup EVM-compatible node. diff --git a/docs/cdk/get-started/deploy-validium/set-up.md b/docs/cdk/get-started/deploy-validium/set-up.md index 1b119ac02..0a6907b7f 100644 --- a/docs/cdk/get-started/deploy-validium/set-up.md +++ b/docs/cdk/get-started/deploy-validium/set-up.md @@ -46,6 +46,9 @@ npm install ETHERSCAN_API_KEY="" # Generate an API key on [Etherscan](https://etherscan.io) ``` + !!! info + Check our documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider). + 3. Generate a new mnemonic using `cast`. ```bash diff --git a/mkdocs.yml b/mkdocs.yml index 6fb1a310d..fbd1c1b2b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -50,6 +50,7 @@ nav: - Validium: - Introduction: cdk/get-started/deploy-validium/intro.md - Prerequisites: cdk/get-started/deploy-validium/prerequisites.md + - Environment overview: cdk/get-started/deploy-validium/environment-overview.md - Set up: cdk/get-started/deploy-validium/set-up.md - Deploy contracts: cdk/get-started/deploy-validium/deploy-contracts.md - Rollup: From b38395a3c93ca9cb0c2c64fe79a93b5b4e6e6577 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 10:49:40 +0100 Subject: [PATCH 10/26] restructure sections --- .../{ => contracts}/deploy-contracts.md | 0 .../{ => contracts}/prerequisites.md | 0 .../deploy-validium/{ => contracts}/set-up.md | 0 .../deploy-validium/deploy-node.md | 0 .../deploy-validium/environment-overview.md | 21 - docs/cdk/get-started/deploy-validium/index.md | 10 + docs/cdk/get-started/deploy-validium/intro.md | 15 - .../deploy-validium/node/deploy-node.md | 680 ++++++++++++++++++ mkdocs.yml | 11 +- 9 files changed, 696 insertions(+), 41 deletions(-) rename docs/cdk/get-started/deploy-validium/{ => contracts}/deploy-contracts.md (100%) rename docs/cdk/get-started/deploy-validium/{ => contracts}/prerequisites.md (100%) rename docs/cdk/get-started/deploy-validium/{ => contracts}/set-up.md (100%) delete mode 100644 docs/cdk/get-started/deploy-validium/deploy-node.md delete mode 100644 docs/cdk/get-started/deploy-validium/environment-overview.md create mode 100644 docs/cdk/get-started/deploy-validium/index.md delete mode 100644 docs/cdk/get-started/deploy-validium/intro.md create mode 100644 docs/cdk/get-started/deploy-validium/node/deploy-node.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md similarity index 100% rename from docs/cdk/get-started/deploy-validium/deploy-contracts.md rename to docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md diff --git a/docs/cdk/get-started/deploy-validium/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md similarity index 100% rename from docs/cdk/get-started/deploy-validium/prerequisites.md rename to docs/cdk/get-started/deploy-validium/contracts/prerequisites.md diff --git a/docs/cdk/get-started/deploy-validium/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md similarity index 100% rename from docs/cdk/get-started/deploy-validium/set-up.md rename to docs/cdk/get-started/deploy-validium/contracts/set-up.md diff --git a/docs/cdk/get-started/deploy-validium/deploy-node.md b/docs/cdk/get-started/deploy-validium/deploy-node.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/cdk/get-started/deploy-validium/environment-overview.md b/docs/cdk/get-started/deploy-validium/environment-overview.md deleted file mode 100644 index 9a1b7ed3b..000000000 --- a/docs/cdk/get-started/deploy-validium/environment-overview.md +++ /dev/null @@ -1,21 +0,0 @@ -Deploying the full stack Polygon CDK validium EVM-compatible network requires installing and deploying a number of different components. - -| Component | Container | Description | -| :---------------- | :------------------- | ------------------------------------------------------------ | -| Sequencer | `zkevm-sequencer` | Fetches txs from the pool DB, checks if valid, then puts valid ones into a batch. | -| Aggregator | `zkevm-aggregator` | Validates sequenced batches by generating verifiable zero-knowledge proofs. | -| Synchronizer | `zkevm-sync` | Updates the state by fetching data from Ethereum through the Etherman. | -| JSON RPC | `zkevm-rpc` | An interface for interacting with the network. e.g., Metamask, Etherscan or Bridge. | -| State DB | `zkevm-state-db` | A database for permanently storing state data (apart from the Merkle tree). | -| Prover | `zkevm-prover-server` | Used by the aggregator to create zk-proofs. The full prover is extremely resource-heavy and runs on an external cloud server. Use the mock prover for evaluation/test purposes. | -| Pool DB | `zkevm-pool-db` | Stores txs from the RPC nodes, waiting to be put in a batch by the sequencer. | -| Executor | `zkevm-executor` | Executes all processes. Collects results’ metadata (state root, receipts, logs) | -| Etherman | `zkevm-eth-tx-manager` | Implements methods for all interactions with the L1 network and smart contracts. | -| Bridge UI | `zkevm-bridge-ui` | User-interface for bridging ERC-20 tokens between L2 and L1 or another L2. | -| Bridge DB | `zkevm-bridge-db` | A database for storing bridge-related transactions data. | -| Bridge service | `zkevm-bridge-service` | A backend service enabling clients like the web UI to interact with bridge smart contracts. | -| zkEVM explorer | `zkevm-explorer-l2` | L2 network's block explorer. i.e., The zkRollup Etherscan [explorer](https://zkevm.polygonscan.com). | -| zkEVM explorer DB | `zkevm-explorer-l2-db` | Database for the L2 network's Block explorer. i.e., Where all the zkRollup Etherscan explorer queries are made. | -| Gas pricer | `zkevm-l2gaspricer` | Responsible for suggesting the gas price for the L2 network fees. | -| Goërli execution | `goerli-execution` | L1 node's execution layer. | -| Goërli consensus | `goerli-consensus` | L1 node's consensus layer. \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/index.md b/docs/cdk/get-started/deploy-validium/index.md new file mode 100644 index 000000000..b15ac8408 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/index.md @@ -0,0 +1,10 @@ +This quick start takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia. + +The process requires two separate steps with different software requirements. For this reason, these instructions have two distinct sections. + +1. Deploying the contracts. +2. Deploying the node and services. + +!!! warning + - The instructions are subject to frequent updates as the software remains at an early development stage. + - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/intro.md b/docs/cdk/get-started/deploy-validium/intro.md deleted file mode 100644 index 2586caa0b..000000000 --- a/docs/cdk/get-started/deploy-validium/intro.md +++ /dev/null @@ -1,15 +0,0 @@ -This quick start takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia. - -!!! warning - - These instructions are subject to frequent updates as the software remains at an early development stage. - - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs - -The process is split into the following sections: - -1. [Prerequisite steps](prerequisites.md): Checking system requirements, prepare configuration and environment variables. - -2. [Set up](set-up.md): Install required dependencies and downloading mainnet files. - -3. [Deploy wallets](deploy-contracts.md): Create wallets and deploy contracts. - -4. [Deploy node](deploy-node.md): Deploy the zkRollup EVM-compatible node. diff --git a/docs/cdk/get-started/deploy-validium/node/deploy-node.md b/docs/cdk/get-started/deploy-validium/node/deploy-node.md new file mode 100644 index 000000000..779d1c2fd --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/node/deploy-node.md @@ -0,0 +1,680 @@ +| Repo | Version | +| --- | --- | +| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 | +| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 | +| https://github.com/0xPolygon/cdk-data-availability.git | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 | + +The listed version may not be the most recent, but this will give a general idea of how the deployment process works. + +# Prerequisites + +### Minimum Requirements: + +| Minimum Disk Size | vCPUs | Memory (GB) | CPU Type | Architecture | OS | +| --- | --- | --- | --- | --- | --- | +| 32GB | 2 | 8 | Intel or AMD | x86/64 | Ubuntu 22.04 | + +Your operating system should be Linux-based (preferably Ubuntu 22.04), and it must have an AMD or Intel chip. + +Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contracts and various contract calls. + +## Dependency Checking + +| Dependency | Version | Installation links | +| --- | --- | --- | +| git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | +| node | 16.0.0 | https://nodejs.org/en/download | +| npm | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | +| golang | 1.18.0 | https://go.dev/doc/install | +| cast | 0.2.0 | https://book.getfoundry.sh/getting-started/installation | +| jq | 1.0 | https://jqlang.github.io/jq/download/ | +| tomlq | 3.0.0 | https://kislyuk.github.io/yq/#installation | +| postgres | 15 | https://www.postgresql.org/download/ | +| psql | 15.0 | https://www.postgresql.org/download/ | +| make | 3.80.0 | https://www.gnu.org/software/make/ | +| docker | 24.0.0 | https://docs.docker.com/engine/install/ | +| pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | +| [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ | +| [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | +- You can run the following script to validate that dependency requirements are met: + + ```bash + #!/bin/bash + + declare -A commands + commands["git"]="2.18.0" + commands["node"]="16.0.0" + commands["npm"]="6.0.0" + commands["go"]="1.18.0" + commands["cast"]="0.2.0" + commands["jq"]="1.0" + commands["tomlq"]="3.0.0" + commands["psql"]="15.0" + commands["make"]="3.80.0" + commands["docker"]="24.0.0" + commands["pip3"]="20.0.2" + commands["python3"]="3.8.0" + commands["polycli"]="0.1.39" + + # Function to check command version + check_version() { + local command=$1 + local min_version=$2 + local version + local status + + if ! command -v "$command" &> /dev/null; then + printf "| %-15s | %-20s | %-20s |\n" "$command" "Not Found" "$min_version" + return + fi + + case "$command" in + git) version=$(git --version | awk '{print $3}') ;; + node) version=$(node --version | cut -d v -f 2) ;; + npm) version=$(npm --version) ;; + go) version=$(go version | awk '{print $3}' | cut -d 'o' -f 2) ;; + cast) version=$(cast --version | awk '{print $2}') ;; + jq) version=$(jq --version | cut -d '-' -f 2) ;; + tomlq) version=$(tomlq --version | awk '{print $2}') ;; + psql) version=$(psql --version | awk '{print $3}') ;; + make) version=$(make --version | head -n 1 | awk '{print $3}') ;; + docker) version=$(docker --version | awk '{print $3}' | cut -d ',' -f 1) ;; + pip3) version=$(pip3 --version | awk '{print $2}') ;; + python3) version=$(python3 --version | awk '{print $2}') ;; + polycli) version=$(polycli version | awk '{print $4}' | cut -d '-' -f 1 | sed 's/v//') ;; + *) version="Found" ;; + esac + + printf "| %-15s | %-20s | %-20s |\n" "$command" "$version" "$min_version" + } + + echo "+-----------------+----------------------+----------------------+" + printf "| %-15s | %-20s | %-20s |\n" "CLI Command" "Found Version" "Minimum Version" + echo "+-----------------+----------------------+----------------------+" + + for cmd in "${!commands[@]}"; do + check_version "$cmd" "${commands[$cmd]}" + echo "+-----------------+----------------------+----------------------+" + done + ``` + + You can create a `version-check.sh` file, then copy and paste the script into that file. Then run the following to execute the script: + + ```bash + chmod +x version-check.sh + ./version-check.sh + ``` + + +# Setup & Deployment + +First, lets navigate back to the working directory we created earlier, `~/cdk-validium` + +```bash +cd ~/cdk-validium +``` + +For this setup, we will also need our information from `deploy_output.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment`. Navigate back to `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment` and run the following script to fill the required parameters into the `/tmp/cdk/.env` we created in the previous steps: + +```bash +cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment +echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env +echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env +echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env +``` + +Source our new environment and navigate back to `~/cdk-validium`: + +```bash +source /tmp/cdk/.env +cd ~/cdk-validium +``` + +## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service + +Now clone the `0.0.3` release of `cdk-validium-node`. + +```bash +git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git +``` + +We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here: + +[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) + +Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting + +```bash +~/cdk-validium % curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz +\tar -xzf cdk-data-availability.tar.gz +``` + +Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here: + +```bash +curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz +\tar -xzf cdk-bridge-service.tar.gz + +``` +Now we have three new directories in *`cdk-validium/`* named ***`cdk-data-availability-0.0.3`, `cdk-validium-node` and `zkevm-bridge-service-0.3.1`*** + +## 2. Preparing the environment + +We will begin our setup in the node directory. + +Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`*** + +```bash +~/cdk-validium % cd cdk-validium-node/ +``` + +### Setup the database + +Run the docker command to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service. + +```bash +docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 +``` + +*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes* + +```bash +sudo lsof -t -i:5432 +kill -9 +``` + +Once you have postgres running, validate you have the following setup correctly: + +- an admin account called: `cdk_user` with a password of `cdk_password` +- postgres server running on `localhost:5432` + +You can use the following command to validate the steps, `\q` to exit: + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 +#=> \q +``` + +### Provision the database + +The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate. Run the script to provision all the necessary databases and schemas that will be used for both the prover and node: + +```bash +~/cdk-validium/cdk-validium-node % PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql +``` + +In addition to the provisions required for the prover and node, another provision is needed for the Data Availability Committee (DAC). We can set this up now for use later. + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" +``` + +Finally, we will provision a database for our bridge service, which we will setup last in this guide. + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" +``` + +### Configure the prover + +To configure our prover, lets copy and modify the contents of `test.prover.config.json` inside `~/cdk-validium/cdk-validium-node/test/config/` to our `/tmp/cdk/` directory we created earlier using the following jq command: + +```bash +~/cdk-validium/cdk-validium-node % jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/postgres"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json +``` + +### Configure the node + +To create the configuration files for our node, we first must build the `cdk-validium-node` itself. + +```bash +~/cdk-validium/cdk-validium-node % make build +``` + +Now we can create a keystore. This will be referenced in all of our`config.toml` we create in the next steps. Take the private key we generated and stored in our `.env` earlier and encrypt it with a basic password. + +For example: + +```bash + +$ source /tmp/cdk/.env +$ ./dist/zkevm-node encryptKey --pk=$TEST_PRIVATE_KEY --pw="testonly" --output=/tmp/cdk/account.keystore +$ find /tmp/cdk/account.keystore -type f -name 'UTC--*' | head -n 1 | xargs -I xxx mv xxx /tmp/cdk/account.key +``` + +*note: make sure your environment is sourced ie: `source /tmp/cdk/.env`* + +The output keystore is now stored in `/tmp/cdk/account.keystore` + +Create a new file `node-config.toml` inside `/tmp/cdk/` and paste the following content: + +Example `node-config.toml`: + +```bash +#/tmp/cdk/node-config.toml +IsTrustedSequencer = true + +[Log] +Environment = "development" # "production" or "development" +Level = "debug" +Outputs = ["stderr"] + +[State] + [State.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "state_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + [State.Batch] + [State.Batch.Constraints] + MaxTxsPerBatch = 300 + MaxBatchBytesSize = 120000 + MaxCumulativeGasUsed = 30000000 + MaxKeccakHashes = 2145 + MaxPoseidonHashes = 252357 + MaxPoseidonPaddings = 135191 + MaxMemAligns = 236585 + MaxArithmetics = 236585 + MaxBinaries = 473170 + MaxSteps = 7570538 + +[Pool] +FreeClaimGasLimit = 1500000 +IntervalToRefreshBlockedAddresses = "5m" +IntervalToRefreshGasPrices = "5s" +MaxTxBytesSize=100132 +MaxTxDataBytesSize=100000 +DefaultMinGasPriceAllowed = 0 +MinAllowedGasPriceInterval = "5m" +PollMinAllowedGasPriceInterval = "15s" +AccountQueue = 64 +GlobalQueue = 1024 + [Pool.EffectiveGasPrice] + Enabled = false + L1GasPriceFactor = 0.25 + ByteGasCost = 16 + ZeroByteGasCost = 4 + NetProfit = 1 + BreakEvenFactor = 1.1 + FinalDeviationPct = 10 + L2GasPriceSuggesterFactor = 0.5 + [Pool.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "pool_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + +[Etherman] +URL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" +ForkIDChunkSize = 20000 +MultiGasProvider = false + [Etherscan] + ApiKey = "" + +[RPC] +Host = "0.0.0.0" +Port = 8123 +ReadTimeout = "60s" +WriteTimeout = "60s" +MaxRequestsPerIPAndSecond = 5000 +SequencerNodeURI = "" +BatchRequestsEnabled = true +EnableL2SuggestedGasPricePolling = true + [RPC.WebSockets] + Enabled = true + Port = 8133 + +[Synchronizer] +SyncInterval = "1s" +SyncChunkSize = 100 +TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. +L1SynchronizationMode = "sequential" # "sequential" or "parallel" + [Synchronizer.L1ParallelSynchronization] + MaxClients = 10 + MaxPendingNoProcessedBlocks = 25 + RequestLastBlockPeriod = "5s" + RequestLastBlockTimeout = "5s" + RequestLastBlockMaxRetries = 3 + StatisticsPeriod = "5m" + TimeoutMainLoop = "5m" + RollupInfoRetriesSpacing= "5s" + FallbackToSequentialModeOnSynchronized = false + [Synchronizer.L1ParallelSynchronization.PerformanceWarning] + AceptableInacctivityTime = "5s" + ApplyAfterNumRollupReceived = 10 + +[Sequencer] +WaitPeriodPoolIsEmpty = "1s" +LastBatchVirtualizationTimeMaxWaitPeriod = "10s" +BlocksAmountForTxsToBeDeleted = 100 +FrequencyToCheckTxsForDelete = "12h" +TxLifetimeCheckTimeout = "10m" +MaxTxLifetime = "3h" + [Sequencer.Finalizer] + GERDeadlineTimeout = "2s" + ForcedBatchDeadlineTimeout = "5s" + SleepDuration = "100ms" + ResourcePercentageToCloseBatch = 10 + GERFinalityNumberOfBlocks = 0 + ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" + ClosingSignalsManagerWaitForCheckingGER = "10s" + ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" + ForcedBatchesFinalityNumberOfBlocks = 0 + TimestampResolution = "10s" + StopSequencerOnBatchNum = 0 + [Sequencer.DBManager] + PoolRetrievalInterval = "500ms" + L2ReorgRetrievalInterval = "5s" + +[SequenceSender] +WaitPeriodSendSequence = "15s" +LastBatchVirtualizationTimeMaxWaitPeriod = "10s" +MaxTxSizeForL1 = 131072 +L2Coinbase = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" +PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + +[Aggregator] +Host = "0.0.0.0" +Port = 50081 +RetryTime = "5s" +VerifyProofInterval = "10s" +TxProfitabilityCheckerType = "acceptall" +TxProfitabilityMinReward = "1.1" +ProofStatePollingInterval = "5s" +SenderAddress = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" +CleanupLockedProofsInterval = "2m" +GeneratingProofCleanupThreshold = "10m" + +[EthTxManager] +ForcedGas = 0 +PrivateKeys = [ + {Path = "/tmp/cdk/account.key", Password = "testonly"} +] + +[L2GasPriceSuggester] +Type = "default" +UpdatePeriod = "10s" +Factor = 0.5 +DefaultGasPriceWei = 0 +MaxGasPriceWei = 0 + +[MTClient] +URI = "localhost:50061" + +[Executor] +URI = "localhost:50071" +MaxGRPCMessageSize = 100000000 + +[Metrics] +Host = "0.0.0.0" +Port = 9091 +Enabled = true +ProfilingHost = "0.0.0.0" +ProfilingPort = 6060 +ProfilingEnabled = true + +[HashDB] +User = "cdk_user" +Password = "cdk_password" +Name = "prover_db" +Host = "localhost" +Port = "5432" +EnableLog = false +MaxConns = 200 +``` + +We will modify the `URL` parameter in`[Etherman]` to the URL of our RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier. Here’s a script to replace those values automatically using your environment sourced from `/tmp/cdk/` + +```bash +source /tmp/cdk/.env +tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.URL = $L1_URL' /tmp/cdk/node-config.toml +tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.SequenceSender.L2Coinbase = $TEST_ADDRESS' /tmp/cdk/node-config.toml +tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.Aggregator.SenderAddress = $TEST_ADDRESS' /tmp/cdk/node-config.toml +``` + +Now we have to copy and modify the `genesis.json` from our earlier deployment of contracts to include information about our newly configured chain + +You can find `genesis.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` + +The values we are going to append to the `genesis.json` would be something like: + +```bash +#~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json +"L1Config": { + "chainId": 11155111, + "maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c", + "polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1", + "cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a", + "polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" +}, +"genesisBlockNumber": 5098088 +``` + +Run the following script to automate the process of appending those JSON values: + +```bash +jq --argjson data "$(jq '{maticTokenAddress, cdkValidiumAddress, cdkDataCommitteeContract, polygonZkEVMGlobalExitRootAddress, deploymentBlockNumber}' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json)" \ +'.L1Config.chainId = 11155111 | +.L1Config.maticTokenAddress = $data.maticTokenAddress | +.L1Config.polygonZkEVMAddress = $data.cdkValidiumAddress | +.L1Config.cdkDataCommitteeContract = $data.cdkDataCommitteeContract | +.L1Config.polygonZkEVMGlobalExitRootAddress = $data.polygonZkEVMGlobalExitRootAddress | +.genesisBlockNumber = $data.deploymentBlockNumber' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json > /tmp/cdk/genesis.json +``` + +### Configure the DAC + +At this point we have setup and provisioned the psql database and configured the zk prover and node. Now let’s configure our Data Availability Comittee + +Navigate into `~/cdk-validium/cdk-data-availability-0.0.3` we downloaded in step 1. + +Build the DAC + +```bash +~/cdk-validium/cdk-data-availability-0.0.3 % make build +``` + +Now we can create a `dac-config.toml` file inside `/tmp/cdk/` . Copy and paste the following example config from below, then run the sequential `tomlq` script to replace the necessary parameters. + +```bash +#~/tmp/cdk/dac-config.toml +PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + +[L1] +WsURL = "wss://sepolia.infura.io/ws/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" +RpcURL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" +CDKValidiumAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" +DataCommitteeAddress = "0x8346026951978bd806912d0c93FB0979D8E3436a" +Timeout = "3m" # Make sure this value is less than the rootchain-int-ws loadbalancer timeout +RetryPeriod = "5s" + +[Log] +Environment = "development" # "production" or "development" +Level = "debug" +Outputs = ["stderr"] + +[DB] +User = "cdk_user" +Password = "cdk_password" +Name = "committee_db" +Host = "127.0.0.1" +Port = "5432" +EnableLog = false +MaxConns = 10 + +[RPC] +Host = "0.0.0.0" +Port = 8444 +ReadTimeout = "60s" +WriteTimeout = "60s" +MaxRequestsPerIPAndSecond = 500 +SequencerNodeURI = "" +EnableL2SuggestedGasPricePolling = false + [RPC.WebSockets] + Enabled = false +``` + +You can replace the values automatically: + +```bash +source /tmp/cdk/.env +tomlq -i -t --arg L1_URL "$L1_URL" '.L1.RpcURL = $L1_URL' /tmp/cdk/dac-config.toml +tomlq -i -t --arg L1_WS_URL "$L1_WS_URL" '.L1.WsURL = $L1_WS_URL' /tmp/cdk/dac-config.toml +tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.CDKValidiumAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml +tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.DataCommitteeAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml +``` + +Now we can update the contracts on Sepolia with information about our DAC + +```bash +cast send \ + --legacy \ + --from $TEST_ADDRESS \ + --private-key $TEST_PRIVATE_KEY \ + --rpc-url $L1_URL \ + $CDK_DATA_COMMITTEE_CONTRACT_ADDRESS \ + 'function setupCommittee(uint256 _requiredAmountOfSignatures, string[] urls, bytes addrsBytes) returns()' \ + 1 \ + '["http://localhost:8444"]' \ + $TEST_ADDRESS +``` + +*note: this can take a few minutes as this transactions has to be mined on Sepolia* + +### Configure Bridge Service + +Navigate into the `cdk-bridge-service-0.3.1` directory and build the files: +```bash +cd ~/cdk-validium/cdk-bridge-service-0.3.1/ +make build +``` +Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk`: using the following config file: + +```bash +nano /tmp/cdk/bridge-config.toml +#/tmp/cdk/bridge-config.toml +[Log] +Level = "info" +Outputs = ["stderr"] + +[SyncDB] +Database = "postgres" +User = "cdk_user" +Name = "bridge_db" +Password = "cdk_password" +Host = "localhost" +Port = "5432" +MaxConns = 20 + +[Etherman] +L1URL = "https://sepolia.infura.io/v3/b27a8be73bcb4bc7a83aada13c65e135" +L2URLs = ["http://localhost:8123"] + +[Synchronizer] +SyncInterval = "1s" +SyncChunkSize = 100 + +[BridgeController] +Store = "postgres" +Height = 32 + +[BridgeServer] +GRPCPort = "9090" +HTTPPort = "8080" +DefaultPageLimit = 25 +MaxPageLimit = 100 +BridgeVersion = "v1" + # Read only + [BridgeServer.DB] + Database = "postgres" + User = "cdk_user" + Name = "bridge_db" + Password = "cdk_password" + Host = "localhost" + Port = "5432" + MaxConns = 20 + +[NetworkConfig] +GenBlockNumber = "5098088" +PolygonZkEVMAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" +PolygonBridgeAddress = "0x24F2aF81Ae588690C9752A342d7549f58133CE4e" +PolygonZkEVMGlobalExitRootAddress = "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" +MaticTokenAddress = "0xd76B50509c1693C7BA35514103a0A156Ca57980c" +L2PolygonBridgeAddresses = ["0x24F2aF81Ae588690C9752A342d7549f58133CE4e"] +L1ChainID = 11155111 + +[ClaimTxManager] +FrequencyToMonitorTxs = "1s" +PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} +Enabled = true +RetryInterval = "1s" +RetryNumber = 10 +``` + +And replace the values using the `tomlq` script: + +```bash +tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.L1URL = $L1_URL' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg GEN_BLOCK_NUMBER "$GEN_BLOCK_NUMBER" '.NetworkConfig.GenBlockNumber = $GEN_BLOCK_NUMBER' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.NetworkConfig.PolygonZkEVMAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg POLYGON_ZKEVM_BRIDGE_ADDRESS "$POLYGON_ZKEVM_BRIDGE_ADDRESS" '.NetworkConfig.PolygonBridgeAddress = $POLYGON_ZKEVM_BRIDGE_ADDRESS' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS "$POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS" '.NetworkConfig.PolygonZkEVMGlobalExitRootAddress = $POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg MATIC_TOKEN_ADDRESS "$MATIC_TOKEN_ADDRESS" '.NetworkConfig.MaticTokenAddress = $MATIC_TOKEN_ADDRESS' /tmp/cdk/bridge-config.toml +tomlq -i -t --arg CDK_DATA_COMMITTEE_CONTRACT_ADDRESS "$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS" '.NetworkConfig.L2PolygonBridgeAddresses = [$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS]' /tmp/cdk/bridge-config.toml +``` + +## 3. Running the components + +### Run the prover + +Since the prover is large and rather compute expensive to build, we will use a docker container + +```bash +docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json +``` + +### Run the node + +```bash +~/cdk-validium/cdk-validium-node % ./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ + --components sequencer \ + --components sequence-sender \ + --components aggregator \ + --components rpc --http.api eth,net,debug,zkevm,txpool,web3 \ + --components synchronizer \ + --components eth-tx-manager \ + --components l2gaspricer +``` + +Run the additional approval scripts for node: + +```bash +~/cdk-validium/cdk-validium-node % ./dist/zkevm-node approve --network custom \ + --custom-network-file /tmp/cdk/genesis.json \ + --cfg /tmp/cdk/node-config.toml \ + --amount 1000000000000000000000000000 \ + --password "testonly" --yes --key-store-path /tmp/cdk/account.key +``` + +### Run the DAC + +```bash +~/cdk-validium/cdk-data-availability-0.0.3 % ./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml +``` + +### Run the Bridge Service + +```bash +~/cdk-validium/cdk-bridge-service % ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 34b8b6a2c..e2e64eab3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,11 +47,12 @@ nav: - Rollup: cdk/get-started/quickstart-rollup.md - Deploy: - Validium: - - Introduction: cdk/get-started/deploy-validium/intro.md - - Prerequisites: cdk/get-started/deploy-validium/prerequisites.md - - Environment overview: cdk/get-started/deploy-validium/environment-overview.md - - Set up: cdk/get-started/deploy-validium/set-up.md - - Deploy contracts: cdk/get-started/deploy-validium/deploy-contracts.md + - Introduction: cdk/get-started/deploy-validium/index.md + - Deploy contracts: + - Prerequisites: cdk/get-started/deploy-validium/contracts/prerequisites.md + - Environment overview: cdk/get-started/deploy-validium/contracts/environment-overview.md + - Set up: cdk/get-started/deploy-validium/contracts/set-up.md + - Deploy contracts: cdk/get-started/deploy-validium/contracts/deploy-contracts.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 18c3775481bba72782d1c0b25d6d524ddda13989 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 10:59:11 +0100 Subject: [PATCH 11/26] commit new page --- docs/cdk/get-started/deploy-validium/index.md | 6 +- .../deploy-validium/node/deploy-node.md | 110 +----------------- .../deploy-validium/node/prerequisites.md | 109 +++++++++++++++++ mkdocs.yml | 4 +- 4 files changed, 116 insertions(+), 113 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/node/prerequisites.md diff --git a/docs/cdk/get-started/deploy-validium/index.md b/docs/cdk/get-started/deploy-validium/index.md index b15ac8408..e427da2ca 100644 --- a/docs/cdk/get-started/deploy-validium/index.md +++ b/docs/cdk/get-started/deploy-validium/index.md @@ -1,9 +1,9 @@ This quick start takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia. -The process requires two separate steps with different software requirements. For this reason, these instructions have two distinct sections. +The process requires two separate flows with different software requirements. For this reason, these instructions have two distinct sections. -1. Deploying the contracts. -2. Deploying the node and services. +1. [Deploying the contracts](contracts/prerequisites.md). +2. [Deploying the node and services](). !!! warning - The instructions are subject to frequent updates as the software remains at an early development stage. diff --git a/docs/cdk/get-started/deploy-validium/node/deploy-node.md b/docs/cdk/get-started/deploy-validium/node/deploy-node.md index 779d1c2fd..1231d2a7e 100644 --- a/docs/cdk/get-started/deploy-validium/node/deploy-node.md +++ b/docs/cdk/get-started/deploy-validium/node/deploy-node.md @@ -1,112 +1,4 @@ -| Repo | Version | -| --- | --- | -| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 | -| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 | -| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 | -| https://github.com/0xPolygon/cdk-data-availability.git | v0.0.3 | -| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 | - -The listed version may not be the most recent, but this will give a general idea of how the deployment process works. - -# Prerequisites - -### Minimum Requirements: - -| Minimum Disk Size | vCPUs | Memory (GB) | CPU Type | Architecture | OS | -| --- | --- | --- | --- | --- | --- | -| 32GB | 2 | 8 | Intel or AMD | x86/64 | Ubuntu 22.04 | - -Your operating system should be Linux-based (preferably Ubuntu 22.04), and it must have an AMD or Intel chip. - -Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contracts and various contract calls. - -## Dependency Checking - -| Dependency | Version | Installation links | -| --- | --- | --- | -| git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | -| node | 16.0.0 | https://nodejs.org/en/download | -| npm | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | -| golang | 1.18.0 | https://go.dev/doc/install | -| cast | 0.2.0 | https://book.getfoundry.sh/getting-started/installation | -| jq | 1.0 | https://jqlang.github.io/jq/download/ | -| tomlq | 3.0.0 | https://kislyuk.github.io/yq/#installation | -| postgres | 15 | https://www.postgresql.org/download/ | -| psql | 15.0 | https://www.postgresql.org/download/ | -| make | 3.80.0 | https://www.gnu.org/software/make/ | -| docker | 24.0.0 | https://docs.docker.com/engine/install/ | -| pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | -| [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ | -| [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | -- You can run the following script to validate that dependency requirements are met: - - ```bash - #!/bin/bash - - declare -A commands - commands["git"]="2.18.0" - commands["node"]="16.0.0" - commands["npm"]="6.0.0" - commands["go"]="1.18.0" - commands["cast"]="0.2.0" - commands["jq"]="1.0" - commands["tomlq"]="3.0.0" - commands["psql"]="15.0" - commands["make"]="3.80.0" - commands["docker"]="24.0.0" - commands["pip3"]="20.0.2" - commands["python3"]="3.8.0" - commands["polycli"]="0.1.39" - - # Function to check command version - check_version() { - local command=$1 - local min_version=$2 - local version - local status - - if ! command -v "$command" &> /dev/null; then - printf "| %-15s | %-20s | %-20s |\n" "$command" "Not Found" "$min_version" - return - fi - - case "$command" in - git) version=$(git --version | awk '{print $3}') ;; - node) version=$(node --version | cut -d v -f 2) ;; - npm) version=$(npm --version) ;; - go) version=$(go version | awk '{print $3}' | cut -d 'o' -f 2) ;; - cast) version=$(cast --version | awk '{print $2}') ;; - jq) version=$(jq --version | cut -d '-' -f 2) ;; - tomlq) version=$(tomlq --version | awk '{print $2}') ;; - psql) version=$(psql --version | awk '{print $3}') ;; - make) version=$(make --version | head -n 1 | awk '{print $3}') ;; - docker) version=$(docker --version | awk '{print $3}' | cut -d ',' -f 1) ;; - pip3) version=$(pip3 --version | awk '{print $2}') ;; - python3) version=$(python3 --version | awk '{print $2}') ;; - polycli) version=$(polycli version | awk '{print $4}' | cut -d '-' -f 1 | sed 's/v//') ;; - *) version="Found" ;; - esac - - printf "| %-15s | %-20s | %-20s |\n" "$command" "$version" "$min_version" - } - - echo "+-----------------+----------------------+----------------------+" - printf "| %-15s | %-20s | %-20s |\n" "CLI Command" "Found Version" "Minimum Version" - echo "+-----------------+----------------------+----------------------+" - - for cmd in "${!commands[@]}"; do - check_version "$cmd" "${commands[$cmd]}" - echo "+-----------------+----------------------+----------------------+" - done - ``` - - You can create a `version-check.sh` file, then copy and paste the script into that file. Then run the following to execute the script: - - ```bash - chmod +x version-check.sh - ./version-check.sh - ``` - + # Setup & Deployment diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md new file mode 100644 index 000000000..41f30b365 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -0,0 +1,109 @@ +| Repo | Version | +| --- | --- | +| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 | +| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 | +| https://github.com/0xPolygon/cdk-data-availability.git | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 | + +The listed version may not be the most recent, but this will give a general idea of how the deployment process works. + +# Prerequisites + +### Minimum Requirements: + +| Minimum Disk Size | vCPUs | Memory (GB) | CPU Type | Architecture | OS | +| --- | --- | --- | --- | --- | --- | +| 32GB | 2 | 8 | Intel or AMD | x86/64 | Ubuntu 22.04 | + +Your operating system should be Linux-based (preferably Ubuntu 22.04), and it must have an AMD or Intel chip. + +Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contracts and various contract calls. + +## Dependency Checking + +| Dependency | Version | Installation links | +| --- | --- | --- | +| git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | +| node | 16.0.0 | https://nodejs.org/en/download | +| npm | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | +| golang | 1.18.0 | https://go.dev/doc/install | +| cast | 0.2.0 | https://book.getfoundry.sh/getting-started/installation | +| jq | 1.0 | https://jqlang.github.io/jq/download/ | +| tomlq | 3.0.0 | https://kislyuk.github.io/yq/#installation | +| postgres | 15 | https://www.postgresql.org/download/ | +| psql | 15.0 | https://www.postgresql.org/download/ | +| make | 3.80.0 | https://www.gnu.org/software/make/ | +| docker | 24.0.0 | https://docs.docker.com/engine/install/ | +| pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | +| [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ | +| [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | +- You can run the following script to validate that dependency requirements are met: + + ```bash + #!/bin/bash + + declare -A commands + commands["git"]="2.18.0" + commands["node"]="16.0.0" + commands["npm"]="6.0.0" + commands["go"]="1.18.0" + commands["cast"]="0.2.0" + commands["jq"]="1.0" + commands["tomlq"]="3.0.0" + commands["psql"]="15.0" + commands["make"]="3.80.0" + commands["docker"]="24.0.0" + commands["pip3"]="20.0.2" + commands["python3"]="3.8.0" + commands["polycli"]="0.1.39" + + # Function to check command version + check_version() { + local command=$1 + local min_version=$2 + local version + local status + + if ! command -v "$command" &> /dev/null; then + printf "| %-15s | %-20s | %-20s |\n" "$command" "Not Found" "$min_version" + return + fi + + case "$command" in + git) version=$(git --version | awk '{print $3}') ;; + node) version=$(node --version | cut -d v -f 2) ;; + npm) version=$(npm --version) ;; + go) version=$(go version | awk '{print $3}' | cut -d 'o' -f 2) ;; + cast) version=$(cast --version | awk '{print $2}') ;; + jq) version=$(jq --version | cut -d '-' -f 2) ;; + tomlq) version=$(tomlq --version | awk '{print $2}') ;; + psql) version=$(psql --version | awk '{print $3}') ;; + make) version=$(make --version | head -n 1 | awk '{print $3}') ;; + docker) version=$(docker --version | awk '{print $3}' | cut -d ',' -f 1) ;; + pip3) version=$(pip3 --version | awk '{print $2}') ;; + python3) version=$(python3 --version | awk '{print $2}') ;; + polycli) version=$(polycli version | awk '{print $4}' | cut -d '-' -f 1 | sed 's/v//') ;; + *) version="Found" ;; + esac + + printf "| %-15s | %-20s | %-20s |\n" "$command" "$version" "$min_version" + } + + echo "+-----------------+----------------------+----------------------+" + printf "| %-15s | %-20s | %-20s |\n" "CLI Command" "Found Version" "Minimum Version" + echo "+-----------------+----------------------+----------------------+" + + for cmd in "${!commands[@]}"; do + check_version "$cmd" "${commands[$cmd]}" + echo "+-----------------+----------------------+----------------------+" + done + ``` + + You can create a `version-check.sh` file, then copy and paste the script into that file. Then run the following to execute the script: + + ```bash + chmod +x version-check.sh + ./version-check.sh + ``` + \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index e2e64eab3..d06270ae6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -50,9 +50,11 @@ nav: - Introduction: cdk/get-started/deploy-validium/index.md - Deploy contracts: - Prerequisites: cdk/get-started/deploy-validium/contracts/prerequisites.md - - Environment overview: cdk/get-started/deploy-validium/contracts/environment-overview.md - Set up: cdk/get-started/deploy-validium/contracts/set-up.md - Deploy contracts: cdk/get-started/deploy-validium/contracts/deploy-contracts.md + - Deploy node: + - Prerequisites: cdk/get-started/deploy-validium/node/prerequisites.md + - Deploy node: cdk/get-started/deploy-validium/node/deploy-node.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From 0974241bb8845b7bfe5e853e6c939a0b2c21e7a5 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 11:12:56 +0100 Subject: [PATCH 12/26] pushing updates for availability externally --- .../contracts/prerequisites.md | 2 +- docs/cdk/get-started/deploy-validium/index.md | 16 +++++++- .../deploy-validium/node/prerequisites.md | 41 +++++++------------ 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index 9f9d5ee33..2ee753866 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -1,7 +1,7 @@ ## Hardware - A Linux-based OS (e.g., Ubuntu Server 22.04 LTS). -- At least 16GB RAM with a 4-core CPU. +- At least 8GB RAM with a 2-core CPU. - An AMD64 architecture system. ## Software diff --git a/docs/cdk/get-started/deploy-validium/index.md b/docs/cdk/get-started/deploy-validium/index.md index e427da2ca..30602cb56 100644 --- a/docs/cdk/get-started/deploy-validium/index.md +++ b/docs/cdk/get-started/deploy-validium/index.md @@ -3,8 +3,20 @@ This quick start takes you through the process of deploying a full CDK validium, The process requires two separate flows with different software requirements. For this reason, these instructions have two distinct sections. 1. [Deploying the contracts](contracts/prerequisites.md). -2. [Deploying the node and services](). +2. [Deploying the node and services](node/prerequisites.md). !!! warning - The instructions are subject to frequent updates as the software remains at an early development stage. - - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs \ No newline at end of file + - Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs + +## Git repos + +These are code bases for setting everything up in this order. + +| Repo | Version | +| --- | --- | +| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 | +| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 | +| https://github.com/0xPolygon/cdk-data-availability.git | v0.0.3 | +| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 | \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index 41f30b365..d721b042e 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -1,28 +1,13 @@ -| Repo | Version | -| --- | --- | -| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 | -| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 | -| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 | -| https://github.com/0xPolygon/cdk-data-availability.git | v0.0.3 | -| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 | +!!! important + - You have already followed the [deploy contracts section](../contracts/prerequisites.md). + - Make sure you have at least `~0.3 Sepolia ETH` ready for deploying more contracts and various contract calls. -The listed version may not be the most recent, but this will give a general idea of how the deployment process works. +## Software requirements -# Prerequisites +!!! important + The specified software versions are required. -### Minimum Requirements: - -| Minimum Disk Size | vCPUs | Memory (GB) | CPU Type | Architecture | OS | -| --- | --- | --- | --- | --- | --- | -| 32GB | 2 | 8 | Intel or AMD | x86/64 | Ubuntu 22.04 | - -Your operating system should be Linux-based (preferably Ubuntu 22.04), and it must have an AMD or Intel chip. - -Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contracts and various contract calls. - -## Dependency Checking - -| Dependency | Version | Installation links | +| Software | Version | Installation link | | --- | --- | --- | | git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | | node | 16.0.0 | https://nodejs.org/en/download | @@ -38,9 +23,10 @@ Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contr | pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | | [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ | | [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | -- You can run the following script to validate that dependency requirements are met: - - ```bash + +1. Create a `version-check.sh` file and copy and paste the script below. + + ```bash #!/bin/bash declare -A commands @@ -100,10 +86,11 @@ Lastly, make sure you have at least `~0.3 Sepolia ETH` ready for deploying contr done ``` - You can create a `version-check.sh` file, then copy and paste the script into that file. Then run the following to execute the script: +2. Run the script: ```bash chmod +x version-check.sh ./version-check.sh ``` - \ No newline at end of file + + \ No newline at end of file From 511bedaed7f7614b964d60b7abd5c796285df143 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 16:50:13 +0100 Subject: [PATCH 13/26] commit new file --- .../deploy-validium/node/prerequisites.md | 37 +++--- .../deploy-validium/node/set-up.md | 109 ++++++++++++++++++ mkdocs.yml | 1 + 3 files changed, 127 insertions(+), 20 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/node/set-up.md diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index d721b042e..cce853422 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -1,28 +1,25 @@ !!! important - You have already followed the [deploy contracts section](../contracts/prerequisites.md). - - Make sure you have at least `~0.3 Sepolia ETH` ready for deploying more contracts and various contract calls. + - Make sure you have at least `~0.3 Sepolia ETH` for deploying more contracts and various contract calls. ## Software requirements -!!! important - The specified software versions are required. - | Software | Version | Installation link | | --- | --- | --- | -| git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | -| node | 16.0.0 | https://nodejs.org/en/download | -| npm | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | -| golang | 1.18.0 | https://go.dev/doc/install | -| cast | 0.2.0 | https://book.getfoundry.sh/getting-started/installation | -| jq | 1.0 | https://jqlang.github.io/jq/download/ | -| tomlq | 3.0.0 | https://kislyuk.github.io/yq/#installation | -| postgres | 15 | https://www.postgresql.org/download/ | -| psql | 15.0 | https://www.postgresql.org/download/ | -| make | 3.80.0 | https://www.gnu.org/software/make/ | -| docker | 24.0.0 | https://docs.docker.com/engine/install/ | -| pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | -| [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ | -| [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | +| `git` | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | +| `node` | 16.0.0 | https://nodejs.org/en/download | +| `npm` | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | +| `golang` | 1.18.0 | https://go.dev/doc/install | +| `cast` | 0.2.0 | https://book.getfoundry.sh/getting-started/installation | +| `jq` | 1.0 | https://jqlang.github.io/jq/download/ | +| `tomlq` | 3.0.0 | https://kislyuk.github.io/yq/#installation | +| `postgres` | 15 | https://www.postgresql.org/download/ | +| `psql` | 15.0 | https://www.postgresql.org/download/ | +| `make` | 3.80.0 | https://www.gnu.org/software/make/ | +| `docker` | 24.0.0 | https://docs.docker.com/engine/install/ | +| `pip3` | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | +| `python3` | 3.8.0 | https://www.python.org/downloads/ | +| [For testing] `polycli` | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | 1. Create a `version-check.sh` file and copy and paste the script below. @@ -86,11 +83,11 @@ done ``` -2. Run the script: +2. Run the script to see what you have already and what is missing from your set up. ```bash chmod +x version-check.sh ./version-check.sh ``` - \ No newline at end of file +3. Install any missing or out-of-date software. \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md new file mode 100644 index 000000000..aa3414ee4 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -0,0 +1,109 @@ +1. Navigate back to the working directory we created earlier, `~/cdk-validium` + +```bash +cd ~/cdk-validium +``` + +For this setup, we will also need our information from `deploy_output.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment`. Navigate back to `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment` and run the following script to fill the required parameters into the `/tmp/cdk/.env` we created in the previous steps: + +```bash +cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment +echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env +echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env +echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env +echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env +``` + +Source our new environment and navigate back to `~/cdk-validium`: + +```bash +source /tmp/cdk/.env +cd ~/cdk-validium +``` + +## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service + +Now clone the `0.0.3` release of `cdk-validium-node`. + +```bash +git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git +``` + +We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here: + +[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) + +Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting + +```bash +~/cdk-validium % curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz +\tar -xzf cdk-data-availability.tar.gz +``` + +Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here: + +```bash +curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz +\tar -xzf cdk-bridge-service.tar.gz + +``` +Now we have three new directories in *`cdk-validium/`* named ***`cdk-data-availability-0.0.3`, `cdk-validium-node` and `zkevm-bridge-service-0.3.1`*** + +## 2. Preparing the environment + +We will begin our setup in the node directory. + +Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`*** + +```bash +~/cdk-validium % cd cdk-validium-node/ +``` + +### Setup the database + +Run the docker command to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service. + +```bash +docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 +``` + +*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes* + +```bash +sudo lsof -t -i:5432 +kill -9 +``` + +Once you have postgres running, validate you have the following setup correctly: + +- an admin account called: `cdk_user` with a password of `cdk_password` +- postgres server running on `localhost:5432` + +You can use the following command to validate the steps, `\q` to exit: + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 +#=> \q +``` + +### Provision the database + +The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate. Run the script to provision all the necessary databases and schemas that will be used for both the prover and node: + +```bash +~/cdk-validium/cdk-validium-node % PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql +``` + +In addition to the provisions required for the prover and node, another provision is needed for the Data Availability Committee (DAC). We can set this up now for use later. + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" +``` + +Finally, we will provision a database for our bridge service, which we will setup last in this guide. + +```bash +PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" +``` diff --git a/mkdocs.yml b/mkdocs.yml index e2af80581..ea7f22e84 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -54,6 +54,7 @@ nav: - Deploy contracts: cdk/get-started/deploy-validium/contracts/deploy-contracts.md - Deploy node: - Prerequisites: cdk/get-started/deploy-validium/node/prerequisites.md + - Set up: cdk/get-started/deploy-validium/node/set-up.md - Deploy node: cdk/get-started/deploy-validium/node/deploy-node.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md From bfe4a98c9f5828563c056792492205fbd90593bd Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Mon, 29 Jan 2024 17:32:28 +0100 Subject: [PATCH 14/26] update latest --- .../contracts/deploy-contracts.md | 2 +- .../contracts/prerequisites.md | 2 +- .../deploy-validium/contracts/set-up.md | 2 +- .../deploy-validium/node/deploy-node.md | 112 ------------------ .../deploy-validium/node/set-up.md | 43 ++++--- 5 files changed, 27 insertions(+), 134 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index 1a61b1051..175fb4cc0 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -141,7 +141,7 @@ When deploying to Sepolia, the contracts should automatically verify based on ot ## Use a different node provider -Modify the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `cdk-validium-contracts-0.0.2/.env` if you prefer to use a different node provider than Infura. +If you would rather use a different node provider than Infura, modify the contents of `~/cdk-validium/cdk-validium-contracts-0.0.2/hardhat.config.js` and `cdk-validium-contracts-0.0.2/.env` . For example, using Alchemy: diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index 2ee753866..980f98022 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -43,5 +43,5 @@ mkdir /tmp/cdk/ Create a `.env` file to store environment variables we will use later on. ```bash -nano /tmp/cdk/.env +nano /var/tmp/.env ``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/contracts/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md index 0a6907b7f..7c305d2a3 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/set-up.md +++ b/docs/cdk/get-started/deploy-validium/contracts/set-up.md @@ -73,7 +73,7 @@ npm install 5. Send 2 Sepolia ETH to the generated address. -6. Add the following variables to `/tmp/cdk/.env`. +6. Add the following variables to `/var/tmp/.env`. ```bash # /tmp/cdk/.env diff --git a/docs/cdk/get-started/deploy-validium/node/deploy-node.md b/docs/cdk/get-started/deploy-validium/node/deploy-node.md index 1231d2a7e..8654b62b7 100644 --- a/docs/cdk/get-started/deploy-validium/node/deploy-node.md +++ b/docs/cdk/get-started/deploy-validium/node/deploy-node.md @@ -1,117 +1,5 @@ -# Setup & Deployment - -First, lets navigate back to the working directory we created earlier, `~/cdk-validium` - -```bash -cd ~/cdk-validium -``` - -For this setup, we will also need our information from `deploy_output.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment`. Navigate back to `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment` and run the following script to fill the required parameters into the `/tmp/cdk/.env` we created in the previous steps: - -```bash -cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment -echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env -echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env -echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env -``` - -Source our new environment and navigate back to `~/cdk-validium`: - -```bash -source /tmp/cdk/.env -cd ~/cdk-validium -``` - -## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service - -Now clone the `0.0.3` release of `cdk-validium-node`. - -```bash -git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git -``` - -We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here: - -[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) - -Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting - -```bash -~/cdk-validium % curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz -\tar -xzf cdk-data-availability.tar.gz -``` - -Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here: - -```bash -curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz -\tar -xzf cdk-bridge-service.tar.gz - -``` -Now we have three new directories in *`cdk-validium/`* named ***`cdk-data-availability-0.0.3`, `cdk-validium-node` and `zkevm-bridge-service-0.3.1`*** - -## 2. Preparing the environment - -We will begin our setup in the node directory. - -Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`*** - -```bash -~/cdk-validium % cd cdk-validium-node/ -``` - -### Setup the database - -Run the docker command to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service. - -```bash -docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 -``` - -*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes* - -```bash -sudo lsof -t -i:5432 -kill -9 -``` - -Once you have postgres running, validate you have the following setup correctly: - -- an admin account called: `cdk_user` with a password of `cdk_password` -- postgres server running on `localhost:5432` - -You can use the following command to validate the steps, `\q` to exit: - -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -#=> \q -``` - -### Provision the database - -The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate. Run the script to provision all the necessary databases and schemas that will be used for both the prover and node: - -```bash -~/cdk-validium/cdk-validium-node % PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql -``` - -In addition to the provisions required for the prover and node, another provision is needed for the Data Availability Committee (DAC). We can set this up now for use later. - -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" -``` - -Finally, we will provision a database for our bridge service, which we will setup last in this guide. - -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" -``` - ### Configure the prover To configure our prover, lets copy and modify the contents of `test.prover.config.json` inside `~/cdk-validium/cdk-validium-node/test/config/` to our `/tmp/cdk/` directory we created earlier using the following jq command: diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index aa3414ee4..aef1f62bb 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -1,27 +1,32 @@ -1. Navigate back to the working directory we created earlier, `~/cdk-validium` +## Set up the environment variables -```bash -cd ~/cdk-validium -``` +1. Navigate to `~/cdk-validium`. -For this setup, we will also need our information from `deploy_output.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment`. Navigate back to `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment` and run the following script to fill the required parameters into the `/tmp/cdk/.env` we created in the previous steps: + ```bash + cd cdk-validium + ``` -```bash -cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment -echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env -echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env -echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env -echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env -``` + !!! info + For the setup, we need the information from the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json` file. -Source our new environment and navigate back to `~/cdk-validium`: +2. Navigate to `cdk-validium-contracts-0.0.2/deployment` and run the following script that inputs the required parameters into `/tmp/cdk/.env`. -```bash -source /tmp/cdk/.env -cd ~/cdk-validium -``` + ```bash + cd cdk-validium-contracts-0.0.2/deployment + echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env + echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env + echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env + echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env + echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env + echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env + ``` + +3. Save the new environment and navigate back to `~/cdk-validium`. + + ```bash + source /tmp/cdk/.env + cd ~/cdk-validium + ``` ## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service From 0c87feca64e2cb702d78e9262b30931250a4b8b4 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Tue, 30 Jan 2024 14:11:45 +0100 Subject: [PATCH 15/26] commit latest --- .../contracts/deploy-contracts.md | 15 ++------ .../contracts/prerequisites.md | 6 ++-- .../deploy-validium/contracts/set-up.md | 35 +++++++++---------- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index 175fb4cc0..f5a32ee81 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -3,23 +3,14 @@ 1. `cd` to the `deployment/` directory and create a new `deploy_parameters.json` by copying the example ```bash - cd /cdk-validium/cdk-validium-contracts-0.0.2/deployment + cd deployment/ cp deploy_parameters.json.example deploy_parameters.json ``` - !!! info "Parameters updates at step 3 in `deploy_parameters.json`" - - `trustedSequencer` - - `trustedAggregator` - - `admin` - - `cdkValidiumOwner` - - `initialCDKValidiumDeployerOwner` - - `trustedSequencerURL` - - `forkID` - 2. Run the following `jq` script to streamline the process of replacing these fields: ```bash - source /tmp/cdk/.env + source /var/tmp/cdk/.env jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json ``` @@ -64,7 +55,7 @@ This contract is a factory that deploys the deterministic contracts required by The address of the contracts it creates depends on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. -1. Run the deploy script. +1. From the same `deployment` directory, run the deploy script. ```bash npm run deploy:deployer:CDKValidium:sepolia diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index 980f98022..303f7807e 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -32,10 +32,10 @@ Use a public faucet to get Sepolia test ETH. ## Configuration files -Create a folder in `/tmp/cdk/` to store configuration files. +Create a folder in `/var/tmp/cdk/` to store configuration files. ```bash -mkdir /tmp/cdk/ +mkdir /var/tmp/cdk/ ``` ## Environment variables @@ -43,5 +43,5 @@ mkdir /tmp/cdk/ Create a `.env` file to store environment variables we will use later on. ```bash -nano /var/tmp/.env +nano /var/tmp/cdk.env ``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/contracts/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md index 7c305d2a3..58ad95d03 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/set-up.md +++ b/docs/cdk/get-started/deploy-validium/contracts/set-up.md @@ -3,6 +3,7 @@ 1. Create a new directory and cd into it. ```bash + cd ~/ mkdir cdk-validium cd cdk-validium/ ``` @@ -35,27 +36,15 @@ npm install ```bash cp .env.example .env - nano .env - ``` - -2. Add the environment variables. - - ```bash - MNEMONIC="" # see instructions below in step 3 - INFURA_PROJECT_ID="" # Generate a project id on [Infura](https://www.infura.io/) - ETHERSCAN_API_KEY="" # Generate an API key on [Etherscan](https://etherscan.io) ``` - !!! info - Check our documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider). - -3. Generate a new mnemonic using `cast`. +2. Generate a new mnemonic using `cast`. ```bash cast wallet new-mnemonic --words 12 ``` - !!! important + !!! tip If the command `new-mnemonic` is not found, update foundry with `foundryup` and try again. The output should look something like this: @@ -69,14 +58,24 @@ npm install Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726 ``` -4. Copy and paste the newly generated `Phrase` into the `MNEMONIC` field inside `cdk-validium-contracts-0.0.2/.env` +3. Add the environment variables to the `.env` file. + + ```bash + nano .env + MNEMONIC="" # copy/paste the generated Phrase + INFURA_PROJECT_ID="" # Generate a project id on [Infura](https://www.infura.io/) + ETHERSCAN_API_KEY="" # Generate an API key on [Etherscan](https://etherscan.io) + ``` + + !!! info + Check our documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider). -5. Send 2 Sepolia ETH to the generated address. +4. Send 2 Sepolia ETH to the generated address. -6. Add the following variables to `/var/tmp/.env`. +5. Add the following variables to `/var/tmp/cdk/.env`. ```bash - # /tmp/cdk/.env + nano /var/tmp/cdk/.env TEST_ADDRESS= TEST_PRIVATE_KEY= L1_URL=https://sepolia.infura.io/v3/ From 4dbeda92b6f5f1e4b2f20564498acfc91a070990 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Tue, 30 Jan 2024 16:50:14 +0100 Subject: [PATCH 16/26] updating --- .../deploy-validium/contracts/deploy-contracts.md | 2 +- docs/cdk/get-started/deploy-validium/contracts/set-up.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index f5a32ee81..c1e148bf9 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -32,7 +32,7 @@ "forkID": 6, "admin":"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", "cdkValidiumOwner": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", - "timelockAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "timelockAddress": "0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", "minDelayTimelock": 3600, "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", "initialCDKValidiumDeployerOwner" :"0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE", diff --git a/docs/cdk/get-started/deploy-validium/contracts/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md index 58ad95d03..a2bdda57a 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/set-up.md +++ b/docs/cdk/get-started/deploy-validium/contracts/set-up.md @@ -76,10 +76,10 @@ npm install ```bash nano /var/tmp/cdk/.env - TEST_ADDRESS= - TEST_PRIVATE_KEY= - L1_URL=https://sepolia.infura.io/v3/ - L1_WS_URL=wss://sepolia.infura.io/ws/v3/ + TEST_ADDRESS="" + TEST_PRIVATE_KEY="" + L1_URL="https://sepolia.infura.io/v3/" + L1_WS_URL="wss://sepolia.infura.io/ws/v3/" ``` !!! important This step allows us to use `jq` and `tomlq` later on to setup our configuration files. From b6257b0cfd8fbaf8d3691e535fee53995344626c Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 09:26:44 +0100 Subject: [PATCH 17/26] update changes --- .../deploy-validium/contracts/deploy-contracts.md | 2 +- .../deploy-validium/contracts/prerequisites.md | 9 ++++++--- docs/cdk/get-started/deploy-validium/contracts/set-up.md | 2 +- docs/cdk/get-started/deploy-validium/index.md | 2 +- .../get-started/deploy-validium/node/prerequisites.md | 3 +++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index c1e148bf9..10ef69bac 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -10,7 +10,7 @@ 2. Run the following `jq` script to streamline the process of replacing these fields: ```bash - source /var/tmp/cdk/.env + source /tmp/cdk/.env jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json ``` diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index 303f7807e..c55487b9f 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -35,7 +35,7 @@ Use a public faucet to get Sepolia test ETH. Create a folder in `/var/tmp/cdk/` to store configuration files. ```bash -mkdir /var/tmp/cdk/ +mkdir /tmp/cdk/ ``` ## Environment variables @@ -43,5 +43,8 @@ mkdir /var/tmp/cdk/ Create a `.env` file to store environment variables we will use later on. ```bash -nano /var/tmp/cdk.env -``` \ No newline at end of file +nano /tmp/cdk/.env +``` + +!!! danger + The system removes this file on shutdown. \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/contracts/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md index a2bdda57a..b44293496 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/set-up.md +++ b/docs/cdk/get-started/deploy-validium/contracts/set-up.md @@ -75,7 +75,7 @@ npm install 5. Add the following variables to `/var/tmp/cdk/.env`. ```bash - nano /var/tmp/cdk/.env + nano /tmp/cdk/.env TEST_ADDRESS="" TEST_PRIVATE_KEY="" L1_URL="https://sepolia.infura.io/v3/" diff --git a/docs/cdk/get-started/deploy-validium/index.md b/docs/cdk/get-started/deploy-validium/index.md index 30602cb56..096a44c5a 100644 --- a/docs/cdk/get-started/deploy-validium/index.md +++ b/docs/cdk/get-started/deploy-validium/index.md @@ -11,7 +11,7 @@ The process requires two separate flows with different software requirements. Fo ## Git repos -These are code bases for setting everything up in this order. +These are code bases we use to set everything up, and in this order. | Repo | Version | | --- | --- | diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index cce853422..d4e691364 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -4,6 +4,9 @@ ## Software requirements +!!! important + These are the minimum versions. + | Software | Version | Installation link | | --- | --- | --- | | `git` | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | From 75ae2e44751ba5e16e0d76f75e9661043da0f5ce Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 09:45:14 +0100 Subject: [PATCH 18/26] update script --- .../deploy-validium/contracts/deploy-contracts.md | 13 ++++++++++--- .../deploy-validium/contracts/prerequisites.md | 2 +- .../deploy-validium/node/prerequisites.md | 14 +++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index 10ef69bac..6d53ec7e4 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -14,10 +14,10 @@ jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json ``` -3. The complete `deploy_parameters.json` should look something like this: +3. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`: ```bash - cat ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json + nano ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json # ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json { "realVerifier": false, @@ -51,7 +51,7 @@ ### `CDKValidiumDeployer` -This contract is a factory that deploys the deterministic contracts required by the system and must be deployed first. +This is a factory contract that deploys the deterministic contracts required by the system and must be deployed first. The address of the contracts it creates depends on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`. @@ -76,6 +76,13 @@ The address of the contracts it creates depends on the salt and the `initialCDKV !!! info This may take several minutes depending on network conditions. + !!! warning + If you see this message, you can safely ignore it: + + ```sh + cp: cannot stat '.openzeppelin/sepolia.json': No such file or directory + ``` + 3. On successful deployment, you should see a new directory named `deployments` containing a directory storing the information about your deployment. For example: ```bash diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index c55487b9f..9daa9fa82 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -32,7 +32,7 @@ Use a public faucet to get Sepolia test ETH. ## Configuration files -Create a folder in `/var/tmp/cdk/` to store configuration files. +Create a folder `/tmp/cdk/` to store configuration files. ```bash mkdir /tmp/cdk/ diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index d4e691364..6c146cfd9 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -28,7 +28,7 @@ ```bash #!/bin/bash - + declare -A commands commands["git"]="2.18.0" commands["node"]="16.0.0" @@ -43,19 +43,19 @@ commands["pip3"]="20.0.2" commands["python3"]="3.8.0" commands["polycli"]="0.1.39" - + # Function to check command version check_version() { local command=$1 local min_version=$2 local version local status - + if ! command -v "$command" &> /dev/null; then printf "| %-15s | %-20s | %-20s |\n" "$command" "Not Found" "$min_version" return fi - + case "$command" in git) version=$(git --version | awk '{print $3}') ;; node) version=$(node --version | cut -d v -f 2) ;; @@ -72,14 +72,14 @@ polycli) version=$(polycli version | awk '{print $4}' | cut -d '-' -f 1 | sed 's/v//') ;; *) version="Found" ;; esac - + printf "| %-15s | %-20s | %-20s |\n" "$command" "$version" "$min_version" } - + echo "+-----------------+----------------------+----------------------+" printf "| %-15s | %-20s | %-20s |\n" "CLI Command" "Found Version" "Minimum Version" echo "+-----------------+----------------------+----------------------+" - + for cmd in "${!commands[@]}"; do check_version "$cmd" "${commands[$cmd]}" echo "+-----------------+----------------------+----------------------+" From 2a3771959ee8815e940b319d8f12b3359643acf7 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 10:04:04 +0100 Subject: [PATCH 19/26] deploy node set up instructions --- .../deploy-validium/node/prerequisites.md | 2 +- .../deploy-validium/node/set-up.md | 115 +++++++++--------- 2 files changed, 61 insertions(+), 56 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index 6c146cfd9..f82897d06 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -21,7 +21,7 @@ | `make` | 3.80.0 | https://www.gnu.org/software/make/ | | `docker` | 24.0.0 | https://docs.docker.com/engine/install/ | | `pip3` | 20.0.0 | https://pip.pypa.io/en/stable/installation/ | -| `python3` | 3.8.0 | https://www.python.org/downloads/ | +| [For testing] `python3` | 3.8.0 | https://www.python.org/downloads/ | | [For testing] `polycli` | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main | 1. Create a `version-check.sh` file and copy and paste the script below. diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index aef1f62bb..0df3607ed 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -28,87 +28,92 @@ cd ~/cdk-validium ``` -## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service +## Download `cdk-validium-node`, `cdk-data-availability`, and `cdk-bridge-service` -Now clone the `0.0.3` release of `cdk-validium-node`. +1. Clone the `0.0.3` release of `cdk-validium-node`. -```bash -git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git -``` + ```bash + git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git + ``` -We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here: +2. Download and extract version `0.0.3` of `cdk-data-availability` as a tar.gz file. -[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) + !!! info + The release file is available here: [Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) -Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting + ```bash + curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz + \tar -xzf cdk-data-availability.tar.gz + ``` -```bash -~/cdk-validium % curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz -\tar -xzf cdk-data-availability.tar.gz -``` +3. Finally, download the `cdk-bridge-service` release `0.3.1`. The release file can be found here: -Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here: + ```bash + curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz + \tar -xzf cdk-bridge-service.tar.gz + ``` -```bash -curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz -\tar -xzf cdk-bridge-service.tar.gz + You should see three new directories in `cdk-validium/`: -``` -Now we have three new directories in *`cdk-validium/`* named ***`cdk-data-availability-0.0.3`, `cdk-validium-node` and `zkevm-bridge-service-0.3.1`*** + - `cdk-data-availability-0.0.3` + - `cdk-validium-node` + - `zkevm-bridge-service-0.3.1` -## 2. Preparing the environment +## Prepare the environment -We will begin our setup in the node directory. +Navigate to the node directory we cloned at the previous step: `cdk-validium-node/`. -Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`*** + ```bash + cd cdk-validium-node/ + ``` -```bash -~/cdk-validium % cd cdk-validium-node/ -``` +## Set up the database -### Setup the database +1. Run the docker command below to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service. -Run the docker command to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service. + ```bash + docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 + ``` -```bash -docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 -``` + !!! note "Port is in use" + If you are unable to start the process because a port is in use, check the processes occupying the port then kill those processes. -*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes* + ```bash + sudo lsof -t -i:5432 + kill -9 + ``` -```bash -sudo lsof -t -i:5432 -kill -9 -``` +2. Use the following command to validate the setup (`\q` to exit). -Once you have postgres running, validate you have the following setup correctly: + ```bash + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 + #=> \q + ``` -- an admin account called: `cdk_user` with a password of `cdk_password` -- postgres server running on `localhost:5432` + You should have: -You can use the following command to validate the steps, `\q` to exit: + - An admin account called: `cdk_user` with a password of `cdk_password`. + - A postgres server running on `localhost:5432`. -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -#=> \q -``` +## Provision the database -### Provision the database +The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate. -The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate. Run the script to provision all the necessary databases and schemas that will be used for both the prover and node: +1. Run the script to provision all the necessary databases and schemas used for the prover and node: -```bash -~/cdk-validium/cdk-validium-node % PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql -``` + ```bash + cd /cdk-validium/cdk-validium-node + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql + ``` -In addition to the provisions required for the prover and node, another provision is needed for the Data Availability Committee (DAC). We can set this up now for use later. +2. In addition to the provisions required for the Data Availability Committee (DAC). We can set this up now to use later. -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" -``` + ```bash + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" + ``` -Finally, we will provision a database for our bridge service, which we will setup last in this guide. +3. Finally, provision a database for the bridge service. -```bash -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" -``` + ```bash + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" + ``` From a7d97fe087c16bba1b3a0a73496948960f9b02a6 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 10:49:49 +0100 Subject: [PATCH 20/26] add new file --- .../node/configure-deployment.md | 421 ++++++++++++++++ .../deploy-validium/node/deploy-node.md | 460 ------------------ .../deploy-validium/node/run-node-services.md | 44 ++ .../deploy-validium/node/set-up.md | 21 +- mkdocs.yml | 3 +- 5 files changed, 471 insertions(+), 478 deletions(-) create mode 100644 docs/cdk/get-started/deploy-validium/node/configure-deployment.md delete mode 100644 docs/cdk/get-started/deploy-validium/node/deploy-node.md create mode 100644 docs/cdk/get-started/deploy-validium/node/run-node-services.md diff --git a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md new file mode 100644 index 000000000..cb70cc75b --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md @@ -0,0 +1,421 @@ +## Configure the prover + +Copy and modify the contents of `test.prover.config.json` in `~/cdk-validium/cdk-validium-node/test/config/` to the `/tmp/cdk/` directory using the following jq command: + +```bash +cd ~/cdk-validium/cdk-validium-node +jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/postgres"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json +``` + +## Configure the node + +1. Create the configuration files for the node by first building the `cdk-validium-node`. + + ```bash + cd ~/cdk-validium/cdk-validium-node + make build + ``` + +2. Create a keystore for reference in the `config.toml` configuration file. Use the private key we generated previously and stored in the `/tmp/cdk/.env` file and encrypt it with a basic password. For example: + + ```bash + $ source /tmp/cdk/.env + $ ./dist/zkevm-node encryptKey --pk=$TEST_PRIVATE_KEY --pw="testonly" --output=/tmp/cdk/account.keystore + $ find /tmp/cdk/account.keystore -type f -name 'UTC--*' | head -n 1 | xargs -I xxx mv xxx /tmp/cdk/account.key + ``` + + !!! important + Make sure you source your environment: `source /tmp/cdk/.env`. + + The output keystore is now stored in `/tmp/cdk/account.keystore` + +3. Create a file `node-config.toml` inside `/tmp/cdk/` and paste in the following content. + +??? "`node-config.toml`" + ```bash + #/tmp/cdk/node-config.toml + IsTrustedSequencer = true + + [Log] + Environment = "development" # "production" or "development" + Level = "debug" + Outputs = ["stderr"] + + [State] + [State.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "state_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + [State.Batch] + [State.Batch.Constraints] + MaxTxsPerBatch = 300 + MaxBatchBytesSize = 120000 + MaxCumulativeGasUsed = 30000000 + MaxKeccakHashes = 2145 + MaxPoseidonHashes = 252357 + MaxPoseidonPaddings = 135191 + MaxMemAligns = 236585 + MaxArithmetics = 236585 + MaxBinaries = 473170 + MaxSteps = 7570538 + + [Pool] + FreeClaimGasLimit = 1500000 + IntervalToRefreshBlockedAddresses = "5m" + IntervalToRefreshGasPrices = "5s" + MaxTxBytesSize=100132 + MaxTxDataBytesSize=100000 + DefaultMinGasPriceAllowed = 0 + MinAllowedGasPriceInterval = "5m" + PollMinAllowedGasPriceInterval = "15s" + AccountQueue = 64 + GlobalQueue = 1024 + [Pool.EffectiveGasPrice] + Enabled = false + L1GasPriceFactor = 0.25 + ByteGasCost = 16 + ZeroByteGasCost = 4 + NetProfit = 1 + BreakEvenFactor = 1.1 + FinalDeviationPct = 10 + L2GasPriceSuggesterFactor = 0.5 + [Pool.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "pool_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + + [Etherman] + URL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" + ForkIDChunkSize = 20000 + MultiGasProvider = false + [Etherscan] + ApiKey = "" + + [RPC] + Host = "0.0.0.0" + Port = 8123 + ReadTimeout = "60s" + WriteTimeout = "60s" + MaxRequestsPerIPAndSecond = 5000 + SequencerNodeURI = "" + BatchRequestsEnabled = true + EnableL2SuggestedGasPricePolling = true + [RPC.WebSockets] + Enabled = true + Port = 8133 + + [Synchronizer] + SyncInterval = "1s" + SyncChunkSize = 100 + TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. + L1SynchronizationMode = "sequential" # "sequential" or "parallel" + [Synchronizer.L1ParallelSynchronization] + MaxClients = 10 + MaxPendingNoProcessedBlocks = 25 + RequestLastBlockPeriod = "5s" + RequestLastBlockTimeout = "5s" + RequestLastBlockMaxRetries = 3 + StatisticsPeriod = "5m" + TimeoutMainLoop = "5m" + RollupInfoRetriesSpacing= "5s" + FallbackToSequentialModeOnSynchronized = false + [Synchronizer.L1ParallelSynchronization.PerformanceWarning] + AceptableInacctivityTime = "5s" + ApplyAfterNumRollupReceived = 10 + + [Sequencer] + WaitPeriodPoolIsEmpty = "1s" + LastBatchVirtualizationTimeMaxWaitPeriod = "10s" + BlocksAmountForTxsToBeDeleted = 100 + FrequencyToCheckTxsForDelete = "12h" + TxLifetimeCheckTimeout = "10m" + MaxTxLifetime = "3h" + [Sequencer.Finalizer] + GERDeadlineTimeout = "2s" + ForcedBatchDeadlineTimeout = "5s" + SleepDuration = "100ms" + ResourcePercentageToCloseBatch = 10 + GERFinalityNumberOfBlocks = 0 + ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" + ClosingSignalsManagerWaitForCheckingGER = "10s" + ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" + ForcedBatchesFinalityNumberOfBlocks = 0 + TimestampResolution = "10s" + StopSequencerOnBatchNum = 0 + [Sequencer.DBManager] + PoolRetrievalInterval = "500ms" + L2ReorgRetrievalInterval = "5s" + + [SequenceSender] + WaitPeriodSendSequence = "15s" + LastBatchVirtualizationTimeMaxWaitPeriod = "10s" + MaxTxSizeForL1 = 131072 + L2Coinbase = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" + PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + + [Aggregator] + Host = "0.0.0.0" + Port = 50081 + RetryTime = "5s" + VerifyProofInterval = "10s" + TxProfitabilityCheckerType = "acceptall" + TxProfitabilityMinReward = "1.1" + ProofStatePollingInterval = "5s" + SenderAddress = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" + CleanupLockedProofsInterval = "2m" + GeneratingProofCleanupThreshold = "10m" + + [EthTxManager] + ForcedGas = 0 + PrivateKeys = [ + {Path = "/tmp/cdk/account.key", Password = "testonly"} + ] + + [L2GasPriceSuggester] + Type = "default" + UpdatePeriod = "10s" + Factor = 0.5 + DefaultGasPriceWei = 0 + MaxGasPriceWei = 0 + + [MTClient] + URI = "localhost:50061" + + [Executor] + URI = "localhost:50071" + MaxGRPCMessageSize = 100000000 + + [Metrics] + Host = "0.0.0.0" + Port = 9091 + Enabled = true + ProfilingHost = "0.0.0.0" + ProfilingPort = 6060 + ProfilingEnabled = true + + [HashDB] + User = "cdk_user" + Password = "cdk_password" + Name = "prover_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + ``` + +4. Modify the `URL` parameter in`[Etherman]` to the URL of the RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier by running the following script. + + ```bash + source /tmp/cdk/.env + tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.URL = $L1_URL' /tmp/cdk/node-config.toml + tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.SequenceSender.L2Coinbase = $TEST_ADDRESS' /tmp/cdk/node-config.toml + tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.Aggregator.SenderAddress = $TEST_ADDRESS' /tmp/cdk/node-config.toml + ``` + +5. Now we will modify the `genesis.json` from the earlier contract deployment to include information about the newly configured chain. + + !!! info + `genesis.json` is in the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` directory + + The values to append to `genesis.json` are something like: + + ```bash + #~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json + "L1Config": { + "chainId": 11155111, + "maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c", + "polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1", + "cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a", + "polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" + }, + "genesisBlockNumber": 5098088 + ``` + +6. Run the following script that automates the process of appending those values: + + ```bash + jq --argjson data "$(jq '{maticTokenAddress, cdkValidiumAddress, cdkDataCommitteeContract, polygonZkEVMGlobalExitRootAddress, deploymentBlockNumber}' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json)" \ + '.L1Config.chainId = 11155111 | + .L1Config.maticTokenAddress = $data.maticTokenAddress | + .L1Config.polygonZkEVMAddress = $data.cdkValidiumAddress | + .L1Config.cdkDataCommitteeContract = $data.cdkDataCommitteeContract | + .L1Config.polygonZkEVMGlobalExitRootAddress = $data.polygonZkEVMGlobalExitRootAddress | + .genesisBlockNumber = $data.deploymentBlockNumber' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json > /tmp/cdk/genesis.json + ``` + +## Configure the DAC + +At this point we should have setup and provisioned the psql database and configured the zk prover and node. + +Now let’s configure the Data Availability Committee. + +1. Navigate to `~/cdk-validium/cdk-data-availability-0.0.3`. + +2. Build the DAC + + ```bash + make build + ``` + +3. Create a `dac-config.toml` file inside `/tmp/cdk/`. + +4. Copy and paste the following example config below into `dac-config.toml`. + + ```bash + #~/tmp/cdk/dac-config.toml + PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + + [L1] + WsURL = "wss://sepolia.infura.io/ws/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" + RpcURL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" + CDKValidiumAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" + DataCommitteeAddress = "0x8346026951978bd806912d0c93FB0979D8E3436a" + Timeout = "3m" # Make sure this value is less than the rootchain-int-ws loadbalancer timeout + RetryPeriod = "5s" + + [Log] + Environment = "development" # "production" or "development" + Level = "debug" + Outputs = ["stderr"] + + [DB] + User = "cdk_user" + Password = "cdk_password" + Name = "committee_db" + Host = "127.0.0.1" + Port = "5432" + EnableLog = false + MaxConns = 10 + + [RPC] + Host = "0.0.0.0" + Port = 8444 + ReadTimeout = "60s" + WriteTimeout = "60s" + MaxRequestsPerIPAndSecond = 500 + SequencerNodeURI = "" + EnableL2SuggestedGasPricePolling = false + [RPC.WebSockets] + Enabled = false + ``` + +5. Run the `tomlq` script to replace the necessary parameters. + + ```bash + source /tmp/cdk/.env + tomlq -i -t --arg L1_URL "$L1_URL" '.L1.RpcURL = $L1_URL' /tmp/cdk/dac-config.toml + tomlq -i -t --arg L1_WS_URL "$L1_WS_URL" '.L1.WsURL = $L1_WS_URL' /tmp/cdk/dac-config.toml + tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.CDKValidiumAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml + tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.DataCommitteeAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml + ``` + +6. Update the contracts on Sepolia with information about our DAC. + + ```bash + cast send \ + --legacy \ + --from $TEST_ADDRESS \ + --private-key $TEST_PRIVATE_KEY \ + --rpc-url $L1_URL \ + $CDK_DATA_COMMITTEE_CONTRACT_ADDRESS \ + 'function setupCommittee(uint256 _requiredAmountOfSignatures, string[] urls, bytes addrsBytes) returns()' \ + 1 \ + '["http://localhost:8444"]' \ + $TEST_ADDRESS + ``` + +!!! note + This can take a few minutes. + +## Configure bridge service + +1. Navigate into the `cdk-bridge-service-0.3.1` directory and build the files. + + ```bash + cd ~/cdk-validium/cdk-bridge-service-0.3.1/ + make build + ``` + +2. Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk` using the following config file: + + ```bash + nano /tmp/cdk/bridge-config.toml + #/tmp/cdk/bridge-config.toml + [Log] + Level = "info" + Outputs = ["stderr"] + + [SyncDB] + Database = "postgres" + User = "cdk_user" + Name = "bridge_db" + Password = "cdk_password" + Host = "localhost" + Port = "5432" + MaxConns = 20 + + [Etherman] + L1URL = "https://sepolia.infura.io/v3/b27a8be73bcb4bc7a83aada13c65e135" + L2URLs = ["http://localhost:8123"] + + [Synchronizer] + SyncInterval = "1s" + SyncChunkSize = 100 + + [BridgeController] + Store = "postgres" + Height = 32 + + [BridgeServer] + GRPCPort = "9090" + HTTPPort = "8080" + DefaultPageLimit = 25 + MaxPageLimit = 100 + BridgeVersion = "v1" + # Read only + [BridgeServer.DB] + Database = "postgres" + User = "cdk_user" + Name = "bridge_db" + Password = "cdk_password" + Host = "localhost" + Port = "5432" + MaxConns = 20 + + [NetworkConfig] + GenBlockNumber = "5098088" + PolygonZkEVMAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" + PolygonBridgeAddress = "0x24F2aF81Ae588690C9752A342d7549f58133CE4e" + PolygonZkEVMGlobalExitRootAddress = "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" + MaticTokenAddress = "0xd76B50509c1693C7BA35514103a0A156Ca57980c" + L2PolygonBridgeAddresses = ["0x24F2aF81Ae588690C9752A342d7549f58133CE4e"] + L1ChainID = 11155111 + + [ClaimTxManager] + FrequencyToMonitorTxs = "1s" + PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + Enabled = true + RetryInterval = "1s" + RetryNumber = 10 + ``` + +3. Replace the values using the `tomlq` script below. + + ```bash + tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.L1URL = $L1_URL' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg GEN_BLOCK_NUMBER "$GEN_BLOCK_NUMBER" '.NetworkConfig.GenBlockNumber = $GEN_BLOCK_NUMBER' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.NetworkConfig.PolygonZkEVMAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg POLYGON_ZKEVM_BRIDGE_ADDRESS "$POLYGON_ZKEVM_BRIDGE_ADDRESS" '.NetworkConfig.PolygonBridgeAddress = $POLYGON_ZKEVM_BRIDGE_ADDRESS' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS "$POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS" '.NetworkConfig.PolygonZkEVMGlobalExitRootAddress = $POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg MATIC_TOKEN_ADDRESS "$MATIC_TOKEN_ADDRESS" '.NetworkConfig.MaticTokenAddress = $MATIC_TOKEN_ADDRESS' /tmp/cdk/bridge-config.toml + tomlq -i -t --arg CDK_DATA_COMMITTEE_CONTRACT_ADDRESS "$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS" '.NetworkConfig.L2PolygonBridgeAddresses = [$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS]' /tmp/cdk/bridge-config.toml + ``` + diff --git a/docs/cdk/get-started/deploy-validium/node/deploy-node.md b/docs/cdk/get-started/deploy-validium/node/deploy-node.md deleted file mode 100644 index 8654b62b7..000000000 --- a/docs/cdk/get-started/deploy-validium/node/deploy-node.md +++ /dev/null @@ -1,460 +0,0 @@ - - -### Configure the prover - -To configure our prover, lets copy and modify the contents of `test.prover.config.json` inside `~/cdk-validium/cdk-validium-node/test/config/` to our `/tmp/cdk/` directory we created earlier using the following jq command: - -```bash -~/cdk-validium/cdk-validium-node % jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/postgres"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json -``` - -### Configure the node - -To create the configuration files for our node, we first must build the `cdk-validium-node` itself. - -```bash -~/cdk-validium/cdk-validium-node % make build -``` - -Now we can create a keystore. This will be referenced in all of our`config.toml` we create in the next steps. Take the private key we generated and stored in our `.env` earlier and encrypt it with a basic password. - -For example: - -```bash - -$ source /tmp/cdk/.env -$ ./dist/zkevm-node encryptKey --pk=$TEST_PRIVATE_KEY --pw="testonly" --output=/tmp/cdk/account.keystore -$ find /tmp/cdk/account.keystore -type f -name 'UTC--*' | head -n 1 | xargs -I xxx mv xxx /tmp/cdk/account.key -``` - -*note: make sure your environment is sourced ie: `source /tmp/cdk/.env`* - -The output keystore is now stored in `/tmp/cdk/account.keystore` - -Create a new file `node-config.toml` inside `/tmp/cdk/` and paste the following content: - -Example `node-config.toml`: - -```bash -#/tmp/cdk/node-config.toml -IsTrustedSequencer = true - -[Log] -Environment = "development" # "production" or "development" -Level = "debug" -Outputs = ["stderr"] - -[State] - [State.DB] - User = "cdk_user" - Password = "cdk_password" - Name = "state_db" - Host = "localhost" - Port = "5432" - EnableLog = false - MaxConns = 200 - [State.Batch] - [State.Batch.Constraints] - MaxTxsPerBatch = 300 - MaxBatchBytesSize = 120000 - MaxCumulativeGasUsed = 30000000 - MaxKeccakHashes = 2145 - MaxPoseidonHashes = 252357 - MaxPoseidonPaddings = 135191 - MaxMemAligns = 236585 - MaxArithmetics = 236585 - MaxBinaries = 473170 - MaxSteps = 7570538 - -[Pool] -FreeClaimGasLimit = 1500000 -IntervalToRefreshBlockedAddresses = "5m" -IntervalToRefreshGasPrices = "5s" -MaxTxBytesSize=100132 -MaxTxDataBytesSize=100000 -DefaultMinGasPriceAllowed = 0 -MinAllowedGasPriceInterval = "5m" -PollMinAllowedGasPriceInterval = "15s" -AccountQueue = 64 -GlobalQueue = 1024 - [Pool.EffectiveGasPrice] - Enabled = false - L1GasPriceFactor = 0.25 - ByteGasCost = 16 - ZeroByteGasCost = 4 - NetProfit = 1 - BreakEvenFactor = 1.1 - FinalDeviationPct = 10 - L2GasPriceSuggesterFactor = 0.5 - [Pool.DB] - User = "cdk_user" - Password = "cdk_password" - Name = "pool_db" - Host = "localhost" - Port = "5432" - EnableLog = false - MaxConns = 200 - -[Etherman] -URL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" -ForkIDChunkSize = 20000 -MultiGasProvider = false - [Etherscan] - ApiKey = "" - -[RPC] -Host = "0.0.0.0" -Port = 8123 -ReadTimeout = "60s" -WriteTimeout = "60s" -MaxRequestsPerIPAndSecond = 5000 -SequencerNodeURI = "" -BatchRequestsEnabled = true -EnableL2SuggestedGasPricePolling = true - [RPC.WebSockets] - Enabled = true - Port = 8133 - -[Synchronizer] -SyncInterval = "1s" -SyncChunkSize = 100 -TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. -L1SynchronizationMode = "sequential" # "sequential" or "parallel" - [Synchronizer.L1ParallelSynchronization] - MaxClients = 10 - MaxPendingNoProcessedBlocks = 25 - RequestLastBlockPeriod = "5s" - RequestLastBlockTimeout = "5s" - RequestLastBlockMaxRetries = 3 - StatisticsPeriod = "5m" - TimeoutMainLoop = "5m" - RollupInfoRetriesSpacing= "5s" - FallbackToSequentialModeOnSynchronized = false - [Synchronizer.L1ParallelSynchronization.PerformanceWarning] - AceptableInacctivityTime = "5s" - ApplyAfterNumRollupReceived = 10 - -[Sequencer] -WaitPeriodPoolIsEmpty = "1s" -LastBatchVirtualizationTimeMaxWaitPeriod = "10s" -BlocksAmountForTxsToBeDeleted = 100 -FrequencyToCheckTxsForDelete = "12h" -TxLifetimeCheckTimeout = "10m" -MaxTxLifetime = "3h" - [Sequencer.Finalizer] - GERDeadlineTimeout = "2s" - ForcedBatchDeadlineTimeout = "5s" - SleepDuration = "100ms" - ResourcePercentageToCloseBatch = 10 - GERFinalityNumberOfBlocks = 0 - ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" - ClosingSignalsManagerWaitForCheckingGER = "10s" - ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" - ForcedBatchesFinalityNumberOfBlocks = 0 - TimestampResolution = "10s" - StopSequencerOnBatchNum = 0 - [Sequencer.DBManager] - PoolRetrievalInterval = "500ms" - L2ReorgRetrievalInterval = "5s" - -[SequenceSender] -WaitPeriodSendSequence = "15s" -LastBatchVirtualizationTimeMaxWaitPeriod = "10s" -MaxTxSizeForL1 = 131072 -L2Coinbase = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" -PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} - -[Aggregator] -Host = "0.0.0.0" -Port = 50081 -RetryTime = "5s" -VerifyProofInterval = "10s" -TxProfitabilityCheckerType = "acceptall" -TxProfitabilityMinReward = "1.1" -ProofStatePollingInterval = "5s" -SenderAddress = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" -CleanupLockedProofsInterval = "2m" -GeneratingProofCleanupThreshold = "10m" - -[EthTxManager] -ForcedGas = 0 -PrivateKeys = [ - {Path = "/tmp/cdk/account.key", Password = "testonly"} -] - -[L2GasPriceSuggester] -Type = "default" -UpdatePeriod = "10s" -Factor = 0.5 -DefaultGasPriceWei = 0 -MaxGasPriceWei = 0 - -[MTClient] -URI = "localhost:50061" - -[Executor] -URI = "localhost:50071" -MaxGRPCMessageSize = 100000000 - -[Metrics] -Host = "0.0.0.0" -Port = 9091 -Enabled = true -ProfilingHost = "0.0.0.0" -ProfilingPort = 6060 -ProfilingEnabled = true - -[HashDB] -User = "cdk_user" -Password = "cdk_password" -Name = "prover_db" -Host = "localhost" -Port = "5432" -EnableLog = false -MaxConns = 200 -``` - -We will modify the `URL` parameter in`[Etherman]` to the URL of our RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier. Here’s a script to replace those values automatically using your environment sourced from `/tmp/cdk/` - -```bash -source /tmp/cdk/.env -tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.URL = $L1_URL' /tmp/cdk/node-config.toml -tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.SequenceSender.L2Coinbase = $TEST_ADDRESS' /tmp/cdk/node-config.toml -tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.Aggregator.SenderAddress = $TEST_ADDRESS' /tmp/cdk/node-config.toml -``` - -Now we have to copy and modify the `genesis.json` from our earlier deployment of contracts to include information about our newly configured chain - -You can find `genesis.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` - -The values we are going to append to the `genesis.json` would be something like: - -```bash -#~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json -"L1Config": { - "chainId": 11155111, - "maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c", - "polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1", - "cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a", - "polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" -}, -"genesisBlockNumber": 5098088 -``` - -Run the following script to automate the process of appending those JSON values: - -```bash -jq --argjson data "$(jq '{maticTokenAddress, cdkValidiumAddress, cdkDataCommitteeContract, polygonZkEVMGlobalExitRootAddress, deploymentBlockNumber}' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json)" \ -'.L1Config.chainId = 11155111 | -.L1Config.maticTokenAddress = $data.maticTokenAddress | -.L1Config.polygonZkEVMAddress = $data.cdkValidiumAddress | -.L1Config.cdkDataCommitteeContract = $data.cdkDataCommitteeContract | -.L1Config.polygonZkEVMGlobalExitRootAddress = $data.polygonZkEVMGlobalExitRootAddress | -.genesisBlockNumber = $data.deploymentBlockNumber' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json > /tmp/cdk/genesis.json -``` - -### Configure the DAC - -At this point we have setup and provisioned the psql database and configured the zk prover and node. Now let’s configure our Data Availability Comittee - -Navigate into `~/cdk-validium/cdk-data-availability-0.0.3` we downloaded in step 1. - -Build the DAC - -```bash -~/cdk-validium/cdk-data-availability-0.0.3 % make build -``` - -Now we can create a `dac-config.toml` file inside `/tmp/cdk/` . Copy and paste the following example config from below, then run the sequential `tomlq` script to replace the necessary parameters. - -```bash -#~/tmp/cdk/dac-config.toml -PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} - -[L1] -WsURL = "wss://sepolia.infura.io/ws/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" -RpcURL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" -CDKValidiumAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" -DataCommitteeAddress = "0x8346026951978bd806912d0c93FB0979D8E3436a" -Timeout = "3m" # Make sure this value is less than the rootchain-int-ws loadbalancer timeout -RetryPeriod = "5s" - -[Log] -Environment = "development" # "production" or "development" -Level = "debug" -Outputs = ["stderr"] - -[DB] -User = "cdk_user" -Password = "cdk_password" -Name = "committee_db" -Host = "127.0.0.1" -Port = "5432" -EnableLog = false -MaxConns = 10 - -[RPC] -Host = "0.0.0.0" -Port = 8444 -ReadTimeout = "60s" -WriteTimeout = "60s" -MaxRequestsPerIPAndSecond = 500 -SequencerNodeURI = "" -EnableL2SuggestedGasPricePolling = false - [RPC.WebSockets] - Enabled = false -``` - -You can replace the values automatically: - -```bash -source /tmp/cdk/.env -tomlq -i -t --arg L1_URL "$L1_URL" '.L1.RpcURL = $L1_URL' /tmp/cdk/dac-config.toml -tomlq -i -t --arg L1_WS_URL "$L1_WS_URL" '.L1.WsURL = $L1_WS_URL' /tmp/cdk/dac-config.toml -tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.CDKValidiumAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml -tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.L1.DataCommitteeAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/dac-config.toml -``` - -Now we can update the contracts on Sepolia with information about our DAC - -```bash -cast send \ - --legacy \ - --from $TEST_ADDRESS \ - --private-key $TEST_PRIVATE_KEY \ - --rpc-url $L1_URL \ - $CDK_DATA_COMMITTEE_CONTRACT_ADDRESS \ - 'function setupCommittee(uint256 _requiredAmountOfSignatures, string[] urls, bytes addrsBytes) returns()' \ - 1 \ - '["http://localhost:8444"]' \ - $TEST_ADDRESS -``` - -*note: this can take a few minutes as this transactions has to be mined on Sepolia* - -### Configure Bridge Service - -Navigate into the `cdk-bridge-service-0.3.1` directory and build the files: -```bash -cd ~/cdk-validium/cdk-bridge-service-0.3.1/ -make build -``` -Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk`: using the following config file: - -```bash -nano /tmp/cdk/bridge-config.toml -#/tmp/cdk/bridge-config.toml -[Log] -Level = "info" -Outputs = ["stderr"] - -[SyncDB] -Database = "postgres" -User = "cdk_user" -Name = "bridge_db" -Password = "cdk_password" -Host = "localhost" -Port = "5432" -MaxConns = 20 - -[Etherman] -L1URL = "https://sepolia.infura.io/v3/b27a8be73bcb4bc7a83aada13c65e135" -L2URLs = ["http://localhost:8123"] - -[Synchronizer] -SyncInterval = "1s" -SyncChunkSize = 100 - -[BridgeController] -Store = "postgres" -Height = 32 - -[BridgeServer] -GRPCPort = "9090" -HTTPPort = "8080" -DefaultPageLimit = 25 -MaxPageLimit = 100 -BridgeVersion = "v1" - # Read only - [BridgeServer.DB] - Database = "postgres" - User = "cdk_user" - Name = "bridge_db" - Password = "cdk_password" - Host = "localhost" - Port = "5432" - MaxConns = 20 - -[NetworkConfig] -GenBlockNumber = "5098088" -PolygonZkEVMAddress = "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1" -PolygonBridgeAddress = "0x24F2aF81Ae588690C9752A342d7549f58133CE4e" -PolygonZkEVMGlobalExitRootAddress = "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" -MaticTokenAddress = "0xd76B50509c1693C7BA35514103a0A156Ca57980c" -L2PolygonBridgeAddresses = ["0x24F2aF81Ae588690C9752A342d7549f58133CE4e"] -L1ChainID = 11155111 - -[ClaimTxManager] -FrequencyToMonitorTxs = "1s" -PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} -Enabled = true -RetryInterval = "1s" -RetryNumber = 10 -``` - -And replace the values using the `tomlq` script: - -```bash -tomlq -i -t --arg L1_URL "$L1_URL" '.Etherman.L1URL = $L1_URL' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg GEN_BLOCK_NUMBER "$GEN_BLOCK_NUMBER" '.NetworkConfig.GenBlockNumber = $GEN_BLOCK_NUMBER' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg CDK_VALIDIUM_ADDRESS "$CDK_VALIDIUM_ADDRESS" '.NetworkConfig.PolygonZkEVMAddress = $CDK_VALIDIUM_ADDRESS' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg POLYGON_ZKEVM_BRIDGE_ADDRESS "$POLYGON_ZKEVM_BRIDGE_ADDRESS" '.NetworkConfig.PolygonBridgeAddress = $POLYGON_ZKEVM_BRIDGE_ADDRESS' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS "$POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS" '.NetworkConfig.PolygonZkEVMGlobalExitRootAddress = $POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg MATIC_TOKEN_ADDRESS "$MATIC_TOKEN_ADDRESS" '.NetworkConfig.MaticTokenAddress = $MATIC_TOKEN_ADDRESS' /tmp/cdk/bridge-config.toml -tomlq -i -t --arg CDK_DATA_COMMITTEE_CONTRACT_ADDRESS "$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS" '.NetworkConfig.L2PolygonBridgeAddresses = [$CDK_DATA_COMMITTEE_CONTRACT_ADDRESS]' /tmp/cdk/bridge-config.toml -``` - -## 3. Running the components - -### Run the prover - -Since the prover is large and rather compute expensive to build, we will use a docker container - -```bash -docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json -``` - -### Run the node - -```bash -~/cdk-validium/cdk-validium-node % ./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ - --components sequencer \ - --components sequence-sender \ - --components aggregator \ - --components rpc --http.api eth,net,debug,zkevm,txpool,web3 \ - --components synchronizer \ - --components eth-tx-manager \ - --components l2gaspricer -``` - -Run the additional approval scripts for node: - -```bash -~/cdk-validium/cdk-validium-node % ./dist/zkevm-node approve --network custom \ - --custom-network-file /tmp/cdk/genesis.json \ - --cfg /tmp/cdk/node-config.toml \ - --amount 1000000000000000000000000000 \ - --password "testonly" --yes --key-store-path /tmp/cdk/account.key -``` - -### Run the DAC - -```bash -~/cdk-validium/cdk-data-availability-0.0.3 % ./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml -``` - -### Run the Bridge Service - -```bash -~/cdk-validium/cdk-bridge-service % ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml -``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md new file mode 100644 index 000000000..180e024d0 --- /dev/null +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -0,0 +1,44 @@ +## Running the components + +### Run the prover + +Since the prover is large and rather compute expensive to build, we will use a docker container + +```bash +docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json +``` + +### Run the node + +```bash +~/cdk-validium/cdk-validium-node % ./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ + --components sequencer \ + --components sequence-sender \ + --components aggregator \ + --components rpc --http.api eth,net,debug,zkevm,txpool,web3 \ + --components synchronizer \ + --components eth-tx-manager \ + --components l2gaspricer +``` + +Run the additional approval scripts for node: + +```bash +~/cdk-validium/cdk-validium-node % ./dist/zkevm-node approve --network custom \ + --custom-network-file /tmp/cdk/genesis.json \ + --cfg /tmp/cdk/node-config.toml \ + --amount 1000000000000000000000000000 \ + --password "testonly" --yes --key-store-path /tmp/cdk/account.key +``` + +### Run the DAC + +```bash +~/cdk-validium/cdk-data-availability-0.0.3 % ./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml +``` + +### Run the Bridge Service + +```bash +~/cdk-validium/cdk-bridge-service % ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml +``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index 0df3607ed..2410e018c 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -1,15 +1,6 @@ ## Set up the environment variables -1. Navigate to `~/cdk-validium`. - - ```bash - cd cdk-validium - ``` - - !!! info - For the setup, we need the information from the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json` file. - -2. Navigate to `cdk-validium-contracts-0.0.2/deployment` and run the following script that inputs the required parameters into `/tmp/cdk/.env`. +1. Navigate to `cdk-validium-contracts-0.0.2/deployment` and run the following script that inputs the required parameters from `deploy_output.json` into `/tmp/cdk/.env`. ```bash cd cdk-validium-contracts-0.0.2/deployment @@ -21,7 +12,7 @@ echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env ``` -3. Save the new environment and navigate back to `~/cdk-validium`. +2. Save the new environment and navigate back to `~/cdk-validium`. ```bash source /tmp/cdk/.env @@ -38,15 +29,12 @@ 2. Download and extract version `0.0.3` of `cdk-data-availability` as a tar.gz file. - !!! info - The release file is available here: [Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) - ```bash curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz \tar -xzf cdk-data-availability.tar.gz ``` -3. Finally, download the `cdk-bridge-service` release `0.3.1`. The release file can be found here: +3. Finally, download the `cdk-bridge-service` release `0.3.1`. ```bash curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz @@ -87,7 +75,6 @@ Navigate to the node directory we cloned at the previous step: `cdk-validium-nod ```bash PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 - #=> \q ``` You should have: @@ -106,7 +93,7 @@ The `cdk-validium-node` directory contains a script called `single_db_server.sql PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql ``` -2. In addition to the provisions required for the Data Availability Committee (DAC). We can set this up now to use later. +2. Set up the database for the Data Availability Committee (DAC). ```bash PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" diff --git a/mkdocs.yml b/mkdocs.yml index 685b209a2..4d3f5ff3d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -55,7 +55,8 @@ nav: - Deploy node: - Prerequisites: cdk/get-started/deploy-validium/node/prerequisites.md - Set up: cdk/get-started/deploy-validium/node/set-up.md - - Deploy node: cdk/get-started/deploy-validium/node/deploy-node.md + - Configure the deployment: cdk/get-started/deploy-validium/node/configure-deployment.md + - Run node and services: cdk/get-started/deploy-validium/node/run-node-services.md - Rollup: - Introduction: cdk/get-started/deploy-rollup/intro.md - Environment overview: cdk/get-started/deploy-rollup/environment-overview.md From e911ab1f48eb6f0614a9e65330c059ef6b889570 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 13:26:44 +0100 Subject: [PATCH 21/26] update the quickstart to run services --- .../deploy-validium/node/configure-deployment.md | 15 ++++++--------- .../deploy-validium/node/run-node-services.md | 14 ++++++-------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md index cb70cc75b..c3b4d05a2 100644 --- a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md +++ b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md @@ -19,9 +19,9 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user: 2. Create a keystore for reference in the `config.toml` configuration file. Use the private key we generated previously and stored in the `/tmp/cdk/.env` file and encrypt it with a basic password. For example: ```bash - $ source /tmp/cdk/.env - $ ./dist/zkevm-node encryptKey --pk=$TEST_PRIVATE_KEY --pw="testonly" --output=/tmp/cdk/account.keystore - $ find /tmp/cdk/account.keystore -type f -name 'UTC--*' | head -n 1 | xargs -I xxx mv xxx /tmp/cdk/account.key + source /tmp/cdk/.env + ./dist/zkevm-node encryptKey --pk=$TEST_PRIVATE_KEY --pw="testonly" --output=/tmp/cdk/account.keystore + find /tmp/cdk/account.keystore -type f -name 'UTC--*' | head -n 1 | xargs -I xxx mv xxx /tmp/cdk/account.key ``` !!! important @@ -31,8 +31,7 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user: 3. Create a file `node-config.toml` inside `/tmp/cdk/` and paste in the following content. -??? "`node-config.toml`" - ```bash +??? "`node-config.toml`" #/tmp/cdk/node-config.toml IsTrustedSequencer = true @@ -209,7 +208,6 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user: Port = "5432" EnableLog = false MaxConns = 200 - ``` 4. Modify the `URL` parameter in`[Etherman]` to the URL of the RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier by running the following script. @@ -337,17 +335,16 @@ Now let’s configure the Data Availability Committee. ## Configure bridge service -1. Navigate into the `cdk-bridge-service-0.3.1` directory and build the files. +1. Navigate into the `zkevm-bridge-service-0.3.1` directory and build the files. ```bash - cd ~/cdk-validium/cdk-bridge-service-0.3.1/ + cd ~/cdk-validium/zkevm-bridge-service-0.3.1/ make build ``` 2. Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk` using the following config file: ```bash - nano /tmp/cdk/bridge-config.toml #/tmp/cdk/bridge-config.toml [Log] Level = "info" diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md index 180e024d0..bf13eab94 100644 --- a/docs/cdk/get-started/deploy-validium/node/run-node-services.md +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -1,14 +1,12 @@ -## Running the components +## Run the prover -### Run the prover - -Since the prover is large and rather compute expensive to build, we will use a docker container +Since the prover is large and compute-expensive to build, we will use a docker container. ```bash docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json ``` -### Run the node +## Run the node ```bash ~/cdk-validium/cdk-validium-node % ./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ @@ -21,7 +19,7 @@ docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 500 --components l2gaspricer ``` -Run the additional approval scripts for node: +### Run the additional approval scripts for the node ```bash ~/cdk-validium/cdk-validium-node % ./dist/zkevm-node approve --network custom \ @@ -31,13 +29,13 @@ Run the additional approval scripts for node: --password "testonly" --yes --key-store-path /tmp/cdk/account.key ``` -### Run the DAC +## Run the DAC ```bash ~/cdk-validium/cdk-data-availability-0.0.3 % ./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml ``` -### Run the Bridge Service +## Run the bridge service ```bash ~/cdk-validium/cdk-bridge-service % ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml From ef4697a07de03913df771b3c3a8264bbacbf6366 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 15:47:26 +0100 Subject: [PATCH 22/26] commit changes --- .../deploy-validium/node/run-node-services.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md index bf13eab94..8150e2be8 100644 --- a/docs/cdk/get-started/deploy-validium/node/run-node-services.md +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -6,6 +6,21 @@ Since the prover is large and compute-expensive to build, we will use a docker c docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json ``` +!!! important + The database logs may output an error while they wait for a node. For example: + + ```txt + 2024-01-31 12:18:30.329 UTC [675] ERROR: relation "state.nodes" does not exist at character 15 + 2024-01-31 12:18:30.329 UTC [675] STATEMENT: SELECT * FROM state.nodes WHERE hash = E'\\xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; + ``` + + The node log may also output an error while they wait for services to come online. For example: + + ```txt + aggregatorClientMockThread() channel broken; will retry in 5 seconds + aggregatorClientMockThread() failed calling readerWriter->Read(&aggregatorMessage) + ``` + ## Run the node ```bash From 1ec78b98f42932c5afd4e74a6be6626356210c9d Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Wed, 31 Jan 2024 16:52:10 +0100 Subject: [PATCH 23/26] last little updates --- .../deploy-validium/node/run-node-services.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md index 8150e2be8..ae1063c77 100644 --- a/docs/cdk/get-started/deploy-validium/node/run-node-services.md +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -24,7 +24,8 @@ docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 500 ## Run the node ```bash -~/cdk-validium/cdk-validium-node % ./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ +cd ~/cdk-validium/cdk-validium-node +./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \ --components sequencer \ --components sequence-sender \ --components aggregator \ @@ -37,7 +38,7 @@ docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 500 ### Run the additional approval scripts for the node ```bash -~/cdk-validium/cdk-validium-node % ./dist/zkevm-node approve --network custom \ +./dist/zkevm-node approve --network custom \ --custom-network-file /tmp/cdk/genesis.json \ --cfg /tmp/cdk/node-config.toml \ --amount 1000000000000000000000000000 \ @@ -47,11 +48,13 @@ docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 500 ## Run the DAC ```bash -~/cdk-validium/cdk-data-availability-0.0.3 % ./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml +cd ~/cdk-validium/cdk-data-availability-0.0.3 +./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml ``` ## Run the bridge service ```bash -~/cdk-validium/cdk-bridge-service % ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml +cd ~/cdk-validium/cdk-bridge-service +./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml ``` \ No newline at end of file From 54e8e518b4852943c27d7cb9e925688c5baeee25 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 1 Feb 2024 08:59:59 +0100 Subject: [PATCH 24/26] update for external --- docs/cdk/get-started/deploy-validium/node/prerequisites.md | 2 +- docs/cdk/get-started/deploy-validium/node/set-up.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/prerequisites.md b/docs/cdk/get-started/deploy-validium/node/prerequisites.md index f82897d06..2f5ab87e7 100644 --- a/docs/cdk/get-started/deploy-validium/node/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/node/prerequisites.md @@ -26,7 +26,7 @@ 1. Create a `version-check.sh` file and copy and paste the script below. - ```bash + ```bash #!/bin/bash declare -A commands diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index 2410e018c..111bac89a 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -30,8 +30,7 @@ 2. Download and extract version `0.0.3` of `cdk-data-availability` as a tar.gz file. ```bash - curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz - \tar -xzf cdk-data-availability.tar.gz + git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-data-availability.git ``` 3. Finally, download the `cdk-bridge-service` release `0.3.1`. From 6d24504ba936d79f5db92ed554098c7d48769a17 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 1 Feb 2024 09:28:01 +0100 Subject: [PATCH 25/26] updating with fixes --- .../node/configure-deployment.md | 344 +++++++++--------- .../deploy-validium/node/run-node-services.md | 2 +- .../deploy-validium/node/set-up.md | 2 +- 3 files changed, 174 insertions(+), 174 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md index c3b4d05a2..1630825c4 100644 --- a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md +++ b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md @@ -31,185 +31,185 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user: 3. Create a file `node-config.toml` inside `/tmp/cdk/` and paste in the following content. -??? "`node-config.toml`" - #/tmp/cdk/node-config.toml - IsTrustedSequencer = true - - [Log] - Environment = "development" # "production" or "development" - Level = "debug" - Outputs = ["stderr"] - - [State] - [State.DB] - User = "cdk_user" - Password = "cdk_password" - Name = "state_db" - Host = "localhost" - Port = "5432" - EnableLog = false - MaxConns = 200 - [State.Batch] - [State.Batch.Constraints] - MaxTxsPerBatch = 300 - MaxBatchBytesSize = 120000 - MaxCumulativeGasUsed = 30000000 - MaxKeccakHashes = 2145 - MaxPoseidonHashes = 252357 - MaxPoseidonPaddings = 135191 - MaxMemAligns = 236585 - MaxArithmetics = 236585 - MaxBinaries = 473170 - MaxSteps = 7570538 - - [Pool] - FreeClaimGasLimit = 1500000 - IntervalToRefreshBlockedAddresses = "5m" - IntervalToRefreshGasPrices = "5s" - MaxTxBytesSize=100132 - MaxTxDataBytesSize=100000 - DefaultMinGasPriceAllowed = 0 - MinAllowedGasPriceInterval = "5m" - PollMinAllowedGasPriceInterval = "15s" - AccountQueue = 64 - GlobalQueue = 1024 - [Pool.EffectiveGasPrice] - Enabled = false - L1GasPriceFactor = 0.25 - ByteGasCost = 16 - ZeroByteGasCost = 4 - NetProfit = 1 - BreakEvenFactor = 1.1 - FinalDeviationPct = 10 - L2GasPriceSuggesterFactor = 0.5 - [Pool.DB] + ??? "`node-config.toml`" + #/tmp/cdk/node-config.toml + IsTrustedSequencer = true + + [Log] + Environment = "development" # "production" or "development" + Level = "debug" + Outputs = ["stderr"] + + [State] + [State.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "state_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + [State.Batch] + [State.Batch.Constraints] + MaxTxsPerBatch = 300 + MaxBatchBytesSize = 120000 + MaxCumulativeGasUsed = 30000000 + MaxKeccakHashes = 2145 + MaxPoseidonHashes = 252357 + MaxPoseidonPaddings = 135191 + MaxMemAligns = 236585 + MaxArithmetics = 236585 + MaxBinaries = 473170 + MaxSteps = 7570538 + + [Pool] + FreeClaimGasLimit = 1500000 + IntervalToRefreshBlockedAddresses = "5m" + IntervalToRefreshGasPrices = "5s" + MaxTxBytesSize=100132 + MaxTxDataBytesSize=100000 + DefaultMinGasPriceAllowed = 0 + MinAllowedGasPriceInterval = "5m" + PollMinAllowedGasPriceInterval = "15s" + AccountQueue = 64 + GlobalQueue = 1024 + [Pool.EffectiveGasPrice] + Enabled = false + L1GasPriceFactor = 0.25 + ByteGasCost = 16 + ZeroByteGasCost = 4 + NetProfit = 1 + BreakEvenFactor = 1.1 + FinalDeviationPct = 10 + L2GasPriceSuggesterFactor = 0.5 + [Pool.DB] + User = "cdk_user" + Password = "cdk_password" + Name = "pool_db" + Host = "localhost" + Port = "5432" + EnableLog = false + MaxConns = 200 + + [Etherman] + URL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" + ForkIDChunkSize = 20000 + MultiGasProvider = false + [Etherscan] + ApiKey = "" + + [RPC] + Host = "0.0.0.0" + Port = 8123 + ReadTimeout = "60s" + WriteTimeout = "60s" + MaxRequestsPerIPAndSecond = 5000 + SequencerNodeURI = "" + BatchRequestsEnabled = true + EnableL2SuggestedGasPricePolling = true + [RPC.WebSockets] + Enabled = true + Port = 8133 + + [Synchronizer] + SyncInterval = "1s" + SyncChunkSize = 100 + TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. + L1SynchronizationMode = "sequential" # "sequential" or "parallel" + [Synchronizer.L1ParallelSynchronization] + MaxClients = 10 + MaxPendingNoProcessedBlocks = 25 + RequestLastBlockPeriod = "5s" + RequestLastBlockTimeout = "5s" + RequestLastBlockMaxRetries = 3 + StatisticsPeriod = "5m" + TimeoutMainLoop = "5m" + RollupInfoRetriesSpacing= "5s" + FallbackToSequentialModeOnSynchronized = false + [Synchronizer.L1ParallelSynchronization.PerformanceWarning] + AceptableInacctivityTime = "5s" + ApplyAfterNumRollupReceived = 10 + + [Sequencer] + WaitPeriodPoolIsEmpty = "1s" + LastBatchVirtualizationTimeMaxWaitPeriod = "10s" + BlocksAmountForTxsToBeDeleted = 100 + FrequencyToCheckTxsForDelete = "12h" + TxLifetimeCheckTimeout = "10m" + MaxTxLifetime = "3h" + [Sequencer.Finalizer] + GERDeadlineTimeout = "2s" + ForcedBatchDeadlineTimeout = "5s" + SleepDuration = "100ms" + ResourcePercentageToCloseBatch = 10 + GERFinalityNumberOfBlocks = 0 + ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" + ClosingSignalsManagerWaitForCheckingGER = "10s" + ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" + ForcedBatchesFinalityNumberOfBlocks = 0 + TimestampResolution = "10s" + StopSequencerOnBatchNum = 0 + [Sequencer.DBManager] + PoolRetrievalInterval = "500ms" + L2ReorgRetrievalInterval = "5s" + + [SequenceSender] + WaitPeriodSendSequence = "15s" + LastBatchVirtualizationTimeMaxWaitPeriod = "10s" + MaxTxSizeForL1 = 131072 + L2Coinbase = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" + PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} + + [Aggregator] + Host = "0.0.0.0" + Port = 50081 + RetryTime = "5s" + VerifyProofInterval = "10s" + TxProfitabilityCheckerType = "acceptall" + TxProfitabilityMinReward = "1.1" + ProofStatePollingInterval = "5s" + SenderAddress = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" + CleanupLockedProofsInterval = "2m" + GeneratingProofCleanupThreshold = "10m" + + [EthTxManager] + ForcedGas = 0 + PrivateKeys = [ + {Path = "/tmp/cdk/account.key", Password = "testonly"} + ] + + [L2GasPriceSuggester] + Type = "default" + UpdatePeriod = "10s" + Factor = 0.5 + DefaultGasPriceWei = 0 + MaxGasPriceWei = 0 + + [MTClient] + URI = "localhost:50061" + + [Executor] + URI = "localhost:50071" + MaxGRPCMessageSize = 100000000 + + [Metrics] + Host = "0.0.0.0" + Port = 9091 + Enabled = true + ProfilingHost = "0.0.0.0" + ProfilingPort = 6060 + ProfilingEnabled = true + + [HashDB] User = "cdk_user" Password = "cdk_password" - Name = "pool_db" + Name = "prover_db" Host = "localhost" Port = "5432" EnableLog = false MaxConns = 200 - [Etherman] - URL = "https://sepolia.infura.io/v3/bd6164d34c324fa08ca5b6dc1d3ed3a2" - ForkIDChunkSize = 20000 - MultiGasProvider = false - [Etherscan] - ApiKey = "" - - [RPC] - Host = "0.0.0.0" - Port = 8123 - ReadTimeout = "60s" - WriteTimeout = "60s" - MaxRequestsPerIPAndSecond = 5000 - SequencerNodeURI = "" - BatchRequestsEnabled = true - EnableL2SuggestedGasPricePolling = true - [RPC.WebSockets] - Enabled = true - Port = 8133 - - [Synchronizer] - SyncInterval = "1s" - SyncChunkSize = 100 - TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc. - L1SynchronizationMode = "sequential" # "sequential" or "parallel" - [Synchronizer.L1ParallelSynchronization] - MaxClients = 10 - MaxPendingNoProcessedBlocks = 25 - RequestLastBlockPeriod = "5s" - RequestLastBlockTimeout = "5s" - RequestLastBlockMaxRetries = 3 - StatisticsPeriod = "5m" - TimeoutMainLoop = "5m" - RollupInfoRetriesSpacing= "5s" - FallbackToSequentialModeOnSynchronized = false - [Synchronizer.L1ParallelSynchronization.PerformanceWarning] - AceptableInacctivityTime = "5s" - ApplyAfterNumRollupReceived = 10 - - [Sequencer] - WaitPeriodPoolIsEmpty = "1s" - LastBatchVirtualizationTimeMaxWaitPeriod = "10s" - BlocksAmountForTxsToBeDeleted = 100 - FrequencyToCheckTxsForDelete = "12h" - TxLifetimeCheckTimeout = "10m" - MaxTxLifetime = "3h" - [Sequencer.Finalizer] - GERDeadlineTimeout = "2s" - ForcedBatchDeadlineTimeout = "5s" - SleepDuration = "100ms" - ResourcePercentageToCloseBatch = 10 - GERFinalityNumberOfBlocks = 0 - ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" - ClosingSignalsManagerWaitForCheckingGER = "10s" - ClosingSignalsManagerWaitForCheckingForcedBatches = "10s" - ForcedBatchesFinalityNumberOfBlocks = 0 - TimestampResolution = "10s" - StopSequencerOnBatchNum = 0 - [Sequencer.DBManager] - PoolRetrievalInterval = "500ms" - L2ReorgRetrievalInterval = "5s" - - [SequenceSender] - WaitPeriodSendSequence = "15s" - LastBatchVirtualizationTimeMaxWaitPeriod = "10s" - MaxTxSizeForL1 = 131072 - L2Coinbase = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" - PrivateKey = {Path = "/tmp/cdk/account.key", Password = "testonly"} - - [Aggregator] - Host = "0.0.0.0" - Port = 50081 - RetryTime = "5s" - VerifyProofInterval = "10s" - TxProfitabilityCheckerType = "acceptall" - TxProfitabilityMinReward = "1.1" - ProofStatePollingInterval = "5s" - SenderAddress = "0xf100D00c376D62682Faf28FeE5cF603AAED75e13" - CleanupLockedProofsInterval = "2m" - GeneratingProofCleanupThreshold = "10m" - - [EthTxManager] - ForcedGas = 0 - PrivateKeys = [ - {Path = "/tmp/cdk/account.key", Password = "testonly"} - ] - - [L2GasPriceSuggester] - Type = "default" - UpdatePeriod = "10s" - Factor = 0.5 - DefaultGasPriceWei = 0 - MaxGasPriceWei = 0 - - [MTClient] - URI = "localhost:50061" - - [Executor] - URI = "localhost:50071" - MaxGRPCMessageSize = 100000000 - - [Metrics] - Host = "0.0.0.0" - Port = 9091 - Enabled = true - ProfilingHost = "0.0.0.0" - ProfilingPort = 6060 - ProfilingEnabled = true - - [HashDB] - User = "cdk_user" - Password = "cdk_password" - Name = "prover_db" - Host = "localhost" - Port = "5432" - EnableLog = false - MaxConns = 200 - -4. Modify the `URL` parameter in`[Etherman]` to the URL of the RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier by running the following script. +4. Run the following script to modify the `URL` parameter in`[Etherman]` to the URL of the RPC Provider, along with the parameters `L2Coinbase` in `[SequenceSender]` and `SenderAddress` in `[Aggregator]` to the address we generated earlier. ```bash source /tmp/cdk/.env diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md index ae1063c77..3c0c73155 100644 --- a/docs/cdk/get-started/deploy-validium/node/run-node-services.md +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -55,6 +55,6 @@ cd ~/cdk-validium/cdk-data-availability-0.0.3 ## Run the bridge service ```bash -cd ~/cdk-validium/cdk-bridge-service +cd ~/cdk-validium/zkevm-bridge-service ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml ``` \ No newline at end of file diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index 111bac89a..b2371ae1d 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -27,7 +27,7 @@ git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git ``` -2. Download and extract version `0.0.3` of `cdk-data-availability` as a tar.gz file. +2. Clone the `0.0.3` release of `cdk-data-availability`. ```bash git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-data-availability.git From 58f2853d56736b5ccd8b733a04bcd303bda15498 Mon Sep 17 00:00:00 2001 From: kmurphypolygon Date: Thu, 1 Feb 2024 09:36:50 +0100 Subject: [PATCH 26/26] formatting --- docs/cdk/get-started/deploy-validium/node/set-up.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index b2371ae1d..0ea246656 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -50,9 +50,9 @@ Navigate to the node directory we cloned at the previous step: `cdk-validium-node/`. - ```bash - cd cdk-validium-node/ - ``` +```bash +cd cdk-validium-node/ +``` ## Set up the database