Skip to content

Commit

Permalink
Merge pull request #56 from NethermindEth/merge-develop
Browse files Browse the repository at this point in the history
Merge develop into main for 0.1 release
  • Loading branch information
AntiD2ta authored Jul 13, 2022
2 parents 31c94d2 + d68cffe commit 132d0d1
Show file tree
Hide file tree
Showing 232 changed files with 9,441 additions and 2,320 deletions.
12 changes: 0 additions & 12 deletions .deepsource.toml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: 1click CI
name: sedge CI

on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ]
branches: [ main, develop ]

jobs:
build:
name: Build 1click
name: Build sedge
runs-on: ubuntu-latest

steps:
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17.3'
go-version: '1.18.2'

- name: Check Go fmt
run: make gofmt
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: sedge unit tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:

jobs:
unit_tests:
name: Run unit tests
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.18.2"]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Install deps
run: make install-deps

- name: Run tests
run: make codecov-test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
files: ./coverage/coverage.out
flags: unittests
name: codecov-umbrella
verbose: true
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ vendor

.idea/

docker-compose-scripts/
/docker-compose-scripts/

coverage/*

.vscode/

.DS_Store

build/sedge
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files.eol": "\n"
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Contributing to 1click
# Contributing to sedge

The Nethermind team maintains guidelines for contributing to the Nethermind repos. Check out our [docs page](https://docs.nethermind.io/nethermind/) for more info about us.

### Code of Conduct

Have you read the [code of conduct](https://github.com/NethermindEth/1click/blob/main/CODE_OF_CONDUCT.md)?
Have you read the [code of conduct](https://github.com/NethermindEth/sedge/blob/main/CODE_OF_CONDUCT.md)?

## Bugs and Feature Request

Before you make your changes, check to see if an [issue](https://github.com/NethermindEth/1click/issues) exists already for the change you want to make.
Before you make your changes, check to see if an [issue](https://github.com/NethermindEth/sedge/issues) exists already for the change you want to make.

### Don't see your issue? Open one

If you spot something new, open an issue using a [template](https://github.com/NethermindEth/1click/issues/new/choose). We'll use the issue to have a conversation about the problem you want to fix.
If you spot something new, open an issue using a [template](https://github.com/NethermindEth/sedge/issues/new/choose). We'll use the issue to have a conversation about the problem you want to fix.

### Open a Pull Request

Expand Down
37 changes: 29 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
.DEFAULT_GOAL := help
.PHONY: compile run run-cli test coverage clients logs all gomod_tidy go_fmt help

compile: ## compile:
@mkdir -p build
@go build -o build/1click cmd/1click/main.go
@go build -o build/sedge cmd/main.go

compile-linux: ## compile:
@mkdir -p build
@env GOOS=linux go build -o build/sedge cmd/main.go

run: ## run
@./build/1click
@./build/sedge

run-cli: compile ## run cli
@./build/sedge cli --config ./config.yaml

test: ## run tests
@mkdir -p coverage
@go test -coverprofile=coverage/coverage.out -covermode=count ./...

codecov-test: ## unit tests with coverage using the courtney tool
@mkdir -p coverage
@courtney/courtney -v -o coverage/coverage.out ./...

install-deps: ## Install some project dependencies
@git clone https://github.com/stdevMac/courtney
@(cd courtney && go get ./... && go build courtney.go)
@go get ./...

run-cli: compile ## run randomized cli
@./build/1click cli -r --config ./config.yaml
coverage: coverage/coverage.out ## show tests coverage
@go tool cover -html=coverage/coverage.out -o coverage/coverage.html

clients: compile ## Run cmd clients with ./config.yaml
@./build/1click clients --config ./config.yaml
@./build/sedge clients --config ./config.yaml

logs: compile ## run cmd logs with ./config.yaml
@./build/1click logs --config ./config.yaml
@./build/sedge logs --config ./config.yaml

all: compile run ## build and run

gomod_tidy:
gomod_tidy: ## go mod tidy
go mod tidy

gofmt:
gofmt: ## go fmt
go fmt -x ./...

help: ## Show this help
Expand Down
114 changes: 58 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# 1click
[![Go Report Card](https://goreportcard.com/badge/github.com/NethermindEth/1click)](https://goreportcard.com/report/github.com/NethermindEth/1click)
# Sedge
[![Go Report Card](https://goreportcard.com/badge/github.com/NethermindEth/sedge)](https://goreportcard.com/report/github.com/NethermindEth/sedge)

A one click setup tool for PoS network/chain validators. Currently, `1click` is designed mainly for solo stakers and testnets devs of Beacon Chain and The Merge (Ethereum). `1click` generates docker-compose scripts for the entire on-premise validator setup depending on the chosen client.
A one click setup tool for PoS network/chain validators. Currently, `sedge` is designed primarily for solo stakers and testnet devs of the Beacon Chain and the Merge (Ethereum). `sedge` generates docker-compose scripts for the entire on-premise validator setup based on the chosen client.

## 💥 How this all started?

As people who actively work on The Merge, we know how hard it is to set up an Ethereum validator:
- The setup requires at least three nodes: an execution node (geth, nethermind, etc), a consensus node, and a validator node (lighthouse, prysm, etc)
- You then need to execute them, connect them, monitor them, and get the validator keys (which includes staking 32 ETH).
- There are several valid combinations of clients to choose for the setup. You need to go through the client's docs, evaluate the client, get instructions for it and test it. You also need to feel comfortable executing commands in the cli, know docker, and basic networking. On top of this, there are many different configurations you can use for your client node.
- In the case of working with Mainnet, you are working with real money that can potentially be lost in the event of having downtime or being slashed. To avoid losing real value, you must be aware of and follow best practices on the validator setup, and also monitor your nodes.
- Have you heard of MEV? Flashbots is working on an MEV-Boost component which will take your validator to another level of awesomeness. You most likely want to always be running the latest version, but you also most likely don’t have the time to understand MEV Boost architecture and how to successfully implement it into your environment.
- You need to procure at least three (compatible) nodes: an execution node (geth, nethermind, etc), a consensus node, and a validator node (lighthouse, prysm, etc)
- You then need to execute them, connect them, monitor them, and secure the validator keys (which includes staking 32 ETH).
- There may be several valid combinations of clients to choose for your setup, so you need to go through each of the client's docs, evaluate it, get instructions for it and test it. You also need to feel comfortable executing commands in the cli, know docker, and understand basics of networking. On top of this, there are many different settings you must read up on and consider for your client node.
- In the case of working with the Ethereum Mainnet, you are working with real money that can potentially be lost in the event of having downtime or being slashed. To avoid losing real value, you must be aware of and follow best practices on the validator setup, and correctly monitor your nodes.
- Have you heard of MEV? Flashbots is working on an MEV-Boost component which will take your validator to another level of awesomeness. You most likely want to always be running the latest version, but you also most likely don’t have the time to understand the MEV-Boost architecture in and out, or how to successfully implement it into your environment.

> Enter 1click
> Enter sedge
We want `1click `to take care of all of this for you. With just a few clicks or steps, `1click` can create an entire staking architecture that supports client diversity and Ethereum's latest features, while being completely free and open source. We want `1click` to save you from mistakes in this complex setup; along with hours or days of research, reading and testing. We want you to be able to stake easily with or without blockchain knowledge by giving you the tools to help this amazing community (and earn some good money of course 😉).
We want `sedge` to take care of all of the above for you. With just a few clicks or steps, `sedge` can create an entire ethereum staking architecture that supports client diversity and Ethereum's latest features, while being completely free and open source. We want `sedge` to save you from making costly mistakes in this complex setup; along with hours or days of research, reading and testing. We want you to be able to stake easily with or without blockchain knowledge by giving you the tools to help this amazing community (and earn some good money of course 😉).

We want to share our knowledge in this topic and create something that allows everyone to easily and safely set up lots of validators.
We want to share our knowledge in this topic and create something that allows everyone to easily and safely set up lots of diverse validators.

We don't want to stop at Ethereum. We also want to help stakers of other PoS networks/chains, so if your favourite chain is not here, you are more than welcome to contribute!

Expand All @@ -26,71 +26,61 @@ We don't want to stop at Ethereum. We also want to help stakers of other PoS net

#### Using Go

If you have at least `go1.18.0` installed then this command will install the `1click` executable along with the library and its dependencies:
If you have at least `go1.18.2` installed then this command will install the `sedge` executable along with the library and its dependencies in your system:

```
go install github.com/NethermindEth/1click/cmd/1click@latest
go install github.com/NethermindEth/sedge/cmd/sedge@latest
```

The executable will be in `$GOBIN` (`$GOPATH/bin`)
The executable will be in your `$GOBIN` (`$GOPATH/bin`)

#### Manual

Generate the executable manually (need Go installed):

```
git clone https://github.com/NethermindEth/1click.git
cd 1click
go build -o 1click cmd/1click/main.go
git clone https://github.com/NethermindEth/sedge.git
cd sedge
go build -o sedge cmd/sedge/main.go
```

or if you have `make` installed:

```
git clone https://github.com/NethermindEth/1click.git
cd 1click
git clone https://github.com/NethermindEth/sedge.git
cd sedge
make compile
```

The executable will be in the `1click/build` folder
The executable will be in the `sedge/build` folder

---
In case you want the binary in PATH (in case you don't have `$GOBIN` either in PATH), copy it to `/usr/local/bin`:
In case you want the binary in your main PATH (or you don't have `$GOBIN` in your PATH), please copy the executable to `/usr/local/bin`:

```
# Using go
sudo $GOPATH/bin/1click /usr/local/bin/
# Manual
sudo cp 1click/build/1click /usr/local/bin/
```

#### Download the binary (only for linux)

> This is temporary until the first release
Download directly the binary and put it in `/usr/local/bin`:

```
sudo curl -LJ -o /usr/local/bin/1click https://github.com/NethermindEth/1click/raw/main/build/1click
sudo chmod +x /usr/local/bin/1click
sudo $GOPATH/bin/sedge /usr/local/bin/
# Manually
sudo cp sedge/build/sedge /usr/local/bin/
```

### Dependencies
`1click` dependencies are `docker` and `docker-compose`, but if you don't have those installed, `1click` will show instructions to install them, or install them for you.
`sedge` dependencies are `docker` with `docker compose` plugin, but if you don't have those installed, `sedge` will show instructions to install them, or install them for you.

### Quick run
With `1click cli` you can go through the entire workflow setup:
With `sedge cli` you can go through the entire workflow setup:
1. Check dependencies
2. Generate a `docker-compose` script with randomized clients selection and `.env`
3. Execute the `docker-compose` script (only execution and consensus nodes will be executed by default)
2. Generate jwtsecret (not for mainnet and prater)
3. Generate a `docker-compose` script with randomized clients selection and `.env`
4. Execute the `docker-compose` script (only execution and consensus nodes will be executed by default)

## 🔥 What can you do right now with this tool?
## 🔥 What can you do with sedge today?

- Select an execution, consensus and validator node (manually or automatically) and generate a `docker-compose` script with production tested configurations to run the setup as you want.
- Generate the keystore folder using the [staking-deposit-cli](https://github.com/ethereum/staking-deposit-cli) tool with `1click keys`
- Don't remember `docker-compose` commands or flags? No problem, you can check the logs of the running services of the generated `docker-compose` script with `1click logs` and shutdown the services with `1click down`
- Select an execution, consensus and validator node (manually or automatically) and generate a `docker-compose` script with production-tested configurations to run the setup you want.
- Generate the keystore folder using the [staking-deposit-cli](https://github.com/ethereum/staking-deposit-cli) tool with `sedge keys`
- Don't remember `docker-compose` commands or flags for your setup? Check docker logs of the running services with `sedge logs`, and shut them down with `sedge down`

> The setup is currently designed to start all the three nodes required to start a validator (execution, consensus and validator node). This will change soon and `1click` will let you connect to a public or remote node, or to automatically start the validator node when the execution and consensus nodes in the setup are synced. Although you can do all of this after generating the docker-compose script 😉
> The setup is currently designed to start all three nodes required to run a validator (execution, consensus and validator node). Soon `sedge` will let you directly connect to a public or remote node. The execution and consensus nodes will be executed first, and the validator node will be executed automatically after those nodes are synced, giving you time to prepare the keystore file and make the deposit for your staked ether.
## Supported networks and clients

Expand All @@ -103,34 +93,46 @@ With `1click cli` you can go through the entire workflow setup:
| | Prysm | Prysm |
| | Teku | Teku |

### Kiln

| Execution | Consensus | Validator |
| ---------- | ---------- | ---------- |
| Geth | Lighthouse | Lighthouse |
| Nethermind | Lodestar | Lodestar |
| | Prysm | Prysm |
| | Teku | Teku |

## ✅ Roadmap
The following roadmap covers the main features and ideas we want to implement but doesn't cover everything we are planning for this tool. Stay touched if you are interested, a lot of improvements are to come in the next two months.
The following roadmap covers the main features and ideas we want to implement but doesn't cover everything we are planning for this tool. Stay in touch if you are interested, a lot of improvements are coming in the next two months.

### Version 0.1 (coming soon in May-June 2022)
### Version 0.1 (coming June-July 2022)
- [x] Generate `docker-compose` scripts and `.env` files for selected clients with a cli tool
- [x] Generate keystore folder with the cli
- [ ] Test coverage (unit and integration tests)
- [ ] Monitoring tool for alerting, tracking validator balance, and tracking sync progress and status of nodes
- [ ] Integrate MEV-Boost as recommended setting
- [ ] Use public execution and consensus nodes
- [x] Test coverage (unit tests)
- [x] Integrate Kiln network
- [ ] Integrate MEV-Boost as an option

### Version 0.X
- [ ] Enable use of public execution and consensus nodes
- [ ] Include monitoring tool for alerting, tracking validator balance, and tracking sync progress and status of nodes
- [ ] TUI for guided and more interactive setup (better UX)
- [ ] Integrate Kiln network
- [ ] Integrate Ropsten network
- [ ] Integrate Sepolia network
- [ ] Integrate Prater network
- [ ] Off-premise setup support
- [ ] Improve documentation
- [ ] Cross platform support
- [ ] Cross platform support and documentation
- [ ] Documentation with examples
- [ ] More tests!!!
- [ ] Integrate other PoS networks

### Version 1.0
Full Ethereum 2 support with MEV-Boost

## 💪 Want to contribute?
Please check our Contributing Guidelines, Code of Conduct and our issues. In case you want to report or suggest something (any help welcomed) please file an issue first and the main team will reach you and discuss it.
Please check our Contributing Guidelines, Code of Conduct and our issues. In case you want to report or suggest something (any help is welcome) please file an issue first so the main team is aware and it can be discussed.

You may know a trick or two already for the validator setup, so if this is the case then please help us to add it to `1click` and help the community grow.
If you know of any good tricks for validator setup that other people could make good use of as well, please consider adding it to `sedge`. Your efforts will be greatly appreciated by the community.

## ⚠️ License

`1click` is a Nethermind free and open-source software licensed under the [Apache 2.0 License](https://github.com/NethermindEth/1click/blob/main/LICENSE).
`sedge` is a Nethermind free and open-source software licensed under the [Apache 2.0 License](https://github.com/NethermindEth/sedge/blob/main/LICENSE).
Binary file removed build/1click
Binary file not shown.
Loading

0 comments on commit 132d0d1

Please sign in to comment.