Skip to content

Commit

Permalink
Devop 1845 compose evm simplified improvemets (#17)
Browse files Browse the repository at this point in the history
* Upgrade evmapp version to 1.3.0
* Upgrade eon evmapp templates to 1.3.0
---------
  • Loading branch information
otoumas authored Mar 13, 2024
1 parent 9395c98 commit 38643a8
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 42 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

**1.3.0**
* SDK dependency updated to version 0.11.0 (see [SDK changelog](https://github.com/HorizenOfficial/Sidechains-SDK/blob/0.11.0/CHANGELOG.md))
* Fork configuration to enable: EVM Update, Forger stake native smart contract new methods, Pause Forging feature
* PLEASE REFER TO THE [MIGRATION GUIDE](./docs/MIGRATION.md) FOR THE MIGRATION PROCESS FROM VERSION 1.2.*.

**1.2.1**
* SDK dependency updated to version 0.10.1
* [eth RPC endpoint] fix on json representation in RPC response of signature V field for transaction type 2.
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ This repository contains all the resources for deploying a forger or rpc EVM sid

---

## Upgrade

1. If your project structure is 1.2.* follow the instructions here: [Migration from 1.2.* to 1.3.0](./docs/MIGRATION.md)
2. Run the [upgrade.sh](./scripts/upgrade.sh) script to upgrade the project to the new version.

---




4 changes: 2 additions & 2 deletions compose_files/docker-compose-forger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
zend:
image: "zencash/zen-node:${ZEND_TAG}"
container_name: "${ZEND_CONTAINER_NAME:-zend}"
restart: always
restart: on-failure:5
stop_grace_period: 10m
networks:
evmapp_network:
Expand Down Expand Up @@ -57,7 +57,7 @@ services:
evmapp:
image: "zencash/evmapp:${EVMAPP_TAG}"
container_name: "${EVMAPP_CONTAINER_NAME:-evmapp}"
restart: always
restart: on-failure:5
stop_grace_period: 10m
networks:
evmapp_network:
Expand Down
2 changes: 2 additions & 0 deletions compose_files/docker-compose-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
image: "zencash/evmapp:${EVMAPP_TAG}"
container_name: "${EVMAPP_CONTAINER_NAME:-evmapp}"
restart: on-failure:5
stop_grace_period: 10m
networks:
evmapp_network:
ipv4_address: "${EVMAPP_IP_ADDRESS}"
Expand Down Expand Up @@ -46,6 +47,7 @@ services:
- SCNODE_ALLOWED_FORGERS
- SCNODE_FORGER_ENABLED
- SCNODE_FORGER_RESTRICT
- SCNODE_FORGER_MAXCONNECTIONS
- SCNODE_GENESIS_BLOCKHEX
- SCNODE_GENESIS_SCID
- SCNODE_GENESIS_POWDATA
Expand Down
31 changes: 18 additions & 13 deletions docs/FORGER.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,26 @@ This directory will be mounted into the zend container and used to seed the node
Keep in mind that the storage requirements will grow over time.

2. Run the zend node and let it sync (only required the first time the stack is started):
```shell
cd deployments/forger/[eon|gobi] && docker compose up -d zend
```shell
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml up -d zend
```

3. Verify if zend node is fully synced by running the following command and comparing the output with the current block height in the mainchain: https://explorer.horizen.io or https://explorer-testnet.horizen.io:
```shell
docker compose exec zend gosu user zen-cli getblockcount
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml exec zend gosu user zen-cli getblockcount
```

4. Once the zend node is fully synced, run the evmapp node:
```shell
cd deployments/forger/[eon|gobi] && docker compose up -d
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml up -d
```

5. Verify if the evmapp node is fully synced by running the following command and comparing the output with the current block height in the sidechain: https://eon-explorer.horizenlabs.io or https://gobi-explorer.horizenlabs.io:
```shell
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml exec evmapp gosu user bash -c 'curl -sXPOST "http://127.0.0.1:${SCNODE_REST_PORT}/block/best" -H "accept: application/json" | jq '.result.height''
```

5. Once the evmapp node is fully synced, generate the keys required to run a forger node:
6. Once the evmapp node is fully synced, generate the keys required to run a forger node:
```shell
./scripts/forger/generate_keys.sh
```
Expand All @@ -89,14 +94,14 @@ This directory will be mounted into the zend container and used to seed the node
Ethereum Private Key for MetaMask : ...
```

6. **STORE THESE VALUES IN A SAFE PLACE. THESE VALUES WILL BE REQUIRED IN THE STAKING PROCESS**
7. **STORE THESE VALUES IN A SAFE PLACE. THESE VALUES WILL BE REQUIRED IN THE STAKING PROCESS**

7. Verify that the keys were generated correctly by running the following command:
8. Verify that the keys were generated correctly by running the following command:
```shell
docker compose exec evmapp gosu user bash -c 'curl -sXPOST "http://127.0.0.1:${SCNODE_REST_PORT}/wallet/allPublicKeys" -H "accept: application/json" -H "Content-Type: application/json"'
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml exec evmapp gosu user bash -c 'curl -sXPOST "http://127.0.0.1:${SCNODE_REST_PORT}/wallet/allPublicKeys" -H "accept: application/json" -H "Content-Type: application/json"'
```

8. **IMPORTANT NOTE**
9. **IMPORTANT NOTE**
- The address **_"Generated Ethereum Address Key Pair"_** is where rewards will go to.
- Rewards are paid to the first ETH address in the wallet of the Forger Node.
- **We recommend to not delegate from the node so that no stakes have to be custodied on it, which reduces attack surface.**
Expand All @@ -109,19 +114,19 @@ This directory will be mounted into the zend container and used to seed the node
- Run the following command to stop the stack:
```shell
cd deployments/forger/[eon|gobi] && docker compose stop
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml stop
```
- Run the following command to start the stack again:
```shell
cd deployments/forger/[eon|gobi] && docker compose up -d
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml up -d
```
- Run the following command to stop the stack and delete the containers:
```shell
cd deployments/forger/[eon|gobi] && docker compose down
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml down
```
- Run the following commands to destroy the stack, **this action will delete your wallet and all the data**:
```shell
cd deployments/forger/[eon|gobi] && docker compose down
docker compose -f deployments/forger/[eon|gobi]/docker-compose.yml down
docker volume ls # List all the volumes
docker volume rm [volume_name] # Remove the volumes related to your stack, these volumes are named after the stack name: [COMPOSE_PROJECT_NAME]_[volume-name]
```
Expand Down
19 changes: 19 additions & 0 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Migration from 1.2.* to 1.3.0

This project has been completely restructured in version 1.3.0. The main changes are:

- Compose file templates have been moved to [compose_files](../compose_files) folder.
- Environment variables file templates have been moved to [env](../env) folder. There is now a specific template for each network (eon vs gobi) and type of node (rpc vs forger).
- New init script is provided to help to set up the project. This is an interactive script that will help to create the required files and folders in [deployments](../deployments) folder.
- Updated documentation that will help to set up and run a forger or a rpc node.

If you are using version 1.2.* of this project, you will need to follow these steps to migrate to version 1.3.0:

1. Make a copy of your .env file. This file contains some secrets that you will need to keep.
2. Stop the running containers. You can use the `docker compose down` command to stop and remove the containers. **DO NOT REMOVE THE VOLUMES**.
3. Pull the new tag 1.3.0 of the project.
4. Run the init script in order to set up the new structure of the project.
5. When requested by the script provide the already generated SCNODE_WALLET_SEED available in the old .env file.
6. Review the new .env file and update the values if necessary. For instance RPC or REST passwords, or node names.
7. Run the `docker compose up -d` command to start the new containers. See the [README](../README.md) for more information.
The nodes should start and use the old volumes and data, so there should be no need to resync the nodes.
10 changes: 5 additions & 5 deletions docs/RPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The script will generate the required deployment files under the [deployments](.
---

```shell
cd deployments/rpc/[eon|gobi] && docker compose up -d
docker compose -f deployments/rpc/[eon|gobi]/docker-compose.yml up -d
```

## Other useful docker commands
Expand All @@ -26,19 +26,19 @@ cd deployments/rpc/[eon|gobi] && docker compose up -d

- Run the following command to stop the stack:
```shell
cd deployments/rpc/[eon|gobi] && docker compose stop
docker compose -f deployments/rpc/[eon|gobi]/docker-compose.yml stop
```
- Run the following command to start the stack again:
```shell
cd deployments/rpc/[eon|gobi] && docker compose up -d
docker compose -f deployments/rpc/[eon|gobi]/docker-compose.yml up -d
```
- Run the following command to stop the stack and delete the containers:
```shell
cd deployments/rpc/[eon|gobi] && docker compose down
docker compose -f deployments/rpc/[eon|gobi]/docker-compose.yml down
```
- Run the following commands to destroy the stack, **this action will delete your wallet and all the data**:
```shell
cd deployments/rpc/[eon|gobi] && docker compose down
docker compose -f deployments/rpc/[eon|gobi]/docker-compose.yml down
docker volume ls # List all the volumes
docker volume rm [volume_name] # Remove the volumes related to your stack, these volumes are named after the stack name: [COMPOSE_PROJECT_NAME]_[volume-name]
```
Expand Down
10 changes: 5 additions & 5 deletions env/.env.forger.eon.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INTERNAL_NETWORK_SUBNET='10.10.50.0/24'
ZEND_TAG=v5.0.1
ZEND_CONTAINER_NAME=zend
ZEND_IP_ADDRESS='10.10.50.10'
EVMAPP_TAG=1.2.1
EVMAPP_TAG=1.3.0
EVMAPP_CONTAINER_NAME=evmapp
EVMAPP_IP_ADDRESS='10.10.50.3'

Expand All @@ -27,7 +27,7 @@ ZEN_LOCAL_GRP_ID=999
# Sidechain config
SCNODE_ROLE=forger
SCNODE_FORGER_ENABLED=true
SCNODE_FORGER_MAXCONNECTIONS=20
SCNODE_FORGER_MAXCONNECTIONS=100
SCNODE_ALLOWED_FORGERS='{blockSignProposition: "10e9b5236a56cddb9f0332e9dd6d69151494f24172b26ab24a27473bbc92a181"\n vrfPublicKey: "6a376f8a88b386f69296baa0792641d393c85a19b28dfd4a11d8f0a74618873280"}\n{blockSignProposition: "99f8b31ad1af7d8362700f520af4cbeccd12d9b409aaf9b5574c8c483b636efd"\n vrfPublicKey: "8cbd4dd8826964a8dbc85f65b3dc9b115647cd8cacb1817214be66da1ccc9b2780"}\n{blockSignProposition: "c0f8ff4e8d486a87974bd5c4661f1757057737e14b89a8fee67f8e2b667ef109"\n vrfPublicKey: "b6ef38b729ce5501425730ec0466e24bbf9ce7a664200e8f73576abd38a6293f00"}\n{blockSignProposition: "105a0fd2d546c17a0dc5554313707cf58edc5f541ba667e1c3e8e3de485e9d25"\n vrfPublicKey: "74051ee6b9cb3acf2fd75829756270425f2611499be5586bd32e079b319d541180"}\n{blockSignProposition: "33b8c640541f69e36440336c326f32127f11f71c9aa26b9d0cfa8c3c18ae5754"\n vrfPublicKey: "a43ecdd5a67de91c4516e09e3eac121c073eecd78edc2fa87678d7ca97d9b81b80"}\n{blockSignProposition: "39b9d852f845de8dc44bd6c517e907b0960f12c4aa7b8010240182a33c325df5"\n vrfPublicKey: "38f7486245fd71a3f947973d64e2e70b40c21096fc5bb0323fb83b4084a1af1000"}\n{blockSignProposition: "cdb371270f257660ad0620b607c859814e193eba9ef7cd4c674b8df87d9cc725"\n vrfPublicKey: "a4c6a4901085ccf688ae969ab2ed888439e206239fb6f575ea0b9aa73393b72d00"}\n{blockSignProposition: "e88cc8058b05c73cbb57406159b93c26c12c9bbda19de113a1499d29be979408"\n vrfPublicKey: "6e5093705f6518fd11e82a5abe5c8a5a98a5e5ca6f92356d11d932e8a74dc43d00"}\n{blockSignProposition: "a16ff09a894cc3b4bd51bf717705d492ed53ced84a7c2a32548f3deed6293a79"\n vrfPublicKey: "9741645fafa564b26ca59a1a219980434c399d6ab3344ab7f75a535a55fac23600"}\n{blockSignProposition: "3e87a684830a641e2d29af0043ed5957138bb51b065838b2bb55a41cce0f0603"\n vrfPublicKey: "cfa46bdcb8b653761c0a16320f90ca131a19e97a1695e5bcf941454d4749d81500"}\n{blockSignProposition: "097a9f319c814f9423fec61bcb13aabc005e279a27e11b87f4b58d5b7d31a38b"\n vrfPublicKey: "bba35d39ab84937dc796b32428fff2324b1404aad48812057304d36f5cccae0700"}'
SCNODE_FORGER_RESTRICT=true

Expand Down Expand Up @@ -56,8 +56,8 @@ SCNODE_NET_P2P_PORT=9084
SCNODE_REST_PORT=9545
SCNODE_REST_PASSWORD=

SCNODE_NET_MAX_IN_CONNECTIONS=10
SCNODE_NET_MAX_OUT_CONNECTIONS=10
SCNODE_NET_MAX_IN_CONNECTIONS=100
SCNODE_NET_MAX_OUT_CONNECTIONS=25

SCNODE_NET_API_LIMITER_ENABLED=false
SCNODE_NET_SLOW_MODE=true
Expand All @@ -76,5 +76,5 @@ SCNODE_WALLET_GENESIS_SECRETS=
SCNODE_WALLET_SEED=
SCNODE_WALLET_MAXTX_FEE=10000000

SCNODE_LOG_FILE_LEVEL=info
SCNODE_LOG_FILE_LEVEL=off
SCNODE_LOG_CONSOLE_LEVEL=info
Loading

0 comments on commit 38643a8

Please sign in to comment.