Skip to content

Commit

Permalink
Merge pull request #14 from zenodeapp/tgenesis-v1.0.0
Browse files Browse the repository at this point in the history
tgenesis v1.0.0
  • Loading branch information
alpha-omega-labs authored Feb 1, 2024
2 parents 59d62ae + a3d5c35 commit 3cb4491
Show file tree
Hide file tree
Showing 93 changed files with 3,222 additions and 1,016 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
- uses: actions/upload-artifact@v3
with:
name: "cronosd-tarball-${{ matrix.os }}"
name: "tgenesisd-tarball-${{ matrix.os }}"
path: "*.tar.gz"
if-no-files-found: ignore

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: '^1.20.0'
go-version: "^1.20.0"
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
Expand All @@ -48,7 +48,7 @@ jobs:
BUILD_TAGS=rocksdb,grocksdb_clean_link
echo "go build"
go build -tags $BUILD_TAGS ./cmd/cronosd
go build -tags $BUILD_TAGS ./cmd/tgenesisd
echo "golangci-lint ."
golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 10m --build-tags $BUILD_TAGS
# Check only if there are differences in the source code
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
integration_tests:
runs-on: ubuntu-latest
timeout-minutes: 240
strategy:
matrix:
tests: [unmarked, ibc, ibc_timeout, ibc_update_client, upgrade, slow]
env:
TESTS_TO_RUN: ${{ matrix.tests }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ go.work.sum

# yaml for test
integration_tests/configs/*.yaml

# Utils
setup-local/_local-variables.sh
utils/tools/quick-shift.sh
utils/tools/shift-wizard.sh
utils/tools/_restate-sync.sh
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

*Jan 05, 2024*

## v1.0.15

- [#1265](https://github.com/crypto-org-chain/cronos/pull/1265) Fix nil pointer panic when filter timeout
- [#1270](https://github.com/crypto-org-chain/cronos/pull/1270) Avoid out of bound panic from error message

*Dec 15, 2023*

## v1.0.14

- [#1259](https://github.com/crypto-org-chain/cronos/pull/1259) Use a hard-fork style upgrade to adjust feemarket parameters.

*Nov 20, 2023*

## v1.0.13

- [#1197](https://github.com/crypto-org-chain/cronos/pull/1197) tune rocksdb options to control memory consumption.
- [#1207](https://github.com/crypto-org-chain/cronos/pull/1207) Update rocksdb to `v8.6.7`.
- [#1240](https://github.com/crypto-org-chain/cronos/pull/1240) Revert rocksdb upgrade.
- [#1239](https://github.com/crypto-org-chain/cronos/pull/1239) Refactor websocket/subscription system to improve performance and stability.
- [#1246](https://github.com/crypto-org-chain/cronos/pull/1246) Update memiavl deps to include bug fixes and state sync restore performance improvement.

*Aug 11, 2023*

## v1.0.12
Expand Down
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ COVERAGE ?= coverage.txt

GOPATH ?= $(shell $(GO) env GOPATH)
BINDIR ?= ~/go/bin
BINARY_NAME = genesisd
NETWORK ?= mainnet
BINARY_NAME = tgenesisd
NETWORK ?= testnet
LEDGER_ENABLED ?= true
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)

Expand Down Expand Up @@ -78,7 +78,7 @@ comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags
ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=cronos \
ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=tgenesis \
-X github.com/cosmos/cosmos-sdk/version.AppName=$(BINARY_NAME) \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
Expand All @@ -92,12 +92,10 @@ endif

all: build
build: check-network print-ledger go.sum
@go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/$(BINARY_NAME) ./cmd/cronosd
@go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/$(BINARY_NAME) ./cmd/$(BINARY_NAME)

install: check-network print-ledger go.sum
@go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/$(BINARY_NAME) ./cmd/cronosd
@mkdir -p $(BINDIR)
@mv $(BUILDDIR)/$(BINARY_NAME) $(BINDIR)/$(BINARY_NAME)
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/$(BINARY_NAME)

test:
@go test -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic
Expand Down Expand Up @@ -219,6 +217,12 @@ test-sim-profile:
### Integration Test ###
###############################################################################

# possible values:
# - all: run all integration tests
# - unmarked: run integration tests that are not marked
# - marker1,marker2: markers separated by comma, run integration tests that are marked with any of the markers
TESTS_TO_RUN ?= all

run-integration-tests:
@nix-shell ./integration_tests/shell.nix --run ./scripts/run-integration-tests

Expand Down
136 changes: 91 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,137 @@
# GenesisL1 blockchain
<h1 align="center">
GenesisL1 Testnet (Cronos fork)
</h1>

<p align="center">
<img src="https://github.com/zenodeapp/genesisL1/assets/108588903/be368fa2-a154-48a6-b04b-8eb452b02033" alt="GenesisL1" width="150" height="150"/>
<ins>Release <b>v1.0.0</b> ~ Cronos <b>v1.0.15</b></ins>
</p>

<p align="center">
Cosmos SDK v0.46.15
<img src="https://raw.githubusercontent.com/alpha-omega-labs/genesis-parameters/main/assets/l1-logo.png" alt="GenesisL1" width="150" height="150"/>
</p>

<p align="center">
<i>Source code fork of cronos and ethermint.</i>
Chain ID <b>tgenesis_290-1</b>
</p>

<p align="center">
A source code fork of <b>Cronos</b> and <b>Ethermint</b>
</p>

<p align="center">
Cosmos SDK <b>v0.46.15</b>
</p>

---

> [!IMPORTANT]
> **For full-node syncing**
>
> We were an Evmos-fork before we made the decision to hard fork to Cronos. Therefore if you do not want to **state sync**, but wish to sync a **full node**, follow the instructions in the [`genesis-ethermint`](https://github.com/alpha-omega-labs/genesis-ethermint) repository first before continuing.
## Node requirements

- 300GB+ good hard drive disk
- 8GB+ RAM (if necessary it will use at max 150GB from hard drive as swap, see below)
- 8GB+ RAM
- 4 CPU Threads
- Good Internet Connection

## **Script**
## Instructions

The instructions provided here will only be suitable for those who would like to join the **public** testnet: `tgenesis_290-1` by **setting up a new node** _or_ **upgrading an existing (full) node**. If you instead want to _test_ **locally**, see the [README](/setup-local/README.md) in the [/setup-local](/setup-local)-folder.

### Overview
> [!NOTE]
> More details for every script mentioned in this README can be found in the folders where they are respectively stored: [/setup](/setup), [/setup-local](/setup-local) or [/utils](/utils).
`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.
### 1. Cloning the repository

```
Usage: genesisd.sh <command> [moniker]
<command> should be either 'upgrade' or 'init'
git clone https://github.com/alpha-omega-labs/genesis-crypto.git
```

### 2. Checkout the right tag/branch

Options:
--crisis-skip Makes sure that genesisd starts with the --x-crisis-skip-assert-invariants flag (default: false)
--skip-state-download Skips downloading the genesis.json file, only do this if you're certain to have the correct state file already (default: false)
--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)
```
git checkout v1.0.0-t
```

### Usage
### 3. Node setup

- **Initialization (new validators; generates a new key)**
Depending on your circumstances, you'll either have to **Setup a node _(using state sync)_** or **Upgrade a node**.

`sh genesisd.sh init $YOUR_NEW_NODE_NAME`
#### 3.1 Setup a node _(using state sync)_

- **Upgrading (existing validators; you already have an existing .genesisd folder and configuration)**
This script takes care of the needed steps to join the network via _state sync_.

`sh genesisd.sh upgrade`
> [!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/backup/create.sh](/utils/backup/create.sh) for this.
_--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>
```
sh setup/state-sync.sh <moniker>
```

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

---
This script assumes that you are currently operating on the Evmos fork of GenesisL1 (repo: [`genesis-ethermint`](https://github.com/alpha-omega-labs/genesis-ethermint)) and the node synced till height: `insert_height_here` which caused it to panic.

### Information
> [!IMPORTANT]
> This should only be used if you run a **full-node** and have to perform the **"plan_crypto"**-upgrade.
#### Swap
```
sh setup/upgrade.sh
```

### 4. Daemon check

If you can't access the `tgenesisd` command at this point, then you may need to execute:

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.
```
. ~/.bashrc
```
> Or the equivalent: `source ~/.bashrc`
### 5. Create or import a key (optional)

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/key/create.sh <key_alias>
```

#### Backups
OR

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.
```
sh utils/key/import.sh <key_alias> <private_eth_key>
```

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.
> _<private_eth_key>_ is the private key for a (wallet) address you already own.
## **Other (bonus) scripts**
### 6. Node syncing

There are some extra scripts in the `genesisd_scripts` folder, which could be useful later down the line.
If everything went well, you should now be able to run your node using:

### Swap scripts
```
systemctl start tgenesisd
```

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.
and see its status with:

- **Adding swap** `sh swap_add.sh <amount_of_swap_in_gb>`
```
journalctl -fu tgenesisd -ocat
```

Example: sh swap_add.sh 50 will create a new genesisd_swapfile that is 50GB in size in '/'.
### 7. Become a validator (optional)

- **Removing swap** `sh swap_remove.sh <filename>`
Once your node is _up-and-running_, _fully synced_ and you have a _key_ created or imported, you could become a validator using:

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.
```
sh setup/create-validator.sh <moniker> <key_alias>
```
> This is a wizard and shall prompt the user only the required fields to create an on-chain validator.
- **Removing all swaps** `sh swap_remove_all.sh`
### 8. Explore utilities (optional)

This will turn off all genesis swapfiles, removes all related lines in '/etc/fstab' and deletes all /genesisd_swapfiles
> [!TIP]
> The [/utils](/utils)-folder contains useful utilities one could use to manage their node (e.g. for fetching latest seeds and peers, fetching the genesis state, quickly shifting your config's ports, recalibrating your state sync etc.). To learn more about these, see the [README](utils/README.md) in the folder.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ import (
)

const (
Name = "genesis"
Name = "tgenesis"

// AddrLen is the allowed length (in bytes) for an address.
//
Expand Down Expand Up @@ -211,7 +211,7 @@ func init() {
panic(err)
}

DefaultNodeHome = filepath.Join(userHomeDir, "."+Name+"d")
DefaultNodeHome = filepath.Join(userHomeDir, "."+Name)
sdk.DefaultPowerReduction = sdk.NewIntFromUint64(1000000000000000000)
}

Expand Down
2 changes: 1 addition & 1 deletion app/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
cmdcfg "github.com/crypto-org-chain/cronos/cmd/cronosd/config"
cmdcfg "github.com/crypto-org-chain/cronos/cmd/tgenesisd/config"
ethcfg "github.com/evmos/ethermint/cmd/config"
)

Expand Down
Loading

0 comments on commit 3cb4491

Please sign in to comment.