Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Grandine Consensus client support #383

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
59 changes: 32 additions & 27 deletions cli/actions/generation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 3 additions & 0 deletions configs/client_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
124 changes: 54 additions & 70 deletions docs/docs/commands/clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
1 change: 1 addition & 0 deletions docs/docs/networks/mainnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/clients/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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"},
},
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/clients/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var AllClients map[string][]string = map[string][]string{
"prysm",
"teku",
"lodestar",
"grandine",
},
"validator": {
"lighthouse",
Expand Down
2 changes: 2 additions & 0 deletions internal/pkg/clients/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
23 changes: 14 additions & 9 deletions internal/pkg/generate/generate_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
7 changes: 6 additions & 1 deletion scripts/check-image-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
13 changes: 13 additions & 0 deletions templates/envs/mainnet/consensus/grandine.tmpl
Original file line number Diff line number Diff line change
@@ -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 }}
46 changes: 46 additions & 0 deletions templates/services/merge/consensus/grandine.tmpl
Original file line number Diff line number Diff line change
@@ -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 }}
Loading