From a89452adf879068ae5cbb3fc426300f358c9cc9c Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 14 Oct 2023 00:38:40 +0700 Subject: [PATCH 1/7] Separate checkpoint url --- go.mod | 4 +- go.sum | 8 ++-- .../config/consensus-common-config.go | 37 ++++++++++++++++++- stader-cli/service/configConsensus.go | 16 +++++++- stader-cli/service/service.go | 27 +++++++++++++- 5 files changed, 83 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index bd773c094..6bd6458c5 100644 --- a/go.mod +++ b/go.mod @@ -35,8 +35,8 @@ require ( github.com/rivo/tview v0.0.0-20230621164836-6cc0565babaf // indirect github.com/sethvargo/go-password v0.2.0 github.com/shirou/gopsutil/v3 v3.23.1 - github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc - github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc + github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52 + github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52 github.com/tyler-smith/go-bip39 v1.1.0 github.com/urfave/cli v1.22.10 github.com/wealdtech/go-eth2-types/v2 v2.7.0 diff --git a/go.sum b/go.sum index 70e30711c..ed35366d7 100644 --- a/go.sum +++ b/go.sum @@ -1231,10 +1231,10 @@ github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7Sr github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= -github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc h1:vWFxcgi1WU9J2oY6rhUAAQS4R/c1Pbn63rcjyv4Bms4= -github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc/go.mod h1:gZcnx3O0sm+mEO2INhKDHw+iUzJH5tPaX4cv5SN5tsQ= -github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc h1:hXzsyqCaeqm0s22ocuzGxs2rflHOg/QoX7zMYHJdGSE= -github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc/go.mod h1:5ojn2lxD9wd5sF0KYaHBDcpUC3ACFgqr0XG1atCIeAs= +github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52 h1:Y3ASJLiv/mBbqREUWgOUXLtoce23fsGnXXJrJ8Rw4kI= +github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52/go.mod h1:gZcnx3O0sm+mEO2INhKDHw+iUzJH5tPaX4cv5SN5tsQ= +github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52 h1:nK3eQ3qreZBPn7feJS15t31pBShhj1rCV01cBRLE+7k= +github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52/go.mod h1:5ojn2lxD9wd5sF0KYaHBDcpUC3ACFgqr0XG1atCIeAs= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E= github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= diff --git a/shared/services/config/consensus-common-config.go b/shared/services/config/consensus-common-config.go index 06005fbbc..fe3677b8f 100644 --- a/shared/services/config/consensus-common-config.go +++ b/shared/services/config/consensus-common-config.go @@ -25,7 +25,10 @@ import ( // Param IDs const GraffitiID string = "graffiti" + const CheckpointSyncUrlID string = "checkpointSyncUrl" +const CheckpointSyncUrlMainnetID string = "checkpointSyncUrlMainnet" +const CheckpointSyncUrlPraterID string = "checkpointSyncUrlPraters" const P2pPortID string = "p2pPort" const ApiPortID string = "apiPort" const OpenApiPortID string = "openApiPort" @@ -52,6 +55,12 @@ type ConsensusCommonConfig struct { // The checkpoint sync URL if used CheckpointSyncProvider config.Parameter `yaml:"checkpointSyncProvider,omitempty"` + // The checkpoint sync URL if used for mainnet + CheckpointSyncProviderMainnet config.Parameter `yaml:"checkpointSyncProviderMainnet,omitempty"` + + // The checkpoint sync URL if used for the prater + CheckpointSyncProviderPrater config.Parameter `yaml:"checkpointSyncProviderPrater,omitempty"` + // The port to use for gossip traffic P2pPort config.Parameter `yaml:"p2pPort,omitempty"` @@ -84,7 +93,7 @@ func NewConsensusCommonConfig(cfg *StaderConfig) *ConsensusCommonConfig { }, CheckpointSyncProvider: config.Parameter{ - ID: CheckpointSyncUrlID, + ID: "checkpointSyncUrlID", Name: "Checkpoint Sync URL", Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + "Example: https://:@eth2-beacon-prater.infura.io\n" + @@ -96,6 +105,30 @@ func NewConsensusCommonConfig(cfg *StaderConfig) *ConsensusCommonConfig { CanBeBlank: true, OverwriteOnUpgrade: false, }, + CheckpointSyncProviderMainnet: config.Parameter{ + ID: CheckpointSyncUrlMainnetID, + Name: "Checkpoint Sync URL Mainnet", + Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + + "Example: https://:@eth2-beacon-prater.infura.io\n" + + "Leave this blank if you want to sync normally from the start of the chain.", + Type: config.ParameterType_String, + Default: map[config.Network]interface{}{config.Network_All: defaultCheckpointSyncProvider}, + AffectsContainers: []config.ContainerID{config.ContainerID_Eth2}, + CanBeBlank: true, + OverwriteOnUpgrade: false, + }, + CheckpointSyncProviderPrater: config.Parameter{ + ID: CheckpointSyncUrlPraterID, + Name: "Checkpoint Sync URL Prater", + Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + + "Example: https://:@eth2-beacon-prater.infura.io\n" + + "Leave this blank if you want to sync normally from the start of the chain.", + Type: config.ParameterType_String, + Default: map[config.Network]interface{}{config.Network_All: defaultCheckpointSyncProvider}, + AffectsContainers: []config.ContainerID{config.ContainerID_Eth2}, + CanBeBlank: true, + OverwriteOnUpgrade: false, + }, P2pPort: config.Parameter{ ID: P2pPortID, @@ -152,6 +185,8 @@ func (cfg *ConsensusCommonConfig) GetParameters() []*config.Parameter { return []*config.Parameter{ &cfg.Graffiti, &cfg.CheckpointSyncProvider, + &cfg.CheckpointSyncProviderMainnet, + &cfg.CheckpointSyncProviderPrater, &cfg.P2pPort, &cfg.ApiPort, &cfg.OpenApiPort, diff --git a/stader-cli/service/configConsensus.go b/stader-cli/service/configConsensus.go index fcf13492e..af1a7bba2 100644 --- a/stader-cli/service/configConsensus.go +++ b/stader-cli/service/configConsensus.go @@ -24,6 +24,7 @@ import ( "strings" stdCf "github.com/stader-labs/stader-node/shared/services/config" + "github.com/stader-labs/stader-node/shared/types/config" cfgtypes "github.com/stader-labs/stader-node/shared/types/config" ) @@ -72,7 +73,14 @@ func setUIConsensusClient(cfg *stdCf.StaderConfig, newSettings map[string]interf // Local newSettings[keys.E2cc_lc_common_graffiti] = cfg.ConsensusCommon.Graffiti.Value - newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProvider.Value + network := newSettings[keys.Sn_node_network].(string) + + if network == "Ethereum Mainnet" { + newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value + } else { + newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value + } + newSettings[keys.E2cc_lc_common_p2p_port] = format(cfg.ConsensusCommon.P2pPort.Value) newSettings[keys.E2cc_lc_common_http_api_port] = format(cfg.ConsensusCommon.ApiPort.Value) newSettings[keys.E2cc_lc_common_expose_api_port] = cfg.ConsensusCommon.OpenApiPort.Value.(bool) @@ -182,6 +190,12 @@ func updateLocalConsensusClient(newCfg *stdCf.StaderConfig, settings map[string] newCfg.ConsensusCommon.OpenApiPort.Value = settings[keys.E2cc_lc_common_expose_api_port] newCfg.ConsensusCommon.DoppelgangerDetection.Value = settings[keys.E2cc_lc_common_doppelganger_detection] + if newCfg.StaderNode.Network.Value.(config.Network) == config.Network_Mainnet { + newCfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = settings[keys.E2cc_lc_common_checkpoint_sync_url] + } else { + newCfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = settings[keys.E2cc_lc_common_checkpoint_sync_url] + } + clientStr, ok := settings[keys.E2cc_lc_consensus_client].(string) if !ok { return fmt.Errorf("Invalid External client %+v", settings[keys.E1ec_lm_execution_client]) diff --git a/stader-cli/service/service.go b/stader-cli/service/service.go index 3cdd85d8f..15240c3d6 100644 --- a/stader-cli/service/service.go +++ b/stader-cli/service/service.go @@ -245,7 +245,17 @@ func UpdateConfig(_cfg *config.StaderConfig, newSettings *pages.SettingsType) (c } cfg.ConsensusCommon.DoppelgangerDetection.Value = ConvertStringToBool(newSettings.ConsensusClient.DoppelgangerProtection) cfg.ConsensusCommon.Graffiti.Value = newSettings.ConsensusClient.Graffit - cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrl + + switch cfgtypes.Network(newSettings.Network) { + case cfgtypes.Network_Mainnet: + cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = newSettings.ConsensusClient.CheckpointUrlMainnet + cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrlMainnet + case cfgtypes.Network_Prater: + cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = newSettings.ConsensusClient.CheckpointUrlPrater + cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrlPrater + default: + panic("UNSUPPORT NETWORK") + } cfg.UseFallbackClients.Value = ConvertStringToBool(newSettings.FallbackClients.SelectionOption) // get the consensus client we are using for fallback @@ -298,6 +308,19 @@ func UpdateConfig(_cfg *config.StaderConfig, newSettings *pages.SettingsType) (c func NewSettingsType(cfg *config.StaderConfig) pages.SettingsType { + checkpointUrlPrater := cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value.(string) + checkpointUrlMainnet := cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value.(string) + + // Set default for older version (< 1.4.0) + // After 1.4.0 w expected to mainnet or prater checkpoint is not empty + if checkpointUrlPrater == "" && checkpointUrlMainnet == "" { + if cfg.StaderNode.Network.Value.(cfgtypes.Network) == cfgtypes.Network_Mainnet { + cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = cfg.ConsensusCommon.CheckpointSyncProvider.Value + } else { + cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = cfg.ConsensusCommon.CheckpointSyncProvider.Value + } + } + currentSettings := pages.SettingsType{ Version: shared.StaderVersion, Network: string(cfg.StaderNode.Network.Value.(cfgtypes.Network)), @@ -314,6 +337,8 @@ func NewSettingsType(cfg *config.StaderConfig) pages.SettingsType { ExternalSelection: string(cfg.ExternalConsensusClient.Value.(cfgtypes.ConsensusClient)), Graffit: cfg.ConsensusCommon.Graffiti.Value.(string), CheckpointUrl: cfg.ConsensusCommon.CheckpointSyncProvider.Value.(string), + CheckpointUrlMainnet: cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value.(string), + CheckpointUrlPrater: cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value.(string), DoppelgangerProtection: ConvertBoolToString(cfg.ConsensusCommon.DoppelgangerDetection.Value.(bool)), External: pages.ConsensusClientExternalType{ Lighthouse: pages.ConsensusClientExternalSelectedLighthouseType{ From 9b21628357d02ff910b4739ea90775878bb3f932 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 14 Oct 2023 16:04:27 +0700 Subject: [PATCH 2/7] Update copies --- .../node/update-operator-reward-address.go | 88 ++++++++++++++++--- 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/stader-cli/node/update-operator-reward-address.go b/stader-cli/node/update-operator-reward-address.go index d62c1d36d..09f5f604d 100644 --- a/stader-cli/node/update-operator-reward-address.go +++ b/stader-cli/node/update-operator-reward-address.go @@ -4,8 +4,11 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" + "github.com/stader-labs/stader-node/shared/services" + "github.com/stader-labs/stader-node/shared/services/config" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" + cfTypes "github.com/stader-labs/stader-node/shared/types/config" cliutils "github.com/stader-labs/stader-node/shared/utils/cli" "github.com/urfave/cli" ) @@ -27,6 +30,10 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro } defer staderClient.Close() + cfg, err := services.GetConfig(c) + if err != nil { + return err + } // check if we can update the el res, err := staderClient.CanUpdateOperatorRewardAddress(operatorRewardAddress) if err != nil { @@ -49,15 +56,8 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro return nil } - infoResponse, err := staderClient.GetContractsInfo() - if err != nil { - return err - } - if res.OperatorAddressAndRewardNotTheSame { - fmt.Printf("%sFor node security, only your existing Reward Address can \npropose a change. To propose and confirm a Reward address \nchange, please use the PermissionlessNodeRegistry Smart Contract: \n%s %s\n\n", colorLightBlue, infoResponse.PermissionlessNodeRegistry, colorReset) - - promptNote() + promptHowToChangeReward(cfg) return nil } @@ -66,8 +66,15 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro return err } + confirmMessage := ` +This action will change your Reward Address. Once it's changed, all future SD and ETH rewards will be sent to the New Reward Address. + +After you propose the change, your New Reward Address will initially be in a 'Confirmation pending' state until you confirm the change using your New Reward Address on the PermissionlessNodeRegistry Smart Contract. Please make sure that your New Reward Address is linked to a web3-compatible wallet, such as MetaMask, to connect with the Smart Contract + +Do you wish to proceed with the Reward Address change?` + if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "\n%sThis action will change your Reward address. Once it's \nchanged, all future SD and ETH reward will be sent to the new address. \n\nYour new Reward address will initially be in a \"Confirmation pending\" state. \nTo confirm the change, please use \nthe PermissionlessNodeRegistry Smart Contract: %s \n\nStader will continue to send reward to your existing address until you \nconfirm the change using your new Reward Address. To complete \nthe confirmation process, make sure you have a web3-compatible wallet like \nMetaMask. Connect your wallet with the Smart Contract using \nyour new Reward address and confirm the Reward address change \nusing the ConfirmRewardAddressChange function. \n\n%sDo you wish to processed with the Reward address change?%s", colorLightBlue, infoResponse.PermissionlessNodeRegistry, colorGreen, colorReset))) { + "\n%s %s %s", colorLightBlue, confirmMessage, colorReset))) { fmt.Println("Cancelled.") return nil } @@ -86,11 +93,66 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro return err } - fmt.Printf("%sYour reward address changed in pending state. Please \nconfirm the request using this contract: %s and the reward address.%s", colorLightBlue, infoResponse.PermissionlessNodeRegistry, colorReset) - + promptSuccessChangedRewardAndNextStep(cfg) return nil } -func promptNote() { - fmt.Printf("%sFollow these steps for your Reward address change: \nStep1: Propose the Reward address change by connecting your wallet \nto the Smart Contract using your EXISTING Reward address and the ProposeRewardAddress function. \nStep2: Confirm the Reward address change by connecting your wallet \nto the Smart Contract using your NEW Reward address and the ConfirmRewardAddressChange function. \n\n%sNote: Stader will continue to send reward to your existing Reward \naddress until you confirm the change using your new Reward Address%s", colorGreen, colorRed, colorReset) +func promptSuccessChangedRewardAndNextStep(cfg *config.StaderConfig) { + switch cfg.StaderNode.Network.Value.(cfTypes.Network) { + case cfTypes.Network_Mainnet: + msg := ` +You have successfully raised a request to change your Reward Address. + +To confirm the Reward Address change please follow these steps: +Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1#writeProxyContract +Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function. + +Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Mainnet-Permissionless-8ef1137e9c2647c88db3911da1642ca2 + +Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your new Reward Address. +` + fmt.Printf("%s %s %s\n", colorLightBlue, msg, colorReset) + case cfTypes.Network_Prater: + msg := ` +You have successfully raised a request to change your Reward Address. + +To confirm the Reward Address change please follow these steps: +Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/0x14F59038b249AA9f44bC3FB7DBfC291C5B21f7F8#writeProxyContract +Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function. + +Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Testnet-Permissionless-db692621a305426bab2e3ad232acbc14 + +Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your new Reward Address.` + fmt.Printf("%s %s %s\n", colorLightBlue, msg, colorReset) + default: + fmt.Println("Unsupported network") + } +} + +func promptHowToChangeReward(cfg *config.StaderConfig) { + network := cfg.StaderNode.Network.Value.(cfTypes.Network) + switch network { + case cfTypes.Network_Mainnet: + msg := ` +For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1#writeProxyContract +Follow these steps for your Reward address change: +Step 1: Propose the Reward Address change by connecting your Existing Reward Address wallet with the Smart Contract and execute the "ProposeRewardAddress" function. +Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function +Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Mainnet-Permissionless-8ef1137e9c2647c88db3911da1642ca2 +Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your New Reward Address. +` + fmt.Printf("%s %s %s\n\n", colorLightBlue, msg, colorReset) + case cfTypes.Network_Prater: + msg := ` +For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/0x14F59038b249AA9f44bC3FB7DBfC291C5B21f7F8#writeProxyContract +Follow these steps for your Reward Address change: +Step 1: Propose the Reward Address change by connecting your Existing Reward Address wallet with the Smart Contract and execute the "ProposeRewardAddress" function. +Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function +Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Testnet-Permissionless-db692621a305426bab2e3ad232acbc14 +Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your New Reward Address. +` + fmt.Printf("%s %s %s\n\n", colorLightBlue, msg, colorReset) + default: + fmt.Println("Unsupported network") + } } From b4b6216aea3b88906be27c996c53a6514d810fb2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 14 Oct 2023 19:14:43 +0700 Subject: [PATCH 3/7] Remove hardcode --- shared/services/config/consensus-common-config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/services/config/consensus-common-config.go b/shared/services/config/consensus-common-config.go index fe3677b8f..d55d3f616 100644 --- a/shared/services/config/consensus-common-config.go +++ b/shared/services/config/consensus-common-config.go @@ -93,7 +93,7 @@ func NewConsensusCommonConfig(cfg *StaderConfig) *ConsensusCommonConfig { }, CheckpointSyncProvider: config.Parameter{ - ID: "checkpointSyncUrlID", + ID: CheckpointSyncUrlID, Name: "Checkpoint Sync URL", Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + "Example: https://:@eth2-beacon-prater.infura.io\n" + From 1811db13d4126ff5c7be9be4f2aca9836174246a Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sat, 14 Oct 2023 19:15:07 +0700 Subject: [PATCH 4/7] Bump version --- shared/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/version.go b/shared/version.go index dbcb63157..f70b9cdc4 100644 --- a/shared/version.go +++ b/shared/version.go @@ -21,7 +21,7 @@ package shared const BinaryBucket string = "/stader-node-build/permissionless" const DockerAccount string = "staderlabs" -const StaderVersion string = "1.4.0" +const StaderVersion string = "1.4.0-dev" const Logo string = ` _____ _ _ _ _ 𝅺 From f88c481e82049376a25aa8283f3639b3f5b18638 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Sun, 15 Oct 2023 14:41:19 +0700 Subject: [PATCH 5/7] Fix build failed --- stader-cli/node/update-operator-reward-address.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stader-cli/node/update-operator-reward-address.go b/stader-cli/node/update-operator-reward-address.go index 09f5f604d..0a38ef9b7 100644 --- a/stader-cli/node/update-operator-reward-address.go +++ b/stader-cli/node/update-operator-reward-address.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" - "github.com/stader-labs/stader-node/shared/services" "github.com/stader-labs/stader-node/shared/services/config" "github.com/stader-labs/stader-node/shared/services/gas" "github.com/stader-labs/stader-node/shared/services/stader" @@ -30,7 +29,7 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro } defer staderClient.Close() - cfg, err := services.GetConfig(c) + cfg, _, err := staderClient.LoadConfig() if err != nil { return err } From e21855fe40895e1f2d174457fdf1ad989286410e Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 16 Oct 2023 15:50:40 +0700 Subject: [PATCH 6/7] Update copies --- stader-cli/node/deposit-sd.go | 2 +- stader-cli/node/register.go | 4 +-- .../node/update-operator-reward-address.go | 36 ++++++++++++++----- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/stader-cli/node/deposit-sd.go b/stader-cli/node/deposit-sd.go index 64e696e46..9207ad153 100644 --- a/stader-cli/node/deposit-sd.go +++ b/stader-cli/node/deposit-sd.go @@ -47,7 +47,7 @@ func nodeDepositSd(c *cli.Context) error { } if allowance.Allowance.Cmp(amountWei) < 0 { - fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", amountWei) + fmt.Println("Before depositing SD, you must first give the collateral contract approval to interact with your SD. Amount to approve: ", eth.WeiToEth(amountWei)) err = nodeApproveSdWithAmount(c, staderClient, amountWei) if err != nil { return err diff --git a/stader-cli/node/register.go b/stader-cli/node/register.go index a4fab3baf..2cb379ec3 100644 --- a/stader-cli/node/register.go +++ b/stader-cli/node/register.go @@ -32,7 +32,7 @@ func registerNode(c *cli.Context, operatorName string) error { operatorRewardAddressString := walletStatus.AccountAddress.String() - confirmText := "Would you wish to join the ETHx Socializing pool?\nType 'Yes' to Opt-in or 'No' to Opt-out. \nNote: The Opt-In and Opt-Out of socializing pool will have a cool-off period of 56 days.\ni.e you will have to wait for 56 days to Opt-Out of the Socializing pool once you Opt-In and vice versa.\nLearn more about the ETHx Socializing Pool here:\nhttps://staderlabs.gitbook.io/ethereum/node-operator/permissionless-node-operator/ethx-rewards-for-permissionless-node-operators/socializing-pool\n" + confirmText := "Would you wish to join the ETHx Socializing pool?\nType 'Y' to Opt-in or 'N' to Opt-out. \nNote: The Opt-In and Opt-Out of socializing pool will have a cool-off period of 56 days.\ni.e you will have to wait for 56 days to Opt-Out of the Socializing pool once you Opt-In and vice versa.\nLearn more about the ETHx Socializing Pool here:\nhttps://staderlabs.gitbook.io/ethereum/node-operator/permissionless-node-operator/ethx-rewards-for-permissionless-node-operators/socializing-pool\n" socializeEl := cliutils.Confirm(confirmText) // Check node can be registered @@ -82,7 +82,7 @@ func registerNode(c *cli.Context, operatorName string) error { } // Log & return - fmt.Printf("Congratulation, your node is now registered on the stader \network. Your current Operator and Reward address is the same. We \nstrongly recommend changing your Reward address. To do so, run the \nfollowing command: 'stader-cli node set-reward-address -ora '.\n") + fmt.Printf("Congratulation, your node is now registered on the Stader \nnetwork. Your current Operator and Reward address is the same. We \nstrongly recommend changing your Reward address. To do so, run the \nfollowing command: ~/bin/stader-cli node set-reward-address -ora .\n") return nil } diff --git a/stader-cli/node/update-operator-reward-address.go b/stader-cli/node/update-operator-reward-address.go index 0a38ef9b7..63ba96488 100644 --- a/stader-cli/node/update-operator-reward-address.go +++ b/stader-cli/node/update-operator-reward-address.go @@ -55,8 +55,13 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro return nil } + infoResponse, err := staderClient.GetContractsInfo() + if err != nil { + return err + } + if res.OperatorAddressAndRewardNotTheSame { - promptHowToChangeReward(cfg) + promptHowToChangeReward(cfg, infoResponse.PermissionlessNodeRegistry) return nil } @@ -68,7 +73,10 @@ func SetRewardAddress(c *cli.Context, operatorRewardAddress common.Address) erro confirmMessage := ` This action will change your Reward Address. Once it's changed, all future SD and ETH rewards will be sent to the New Reward Address. -After you propose the change, your New Reward Address will initially be in a 'Confirmation pending' state until you confirm the change using your New Reward Address on the PermissionlessNodeRegistry Smart Contract. Please make sure that your New Reward Address is linked to a web3-compatible wallet, such as MetaMask, to connect with the Smart Contract +After you propose the change, your New Reward Address will initially be in a +'Confirmation pending' state until you confirm the change using your New RewardAddress on the +PermissionlessNodeRegistry Smart Contract. Please make sure that your New Reward Address +is linked to a web3-compatible wallet, such as MetaMask, to connect with the Smart Contract Do you wish to proceed with the Reward Address change?` @@ -92,64 +100,74 @@ Do you wish to proceed with the Reward Address change?` return err } - promptSuccessChangedRewardAndNextStep(cfg) + promptSuccessChangedRewardAndNextStep(cfg, infoResponse.PermissionlessNodeRegistry) return nil } -func promptSuccessChangedRewardAndNextStep(cfg *config.StaderConfig) { +func promptSuccessChangedRewardAndNextStep(cfg *config.StaderConfig, contractAddr common.Address) { switch cfg.StaderNode.Network.Value.(cfTypes.Network) { case cfTypes.Network_Mainnet: msg := ` You have successfully raised a request to change your Reward Address. To confirm the Reward Address change please follow these steps: -Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1#writeProxyContract +Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/%s#writeProxyContract#F3 Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function. Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Mainnet-Permissionless-8ef1137e9c2647c88db3911da1642ca2 Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your new Reward Address. ` + msg = fmt.Sprintf(msg, contractAddr.String()) fmt.Printf("%s %s %s\n", colorLightBlue, msg, colorReset) case cfTypes.Network_Prater: msg := ` You have successfully raised a request to change your Reward Address. To confirm the Reward Address change please follow these steps: -Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/0x14F59038b249AA9f44bC3FB7DBfC291C5B21f7F8#writeProxyContract +Step 1: Visit the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/%s#writeProxyContract#F3 Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function. Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Testnet-Permissionless-db692621a305426bab2e3ad232acbc14 Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your new Reward Address.` + msg = fmt.Sprintf(msg, contractAddr.String()) fmt.Printf("%s %s %s\n", colorLightBlue, msg, colorReset) default: fmt.Println("Unsupported network") } } -func promptHowToChangeReward(cfg *config.StaderConfig) { +func promptHowToChangeReward(cfg *config.StaderConfig, contractAddr common.Address) { network := cfg.StaderNode.Network.Value.(cfTypes.Network) switch network { case cfTypes.Network_Mainnet: msg := ` -For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1#writeProxyContract +For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://etherscan.io/address/%s#writeProxyContract#F10 + Follow these steps for your Reward address change: Step 1: Propose the Reward Address change by connecting your Existing Reward Address wallet with the Smart Contract and execute the "ProposeRewardAddress" function. Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function + Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Mainnet-Permissionless-8ef1137e9c2647c88db3911da1642ca2 + Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your New Reward Address. ` + msg = fmt.Sprintf(msg, contractAddr.String()) fmt.Printf("%s %s %s\n\n", colorLightBlue, msg, colorReset) case cfTypes.Network_Prater: msg := ` -For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/0x14F59038b249AA9f44bC3FB7DBfC291C5B21f7F8#writeProxyContract +For node security, only your existing Reward Address can propose a change. To propose and confirm a Reward Address change, please use the PermissionlessNodeRegistry Smart Contract: https://goerli.etherscan.io/address/%s#writeProxyContract#F10 + Follow these steps for your Reward Address change: Step 1: Propose the Reward Address change by connecting your Existing Reward Address wallet with the Smart Contract and execute the "ProposeRewardAddress" function. Step 2: Confirm the Reward Address change by connecting your New Reward Address wallet with the Smart Contract and execute the "ConfirmRewardAddressChange" function + Please refer to the Reward Address change guide here - https://staderlabs.notion.site/staderlabs/Stader-ETHx-Reward-address-change-flow-Testnet-Permissionless-db692621a305426bab2e3ad232acbc14 + Note: Stader will continue to send rewards to your existing Reward Address until you confirm the change using your New Reward Address. ` + msg = fmt.Sprintf(msg, contractAddr.String()) fmt.Printf("%s %s %s\n\n", colorLightBlue, msg, colorReset) default: fmt.Println("Unsupported network") From 839f69c63c7a60828c617fba9b0d082177e66bb2 Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 16 Oct 2023 15:51:08 +0700 Subject: [PATCH 7/7] Revert "Separate checkpoint url" This reverts commit a89452adf879068ae5cbb3fc426300f358c9cc9c. --- go.mod | 4 +-- go.sum | 8 ++--- .../config/consensus-common-config.go | 35 ------------------- stader-cli/service/configConsensus.go | 16 +-------- stader-cli/service/service.go | 27 +------------- 5 files changed, 8 insertions(+), 82 deletions(-) diff --git a/go.mod b/go.mod index 6bd6458c5..bd773c094 100644 --- a/go.mod +++ b/go.mod @@ -35,8 +35,8 @@ require ( github.com/rivo/tview v0.0.0-20230621164836-6cc0565babaf // indirect github.com/sethvargo/go-password v0.2.0 github.com/shirou/gopsutil/v3 v3.23.1 - github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52 - github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52 + github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc + github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc github.com/tyler-smith/go-bip39 v1.1.0 github.com/urfave/cli v1.22.10 github.com/wealdtech/go-eth2-types/v2 v2.7.0 diff --git a/go.sum b/go.sum index ed35366d7..70e30711c 100644 --- a/go.sum +++ b/go.sum @@ -1231,10 +1231,10 @@ github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7Sr github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= -github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52 h1:Y3ASJLiv/mBbqREUWgOUXLtoce23fsGnXXJrJ8Rw4kI= -github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231013173524-71ae1fe3ea52/go.mod h1:gZcnx3O0sm+mEO2INhKDHw+iUzJH5tPaX4cv5SN5tsQ= -github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52 h1:nK3eQ3qreZBPn7feJS15t31pBShhj1rCV01cBRLE+7k= -github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231013173524-71ae1fe3ea52/go.mod h1:5ojn2lxD9wd5sF0KYaHBDcpUC3ACFgqr0XG1atCIeAs= +github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc h1:vWFxcgi1WU9J2oY6rhUAAQS4R/c1Pbn63rcjyv4Bms4= +github.com/stader-labs/ethcli-ui/configuration v0.0.0-20231010150025-cdbbe61da8dc/go.mod h1:gZcnx3O0sm+mEO2INhKDHw+iUzJH5tPaX4cv5SN5tsQ= +github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc h1:hXzsyqCaeqm0s22ocuzGxs2rflHOg/QoX7zMYHJdGSE= +github.com/stader-labs/ethcli-ui/wizard v0.0.0-20231010150025-cdbbe61da8dc/go.mod h1:5ojn2lxD9wd5sF0KYaHBDcpUC3ACFgqr0XG1atCIeAs= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 h1:Oo2KZNP70KE0+IUJSidPj/BFS/RXNHmKIJOdckzml2E= github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= diff --git a/shared/services/config/consensus-common-config.go b/shared/services/config/consensus-common-config.go index d55d3f616..06005fbbc 100644 --- a/shared/services/config/consensus-common-config.go +++ b/shared/services/config/consensus-common-config.go @@ -25,10 +25,7 @@ import ( // Param IDs const GraffitiID string = "graffiti" - const CheckpointSyncUrlID string = "checkpointSyncUrl" -const CheckpointSyncUrlMainnetID string = "checkpointSyncUrlMainnet" -const CheckpointSyncUrlPraterID string = "checkpointSyncUrlPraters" const P2pPortID string = "p2pPort" const ApiPortID string = "apiPort" const OpenApiPortID string = "openApiPort" @@ -55,12 +52,6 @@ type ConsensusCommonConfig struct { // The checkpoint sync URL if used CheckpointSyncProvider config.Parameter `yaml:"checkpointSyncProvider,omitempty"` - // The checkpoint sync URL if used for mainnet - CheckpointSyncProviderMainnet config.Parameter `yaml:"checkpointSyncProviderMainnet,omitempty"` - - // The checkpoint sync URL if used for the prater - CheckpointSyncProviderPrater config.Parameter `yaml:"checkpointSyncProviderPrater,omitempty"` - // The port to use for gossip traffic P2pPort config.Parameter `yaml:"p2pPort,omitempty"` @@ -105,30 +96,6 @@ func NewConsensusCommonConfig(cfg *StaderConfig) *ConsensusCommonConfig { CanBeBlank: true, OverwriteOnUpgrade: false, }, - CheckpointSyncProviderMainnet: config.Parameter{ - ID: CheckpointSyncUrlMainnetID, - Name: "Checkpoint Sync URL Mainnet", - Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + - "Example: https://:@eth2-beacon-prater.infura.io\n" + - "Leave this blank if you want to sync normally from the start of the chain.", - Type: config.ParameterType_String, - Default: map[config.Network]interface{}{config.Network_All: defaultCheckpointSyncProvider}, - AffectsContainers: []config.ContainerID{config.ContainerID_Eth2}, - CanBeBlank: true, - OverwriteOnUpgrade: false, - }, - CheckpointSyncProviderPrater: config.Parameter{ - ID: CheckpointSyncUrlPraterID, - Name: "Checkpoint Sync URL Prater", - Description: "If you would like to instantly sync using an existing Beacon node, enter its URL.\n" + - "Example: https://:@eth2-beacon-prater.infura.io\n" + - "Leave this blank if you want to sync normally from the start of the chain.", - Type: config.ParameterType_String, - Default: map[config.Network]interface{}{config.Network_All: defaultCheckpointSyncProvider}, - AffectsContainers: []config.ContainerID{config.ContainerID_Eth2}, - CanBeBlank: true, - OverwriteOnUpgrade: false, - }, P2pPort: config.Parameter{ ID: P2pPortID, @@ -185,8 +152,6 @@ func (cfg *ConsensusCommonConfig) GetParameters() []*config.Parameter { return []*config.Parameter{ &cfg.Graffiti, &cfg.CheckpointSyncProvider, - &cfg.CheckpointSyncProviderMainnet, - &cfg.CheckpointSyncProviderPrater, &cfg.P2pPort, &cfg.ApiPort, &cfg.OpenApiPort, diff --git a/stader-cli/service/configConsensus.go b/stader-cli/service/configConsensus.go index af1a7bba2..fcf13492e 100644 --- a/stader-cli/service/configConsensus.go +++ b/stader-cli/service/configConsensus.go @@ -24,7 +24,6 @@ import ( "strings" stdCf "github.com/stader-labs/stader-node/shared/services/config" - "github.com/stader-labs/stader-node/shared/types/config" cfgtypes "github.com/stader-labs/stader-node/shared/types/config" ) @@ -73,14 +72,7 @@ func setUIConsensusClient(cfg *stdCf.StaderConfig, newSettings map[string]interf // Local newSettings[keys.E2cc_lc_common_graffiti] = cfg.ConsensusCommon.Graffiti.Value - network := newSettings[keys.Sn_node_network].(string) - - if network == "Ethereum Mainnet" { - newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value - } else { - newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value - } - + newSettings[keys.E2cc_lc_common_checkpoint_sync_url] = cfg.ConsensusCommon.CheckpointSyncProvider.Value newSettings[keys.E2cc_lc_common_p2p_port] = format(cfg.ConsensusCommon.P2pPort.Value) newSettings[keys.E2cc_lc_common_http_api_port] = format(cfg.ConsensusCommon.ApiPort.Value) newSettings[keys.E2cc_lc_common_expose_api_port] = cfg.ConsensusCommon.OpenApiPort.Value.(bool) @@ -190,12 +182,6 @@ func updateLocalConsensusClient(newCfg *stdCf.StaderConfig, settings map[string] newCfg.ConsensusCommon.OpenApiPort.Value = settings[keys.E2cc_lc_common_expose_api_port] newCfg.ConsensusCommon.DoppelgangerDetection.Value = settings[keys.E2cc_lc_common_doppelganger_detection] - if newCfg.StaderNode.Network.Value.(config.Network) == config.Network_Mainnet { - newCfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = settings[keys.E2cc_lc_common_checkpoint_sync_url] - } else { - newCfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = settings[keys.E2cc_lc_common_checkpoint_sync_url] - } - clientStr, ok := settings[keys.E2cc_lc_consensus_client].(string) if !ok { return fmt.Errorf("Invalid External client %+v", settings[keys.E1ec_lm_execution_client]) diff --git a/stader-cli/service/service.go b/stader-cli/service/service.go index 15240c3d6..3cdd85d8f 100644 --- a/stader-cli/service/service.go +++ b/stader-cli/service/service.go @@ -245,17 +245,7 @@ func UpdateConfig(_cfg *config.StaderConfig, newSettings *pages.SettingsType) (c } cfg.ConsensusCommon.DoppelgangerDetection.Value = ConvertStringToBool(newSettings.ConsensusClient.DoppelgangerProtection) cfg.ConsensusCommon.Graffiti.Value = newSettings.ConsensusClient.Graffit - - switch cfgtypes.Network(newSettings.Network) { - case cfgtypes.Network_Mainnet: - cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = newSettings.ConsensusClient.CheckpointUrlMainnet - cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrlMainnet - case cfgtypes.Network_Prater: - cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = newSettings.ConsensusClient.CheckpointUrlPrater - cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrlPrater - default: - panic("UNSUPPORT NETWORK") - } + cfg.ConsensusCommon.CheckpointSyncProvider.Value = newSettings.ConsensusClient.CheckpointUrl cfg.UseFallbackClients.Value = ConvertStringToBool(newSettings.FallbackClients.SelectionOption) // get the consensus client we are using for fallback @@ -308,19 +298,6 @@ func UpdateConfig(_cfg *config.StaderConfig, newSettings *pages.SettingsType) (c func NewSettingsType(cfg *config.StaderConfig) pages.SettingsType { - checkpointUrlPrater := cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value.(string) - checkpointUrlMainnet := cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value.(string) - - // Set default for older version (< 1.4.0) - // After 1.4.0 w expected to mainnet or prater checkpoint is not empty - if checkpointUrlPrater == "" && checkpointUrlMainnet == "" { - if cfg.StaderNode.Network.Value.(cfgtypes.Network) == cfgtypes.Network_Mainnet { - cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value = cfg.ConsensusCommon.CheckpointSyncProvider.Value - } else { - cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value = cfg.ConsensusCommon.CheckpointSyncProvider.Value - } - } - currentSettings := pages.SettingsType{ Version: shared.StaderVersion, Network: string(cfg.StaderNode.Network.Value.(cfgtypes.Network)), @@ -337,8 +314,6 @@ func NewSettingsType(cfg *config.StaderConfig) pages.SettingsType { ExternalSelection: string(cfg.ExternalConsensusClient.Value.(cfgtypes.ConsensusClient)), Graffit: cfg.ConsensusCommon.Graffiti.Value.(string), CheckpointUrl: cfg.ConsensusCommon.CheckpointSyncProvider.Value.(string), - CheckpointUrlMainnet: cfg.ConsensusCommon.CheckpointSyncProviderMainnet.Value.(string), - CheckpointUrlPrater: cfg.ConsensusCommon.CheckpointSyncProviderPrater.Value.(string), DoppelgangerProtection: ConvertBoolToString(cfg.ConsensusCommon.DoppelgangerDetection.Value.(bool)), External: pages.ConsensusClientExternalType{ Lighthouse: pages.ConsensusClientExternalSelectedLighthouseType{