From 7b2ed4de7daf649d8002cc8e9ef1e38e0172b109 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 11:26:52 -0300 Subject: [PATCH 01/15] initial commit --- eigenda-integration.md | 154 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/eigenda-integration.md b/eigenda-integration.md index 4d02fa6a824..de587a51dc6 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -71,3 +71,157 @@ zk_supervisor test integration --chain eigen_da ### Metrics Access Grafana at [http://localhost:3000/](http://localhost:3000/), go to dashboards and select `EigenDA`. + +## Holesky Setup + +### Used wallets + +Modify `etc/env/file_based/wallets.yaml` with the following wallets: + +```yaml +# Use your own holesky wallets, be sure they have enough funds +``` + +### EigenProxy RPC + +Get `EIGEN_SIGNER_PK` from 1password and set it as an `env` var: + +```bash +export EIGEN_SIGNER_PK= +``` + +Modify `docker-compose.yml` to use holesky RPCs: + +```rust + eigenda-proxy: + image: ghcr.io/layr-labs/eigenda-proxy + environment: + - EIGEN_SIGNER_PK=$EIGEN_SIGNER_PK + ports: + - "4242:4242" + command: ./eigenda-proxy --addr 0.0.0.0 --port 4242 --eigenda-disperser-rpc disperser-holesky.eigenda.xyz:443 --eigenda-signer-private-key-hex $EIGEN_SIGNER_PK --eigenda-eth-rpc https://ethereum-holesky-rpc.publicnode.com --eigenda-svc-manager-addr 0xD4A7E1Bd8015057293f0D0A557088c286942e84b --eigenda-eth-confirmation-depth 0 +``` + +### Create and initialize the ecosystem + +```bash +zk_inception chain create \ + --chain-name holesky_eigen_da \ + --chain-id 275 \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false + +zk_inception ecosystem init \ + --deploy-paymaster true \ + --deploy-erc20 true \ + --deploy-ecosystem true \ + --l1-rpc-url https://ethereum-holesky-rpc.publicnode.com \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_holesky_eigen_da \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_holesky_eigen_da \ + --chain holesky_eigen_da \ + --verbose +``` + +## Backup and restoration + +It's possible to run the zk stack on one computer, and then migrate it to another, this is specially useful for holesky testing. + +### Backup + +Set up the following command to streamline the process: + +```bash +export PGPASSWORD=notsecurepassword +``` + +1. Let's assume that you have set up an `holesky_eigen_da` chain to run in holesky, you can backup the database with the following commands (make sure the databases are named likewise): + +```bash +pg_dump -U postgres -h localhost zksync_server_holesky_eigen_da > zksync_server_holesky_eigen_da_backup.sql +pg_dump -U postgres -h localhost zksync_prover_holesky_eigen_da > zksync_prover_holesky_eigen_da_backup.sql +``` + +2. You also need to backup the chain configuration, make a copy of the folder `ZKSYNC_HOME/chains/hiolesky_eigen_da` + +### Restoration + +On the new computer you can restore the databases with the following commands: + +1. Initialize postgres containers: + +```bash +zk_inception containers +``` + +2. Create the `eigen_da` chain with the same parameters as before (for example): + +```bash +zk_inception chain create \ + --chain-name holesky_eigen_da \ + --chain-id 275 \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false +``` + +4. Restore the databases: + +```bash +createdb -U postgres -h localhost zksync_server_holesky_eigen_da +psql -U postgres -h localhost -d zksync_server_holesky_eigen_da -f zksync_server_holesky_eigen_da_backup.sql + +createdb -U postgres -h localhost zksync_prover_holesky_eigen_da +psql -U postgres -h localhost -d zksync_prover_holesky_eigen_da -f zksync_prover_holesky_eigen_da_backup.sql +``` + +> ⚠️ The following step may and should be simplified + +5. Create and init a dummy ecosystem to build necessary contracts: + +```bash +zk_inception chain create \ + --chain-name dummy_chain \ + --chain-id sequential \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false + +zk_inception ecosystem init \ + --deploy-paymaster true \ + --deploy-erc20 true \ + --deploy-ecosystem true \ + --l1-rpc-url http://127.0.0.1:8545 \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_dummy_chain \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_dummy_chain \ + --chain dummy_chain \ + --verbose +``` + +6. Start the server of the restored chain: + +```bash +zk_inception server --chain zksync_server_holesky_eigen_da +``` + +If everything went well, you should see the server logging a message like: + +``` +2024-09-30T13:29:41.723324Z INFO zksync_state_keeper::keeper: Starting state keeper. Next l1 batch to seal: 44, next L2 block to seal: 138 +``` From 8cbaf34b398a42287b70b6b10b19b8f60b89f69e Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 11:51:42 -0300 Subject: [PATCH 02/15] add more steps --- eigenda-integration.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index de587a51dc6..6b620803c80 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -104,6 +104,8 @@ Modify `docker-compose.yml` to use holesky RPCs: ### Create and initialize the ecosystem +(be sure to have postgres container running on the background) + ```bash zk_inception chain create \ --chain-name holesky_eigen_da \ @@ -148,7 +150,7 @@ pg_dump -U postgres -h localhost zksync_server_holesky_eigen_da > zksync_server_ pg_dump -U postgres -h localhost zksync_prover_holesky_eigen_da > zksync_prover_holesky_eigen_da_backup.sql ``` -2. You also need to backup the chain configuration, make a copy of the folder `ZKSYNC_HOME/chains/hiolesky_eigen_da` +2. You also need to backup the chain configuration, make a copy of the folder `ZKSYNC_HOME/chains/holesky_eigen_da` ### Restoration @@ -175,6 +177,8 @@ zk_inception chain create \ --set-as-default false ``` +3. Copy backed up chain configuration to the new computer (replace the directory) + 4. Restore the databases: ```bash From 3b1c71e016379bb507afbd0a680569850d0cb14c Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 14:43:22 -0300 Subject: [PATCH 03/15] add backup and restore ecosystem scripts --- .gitignore | 3 ++ backup-ecosystem.sh | 48 ++++++++++++++++++++++++++++ restore-ecosystem.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100755 backup-ecosystem.sh create mode 100755 restore-ecosystem.sh diff --git a/.gitignore b/.gitignore index c3de7a2df84..f95274b0e36 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,6 @@ configs/* era-observability/ core/tests/ts-integration/deployments-zk transactions/ + +# Ecosystem backups +ecosystem_backups/ diff --git a/backup-ecosystem.sh b/backup-ecosystem.sh new file mode 100755 index 00000000000..534939ef0f8 --- /dev/null +++ b/backup-ecosystem.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Check if the ecosystem name was provided as an argument +if [ -z "$1" ]; then + echo "Usage: ./backup-ecosystem ECOSYSTEM_NAME" + exit 1 +fi + +# Store the first argument as ECOSYSTEM_NAME +ECOSYSTEM_NAME=$1 + +# Prompt for the Postgres password and store it in PGPASSWORD +read -sp "Enter Postgres password: " PGPASSWORD +export PGPASSWORD + +# Path to the secrets.yaml file +SECRETS_FILE="./chains/${ECOSYSTEM_NAME}/configs/secrets.yaml" + +# Check if the secrets.yaml file exists +if [ ! -f "$SECRETS_FILE" ]; then + echo "Error: $SECRETS_FILE does not exist." + exit 1 +fi + +# Extract server_url and prover_url from the secrets.yaml file +SERVER_DB_NAME=$(grep 'server_url' "$SECRETS_FILE" | awk -F'/' '{print $NF}') +PROVER_DB_NAME=$(grep 'prover_url' "$SECRETS_FILE" | awk -F'/' '{print $NF}') + +# Export the database names +echo "Extracted SERVER_DB_NAME: $SERVER_DB_NAME" +echo "Extracted PROVER_DB_NAME: $PROVER_DB_NAME" + +# Create backup directory +mkdir -p "./ecosystem_backups/${ECOSYSTEM_NAME}" + +# Run pg_dump commands +echo "Running pg_dump for $SERVER_DB_NAME..." +pg_dump -U postgres -h localhost "$SERVER_DB_NAME" > "ecosystem_backups/${ECOSYSTEM_NAME}/${SERVER_DB_NAME}_backup.sql" +echo "Running pg_dump for $PROVER_DB_NAME..." +pg_dump -U postgres -h localhost "$PROVER_DB_NAME" > "ecosystem_backups/${ECOSYSTEM_NAME}/${PROVER_DB_NAME}_backup.sql" + +# Unset the PGPASSWORD variable for security +unset PGPASSWORD + +# Copy the chain configuration files +cp -r "./chains/${ECOSYSTEM_NAME}" "./ecosystem_backups/${ECOSYSTEM_NAME}/" + +echo "Backup completed." diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh new file mode 100755 index 00000000000..fd17410fbc2 --- /dev/null +++ b/restore-ecosystem.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# Check if the ecosystem name was provided as an argument +if [ -z "$1" ]; then + echo "Usage: ./restore-ecosystem ECOSYSTEM_NAME" + exit 1 +fi + +# Store the first argument as ECOSYSTEM_NAME +ECOSYSTEM_NAME=$1 + +# Prompt for the Postgres password and store it in PGPASSWORD +read -sp "Enter Postgres password: " PGPASSWORD +export PGPASSWORD + +# Check if the chain directory exists +CHAIN_PATH="./chains/${ECOSYSTEM_NAME}" +BACKUP_PATH="./ecosystem_backups/${ECOSYSTEM_NAME}" + +if [ ! -d "$CHAIN_PATH" ]; then + echo "Error: $CHAIN_PATH does not exist. Please create the chain first." + exit 1 +fi + +# Check if the backup directory exists +if [ ! -d "$BACKUP_PATH" ]; then + echo "Error: Backup not found at $BACKUP_PATH." + exit 1 +fi + +# Check if the postgres is running +if ! docker ps --filter "name=postgres" --filter "status=running" | grep "postgres" > /dev/null; then + echo "Error: postgres not running, set it up first with 'zk_inception containers'." + exit 1 +fi + +# Copy the ecosystem backup folder to the chains folder, replacing any existing files +echo "Copying backup files to $CHAIN_PATH..." +cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME" "$CHAIN_PATH" + +# Path to the secrets.yaml file +SECRETS_FILE="$CHAIN_PATH/configs/secrets.yaml" + +# Check if the secrets.yaml file exists +if [ ! -f "$SECRETS_FILE" ]; then + echo "Error: $SECRETS_FILE does not exist." + exit 1 +fi + +# Extract server_url and prover_url from the secrets.yaml file +SERVER_DB_NAME=$(grep 'server_url' "$SECRETS_FILE" | awk -F'/' '{print $NF}') +PROVER_DB_NAME=$(grep 'prover_url' "$SECRETS_FILE" | awk -F'/' '{print $NF}') + +# Show the extracted database names +echo "Extracted SERVER_DB_NAME: $SERVER_DB_NAME" +echo "Extracted PROVER_DB_NAME: $PROVER_DB_NAME" + +# Create and restore the server database +echo "Creating database $SERVER_DB_NAME..." +createdb -U postgres -h localhost "$SERVER_DB_NAME" + +echo "Restoring $SERVER_DB_NAME from backup..." +psql -U postgres -h localhost -d "$SERVER_DB_NAME" -f "$BACKUP_PATH/${SERVER_DB_NAME}_backup.sql" + +# Create and restore the prover database +echo "Creating database $PROVER_DB_NAME..." +createdb -U postgres -h localhost "$PROVER_DB_NAME" + +echo "Restoring $PROVER_DB_NAME from backup..." +psql -U postgres -h localhost -d "$PROVER_DB_NAME" -f "$BACKUP_PATH/${PROVER_DB_NAME}_backup.sql" + +# Unset the PGPASSWORD variable for security +unset PGPASSWORD + +echo "Restore completed." From 4ed4f775c0f768997fd22692609dabf0202dac76 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 15:23:49 -0300 Subject: [PATCH 04/15] remove unnecessary step --- restore-ecosystem.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index fd17410fbc2..642e6cfdbcb 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -17,11 +17,6 @@ export PGPASSWORD CHAIN_PATH="./chains/${ECOSYSTEM_NAME}" BACKUP_PATH="./ecosystem_backups/${ECOSYSTEM_NAME}" -if [ ! -d "$CHAIN_PATH" ]; then - echo "Error: $CHAIN_PATH does not exist. Please create the chain first." - exit 1 -fi - # Check if the backup directory exists if [ ! -d "$BACKUP_PATH" ]; then echo "Error: Backup not found at $BACKUP_PATH." From 11536515fac93e6661dde6411dc00dec7da991cd Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 16:59:37 -0300 Subject: [PATCH 05/15] improve docs --- eigenda-integration.md | 102 ++++++++++++----------------------------- 1 file changed, 30 insertions(+), 72 deletions(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index 6b620803c80..03a63ccb72f 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -137,95 +137,53 @@ It's possible to run the zk stack on one computer, and then migrate it to anothe ### Backup -Set up the following command to streamline the process: +Suppose that you want to make a backup of `holesky_eigen_da` ecosystem, you only need to run: ```bash -export PGPASSWORD=notsecurepassword +./backup-ecosystem.sh holesky_eigen_da ``` -1. Let's assume that you have set up an `holesky_eigen_da` chain to run in holesky, you can backup the database with the following commands (make sure the databases are named likewise): - -```bash -pg_dump -U postgres -h localhost zksync_server_holesky_eigen_da > zksync_server_holesky_eigen_da_backup.sql -pg_dump -U postgres -h localhost zksync_prover_holesky_eigen_da > zksync_prover_holesky_eigen_da_backup.sql -``` - -2. You also need to backup the chain configuration, make a copy of the folder `ZKSYNC_HOME/chains/holesky_eigen_da` +This will generate a directory inside of `ecosystem_backups` with the name `holesky_eigen_da`. ### Restoration -On the new computer you can restore the databases with the following commands: +1. Move the `ecoystem_backups/holesky_eigen_da` directory to the other computer, it should be placed in the root of the project. -1. Initialize postgres containers: +2. Restore the ecosystem with: ```bash -zk_inception containers +./restore-ecosystem.sh holesky_eigen_da ``` -2. Create the `eigen_da` chain with the same parameters as before (for example): - -```bash -zk_inception chain create \ - --chain-name holesky_eigen_da \ - --chain-id 275 \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode validium \ - --base-token-address 0x0000000000000000000000000000000000000001 \ - --base-token-price-nominator 1 \ - --base-token-price-denominator 1 \ - --set-as-default false -``` - -3. Copy backed up chain configuration to the new computer (replace the directory) - -4. Restore the databases: - -```bash -createdb -U postgres -h localhost zksync_server_holesky_eigen_da -psql -U postgres -h localhost -d zksync_server_holesky_eigen_da -f zksync_server_holesky_eigen_da_backup.sql - -createdb -U postgres -h localhost zksync_prover_holesky_eigen_da -psql -U postgres -h localhost -d zksync_prover_holesky_eigen_da -f zksync_prover_holesky_eigen_da_backup.sql -``` +Note that: -> ⚠️ The following step may and should be simplified +- The `postgres` container has to be running. +- The `chain_id` can't be already in use. +- If you are restoring a local ecosystem, you have to use the same `reth` container as before. -5. Create and init a dummy ecosystem to build necessary contracts: +#### ⚠️ If no ecosystem has been `init`ialized yet, the restored ecosystem will fail to start its server. `init` and `create` a dummy chain: ```bash zk_inception chain create \ - --chain-name dummy_chain \ - --chain-id sequential \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode validium \ - --base-token-address 0x0000000000000000000000000000000000000001 \ - --base-token-price-nominator 1 \ - --base-token-price-denominator 1 \ - --set-as-default false + --chain-name foo \ + --chain-id 275 \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false zk_inception ecosystem init \ - --deploy-paymaster true \ - --deploy-erc20 true \ - --deploy-ecosystem true \ - --l1-rpc-url http://127.0.0.1:8545 \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_dummy_chain \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_dummy_chain \ - --chain dummy_chain \ - --verbose -``` - -6. Start the server of the restored chain: - -```bash -zk_inception server --chain zksync_server_holesky_eigen_da -``` - -If everything went well, you should see the server logging a message like: - -``` -2024-09-30T13:29:41.723324Z INFO zksync_state_keeper::keeper: Starting state keeper. Next l1 batch to seal: 44, next L2 block to seal: 138 + --deploy-paymaster true \ + --deploy-erc20 true \ + --deploy-ecosystem true \ + --l1-rpc-url https://ethereum-holesky-rpc.publicnode.com \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_foo \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_foo \ + --chain foo \ + --verbose ``` From 29f8a0e37cec079773401be75c0ce30015998de3 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 17:00:10 -0300 Subject: [PATCH 06/15] fix docs --- eigenda-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index 03a63ccb72f..fe30c204ac9 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -109,7 +109,7 @@ Modify `docker-compose.yml` to use holesky RPCs: ```bash zk_inception chain create \ --chain-name holesky_eigen_da \ - --chain-id 275 \ + --chain-id sequential \ --prover-mode no-proofs \ --wallet-creation localhost \ --l1-batch-commit-data-generator-mode validium \ From 2d8d55935a3fcdc8b9afea50f2b53312c1af3659 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 17:00:38 -0300 Subject: [PATCH 07/15] fix the fix docs --- eigenda-integration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index fe30c204ac9..1cbacaa5159 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -109,7 +109,7 @@ Modify `docker-compose.yml` to use holesky RPCs: ```bash zk_inception chain create \ --chain-name holesky_eigen_da \ - --chain-id sequential \ + --chain-id 275 \ --prover-mode no-proofs \ --wallet-creation localhost \ --l1-batch-commit-data-generator-mode validium \ @@ -166,7 +166,7 @@ Note that: ```bash zk_inception chain create \ --chain-name foo \ - --chain-id 275 \ + --chain-id sequential \ --prover-mode no-proofs \ --wallet-creation localhost \ --l1-batch-commit-data-generator-mode validium \ From 21d9f192460cfcb1546e783da98c8222b72aa6f7 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 17:38:25 -0300 Subject: [PATCH 08/15] add extra step --- backup-ecosystem.sh | 3 +++ restore-ecosystem.sh | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/backup-ecosystem.sh b/backup-ecosystem.sh index 534939ef0f8..dbdf82e3a38 100755 --- a/backup-ecosystem.sh +++ b/backup-ecosystem.sh @@ -45,4 +45,7 @@ unset PGPASSWORD # Copy the chain configuration files cp -r "./chains/${ECOSYSTEM_NAME}" "./ecosystem_backups/${ECOSYSTEM_NAME}/" +# Copy the configs directory +cp -r "./configs" "./ecosystem_backups/${ECOSYSTEM_NAME}/" + echo "Backup completed." diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index 642e6cfdbcb..806f349dfcc 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -33,6 +33,12 @@ fi echo "Copying backup files to $CHAIN_PATH..." cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME" "$CHAIN_PATH" +# Copy the configs folder in the backup to the configs folder in the root of the project +# TODO: it may be suitable to warn the user about overwriting the existing configs +# and ask for confirmation before proceeding +echo "Copying configs folder from backup..." +cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME/configs" "./" + # Path to the secrets.yaml file SECRETS_FILE="$CHAIN_PATH/configs/secrets.yaml" From 37b986c373b1b4e93e0a6044c4feb022ba5496c9 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 18:06:13 -0300 Subject: [PATCH 09/15] fix restore path --- restore-ecosystem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index 806f349dfcc..1d830c09529 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -37,7 +37,7 @@ cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME" "$CHAIN_PATH" # TODO: it may be suitable to warn the user about overwriting the existing configs # and ask for confirmation before proceeding echo "Copying configs folder from backup..." -cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME/configs" "./" +cp -r "$BACKUP_PATH/configs" "./" # Path to the secrets.yaml file SECRETS_FILE="$CHAIN_PATH/configs/secrets.yaml" From 62a092fe8d34fce6caadca9af93ed0c131a7236e Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 30 Sep 2024 18:09:57 -0300 Subject: [PATCH 10/15] simplify restoration note --- eigenda-integration.md | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index 1cbacaa5159..8bc83829b4e 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -160,30 +160,8 @@ Note that: - The `postgres` container has to be running. - The `chain_id` can't be already in use. - If you are restoring a local ecosystem, you have to use the same `reth` container as before. - -#### ⚠️ If no ecosystem has been `init`ialized yet, the restored ecosystem will fail to start its server. `init` and `create` a dummy chain: +- If no ecosystem has been `init`ialized on this computer before, run this command: ```bash -zk_inception chain create \ - --chain-name foo \ - --chain-id sequential \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode validium \ - --base-token-address 0x0000000000000000000000000000000000000001 \ - --base-token-price-nominator 1 \ - --base-token-price-denominator 1 \ - --set-as-default false - -zk_inception ecosystem init \ - --deploy-paymaster true \ - --deploy-erc20 true \ - --deploy-ecosystem true \ - --l1-rpc-url https://ethereum-holesky-rpc.publicnode.com \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_foo \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_foo \ - --chain foo \ - --verbose +git submodule update --init --recursive && zk_supervisor contracts ``` From e4d25fa78ae7304a6489ea59090bab698a41493a Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Tue, 1 Oct 2024 17:37:34 -0300 Subject: [PATCH 11/15] more docs --- eigenda-integration.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index 8bc83829b4e..1c0479ac9ce 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -74,14 +74,24 @@ Access Grafana at [http://localhost:3000/](http://localhost:3000/), go to dashbo ## Holesky Setup +### Modify localhost chain id number + +Modify line 32 in `zk_toolbox/crates/types/src/l1_network.rs`: + +```rs +L1Network::Localhost => 17000, +``` + ### Used wallets -Modify `etc/env/file_based/wallets.yaml` with the following wallets: +Modify `etc/env/file_based/wallets.yaml` and `configs/wallets.yaml` with the following wallets: ```yaml # Use your own holesky wallets, be sure they have enough funds ``` +> ⚠️ Some steps distribute ~5000ETH to some wallets, modify `AMOUNT_FOR_DISTRIBUTION_TO_WALLETS` to a lower value if needed. + ### EigenProxy RPC Get `EIGEN_SIGNER_PK` from 1password and set it as an `env` var: @@ -109,7 +119,7 @@ Modify `docker-compose.yml` to use holesky RPCs: ```bash zk_inception chain create \ --chain-name holesky_eigen_da \ - --chain-id 275 \ + --chain-id 114411 \ --prover-mode no-proofs \ --wallet-creation localhost \ --l1-batch-commit-data-generator-mode validium \ @@ -131,6 +141,12 @@ zk_inception ecosystem init \ --verbose ``` +### Start the server + +```bash +zk_inception server --chain holesky_eigen_da +``` + ## Backup and restoration It's possible to run the zk stack on one computer, and then migrate it to another, this is specially useful for holesky testing. From 16b6130ca3f32d8475cc80284fe97c231e68d0c5 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Fri, 4 Oct 2024 13:21:24 -0300 Subject: [PATCH 12/15] fix paths in backup restoration --- eigenda-integration.md | 6 ++++++ restore-ecosystem.sh | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/eigenda-integration.md b/eigenda-integration.md index 1c0479ac9ce..27dce5bffea 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -82,6 +82,12 @@ Modify line 32 in `zk_toolbox/crates/types/src/l1_network.rs`: L1Network::Localhost => 17000, ``` +Then recompile the zk toolbox: + +```bash +./bin/zkt +``` + ### Used wallets Modify `etc/env/file_based/wallets.yaml` and `configs/wallets.yaml` with the following wallets: diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index 1d830c09529..baae34fcda7 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -29,6 +29,28 @@ if ! docker ps --filter "name=postgres" --filter "status=running" | grep "postgr exit 1 fi +# Fix backup files $ZKSYNC_HOME paths +find_and_replace() { + local target_file=$1 + + # Find lines with the pattern and replace them with `pwd/./` + sed -i '' -e "s|.*zksync-era/\./|$(pwd)/./|g" "$target_file" +} + +# Array of specific files to modify +files=("$BACKUP_PATH/$ECOSYSTEM_NAME/configs/general.yaml" "$BACKUP_PATH/$ECOSYSTEM_NAME/ZkStack.yaml ") + +# Loop over the files and perform the find and replace +for file in "${files[@]}"; do + if [ -f "$file" ]; then + find_and_replace "$file" + else + # Exit with error code + echo "ERROR: backup file $file does not exist." + exit 1 + fi +done + # Copy the ecosystem backup folder to the chains folder, replacing any existing files echo "Copying backup files to $CHAIN_PATH..." cp -r "$BACKUP_PATH/$ECOSYSTEM_NAME" "$CHAIN_PATH" From f941f281c315f85f5de6261275061117aeb8155c Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Fri, 4 Oct 2024 15:34:22 -0300 Subject: [PATCH 13/15] fix whitespace --- restore-ecosystem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index baae34fcda7..1b14b828d72 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -38,7 +38,7 @@ find_and_replace() { } # Array of specific files to modify -files=("$BACKUP_PATH/$ECOSYSTEM_NAME/configs/general.yaml" "$BACKUP_PATH/$ECOSYSTEM_NAME/ZkStack.yaml ") +files=("$BACKUP_PATH/$ECOSYSTEM_NAME/configs/general.yaml" "$BACKUP_PATH/$ECOSYSTEM_NAME/ZkStack.yaml") # Loop over the files and perform the find and replace for file in "${files[@]}"; do From 8ecc04d41eea79bd5b3379692b39fb3550f2260a Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Fri, 4 Oct 2024 16:13:42 -0300 Subject: [PATCH 14/15] replacement fixes --- restore-ecosystem.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/restore-ecosystem.sh b/restore-ecosystem.sh index 1b14b828d72..7fbff3e9802 100755 --- a/restore-ecosystem.sh +++ b/restore-ecosystem.sh @@ -33,8 +33,10 @@ fi find_and_replace() { local target_file=$1 - # Find lines with the pattern and replace them with `pwd/./` - sed -i '' -e "s|.*zksync-era/\./|$(pwd)/./|g" "$target_file" + sed -i '' -e "s|db_path:.*zksync-era/\./|db_path: $(pwd)/./|g" "$target_file" + sed -i '' -e "s|state_keeper_db_path:.*zksync-era/\./|state_keeper_db_path: $(pwd)/./|g" "$target_file" + sed -i '' -e "s|path:.*zksync-era/\./|path: $(pwd)/./|g" "$target_file" + sed -i '' -e "s|configs:.*zksync-era/\./|configs: $(pwd)/./|g" "$target_file" } # Array of specific files to modify From 8bff5a49e0cd89063224e0c280ebdbc0ca7a3e31 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Mon, 7 Oct 2024 13:11:31 -0300 Subject: [PATCH 15/15] moved holesky rpc url to env var --- eigenda-integration.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eigenda-integration.md b/eigenda-integration.md index 27dce5bffea..638719e2b4d 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -104,6 +104,7 @@ Get `EIGEN_SIGNER_PK` from 1password and set it as an `env` var: ```bash export EIGEN_SIGNER_PK= +export HOLESKY_RPC_URL= ``` Modify `docker-compose.yml` to use holesky RPCs: @@ -113,9 +114,10 @@ Modify `docker-compose.yml` to use holesky RPCs: image: ghcr.io/layr-labs/eigenda-proxy environment: - EIGEN_SIGNER_PK=$EIGEN_SIGNER_PK + - HOLESKY_RPC_URL=$HOLESKY_RPC_URL ports: - "4242:4242" - command: ./eigenda-proxy --addr 0.0.0.0 --port 4242 --eigenda-disperser-rpc disperser-holesky.eigenda.xyz:443 --eigenda-signer-private-key-hex $EIGEN_SIGNER_PK --eigenda-eth-rpc https://ethereum-holesky-rpc.publicnode.com --eigenda-svc-manager-addr 0xD4A7E1Bd8015057293f0D0A557088c286942e84b --eigenda-eth-confirmation-depth 0 + command: ./eigenda-proxy --addr 0.0.0.0 --port 4242 --eigenda-disperser-rpc disperser-holesky.eigenda.xyz:443 --eigenda-signer-private-key-hex $EIGEN_SIGNER_PK --eigenda-eth-rpc $HOLESKY_RPC_URL --eigenda-svc-manager-addr 0xD4A7E1Bd8015057293f0D0A557088c286942e84b --eigenda-eth-confirmation-depth 0 ``` ### Create and initialize the ecosystem @@ -138,7 +140,7 @@ zk_inception ecosystem init \ --deploy-paymaster true \ --deploy-erc20 true \ --deploy-ecosystem true \ - --l1-rpc-url https://ethereum-holesky-rpc.publicnode.com \ + --l1-rpc-url $HOLESKY_RPC_URL \ --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ --server-db-name=zksync_server_holesky_eigen_da \ --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \