diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a6c845d..717401af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Add Grandine Consensus client support. - New command `lido-status` to display data of Lido Node Operator. - Monitoring stack setup with Grafana, Prometheus, and Node Exporter. diff --git a/README.md b/README.md index 6585dd5a..1d3de95f 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ read more about it in [our documentation](https://docs.sedge.nethermind.io/docs/ | Nethermind | Lodestar | Lodestar | | Erigon | Prysm | Prysm | | Besu | Teku | Teku | +| | Grandine | | ### Sepolia diff --git a/cli/actions/generation_test.go b/cli/actions/generation_test.go index c91cacfd..65e83c89 100644 --- a/cli/actions/generation_test.go +++ b/cli/actions/generation_test.go @@ -155,36 +155,41 @@ func TestGenerateDockerCompose(t *testing.T) { ExecutionAuthUrl: "http://localhost:8551", }, }, - genTestData{ - name: fmt.Sprintf("validator: %s, network: %s, only validator", consensusCl, network), - genData: generate.GenData{ - ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, - Services: []string{"validator"}, - Network: network, - ConsensusApiUrl: "http://localhost:4000", + ) + // Only add the "only validator" test case if consensus client is not "grandine" + if consensusCl != "grandine" { + tests = append(tests, + genTestData{ + name: fmt.Sprintf("validator: %s, network: %s, only validator", consensusCl, network), + genData: generate.GenData{ + ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, + Services: []string{"validator"}, + Network: network, + ConsensusApiUrl: "http://localhost:4000", + }, }, - }, - genTestData{ - name: fmt.Sprintf("validator: %s, network: %s, only validator, mev-boost on", consensusCl, network), - genData: generate.GenData{ - ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, - Services: []string{"validator"}, - Network: network, - ConsensusApiUrl: "http://localhost:4000", - MevBoostOnValidator: true, + genTestData{ + name: fmt.Sprintf("validator: %s, network: %s, only validator, mev-boost on", consensusCl, network), + genData: generate.GenData{ + ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, + Services: []string{"validator"}, + Network: network, + ConsensusApiUrl: "http://localhost:4000", + MevBoostOnValidator: true, + }, }, - }, - genTestData{ - name: fmt.Sprintf("validator: %s, network: %s, only validator with tag, https", consensusCl, network), - genData: generate.GenData{ - ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, - Services: []string{"validator"}, - Network: network, - ContainerTag: "sampleTag", - ConsensusApiUrl: "https://localhost:4000", + genTestData{ + name: fmt.Sprintf("validator: %s, network: %s, only validator with tag, https", consensusCl, network), + genData: generate.GenData{ + ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"}, + Services: []string{"validator"}, + Network: network, + ContainerTag: "sampleTag", + ConsensusApiUrl: "https://localhost:4000", + }, }, - }, - ) + ) + } if utils.Contains(validatorClients, consensusCl) { tests = append(tests, genTestData{ diff --git a/configs/client_images.yaml b/configs/client_images.yaml index 02de5d20..6fd2fe3c 100644 --- a/configs/client_images.yaml +++ b/configs/client_images.yaml @@ -24,6 +24,9 @@ consensus: prysm: name: gcr.io/prysmaticlabs/prysm/beacon-chain version: v5.1.0 + grandine: + name: sifrai/grandine + version: 0.4.1 validator: lighthouse: name: sigp/lighthouse diff --git a/configs/images.go b/configs/images.go index dcb2ac93..809d1df2 100644 --- a/configs/images.go +++ b/configs/images.go @@ -29,6 +29,7 @@ var ClientImages struct { Lodestar Image `yaml:"lodestar"` Teku Image `yaml:"teku"` Prysm Image `yaml:"prysm"` + Grandine Image `yaml:"grandine"` } Validator struct { Lighthouse Image `yaml:"lighthouse"` diff --git a/docs/docs/commands/clients.mdx b/docs/docs/commands/clients.mdx index 4fa85fc0..5b3b6a9b 100644 --- a/docs/docs/commands/clients.mdx +++ b/docs/docs/commands/clients.mdx @@ -30,75 +30,59 @@ The execution of `sedge clients` will result in an output like this, that will s ``` $ sedge clients -2024-08-21 12:17:07 -- [INFO] [Logger Init] Log level: info -2024-08-21 12:17:08 -- [INFO] You are running the latest version of sedge. Version: v1.4.0 -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network chiado - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │- │teku │teku - 3 │- │lodestar │lodestar - - -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network custom - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │- │prysm │prysm - 3 │- │teku │teku - 4 │- │lodestar │lodestar - - -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network gnosis - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │erigon │teku │teku - 3 │- │lodestar │lodestar - - -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network holesky - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │geth │prysm │prysm - 3 │erigon │teku │teku - 4 │besu │lodestar │lodestar - - -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network mainnet - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │geth │prysm │prysm - 3 │erigon │teku │teku - 4 │besu │lodestar │lodestar - - -2024-08-21 12:17:08 -- [INFO] Listing supported clients for network sepolia - - - - # │Execution Clients │Consensus Clients │Validator Clients - ────────┼───────────────────────┼───────────────────────┼─────────────────────── - 1 │nethermind │lighthouse │lighthouse - 2 │geth │prysm │prysm - 3 │erigon │teku │teku - 4 │besu │lodestar │lodestar +2023-10-13 14:13:44 -- [INFO] [Logger Init] Log level: info +2023-10-13 14:13:45 -- [INFO] You are running the latest version of sedge. Version: v1.3.1 +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network chiado + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 - teku teku + 3 - lodestar lodestar + +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network custom + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 - prysm prysm + 3 - teku teku + 4 - lodestar lodestar + +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network gnosis + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 erigon teku teku + 3 - lodestar lodestar + +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network holesky + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 geth teku teku + 3 erigon lodestar lodestar + 4 besu prysm prysm + +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network mainnet + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 geth prysm prysm + 3 erigon teku teku + 4 besu lodestar lodestar + 5 grandine + +2023-10-13 14:13:45 -- [INFO] Listing supported clients for network sepolia + + # Execution Clients Consensus Clients Validator Clients +=== =================== =================== =================== + 1 nethermind lighthouse lighthouse + 2 geth prysm prysm + 3 erigon teku teku + 4 besu lodestar lodestar ``` \ No newline at end of file diff --git a/docs/docs/networks/mainnet.mdx b/docs/docs/networks/mainnet.mdx index e12e0e19..b3ed6a01 100644 --- a/docs/docs/networks/mainnet.mdx +++ b/docs/docs/networks/mainnet.mdx @@ -20,6 +20,7 @@ secured by the Proof-of-Stake (PoS) algorithm. - [Lodestar](https://chainsafe.github.io/lodestar/) - [Prysm](https://docs.prylabs.network/docs/getting-started/) - [Teku](https://docs.teku.consensys.net/en/latest/) +- [Grandine](https://docs.grandine.io/) ## Supported Validator Clients - [Lighthouse](https://lighthouse-book.sigmaprime.io/) diff --git a/internal/pkg/clients/clients_test.go b/internal/pkg/clients/clients_test.go index ddb40428..01e61561 100644 --- a/internal/pkg/clients/clients_test.go +++ b/internal/pkg/clients/clients_test.go @@ -31,7 +31,7 @@ func TestSupportedClients(t *testing.T) { isErr bool }{ {"execution", "gnosis", []string{"nethermind", "erigon"}, false}, - {"consensus", "gnosis", utils.Filter(AllClients["consensus"], func(c string) bool { return c != "prysm" }), false}, + {"consensus", "gnosis", utils.Filter(AllClients["consensus"], func(c string) bool { return c != "prysm" && c != "grandine" }), false}, {"execution", "mainnet", AllClients["execution"], false}, {"consensus", "mainnet", AllClients["consensus"], false}, {"validator", "mainnet", AllClients["validator"], false}, @@ -91,7 +91,7 @@ func TestClients(t *testing.T) { inputs := [...]clientsTestCase{ { map[string][]string{ - "consensus": {"lighthouse", "prysm", "teku", "lodestar"}, + "consensus": {"lighthouse", "prysm", "teku", "lodestar", "grandine"}, "validator": {"lighthouse", "prysm", "teku", "lodestar"}, "execution": {"nethermind", "geth", "besu", "erigon"}, }, diff --git a/internal/pkg/clients/init.go b/internal/pkg/clients/init.go index 2eaf1cc4..fd83117e 100644 --- a/internal/pkg/clients/init.go +++ b/internal/pkg/clients/init.go @@ -27,6 +27,7 @@ var AllClients map[string][]string = map[string][]string{ "prysm", "teku", "lodestar", + "grandine", }, "validator": { "lighthouse", diff --git a/internal/pkg/clients/types.go b/internal/pkg/clients/types.go index 19f5116c..b1fcec95 100644 --- a/internal/pkg/clients/types.go +++ b/internal/pkg/clients/types.go @@ -62,6 +62,8 @@ func (c *Client) setConsensusImage(image string) { c.Image = valueOrDefault(image, configs.ClientImages.Consensus.Teku.String()) case "lodestar": c.Image = valueOrDefault(image, configs.ClientImages.Consensus.Lodestar.String()) + case "grandine": + c.Image = valueOrDefault(image, configs.ClientImages.Consensus.Grandine.String()) } } diff --git a/internal/pkg/generate/generate_scripts_test.go b/internal/pkg/generate/generate_scripts_test.go index 38ad4355..c3023a1f 100644 --- a/internal/pkg/generate/generate_scripts_test.go +++ b/internal/pkg/generate/generate_scripts_test.go @@ -293,16 +293,21 @@ func generateTestCases(t *testing.T) (tests []genTestData) { }, CheckFunctions: []CheckFunc{defaultFunc, checkOnlyConsensus, checkValidatorBlocker}, }, - genTestData{ - Description: fmt.Sprintf(baseDescription+"validator: %s, network: %s, only validator", consensusCl, network), - GenerationData: &GenData{ - ValidatorClient: &clients.Client{Name: consensusCl}, - Network: network, - Services: []string{validator}, - }, - CheckFunctions: []CheckFunc{defaultFunc, checkOnlyValidator, checkValidatorBlocker}, - }, ) + // Only add the "only validator" test case if consensus client is not "grandine" + if consensusCl != "grandine" { + tests = append(tests, + genTestData{ + Description: fmt.Sprintf(baseDescription+"validator: %s, network: %s, only validator", consensusCl, network), + GenerationData: &GenData{ + ValidatorClient: &clients.Client{Name: consensusCl}, + Network: network, + Services: []string{validator}, + }, + CheckFunctions: []CheckFunc{defaultFunc, checkOnlyValidator, checkValidatorBlocker}, + }, + ) + } if utils.Contains(validatorClients, consensusCl) { tests = append(tests, genTestData{ diff --git a/scripts/check-image-updates.sh b/scripts/check-image-updates.sh index 19fcc7d4..7d102777 100755 --- a/scripts/check-image-updates.sh +++ b/scripts/check-image-updates.sh @@ -55,7 +55,12 @@ TEKU_LATEST_VERSION=$(curl -H "Authorization: Bearer $PAT" -sL https://api.githu update-client "Teku" "consensus" ".consensus.teku" "$TEKU_LATEST_VERSION" update-client "Teku" "validator" ".validator.teku" "$TEKU_LATEST_VERSION" -## Prysm +# Prysm PRYSM_LATEST_VERSION=$(curl -H "Authorization: Bearer $PAT" -sL https://api.github.com/repos/prysmaticlabs/prysm/releases/latest | jq -r ".tag_name") update-client "Prysm" "consensus" ".consensus.prysm" "$PRYSM_LATEST_VERSION" update-client "Prysm" "validator" ".validator.prysm" "$PRYSM_LATEST_VERSION" + +# Grandine +GRANDINE_LATEST_VERSION=$(curl -H "Authorization: Bearer $PAT" -sL https://api.github.com/repos/grandinetech/grandine/releases | jq -r ".tag_name") +update-client "Grandine" "consensus" ".consensus.grandine" "$GRANDINE_LATEST_VERSION" +update-client "Grandine" "validator" ".validator.grandine" "$GRANDINE_LATEST_VERSION" \ No newline at end of file diff --git a/templates/envs/mainnet/consensus/grandine.tmpl b/templates/envs/mainnet/consensus/grandine.tmpl new file mode 100644 index 00000000..a1960ae4 --- /dev/null +++ b/templates/envs/mainnet/consensus/grandine.tmpl @@ -0,0 +1,13 @@ +{{/* grandine.tmpl */}} +{{ define "consensus" }} +# --- Consensus Layer - Beacon Node - configuration --- +CC_PEER_COUNT=50 +CC_LOG_LEVEL=info +EC_API_URL={{.ExecutionApiURL}} +EC_AUTH_URL={{.ExecutionAuthURL}} +CC_INSTANCE_NAME=Grandine +CC_IMAGE_VERSION={{.CcImage}} +CC_DATA_DIR={{.CcDataDir}} +CC_JWT_SECRET_PATH={{.JWTSecretPath}} +{{if .CheckpointSyncUrl}}CHECKPOINT_SYNC_URL={{.CheckpointSyncUrl}}{{end}} +{{ end }} \ No newline at end of file diff --git a/templates/services/merge/consensus/grandine.tmpl b/templates/services/merge/consensus/grandine.tmpl new file mode 100644 index 00000000..c9d80372 --- /dev/null +++ b/templates/services/merge/consensus/grandine.tmpl @@ -0,0 +1,46 @@ +{{/* grandine.tmpl */}} +{{ define "consensus" }} + consensus: + stop_grace_period: 30s + container_name: sedge-consensus-client{{if .ContainerTag}}-{{.ContainerTag}}{{end}} + restart: unless-stopped + image: ${CC_IMAGE_VERSION}{{if .Mev}} + depends_on:{{if .Mev}} + mev-boost: + condition: service_started{{end}}{{end}} + networks: + - sedge + volumes: + - ${CC_DATA_DIR}:/root/.grandine + - ${CC_JWT_SECRET_PATH}:/root/.grandine/jwtsecret{{if .CustomConsensusConfigs}}{{if .CustomNetworkConfigPath}} + - {{.CustomNetworkConfigPath}}:/network/config.yaml{{end}}{{if .CustomGenesisPath}} + - {{.CustomGenesisPath}}:/network/genesis.ssz{{end}}{{if .CustomDeployBlockPath}} + - {{.CustomDeployBlockPath}}:/network/deploy_block.txt{{end}}{{end}} + ports: + - "{{.ClDiscoveryPort}}:{{.ClDiscoveryPort}}/tcp" + - "{{.ClDiscoveryPort}}:{{.ClDiscoveryPort}}/udp" + - "{{.ClMetricsPort}}:{{.ClMetricsPort}}/tcp"{{if .MapAllPorts}} + - "{{.ClApiPort}}:{{.ClApiPort}}"{{end}} + expose: + - {{.ClApiPort}} + command: + - grandine{{if .CustomConsensusConfigs}} + - --config-file=/network/config.yaml{{end}} + - --datadir=/root/.grandine + - --eth1-rpc-urls=${EC_API_URL} + - --jwt-secret=/root/.grandine/jwtsecret + - --http-address=0.0.0.0 + - --http-port={{.ClApiPort}}{{if not .CustomConsensusConfigs}} + - --network={{if .SplittedNetwork}}${CL_NETWORK}{{else}}${NETWORK}{{end}}{{end}} + - --metrics + - --metrics-port={{.ClMetricsPort}} + - --metrics-address=0.0.0.0{{if or .ClCheckpointSyncUrl .CheckpointSyncUrl}} + - --checkpoint-sync-url={{if .CheckpointSyncUrl}}{{ .CheckpointSyncUrl }}{{else}}${CHECKPOINT_SYNC_URL}{{end}}{{end}}{{range $flag := .ClExtraFlags}} + - --{{$flag}}{{end}}{{if .MevBoostEndpoint}} + - --builder={{.MevBoostEndpoint}}{{end}}{{if .LoggingDriver}} + logging: + driver: "{{.LoggingDriver}}"{{if eq .LoggingDriver "json-file"}} + options: + max-size: "10m" + max-file: "10"{{end}}{{end}} +{{ end }} \ No newline at end of file