Skip to content

Commit

Permalink
Merge pull request #17 from zenodeapp/genesis-v1.0.0
Browse files Browse the repository at this point in the history
Genesis v1.0.0
  • Loading branch information
zenodeapp authored Jan 17, 2024
2 parents d833905 + 8f44cc2 commit 9070943
Show file tree
Hide file tree
Showing 33 changed files with 695 additions and 158 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ go.work.sum
integration_tests/configs/*.yaml

# Utils
utils/quick-shift.sh
utils/shift-wizard.sh
utils/restate-sync.sh
utils/tools/quick-shift.sh
utils/tools/shift-wizard.sh
utils/tools/_restate-sync.sh
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This script takes care of the needed steps to join the network via _state sync_.
> [!WARNING]
> Running this will **wipe the entire database** (the _/data_-folder **excluding** the priv_validator_state.json file). Therefore if you already have a node set up and you prefer not to have your GenesisL1 database lost, create a backup.
>
> You could use [utils/create-backup.sh](/utils/create-backup.sh) for this.
> You could use [utils/backup/create.sh](/utils/backup/create.sh) for this.
```
sh setup/state-sync.sh <moniker>
Expand All @@ -88,13 +88,13 @@ sh setup/upgrade.sh
A key is necessary to interact with the network/node. If you haven't already created one, either import one or generate a new one, using:

```
sh utils/create-key.sh <key_alias>
sh utils/key/create.sh <key_alias>
```

OR

```
sh utils/import-key.sh <key_alias> <private_eth_key>
sh utils/key/create.sh <key_alias> <private_eth_key>
```

> _<private_eth_key>_ is the private key for a (wallet) address you already own.
Expand Down
7 changes: 4 additions & 3 deletions setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This script installs all the dependencies (and system configurations) that are n
This script takes care of the needed steps to upgrade the node to the new fork:

- It stops the node (the service)
- Installs all the necessary dependencies
- Creates a backup of existing _config.toml_ or _app.toml_ files (as _.toml.bak_)
- Introduces new config files
- Fetches latest seeds and peers
Expand All @@ -31,7 +32,7 @@ sh setup/upgrade.sh
> [!CAUTION]
> Running this will **wipe the entire database** (the _/data_-folder **excluding** the priv_validator_state.json file).
>
> Make a backup if needed: [utils/create-backup.sh](/utils/create-backup.sh).
> Make a backup if needed: [utils/backup/create.sh](/utils/backup/create.sh).
This script takes care of the needed steps to join the network via State Sync:

Expand All @@ -51,14 +52,14 @@ This script takes care of the needed steps to join the network via State Sync:
```
sh setup/state-sync.sh <moniker>
```
> If you wish to change the default _[height_interval]_ of `2000`, run [utils/recalibrate-state-sync.sh](/utils/recalibrate-state-sync.sh) _[height_interval]_ yourself _after_ having run _setup/state-sync.sh_; see [utils/README.md](/utils) for more information.
> If you wish to change the default _[height_interval]_ of `2000`, run [utils/tools/restate-sync.sh](/utils/tools/restate-sync.sh) _[height_interval]_ yourself _after_ having run _setup/state-sync.sh_; see [utils/README.md](/utils) for more information.
## create-validator.sh

> [!IMPORTANT]
> _create-validator.sh_ requires a key.
>
> If you haven't already created or imported one, use: [utils/create-key.sh](/utils/create-key.sh) _or_ [utils/import-key.sh](/utils/import-key.sh).
> If you haven't already created or imported one, use: [utils/key/create.sh](/utils/key/create.sh) _or_ [utils/key/import.sh](/utils/key/import.sh).
This script should only be run once you're **fully synced**. It's a wizard; prompting the user only the required fields for creating a validator.

Expand Down
12 changes: 6 additions & 6 deletions setup/state-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ echo "So take this into consideration when deciding to state sync or not."
echo ""
echo "WARNING: Any config files will get overwritten and the data folder shall be removed, but there"
echo "will be a backup and restore of the priv_validator_state.json file. If needed, use"
echo "utils/create-backup.sh to create a backup."
echo "utils/backup/create.sh to create a backup."
echo ""
read -p "Do you want to continue? (y/N): " ANSWER

Expand Down Expand Up @@ -79,16 +79,16 @@ cp "./configs/default_config.toml" $CONFIG_DIR/config.toml
sed -i "s/moniker = .*/moniker = \"$MONIKER\"/" $CONFIG_DIR/config.toml

# Fetch latest seeds and peers list from genesis-parameters repo
sh ./utils/fetch-peers.sh
sh ./utils/fetch/peers.sh

# Fetch state file from genesis-parameters repo
sh ./utils/fetch-state.sh
sh ./utils/fetch/state.sh

# Fetch latest rpc_servers from genesis-parameters repo
sh ./utils/fetch-rpcs.sh
sh ./utils/fetch/rpcs.sh

# Install service
sh ./utils/install-service.sh
sh ./utils/service/install.sh

# Recalibrate state sync
sh ./utils/recalibrate-state-sync.sh
sh ./utils/tools/restate-sync.sh
7 changes: 5 additions & 2 deletions setup/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ systemctl stop $BINARY_NAME
# cd to root of the repository
cd $REPO_ROOT

# System update and installation of dependencies
sh ./setup/dependencies.sh

# Create a backup of old config files and moniker
cp $CONFIG_DIR/app.toml $CONFIG_DIR/app.toml.bak
cp $CONFIG_DIR/config.toml $CONFIG_DIR/config.toml.bak
Expand All @@ -55,7 +58,7 @@ cp ./configs/default_config.toml $CONFIG_DIR/config.toml
sed -i "s/moniker = .*/moniker = \"$MONIKER\"/" $CONFIG_DIR/config.toml

# Fetch latest seeds and peers list from genesis-parameters repo
sh ./utils/fetch-peers.sh
sh ./utils/fetch/peers.sh

# Install binaries
go mod tidy
Expand All @@ -68,4 +71,4 @@ make install && {
echo "you ever need to restore some of your previous settings."
echo ""
echo "When ready, turn on your node again using '$BINARY_NAME start' or 'systemctl start $BINARY_NAME'!"
}
}
1 change: 1 addition & 0 deletions utils/.install/.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=main
20 changes: 20 additions & 0 deletions utils/.install/.versionmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.install/updater.sh v1.0.0 r
.install/_variables.sh.example v1.0.1 a
backup/create.sh v1.0.0 u
backup/README.md v1.0.0 d
fetch/peers.sh v1.0.0 u
fetch/rpcs.sh v1.0.0 u
fetch/state.sh v1.0.0 u
fetch/README.md v1.0.1 d
info/my-peer.sh v1.0.0 u
info/README.md v1.0.1 d
key/create.sh v1.0.0 u
key/import.sh v1.0.0 u
key/README.md v1.0.0 d
service/install.sh v1.0.0 u
service/uninstall.sh v1.0.0 u
service/README.md v1.0.1 d
tools/restate-sync.sh v1.0.0 u
tools/port-shifter.sh v1.0.1 u
tools/README.md v1.0.0 d
LICENSE v1.0.0 a
28 changes: 28 additions & 0 deletions utils/.install/_variables.sh.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# This is an example.
# Create a _variables.sh file in the root and add these variables to allow the scripts to work their magic.

# Variables for all modules
CHAIN_ID=genesis_29-2
BINARY_NAME=genesisd
NODE_DIR_NAME=.genesis
NODE_DIR=$HOME/$NODE_DIR_NAME
CONFIG_DIR=$NODE_DIR/config
DATA_DIR=$NODE_DIR/data

# /fetch module variables.
# Adviced is to create a repo containing a genesis.json, seeds.txt, peers.txt and rpc_servers.txt file.
# See: https://github.com/zenodeapp/genesis-parameters/tree/main/genesis_29-2 for an example.
FETCH_URL=https://raw.githubusercontent.com/zenodeapp/genesis-parameters/main/$CHAIN_ID
SEEDS_URL=$FETCH_URL/seeds.txt
PEERS_URL=$FETCH_URL/peers.txt
STATE_URL=$FETCH_URL/genesis.json
RPC_SERVERS_URL=$FETCH_URL/rpc_servers.txt

# /info module variables.
IP_INFO_PROVIDER=ipinfo.io/ip

# /service module variables.
SERVICE_DIR=$(cd "$(dirname "$0")"/../.. && pwd)/services # Where the service file is located, this example points two directories back based on /service/* (e.g. /service/install.sh/../../services).
SERVICE_FILE=$BINARY_NAME.service
Loading

0 comments on commit 9070943

Please sign in to comment.