Skip to content

Commit

Permalink
Merge pull request #10 from zenodeapp/release.46.15
Browse files Browse the repository at this point in the history
Updated README.md and added UPGRADE_29-2_CRONOS.md
  • Loading branch information
alpha-omega-labs authored Sep 16, 2023
2 parents d1585d7 + 00d9f95 commit 59d62ae
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 19 deletions.
94 changes: 76 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<h1>GenesisL1 blockchain</h1>
Cosmos SDK sdk v0.46.15</br>
<i>Source code fork of cronos and ethermint</i>
# GenesisL1 blockchain

<strong>Node requirements:</strong>
<p align="center">
<img src="https://github.com/zenodeapp/genesisL1/assets/108588903/be368fa2-a154-48a6-b04b-8eb452b02033" alt="GenesisL1" width="150" height="150"/>
</p>

<li>300GB+ good hard drive disk</li>
<li>8GB+ RAM (if necessary it will be swapped to 150GB from hard drive)</li>
<li>4 CPU Threads</li>
<li>Good Internet Connection</li>
<p align="center">
Cosmos SDK v0.46.15
</p>

<strong>Node init/upgrade time is 30-60min or a few tea cups</strong>
<p align="center">
<i>Source code fork of cronos and ethermint.</i>
</p>

<li><i>Initialization (which will generate a new key):</i></br>
<code>sh genesisd.sh init $YOUR_NEW_NODE_NAME</code></li>
## Node requirements

<li><i>Upgrading (for if you already have an existing .genesisd folder and configuration):</i></br>
<code>sh genesisd.sh upgrade</code></li>
- 300GB+ good hard drive disk
- 8GB+ RAM (if necessary it will use at max 150GB from hard drive as swap, see below)
- 4 CPU Threads
- Good Internet Connection

<li><i>Upgrading (for if you already have an existing .genesisd folder and configuration, but want a different node name):</i></br>
<code>sh genesisd.sh upgrade $YOUR_NEW_NODE_NAME</code></li>
Other options:
<code>
## **Script**

### Overview

`genesisd.sh` is available in the root folder of the repository. Running `sh genesisd.sh` gives an overview of what the script is capable of.

```
Usage: genesisd.sh <command> [moniker]
<command> should be either 'upgrade' or 'init'
Expand All @@ -30,4 +35,57 @@ Usage: genesisd.sh <command> [moniker]
--reset-priv-val-state Resets data/priv_validator_state.json file [UNSAFE] (default: false)
--no-service This prevents the genesisd service from being made (default: false)
--no-start This prevents the genesisd service from starting at the end of the script (default: false)
</code>
```

### Usage

- **Initialization (new validators; generates a new key)**

`sh genesisd.sh init $YOUR_NEW_NODE_NAME`

- **Upgrading (existing validators; you already have an existing .genesisd folder and configuration)**

`sh genesisd.sh upgrade`

_--if you want a different node name you could use `sh genesisd.sh upgrade $YOUR_NEW_NODE_NAME`_

_--more detailed guides for specific upgrades could be found in the [\/genesisd_docs](genesisd_docs/)-folder_
<br>

<p align="center">
☕ <i>node init/upgrade time is 30-60min or a few tea cups...</i>
</p>

---

### Information

#### Swap

Initializing a node uses quite a bit of memory. The script therefore automatically creates virtual memory (swap) to compensate for the amount it requires to start the node. Currently the script is set to automatically calculate how much RAM + Swap is available. Then, whether the user has enough disk space, creates additional swap to have a total of 150GB available RAM + Swap (Example: if 32GB RAM is unused and 30GB of swap is free, an additional swap of 88GB will be created). These swapfiles are formatted as `genesisd_swapfile_{number}` and are made persistent across reboots by adding a line to the `etc/fstab` file. See the bonus scripts for more info on how to properly add or remove them.

#### Backups

If a `.genesisd` folder already exists, the script will back this up to a folder formatted as `.genesisd_backup_{date_time}`. This is a unique name based on the system's current time. Therefore running the script multiple times will continue to create new backup folders.

Since our state file is large this would mean that it will be around ~14GB every time a backup is made. Make sure to remove older backup folders if you plan on running the script more often (testing purposes for instance). They're hidden folders in the root folder; use `cd ~` then `ls -a` to see them.

## **Other (bonus) scripts**

There are some extra scripts in the `genesisd_scripts` folder, which could be useful later down the line.

### Swap scripts

Since the node requires quite some memory usage, swapfiles are created when you run the genesisd.sh script. To alter these swap files we've included scripts to quickly add or remove genesisd_swapfiles.

- **Adding swap** `sh swap_add.sh <amount_of_swap_in_gb>`

Example: sh swap_add.sh 50 will create a new genesisd_swapfile that is 50GB in size in '/'.

- **Removing swap** `sh swap_remove.sh <filename>`

Example: sh swap_remove.sh /genesisd_swapfile_2 turns off swapfile genesisd_swapfile_2, removes the related line in '/etc/fstab' and deletes /genesisd_swapfile_2.

- **Removing all swaps** `sh swap_remove_all.sh`

This will turn off all genesis swapfiles, removes all related lines in '/etc/fstab' and deletes all /genesisd_swapfiles
2 changes: 1 addition & 1 deletion genesisd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ if [ "$1" = "init" ]; then
sleep 120s
fi

genesisd init $moniker --chain-id genesis_29-2
genesisd init $moniker --chain-id genesis_29-2
fi

#IMPORTING GENESIS STATE
Expand Down
102 changes: 102 additions & 0 deletions genesisd_docs/UPGRADE_29-2_CRONOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Chain upgrade: genesis_29-2 (Cronos)

This readme is a guide on how to upgrade your node from genesis_29-2 (evmos) to genesis_29-2 (cronos) and what you should be paying attention to.

**IMPORTANT:** Make sure you backup your keys before running the `genesisd.sh` script. Even if it is configured to make a backup of everything, manually doing one yourself is always wise in case anything goes wrong.

Also, for those who come from genesis_29-2 (evmos), do note that this is a different repository than we used before. The old one was named `genesisd`, this one `genesisL1`. Thus don't skip the first steps if you haven't already git cloned the new repository.

---

### <p align="center">1. I am new, I am not a validator yet, but would like to join 🎉</p>

#### Oneliner:

Make sure to replace <NODE_NAME> in the oneliner below with a name of your choice.

```
cd ~ && git clone https://github.com/alpha-omega-labs/genesisL1.git && cd genesisL1 && sh genesisd.sh init <NODE_NAME> --reset-priv-val-state
```

#### Or, step-by-step:

1. `cd ~`
2. `git clone https://github.com/alpha-omega-labs/genesisL1.git`
3. `cd genesisL1`
4. `sh genesisd.sh init <NODE_NAME> --reset-priv-val-state`

_replace <NODE_NAME> with a name of your choice_

_the --reset-priv-val-state flag is an extra pre-caution to prevent old values to be used in your new node (if you already had a .genesisd folder)._

---

### <p align="center">2. I am a validator and I NEVER upgraded to the 'cronos' version of GenesisL1 🥱</p>

This means that you still use the `genesisd` repository and not the `genesisL1` repository. If this is the case, then:

#### Oneliner:

```
cd ~ && git clone https://github.com/alpha-omega-labs/genesisL1.git && cd genesisL1 && sh genesisd.sh upgrade --reset-priv-val-state
```

#### Or, step-by-step:

1. `cd ~`
2. `git clone https://github.com/alpha-omega-labs/genesisL1.git`
3. `cd genesisL1`
4. `sh genesisd.sh upgrade --reset-priv-val-state`

_in case you want to change your node's name, you could also run sh genesisd.sh upgrade <NODE_NAME> --reset-priv-val-state and replace <NODE_NAME> with a name of your choice._

---

### <p align="center">3. I am a validator and I HAVE upgraded to the 'cronos' version of GenesisL1 😎</p>

#### Oneliner:

```
cd ~ && rm -r genesisL1 && git clone https://github.com/alpha-omega-labs/genesisL1.git && cd genesisL1 && sh genesisd.sh upgrade --skip-state-download
```

#### Or, step-by-step:

1. `cd ~`
2. `rm -r genesisL1`
3. `git clone https://github.com/alpha-omega-labs/genesisL1.git`
4. `cd genesisL1`
5. `sh genesisd.sh upgrade --skip-state-download`

_in case you want to change your node's name, you could also run sh genesisd.sh upgrade <NODE_NAME> --skip-state-download and replace <NODE_NAME> with a name of your choice._

_--skip-state-download is not necessary but, as you already upgraded, you probably already have the 14GB genesis.json state file thus speeding up the process._

---

### <p align="center">4. I am a validator and I HAVE upgraded to the 'cronos' version of GenesisL1, but prefer to upgrade manually 🤓</p>

For advanced users only. You know who you are. Take note of what exactly happens in the oneliner or step-by-step guide. Important to know is that the `priv_validator_state.json` shouldn't date back to when we were at 29-2 (evmos), else you will not be able to participate properly in the consensus. Your `priv_validator_state.json`-file would then point to a block height that's, at the time of writing, in the future (probably to 6751398 or 6751399). If you're one of these people then you should skip the backup and restore of the `priv_validator_state.json`-file in the commands below.

_The commands below don't take care of this for it's too user-specific, but make sure that your config.toml and app.toml are up-to-date. If you participated in the cronos upgrade and already copied over the config files in the `/genesisd_config/` folder or used the `genesisd.sh` script back then, then you're good, else you should check the folder to see what the config files are supposed to look like. Do not forget to restore your moniker and any other settings you had if you end up using these pre-configured files._

#### Oneliner:

```
cd ~ && rm -r genesisL1 && git clone https://github.com/alpha-omega-labs/genesisL1.git && service genesisd stop && cd genesisL1 && go mod tidy && make install && cd ~/.genesisd && cp ./data/priv_validator_state.json ./priv_validator_state.json && genesisd tendermint unsafe-reset-all && mv ./priv_validator_state.json ./data/priv_validator_state.json && service genesisd start
```

#### Or, step-by-step:

1. `cd ~`
2. `rm -r genesisL1`
3. `git clone https://github.com/alpha-omega-labs/genesisL1.git`
4. `service genesisd stop`
5. `cd genesisL1`
6. `go mod tidy`
7. `make install`
8. `cd ~/.genesisd`
9. `cp ./data/priv_validator_state.json ./priv_validator_state.json`
10. `genesisd tendermint unsafe-reset-all`
12. `mv ./priv_validator_state.json ./data/priv_validator_state.json`
13. `service genesisd start`

0 comments on commit 59d62ae

Please sign in to comment.