Skip to content

Commit

Permalink
Create generic prysm package
Browse files Browse the repository at this point in the history
  • Loading branch information
dappnodedev committed Jul 4, 2024
1 parent 9eeb4a2 commit ada4e77
Show file tree
Hide file tree
Showing 29 changed files with 5,224 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dappnode/package-mantainers
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title:
labels:
assignees:
---

<!--NOTE: -->
<!--- General questions should go to the discord chat instead of the issue tracker.-->

**Describe the bug**

<!--A clear and concise description of what the bug is.-->

**To Reproduce**

<!--Steps to reproduce the behavior:
1. Install version X
2. Set this configuration option
3. Do this action
4. See error-->

**Expected behavior**

<!--A clear and concise description of what you expected to happen.-->

**Screenshots**

<!--If applicable, add screenshots to help explain your problem.-->

**DAppNode version:**

<!--Print the DAppNode versions and info found in http://my.dappnode/#/support/report -->

- Package version: <!-- v0.1.14, upstream: prysm-1.0.0-beta -->
- OS: <!-- Ubuntu, Debian, DAppNode Mini, DAppNode Advance -->
- Browser <!-- If applicable: Brave, Firefox, Chrome, Safari -->

**Additional context**

<!--Add any other context about the problem here.-->
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

<!--NOTE: -->
<!--- General questions should go to the discord chat instead of the issue tracker.-->

**Is your feature request related to a problem? Please describe.**

<!--A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]-->

**Describe the solution you'd like**

<!--A clear and concise description of what you want to happen.-->

**Describe alternatives you've considered**

<!--A clear and concise description of any alternative solutions or features you've considered.-->

**Additional context**

<!--Add any other context or screenshots about the feature request here.-->
19 changes: 19 additions & 0 deletions .github/workflows/auto_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Bump upstream version

on:
schedule:
- cron: "00 */4 * * *"
push:
branches:
- "master"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx @dappnode/dappnodesdk github-action bump-upstream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Main"
on:
pull_request:
push:
branches:
- "main"
- "master"
- "v[0-9]+.[0-9]+.[0-9]+"
paths-ignore:
- "README.md"

jobs:
build-test:
runs-on: ubuntu-latest
name: Build test
if: github.event_name != 'push'
steps:
- uses: actions/checkout@v4
- run: npx @dappnode/dappnodesdk build --variant mainnet --skip_save

# e2e-test:
# runs-on: mainnet
# needs: build-test
# if: github.event_name != 'push'
# name: End to end tests
# steps:
# - uses: actions/checkout@v4
# - run: npx @dappnode/dappnodesdk@latest github-action test-end-to-end --errorLogsTimeout 120 --healthCheckUrl http://beacon-chain.prysm.dappnode:3500/eth/v1/beacon/genesis --network mainnet --environmentByService="{\"beacon-chain\":{\"CHECKPOINT_SYNC_URL\":\"https://checkpoint-sync.dappnode.io\"}}"

release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Publish
run: npx @dappnode/dappnodesdk publish patch --dappnode_team_preset --all-varians
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEVELOPER_ADDRESS: "0xf35960302a07022aba880dffaec2fdd64d5bf1c1"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DNP artifacts
build_*/
docker-compose-tmp.yml
147 changes: 147 additions & 0 deletions DISCLAIMER.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Welcome to the Merged Ethereum Mainnet Consensus Client: Prysm

- Your keystores should now managed in the [Staking Brain](http://brain.web3signer.dappnode)
- Don't have the Web3signer installed yet? It can be manually installed [here](http://my.dappnode/installer/my/web3signer.dnp.dappnode.eth)
- All Staking management now has a new home in the comprehensive [StakersUI](http://my.dappnode/stakers/ethereum)
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lodestar Dappnode Package

**Lodestar ETH2.0 Beacon chain + validator**

Go Ethereum Consensus Layer Implementation by Prysmatic Labs.

![avatar](avatar.png)
Binary file added avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions beacon-chain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM debian:bullseye-slim AS builder

ARG NETWORK

# Use ldd to copy dependencies of grep
RUN mkdir /deps
RUN ldd /bin/grep | tr -s '[:space:]' '\n' | grep '^/' | xargs -I {} cp -v {} /deps || true

ENV LUKSO_CONFIG_PATH=/configs/lukso \
LUKSO_SHARED_CONFIG_URL=https://raw.githubusercontent.com/lukso-network/network-configs/main/mainnet/shared

RUN mkdir -p ${LUKSO_CONFIG_PATH} && \
if [ "${NETWORK}" = "lukso" ]; then \
wget ${LUKSO_SHARED_CONFIG_URL}/genesis.ssz -O ${LUKSO_CONFIG_PATH}/genesis.ssz && \
wget ${LUKSO_SHARED_CONFIG_URL}/config.yaml -O ${LUKSO_CONFIG_PATH}/config.yaml; \
fi

ARG UPSTREAM_VERSION
FROM gcr.io/prysmaticlabs/prysm/beacon-chain:${UPSTREAM_VERSION}

COPY jwtsecret.hex /jwtsecret
COPY entrypoint.sh /usr/local/bin/entrypoint.sh

COPY --from=builder /bin/sh /bin/sh
COPY --from=builder /bin/grep /bin/grep
COPY --from=builder /deps/* /lib/

ENV JWT_PATH=/jwtsecret \
VALIDATOR_PORT=3500 \
DATA_DIR=/data \
LUKSO_CONFIG_PATH=/configs/lukso \
LUKSO_GENESIS_FILE_PATH=${LUKSO_CONFIG_PATH}/genesis.ssz \
LUKSO_CHAIN_CONFIG_FILE_PATH=${LUKSO_CONFIG_PATH}/config.yaml

COPY --from=builder /configs /configs

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
68 changes: 68 additions & 0 deletions beacon-chain/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/sh

SUPPORTED_NETWORKS="sepolia lukso holesky mainnet"
CHECKPOINT_SYNC_FLAG_1="--checkpoint-sync-url"
CHECKPOINT_SYNC_FLAG_2="--genesis-beacon-api-url"
MEVBOOST_FLAGS="--http-mev-relay"

handle_network() {
case "$NETWORK" in
"holesky")
set_beacon_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}" "--holesky"
;;
"lukso")
set_beacon_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}" "--chain-config-file=$LUKSO_CONFIG_PATH --contract-deployment-block=0 --bootstrap-node=enr:-MK4QJ-Bt9HATy4GQawPbDDTArtnt_phuWiVVoWKhS7-DSNjVzmGKBI9xKzpyRtpeCWd3qA9737FTdkKGDgtHfF4N-6GAYlzJCVRh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA2ulfbQgAABP__________gmlkgnY0gmlwhCKTScGJc2VjcDI1NmsxoQJNpNUERqKhA8eDDC4tovG3a59NXVOW16JDFAWXoFFTEYhzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A","enr:-MK4QDOs4pISOkkYbVHnGYHC5EhYCsVzwguun6sFZjLTqrY6Kx_AoE-YyHvqBIHDUwyQqESC4-B3o6DigPQNfKpdhXiGAYgmPWCdh2F0dG5ldHOIAAAAAAAAAACEZXRoMpA2ulfbQgAABP__________gmlkgnY0gmlwhCIgwNOJc2VjcDI1NmsxoQNGVC8JPcsqsZPoohLP1ujAYpBfS0dBwiz4LeoUQ-k5OohzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A"
;;
"mainnet")
set_beacon_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}" "--mainnet"
;;
"sepolia")
set_beacon_config_by_network "${NETWORK}" "${SUPPORTED_NETWORKS}" "--sepolia"
;;
*)
echo "[ERROR - entrypoint] Unsupported network: $NETWORK"
exit 1
;;
esac
}

handle_checkpoint() {
# Check if network is lukso and checkpoint sync url is empty
if [ "${NETWORK}" = "lukso" ] && [ -z "${CHECKPOINT_SYNC_URL}" ]; then
echo "[INFO - entrypoint] Syncing LUKSO chain from genesis"
add_flag_to_extra_opts "--genesis-state=${LUKSO_GENESIS_FILE_PATH}"
else
# Prysm needs these 2 flags to be set for checkpoint sync
set_checkpointsync_url "${CHECKPOINT_SYNC_FLAG_1}" "${CHECKPOINT_SYNC_URL}"
set_checkpointsync_url "${CHECKPOINT_SYNC_FLAG_2}" "${CHECKPOINT_SYNC_URL}"
fi
}

run_beacon() {
echo "[INFO - entrypoint] Running beacon service"

# shellcheck disable=SC2086
exec /beacon-chain \
--accept-terms-of-use \
--datadir=${DATA_DIR} \
--jwt-secret="${JWT_PATH}" \
--execution-endpoint="${ENGINE_API_URL}" \
--monitoring-host=0.0.0.0 \
--grpc-gateway-host=0.0.0.0 \
--grpc-gateway-port="${VALIDATOR_PORT}" \
--grpc-gateway-corsdomain="${CORSDOMAIN}" \
--rpc-host=0.0.0.0 \
--verbosity="${VERBOSITY}" \
--p2p-tcp-port="${P2P_TCP_PORT}" \
--p2p-udp-port="${P2P_UDP_PORT}" \
--p2p-max-peers="$MAX_PEERS" \
--min-sync-peers="$MIN_SYNC_PEERS" \
--subscribe-all-subnets="$SUBSCRIBE_ALL_SUBNETS" ${EXTRA_OPTS}
}

validate_fee_recipient
handle_network
handle_checkpoint
set_mevboost_flag "${MEVBOOST_FLAGS}"
add_flag_to_extra_opts "--suggested-fee-recipient=${FEE_RECIPIENT}"
run_beacon
1 change: 1 addition & 0 deletions beacon-chain/jwtsecret.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ad9cfdec75eceb662f5e48f5765701c17f51a5233a60fbcfa5f9e495fa99d18
47 changes: 47 additions & 0 deletions dappnode_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"upstream": [
{
"repo": "prysmaticlabs/prysm",
"version": "v5.0.4",
"arg": "UPSTREAM_VERSION"
},
{
"repo": "dappnode/staker-package-scripts",
"version": "v0.1.0",
"arg": "STAKER_SCRIPTS_VERSION"
}
],
"shortDescription": "Prysm mainnet ETH2.0 Beacon chain + validator",
"description": "Validate with Prysm: a Go implementation of the Ethereum 2.0 Serenity protocol and open source project created by Prysmatic Labs.\n\nIt includes a Grafana dashboard for the [DMS](http://my.dappnode/#/installer/dms.dnp.dappnode.eth) thanks to the amazing work of [metanull-operator](https://github.com/metanull-operator/eth2-grafana)",
"type": "service",
"author": "DAppNode Association <[email protected]> (https://github.com/dappnode)",
"architectures": ["linux/amd64", "linux/arm64"],
"mainService": "beacon-chain",
"contributors": [
"dappLion <[email protected]> (https://github.com/dapplion)"
],
"chain": {
"driver": "ethereum-beacon-chain",
"serviceName": "beacon-chain",
"portNumber": 3500
},
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/dappnode/DAppNodePackage-prysm-generic.git"
},
"bugs": {
"url": "https://github.com/dappnode/DAppNodePackage-prysm-generic/issues"
},
"requirements": {
"minimumDappnodeVersion": "0.2.60"
},
"categories": ["Blockchain", "ETH2.0"],
"style": {
"featuredBackground": "linear-gradient(67deg, #16000c, #123939)",
"featuredColor": "white"
},
"warnings": {
"onRemove": "Make sure your StakersUI does not have this client selected! Double check in the Stakers Tab in the left NavBar"
}
}
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.5"
services:
beacon-chain:
build:
context: beacon-chain
args:
UPSTREAM_VERSION: v5.0.4
STAKER_SCRIPTS_VERSION: v0.1.0
volumes:
- "beacon-chain-data:/data"
restart: unless-stopped
environment:
CHECKPOINT_SYNC_URL: ""
EXTRA_OPTS: ""
FEE_RECIPIENT: ""
VERBOSITY: info
MIN_SYNC_PEERS: "3"
MAX_PEERS: "70"
SUBSCRIBE_ALL_SUBNETS: "false"
validator:
build:
context: validator
args:
UPSTREAM_VERSION: v5.0.4
STAKER_SCRIPTS_VERSION: v0.1.0
volumes:
- "validator-data:/root/"
restart: unless-stopped
environment:
LOG_TYPE: INFO
GRAFFITI: validating_from_DAppNode
EXTRA_OPTS: ""
FEE_RECIPIENT: ""
VERBOSITY: info
volumes:
beacon-chain-data: {}
validator-data: {}
20 changes: 20 additions & 0 deletions package_variants/holesky/dappnode_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "prysm-holesky.dnp.dappnode.eth",
"version": "0.1.4",
"links": {
"ui": "http://brain.web3signer-holesky.dappnode",
"homepage": "https://prysmaticlabs.com/",
"readme": "https://github.com/dappnode/DAppNodePackage-prysm-generic",
"docs": "https://docs.prylabs.network/docs/getting-started"
},
"globalEnvs": [
{
"envs": ["EXECUTION_CLIENT_HOLESKY", "MEVBOOST_HOLESKY"],
"services": ["beacon-chain"]
},
{
"envs": ["MEVBOOST_HOLESKY"],
"services": ["validator"]
}
]
}
19 changes: 19 additions & 0 deletions package_variants/holesky/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.5"
services:
beacon-chain:
build:
args:
NETWORK: holesky
P2P_TCP_PORT: 14503
P2P_UDP_PORT: 14503
ports:
- 14503:14503/tcp
- 14503:14503/udp
environment:
CORSDOMAIN: "http://prysm-holesky.dappnode"
validator:
build:
args:
NETWORK: holesky
BEACON_RPC_PROVIDER: "beacon-chain.prysm-holesky.dappnode:4000"
BEACON_RPC_GATEWAY_PROVIDER: "beacon-chain.prysm-holesky.dappnode:3500"
Loading

0 comments on commit ada4e77

Please sign in to comment.