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 Lido Flow #389

Merged
merged 33 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
11260c2
feat: add method GetRelaysURI and adjust mevboostrelaylist package
khalifaa55 Jun 26, 2024
68bb591
feat: add lido flow for cli.go
khalifaa55 Jun 26, 2024
be9b864
refactor: adjust prompts for lido flow
khalifaa55 Jun 28, 2024
d4a35f0
feat: add non-interactive lido flow
khalifaa55 Jun 28, 2024
c7859e4
style: adjust formatting
khalifaa55 Jun 28, 2024
b9cd4f8
fix: adjust formatting
khalifaa55 Jun 28, 2024
5c83be2
test: add e2e test for non-interactive setup
khalifaa55 Jul 1, 2024
b4d431a
fix: adjust e2e test
khalifaa55 Jul 1, 2024
9d8f23d
style: adjust formatting
khalifaa55 Jul 1, 2024
8ef0e7d
test: Add mocks test for non-interactive setup in cli/generate_test.go
khalifaa55 Jul 1, 2024
1025efa
doc: documentation for lido csm on sedge
stdevMac Jul 4, 2024
c113b61
test: adjust e2e tests for lido flow
khalifaa55 Jul 3, 2024
1c147a1
fix: update go.mod
khalifaa55 Jul 3, 2024
cd62b93
fix: Adjust generate_test.go
khalifaa55 Jul 3, 2024
36d6999
feat: Add --lido to sedge keys
khalifaa55 Jul 4, 2024
c967343
feat: Overwrite WithdrawalAddress in prompts setup
khalifaa55 Jul 4, 2024
7ea3c40
refactor: error messages
khalifaa55 Jul 4, 2024
144eef1
refactor: adjust tests and naming
khalifaa55 Jul 4, 2024
020ce1a
test: adjust keys for holesky
khalifaa55 Jul 4, 2024
e1f760a
doc: Update Sedge with Lido guide (#390)
AntiD2ta Jul 5, 2024
17c99e7
feat: MEV prompt with lido
khalifaa55 Jul 5, 2024
c78abed
Merge branch 'feat/lido-flow' of https://github.com/NethermindEth/sed…
khalifaa55 Jul 5, 2024
c5b7dee
refactor: Validate lido supported networks
khalifaa55 Jul 5, 2024
381a99f
refactor: NodeOptionsFactory interface for cli
khalifaa55 Jul 5, 2024
ca7ad5e
refactor: NodeOptionsFactory interface for sedge generate
khalifaa55 Jul 5, 2024
dd49a00
fix: Holesky fork version
AntiD2ta Jul 8, 2024
c877743
refac: New pkg options for Sedge setup type logic
AntiD2ta Jul 8, 2024
aa1af71
feat(keys): Log keystore path after generation
AntiD2ta Jul 8, 2024
bb06092
doc: Add --network holesky to sedge keys --lido example
AntiD2ta Jul 8, 2024
89a6ca7
chore: Update go.mod
AntiD2ta Jul 8, 2024
9749a99
fix documentation for update on commands
stdevMac Jul 9, 2024
10d7420
doc: Update CHANGELOG
AntiD2ta Jul 9, 2024
fbf34a3
Merge branch 'develop' into feat/lido-flow
khalifaa55 Jul 9, 2024
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
54 changes: 51 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/NethermindEth/sedge/internal/pkg/clients"
"github.com/NethermindEth/sedge/internal/pkg/dependencies"
"github.com/NethermindEth/sedge/internal/pkg/generate"
sedgeOpts "github.com/NethermindEth/sedge/internal/pkg/options"
"github.com/NethermindEth/sedge/internal/ui"

"github.com/NethermindEth/sedge/cli/actions"
Expand Down Expand Up @@ -79,6 +80,7 @@ type CliCmdOptions struct {
keystorePassphrasePath string
keystorePassphrase string
withdrawalAddress string
nodeSetup string
numberOfValidators int64
existingValidators int64
installDependencies bool
Expand All @@ -96,13 +98,15 @@ func CliCmd(p ui.Prompter, actions actions.SedgeActions, depsMgr dependencies.De
- Execution Node
- Consensus Node
- Validator Node
- Lido CSM Node

Follow the prompts to select the options you want for your node. At the end of the process, you will
be asked to run the generated setup or not. If you chose to run the setup, it will be executed for you
using docker compose command behind the scenes.
`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := runPromptActions(p, o,
selectNodeSetup,
selectNetwork,
selectNodeType,
inputGenerationPath,
Expand Down Expand Up @@ -614,8 +618,20 @@ func runPromptActions(p ui.Prompter, o *CliCmdOptions, actions ...promptAction)
return nil
}

func selectNodeSetup(p ui.Prompter, o *CliCmdOptions) (err error) {
options := []string{sedgeOpts.EthereumNode, sedgeOpts.LidoNode}
index, err := p.Select("Select node setup", "", options)
if err != nil {
return err
}
o.nodeSetup = options[index]
return
}

func selectNetwork(p ui.Prompter, o *CliCmdOptions) error {
options := []string{NetworkMainnet, NetworkSepolia, NetworkGnosis, NetworkChiado, NetworkHolesky}
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
options := opts.SupportedNetworks()

index, err := p.Select("Select network", "", options)
if err != nil {
return err
Expand Down Expand Up @@ -792,6 +808,12 @@ func confirmInstallDependencies(p ui.Prompter, o *CliCmdOptions) (err error) {
}

func confirmEnableMEVBoost(p ui.Prompter, o *CliCmdOptions) (err error) {
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
enableMev := opts.MEVBoostEnabled(o.genData.Network)
if opts.OverwriteSettings().MevBoost {
o.withMevBoost = enableMev
return
}
o.withMevBoost, err = p.Confirm("Enable MEV Boost?", true)
return
}
Expand Down Expand Up @@ -847,8 +869,16 @@ func inputMevBoostEndpoint(p ui.Prompter, o *CliCmdOptions) (err error) {
}

func inputRelayURL(p ui.Prompter, o *CliCmdOptions) (err error) {
var defaultValue []string = configs.NetworksConfigs()[o.genData.Network].RelayURLs
relayURLs, err := p.InputList("Insert relay URLs if you don't want to use the default values listed below", defaultValue, func(list []string) error {
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
relayURLs, err := opts.RelayURLs(o.genData.Network)
if err != nil {
return err
}
if relayURLs != nil && opts.OverwriteSettings().RelayURLs {
o.genData.RelayURLs = relayURLs
return
}
relayURLs, err = p.InputList("Insert relay URLs if you don't want to use the default values listed below", relayURLs, func(list []string) error {
badUri, ok := utils.UriValidator(list)
if !ok {
return fmt.Errorf(configs.InvalidUrlFlagError, "relay", badUri)
Expand All @@ -870,11 +900,23 @@ func inputCheckpointSyncURL(p ui.Prompter, o *CliCmdOptions) (err error) {
}

func inputFeeRecipient(p ui.Prompter, o *CliCmdOptions) (err error) {
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
feeRecipient := opts.FeeRecipient(o.genData.Network)
if opts.OverwriteSettings().FeeRecipient {
o.genData.FeeRecipient = feeRecipient
return
}
o.genData.FeeRecipient, err = p.EthAddress("Please enter the Fee Recipient address", "", true)
return
}

func inputFeeRecipientNoValidator(p ui.Prompter, o *CliCmdOptions) (err error) {
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
feeRecipient := opts.FeeRecipient(o.genData.Network)
if opts.OverwriteSettings().FeeRecipient {
o.genData.FeeRecipient = feeRecipient
return
}
o.genData.FeeRecipient, err = p.EthAddress("Please enter the Fee Recipient address (press enter to skip it)", "", false)
return
}
Expand Down Expand Up @@ -929,6 +971,12 @@ func inputKeystorePassphrase(p ui.Prompter, o *CliCmdOptions) (err error) {
}

func inputWithdrawalAddress(p ui.Prompter, o *CliCmdOptions) (err error) {
opts := sedgeOpts.CreateSedgeOptions(o.nodeSetup)
withdrawalAddress := opts.WithdrawalAddress(o.genData.Network)
if opts.OverwriteSettings().WithdrawalAddress {
o.withdrawalAddress = withdrawalAddress
return
}
o.withdrawalAddress, err = p.Input("Withdrawal address", "", false, func(s string) error { return ui.EthAddressValidator(s, true) })
return
}
Expand Down
Loading