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 18 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New cli flag --distributed for running cluster with Charon distributed validator

### Changed
- Updated documentation to include Grandine consensus client support
- Added Grandine to supported clients tables
- Override `--latest` flag to not use the latest version of the image in the clients if image is specified

## [v1.7.2] - 2024-11-12
Expand Down Expand Up @@ -40,6 +42,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
3 changes: 3 additions & 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 All @@ -161,6 +162,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 |

### Holesky
Expand All @@ -171,6 +173,7 @@ Integrating Charon with Sedge would make it easy for stakers to setup and run a
| Nethermind | Lodestar | Lodestar |
| Erigon | Teku | Teku |
| Besu | Prysm | Prysm |
| | Grandine |
| | Nimbus | Nimbus |

### Gnosis
Expand Down
88 changes: 48 additions & 40 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 Expand Up @@ -298,20 +303,23 @@ func TestGenerateDockerCompose(t *testing.T) {

// For distributedValidator
if utils.Contains(distributedValidatorClients, "charon") {
tests = append(tests,
genTestData{
name: fmt.Sprintf("execution: %s, consensus: %s, validator: %s,distributedValidator: %s, network: %s, all, with distributedValidator", executionCl, consensusCl, consensusCl, distributedValidatorClients, network),
genData: generate.GenData{
Distributed: true,
DistributedValidatorClient: &clients.Client{Name: "charon", Type: "distributedValidator"},
ExecutionClient: &clients.Client{Name: executionCl, Type: "execution"},
ConsensusClient: &clients.Client{Name: consensusCl, Type: "consensus"},
ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"},
Services: []string{"execution", "consensus", "validator", "distributedValidator"},
Network: network,
// Only add distributed validator test if consensus client is not grandine
if consensusCl != "grandine" {
tests = append(tests,
genTestData{
name: fmt.Sprintf("execution: %s, consensus: %s, validator: %s,distributedValidator: %s, network: %s, all, with distributedValidator", executionCl, consensusCl, consensusCl, distributedValidatorClients, network),
genData: generate.GenData{
Distributed: true,
DistributedValidatorClient: &clients.Client{Name: "charon", Type: "distributedValidator"},
ExecutionClient: &clients.Client{Name: executionCl, Type: "execution"},
ConsensusClient: &clients.Client{Name: consensusCl, Type: "consensus"},
ValidatorClient: &clients.Client{Name: consensusCl, Type: "validator"},
Services: []string{"execution", "consensus", "validator", "distributedValidator"},
Network: network,
},
},
},
)
)
}
}

}
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
13 changes: 13 additions & 0 deletions docs/docs/hardware-requirements/mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ As you need to keep both execution and consensus layers (consensus and validator

- Check with client documentation to ensure the hardware you want to use is sufficient and supported.
- Resource usage can vary significantly between clients. Research the different clients if you're working with resource constraints.
- For Grandine consensus client, recommended specifications are:
- CPU: 4+ cores (8+ cores recommended for optimal performance)
- RAM: 16GB+ RAM (32GB recommended for optimal performance)
- Storage: SSD with at least 1TB free space
- Storage optimization: Grandine supports state and payload pruning to reduce disk usage

### Internet

- Ideally your internet connection should be reliable and as close to 24/7 as possible without interruption.
- Ensure your bandwidth can't be throttled and isn't capped so your node stays in sync and will be ready to validate when called.
- You need enough upload bandwidth too. As of May 2022 this is ~1.2-1.3 GB download and ~0.9-1 GB upload per hour, and is likely to increase.

### Client-Specific Monitoring

Each client exposes metrics differently. Here are the default ports and endpoints:

- Grandine: Metrics available on port 9090 with detailed metrics enabled by default
- Basic metrics: /metrics
- Detailed metrics: enabled with --metrics-detailed flag
1 change: 1 addition & 0 deletions docs/docs/networks/holesky.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Holesky is Ethereum's public testnet that serves as a technical experimentation
- [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
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
1 change: 1 addition & 0 deletions docs/docs/networks/sepolia.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sepolia is a permissioned Ethereum test network. It is one of the testnets that
- [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
6 changes: 3 additions & 3 deletions internal/pkg/clients/clients_test.go
Original file line number Diff line number Diff line change
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 Expand Up @@ -132,7 +132,7 @@ func TestClients(t *testing.T) {
{
map[string][]string{
"validator": {"lighthouse", "teku", "lodestar", "nimbus"},
"consensus": {"lighthouse", "teku", "lodestar", "nimbus"},
"consensus": {"lighthouse", "teku", "lodestar", "nimbus", "grandine"},
"execution": {"nethermind", "erigon"},
},
[]string{"consensus", "execution", "validator"},
Expand All @@ -142,7 +142,7 @@ func TestClients(t *testing.T) {
{
map[string][]string{
"validator": {"lighthouse", "prysm", "teku", "lodestar", "nimbus"},
"consensus": {"lighthouse", "prysm", "teku", "lodestar", "nimbus"},
"consensus": {"lighthouse", "prysm", "teku", "lodestar", "nimbus", "grandine"},
"execution": {"nethermind", "geth", "besu", "erigon"},
"distributedValidator": {"charon"},
},
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 @@ -69,6 +69,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
7 changes: 7 additions & 0 deletions internal/pkg/clients/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ func TestSetImageOrDefault_Consensus(t *testing.T) {
},
expectedImage: *regexp.MustCompile(`^chainsafe/lodestar:v\d+\.\d+\.\d+$`),
},
{
client: Client{
Name: "grandine",
Type: "consensus",
},
expectedImage: *regexp.MustCompile(`^sifrai/grandine:\d+\.\d+\.\d+$`),
},
}
for _, test := range tests {
t.Run(test.client.Name, func(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions internal/pkg/generate/generate_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func validateValidator(gd *GenData, c *clients.ClientInfo) error {
return ErrUnableToGetClientsInfo
}
if !utils.Contains(validatorClients, gd.ValidatorClient.Name) {
// Only check for Grandine specifically if it's not in the supported list
// This provides a more helpful error message
if gd.ValidatorClient.Name == "grandine" {
return fmt.Errorf("grandine is a consensus-only client and currently not supported as a validator")
}
return ErrValidatorClientNotValid
}
return nil
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/chiado/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 }}
Loading
Loading