Skip to content

Commit

Permalink
feat: Electra support (#177)
Browse files Browse the repository at this point in the history
* feat: Initial Electra support

* feat: Update Go version to 1.22.0

* style: Update Go version in go.mod to 1.22

* feat: Update Go versions to 1.22 in workflow files

* fix: Update golang version in Dockerfile

* Bump go-eth2

* fix(web): handle epoch as string

* refactor: Update dependencies versions and modules in go.mod and go.sum files

* refactor: Simplify fetching current epoch in download functions

* refactor: Add NotOptimisticEL method to Nodes type

* chore(goeth2): bump to latest electra commit

* fix(beacon): deneb fork name

* feat: upgrade go dependencies

This commit upgrades the go dependencies to their latest versions.
The gosec linter was disabled for some lines because they are not
security issues.
The expire package was removed because it was not being used.
The expire_test package was moved to beacon_test package.
The CalculateSlotExpiration and GetSlotTime functions were moved to
the expire_test package.

* fix(beacon): remove nolint directive from UpstreamsStatus function

* feat(checkpoint-sync): upgrade upload-artifact action to v4

The action was upgraded to the latest major version.

* feat(checkpoint-sync): use secrets for beacon node URLs

* feat(checkpoint-sync): use env vars for beacon node URLs in action

* feat(checkpoint-sync): add beacon_node_url input to action

This allows the user to specify the beacon node URL to use for
checkpoint sync, and removes the need for the action to have
knowledge of the different networks and their corresponding URLs.
This makes the action more generic and reusable.

* feat(integration.yaml): use env vars for beacon node URLs
feat: remove exportloopref linter

The integration workflow now uses environment variables to
configure beacon node URLs, and the exportloopref linter has been
removed from the golangci configuration.

* feat: strip trailing slash from beacon node URL in checkpoint sync
fix(integration.yaml): set beacon_node_url to MAINNET_BEACON_API_URL

* fix(checkpoint-sync): validate beacon node URL format

The action now validates the beacon node URL to ensure it starts
with either 'http://' or 'https://'. If the URL is invalid, the
action will exit with an error message.

* feat(integration.yaml): add mainnet integration tests and use secrets for beacon node url

* feat(action.yaml): add execution endpoint to lighthouse to connect to geth

---------

Co-authored-by: Andrew Davis <[email protected]>
Co-authored-by: Matty Evans <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2025
1 parent 9c4823c commit c6ce47a
Show file tree
Hide file tree
Showing 22 changed files with 203 additions and 572 deletions.
23 changes: 10 additions & 13 deletions .github/actions/checkpoint-sync/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Run a checkpoint sync test
description: Runs a consensus client and checkpoint syncs from the running checkpointz instance.

Expand All @@ -9,7 +8,9 @@ inputs:
network:
description: "The name of the network to run the test against (one of ropsten, sepolia, prater/goerli)."
required: true

beacon_node_url:
description: "The beacon node API URL to use"
required: true

runs:
using: composite
Expand All @@ -28,13 +29,9 @@ runs:
- name: Configure checkpointz
shell: bash
run: |
beacon_node=""
if [[ ${{ inputs.network }} == "mainnet" ]]; then
beacon_node="http://testing.mainnet.beacon-api.nimbus.team/"
elif [[ ${{ inputs.network }} == "holesky" ]]; then
beacon_node="http://testing.holesky.beacon-api.nimbus.team/"
else
echo "Unsupported network: ${{ inputs.network }}"
# Check if beacon node url is valid
if [[ ! "${{ inputs.beacon_node_url }}" =~ ^https?:// ]]; then
echo "Invalid beacon node URL"
exit 1
fi
Expand All @@ -46,7 +43,7 @@ runs:
beacon:
upstreams:
- name: state-provider
address: $beacon_node
address: "${{ inputs.beacon_node_url }}"
timeoutSeconds: 30
dataProvider: true
checkpointz:
Expand Down Expand Up @@ -193,7 +190,7 @@ runs:
if: ${{ inputs.consensus == 'lighthouse' }}
run: |
echo "Starting Lighthouse...";
docker run -p 5052:5052 --network eth -d --name beacon sigp/lighthouse:latest lighthouse bn --network=${{ inputs.network }} --datadir=/data --checkpoint-sync-url=http://checkpointz:5555 --http --http-address=0.0.0.0
docker run -p 5052:5052 --network eth -d --name beacon sigp/lighthouse:latest lighthouse bn --network=${{ inputs.network }} --datadir=/data --checkpoint-sync-url=http://checkpointz:5555 --http --http-address=0.0.0.0 --execution-endpoint=http://localhost:8545
echo "Lighthouse is running.";
- name: Run prysm
shell: bash
Expand Down Expand Up @@ -228,12 +225,12 @@ runs:
fi
sleep 1;
done;
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ inputs.network }}-${{ inputs.consensus }}-checkpointz.log
path: logs/checkpointz.log
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ inputs.network }}-${{ inputs.consensus }}-consensus.log
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.22
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.22'
-
name: Set up NodeJS
uses: actions/setup-node@v3
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ jobs:
fail-fast: false
matrix:
consensus: [lighthouse, teku, prysm, nimbus, lodestar]
network: [mainnet]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Print details
run: |
echo "Consensus: ${{ matrix.consensus }}"
echo "Network: ${{ matrix.network }}"
- name: Run ${{ matrix.network }}-${{ matrix.consensus }}
- name: Run mainnet-${{ matrix.consensus }}
id: run-test
uses: ./.github/actions/checkpoint-sync
with:
## Variables
consensus: ${{ matrix.consensus }}
network: ${{ matrix.network }}
network: 'mainnet'
beacon_node_url: ${{ secrets.MAINNET_BEACON_NODE_URL }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
full_ci:
strategy:
matrix:
go_version: [ 1.18.x ]
go_version: [ 1.22.x ]

runs-on: ubuntu-20.04

Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ linters:
- dogsled
- dupl
- errcheck
- exportloopref
- goconst
- gocritic
- gofmt
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20 AS builder
FROM golang:1.22 AS builder
WORKDIR /src
COPY go.sum go.mod ./
RUN go mod download
Expand Down
51 changes: 30 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/ethpandaops/checkpointz

go 1.17
go 1.22

require (
github.com/attestantio/go-eth2-client v0.19.9
github.com/attestantio/go-eth2-client v0.24.0
github.com/chuckpreslar/emission v0.0.0-20170206194824-a7ddd980baf9
github.com/creasty/defaults v1.6.0
github.com/ethpandaops/beacon v0.35.0
github.com/ethpandaops/beacon v0.47.0
github.com/ethpandaops/ethwallclock v0.2.0
github.com/go-co-op/gocron v1.18.0
github.com/julienschmidt/httprouter v1.3.0
Expand All @@ -15,16 +15,20 @@ require (
github.com/prometheus/client_golang v1.16.0
github.com/sirupsen/logrus v1.9.1
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/emicklei/dot v1.6.4 // indirect
github.com/ethereum/go-ethereum v1.14.10 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/ferranbt/fastssz v0.1.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.7.4 // indirect
github.com/go-logr/logr v1.2.4 // indirect
Expand All @@ -33,43 +37,48 @@ require (
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/goccy/go-yaml v1.9.5 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huandu/go-clone v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pk910/dynamic-ssz v0.0.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15 // indirect
github.com/r3labs/sse/v2 v2.10.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/zerolog v1.29.1 // indirect
github.com/rs/zerolog v1.32.0 // indirect
github.com/signalsciences/ac v1.2.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/protobuf v1.30.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit c6ce47a

Please sign in to comment.