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 13 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0


### Added
- Add Grandine Consensus client support.
- New command `lido-status` to display data of Lido Node Operator.
- New command `monitoring` to run monitoring stack setup with Grafana, Prometheus, Node Exporter and Lido Exporter.
- Security policy.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Integrating Charon with Sedge would make it easy for stakers to setup and run a
| Nethermind | Lodestar | Lodestar |
| Erigon | Prysm | Prysm |
| Besu | Teku | Teku |
| | Grandine | |
| | Nimbus | Nimbus |

### 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 @@ -162,36 +162,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
5 changes: 4 additions & 1 deletion configs/client_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ consensus:
version: 24.10.3
prysm:
name: gcr.io/prysmaticlabs/prysm/beacon-chain
version: v5.1.2
version: v5.1.0
grandine:
name: sifrai/grandine
version: 0.4.1
nimbus:
name: statusim/nimbus-eth2
version: multiarch-v24.10.0
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"`
Nimbus Image `yaml:"nimbus"`
}
Validator struct {
Expand Down
23 changes: 10 additions & 13 deletions docs/docs/commands/clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ 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
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



Expand All @@ -46,17 +46,14 @@ $ sedge clients

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


# │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
2023-10-13 14:13:45 -- [INFO] Listing supported clients for network gnosis



Expand Down
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/)
- [Nimbus](https://nimbus.guide/)

## Supported Validator Clients
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 @@ -92,7 +92,7 @@ func TestClients(t *testing.T) {
inputs := [...]clientsTestCase{
{
map[string][]string{
"consensus": {"lighthouse", "prysm", "teku", "lodestar", "nimbus"},
"consensus": {"lighthouse", "prysm", "teku", "lodestar", "nimbus", "grandine"},
"validator": {"lighthouse", "prysm", "teku", "lodestar", "nimbus"},
"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",
"nimbus",
},
"validator": {
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 @@ -68,6 +68,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())
case "nimbus":
c.Image = valueOrDefault(image, configs.ClientImages.Consensus.Nimbus.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
16 changes: 14 additions & 2 deletions scripts/check-image-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,23 @@ 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"
## Charon
CHARON_LATEST_VERSION=$(curl -H "Authorization: Bearer $PAT" -sL https://api.github.com/repos/ObolNetwork/charon/releases/latest | jq -r ".tag_name")
update-client "Charon" "distributed" ".distributed.charon" "$PRYSM_LATEST_VERSION"
update-client "Charon" "distributed" ".distributed.charon" "$PRYSM_LATEST_VERSION"

## Charon
CHARON_LATEST_VERSION=$(curl -H "Authorization: Bearer $PAT" -sL https://api.github.com/repos/ObolNetwork/charon/releases/latest | jq -r ".tag_name")
update-client "Charon" "distributed" ".distributed.charon" "$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