From caa97d86f2ac954fe9147a60b096a20aca47c70f Mon Sep 17 00:00:00 2001 From: Joe Clapis Date: Tue, 6 Sep 2022 01:09:30 -0400 Subject: [PATCH] Used Debian bullseye as the base, updated docs --- Dockerfile | 2 +- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- main.go | 2 +- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bfb9bc7..8d246f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rocketpool/smartnode-base +FROM debian:bullseye-slim ARG TARGETARCH COPY ./Releases/treegen-linux-${TARGETARCH} /treegen diff --git a/README.md b/README.md index 2f94d77..293c2d1 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,60 @@ This is a standalone tool for creating the rewards tree and minipool attestation files for rewards intervals on the Rocket Pool network. It can recreate trees for past rewards intervals, or it can "simulate" the tree for the current interval ending at the latest finalized block (for testing purposes). +It uses the same codebase as the Smartnode, so you can be assured that `treegen` will generate the same trees as the Smartnode stack. + + +## Running Treegen + +There are currently three ways to run `treegen`: + +1. Run the precompiled binaries locally (Linux only, using `glibc`) +2. Run the Docker image (Linux, Windows, and macOS) +3. Build from source and run locally + + +### Running the Binary Locally + +Run the binary as follows: + +``` +$ ./treegen-linux-amd64 [options] +``` + +Options: + +``` + --bn-endpoint value, -b value The URL of the Beacon Node's REST API. Note that for past interval generation, this must have Archive capability (ability to replay arbitrary historical states). (default: "http://localhost:5052") + --ec-endpoint value, -e value The URL of the Execution Client's JSON-RPC API. Note that for past interval generation, this must be an Archive EC. (default: "http://localhost:8545") + --interval value, -i value The rewards interval to generate the artifacts for. A value of -1 indicates that you want to do a "dry run" of generating the tree for the current (active) interval, using the current latest finalized block as the interval end. (default: -1) + --output-dir value, -o value Optional output directory to save generated files (default is the current working directory). + --pretty-print, -p Toggle for saving the files in pretty-print format so they're human readable. (default: true) +``` + + +### Running via the Docker Image + +`treegen` is also available in a Docker image for users not on Linux systems, or on systems incompatible with the precompiled binaries. +To run it, use the following command: + +``` +$ ./treegen.sh -e -b [options] +``` + +Options: + +``` + --bn-endpoint value, -b value The URL of the Beacon Node's REST API. Note that for past interval generation, this must have Archive capability (ability to replay arbitrary historical states). (default: "http://localhost:5052") + --ec-endpoint value, -e value The URL of the Execution Client's JSON-RPC API. Note that for past interval generation, this must be an Archive EC. (default: "http://localhost:8545") + --interval value, -i value The rewards interval to generate the artifacts for. A value of -1 indicates that you want to do a "dry run" of generating the tree for the current (active) interval, using the current latest finalized block as the interval end. (default: -1) + --pretty-print, -p Toggle for saving the files in pretty-print format so they're human readable. (default: true) +``` + +NOTE: Do *not* use the `-o` flag if you are using this script, as it is already built into the script. +Output files will be stored in the `out` directory. ## Building -To build it, simply enter this folder and run `go build`. -You will need to have Go v1.19 set up already. +To build the binary locally, simply enter this folder and run `go build`. +You will need to have Go v1.19 or higher set up already. diff --git a/main.go b/main.go index 935f7cf..527095a 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( ) const ( - version string = "0.1.0" + version string = "1.0.0" colorReset string = "\033[0m" colorRed string = "\033[31m" )