diff --git a/CHANGELOG.md b/CHANGELOG.md index 2864f2a72..6f59fe9b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- New command `lido-status` to display data of Lido Node Operator. + ### Fixed - Teku and Lighthouse import keys container error on Windows. diff --git a/cli/actions/testdata/getContainers_tests/case_consensusNF/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_consensusNF/docker-compose.yml index 51df73989..ac56f7e60 100644 --- a/cli/actions/testdata/getContainers_tests/case_consensusNF/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_consensusNF/docker-compose.yml @@ -82,7 +82,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_consensusOnly/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_consensusOnly/docker-compose.yml index 99e618c7c..40f670d56 100644 --- a/cli/actions/testdata/getContainers_tests/case_consensusOnly/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_consensusOnly/docker-compose.yml @@ -29,7 +29,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_executionNF/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_executionNF/docker-compose.yml index 6f699fe25..3ada19120 100644 --- a/cli/actions/testdata/getContainers_tests/case_executionNF/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_executionNF/docker-compose.yml @@ -82,7 +82,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_fullNode/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_fullNode/docker-compose.yml index 9d9c127bc..6d941aeaf 100644 --- a/cli/actions/testdata/getContainers_tests/case_fullNode/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_fullNode/docker-compose.yml @@ -82,7 +82,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_fullNodeTag/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_fullNodeTag/docker-compose.yml index 8632b4b54..c69bfdff3 100644 --- a/cli/actions/testdata/getContainers_tests/case_fullNodeTag/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_fullNodeTag/docker-compose.yml @@ -83,7 +83,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_noExecution/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_noExecution/docker-compose.yml index a33b9a9ba..9bf66d4de 100644 --- a/cli/actions/testdata/getContainers_tests/case_noExecution/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_noExecution/docker-compose.yml @@ -44,7 +44,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_noMev/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_noMev/docker-compose.yml index 98debf6ef..043333209 100644 --- a/cli/actions/testdata/getContainers_tests/case_noMev/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_noMev/docker-compose.yml @@ -68,7 +68,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_noValidator/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_noValidator/docker-compose.yml index f06ba0ab1..a2da0cc7b 100644 --- a/cli/actions/testdata/getContainers_tests/case_noValidator/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_noValidator/docker-compose.yml @@ -82,7 +82,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/actions/testdata/getContainers_tests/case_validatorNF/docker-compose.yml b/cli/actions/testdata/getContainers_tests/case_validatorNF/docker-compose.yml index 72761b190..2d25dc82b 100644 --- a/cli/actions/testdata/getContainers_tests/case_validatorNF/docker-compose.yml +++ b/cli/actions/testdata/getContainers_tests/case_validatorNF/docker-compose.yml @@ -82,7 +82,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/lidoStatus.go b/cli/lidoStatus.go new file mode 100644 index 000000000..eb32f83b5 --- /dev/null +++ b/cli/lidoStatus.go @@ -0,0 +1,335 @@ +/* +Copyright 2022 Nethermind + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package cli + +import ( + "errors" + "flag" + "fmt" + "math/big" + "sort" + "time" + + "github.com/NethermindEth/sedge/internal/lido/contracts" + bonds "github.com/NethermindEth/sedge/internal/lido/contracts/csaccounting" + rewards "github.com/NethermindEth/sedge/internal/lido/contracts/csfeedistributor" + "github.com/NethermindEth/sedge/internal/lido/contracts/csmodule" + "github.com/NethermindEth/sedge/internal/ui" + "github.com/gosuri/uiprogress" + "github.com/shopspring/decimal" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +type lidoData struct { + nodeID *big.Int + nodeInfo csmodule.NodeOperator + keys csmodule.Keys + bondInfo bonds.BondInfo + rewards *big.Int +} + +var ( + rewardAddress string + networkName string + longDescriptions bool + nodeIDInt int64 +) + +const ( + nodeOpInfo = `Node Operator Info` + keysInfo = `Keys` + queueInfo = `Queue` + bondInfo = `Bond` + rewardsInfo = `Rewards` +) + +func LidoStatusCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "lido-status [flags] [args]", + Short: "Display status and information of Lido Node Operator", + Long: `This command retrieves and displays the status and detailed information of Lido Node Operators. + +This information includes: +- Node Operator ID. +- Keys and queue information: available for deposit (in the queue), stuck, refunded, exited, deposited. +- Bond and rewards information: total amount, amounts lower and higher than required, non-claimed rewards. + +Valid args: reward address of Node Operator (rewards recipient)`, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) > 0 { + if cobra.ExactArgs(1)(cmd, args) != nil { + return errors.New("requires one argument") + } + rewardAddress = args[0] + } + return nil + }, + PreRunE: func(cmd *cobra.Command, args []string) error { + if err := ui.EthAddressValidator(rewardAddress, false); err != nil && len(args) != 0 { + return err + } + if len(args) == 0 && nodeIDInt < 0 { + return errors.New("must provide reward address or node ID") + } + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + if err := runListLidoStatusCmd(cmd, args); err != nil { + return err + } + + return nil + }, + } + cmd.Flags().StringVarP(&networkName, "network", "n", "holesky", "Target network. e.g. holesky, mainnet etc.") + cmd.Flags().BoolVar(&longDescriptions, "l", false, "Show detailed descriptions for each value") + cmd.Flags().Int64VarP(&nodeIDInt, "nodeID", "i", -1, "Your Node Operator ID (optional)") + cmd.Flags().SortFlags = false + return cmd +} + +func runListLidoStatusCmd(cmd *cobra.Command, args []string) error { + log.Infof("Retrieving Lido Node Operator Information\n") + + nodeData, err := nodeData() + if err != nil { + return err + } + dataMap := buildLidoData(nodeData) + + // Extract headers and sort by weight + headers := make([]string, 0, len(dataMap)) + for header := range dataMap { + headers = append(headers, header) + } + + // Sort headers by their weights + sort.SliceStable(headers, func(i, j int) bool { + return dataMap[headers[i]].weight < dataMap[headers[j]].weight + }) + + log.Infof("Listing Node Operator Information") + for _, header := range headers { + ui.WriteLidoStatusTable(cmd.OutOrStdout(), dataMap[header].data, header) + } + return nil +} + +// Get the data for the Node Operator +func nodeData() (*lidoData, error) { + nodeData := &lidoData{} + var nodeID *big.Int + var err error + + steps := []string{ + "Fetching NO Info", + "Fetching Keys & Queue", + "Fetching Bond Info", + "Fetching Rewards Data", + } + + if !isTestEnv() { + uiprogress.Start() + } + + bar := uiprogress.AddBar(len(steps)).AppendCompleted() + // Progress bar label setup + bar.PrependFunc(func(b *uiprogress.Bar) string { + if b.Current() > 0 { + return steps[b.Current()-1] + } + return "Retrieving Node Operator.." + }) + + if nodeIDInt < 0 { + nodeID, err = csmodule.NodeID(networkName, rewardAddress) + if err != nil { + return nodeData, err + } + } else { + nodeID = big.NewInt(nodeIDInt) + } + bar.Incr() + + nodeInfo, err := csmodule.NodeOperatorInfo(networkName, nodeID) + if err != nil { + return nodeData, err + } + time.Sleep(time.Second / 10) + bar.Incr() + + keys, err := csmodule.KeysStatus(networkName, nodeID) + if err != nil { + return nodeData, err + } + time.Sleep(time.Second / 10) + bar.Incr() + + bond, err := bonds.BondSummary(networkName, nodeID) + if err != nil { + return nodeData, err + } + time.Sleep(time.Second / 10) + bar.Incr() + + reward, err := rewards.Rewards(networkName, nodeID) + if err != nil { + return nodeData, err + } + time.Sleep(time.Second / 10) + bar.Incr() + + if !isTestEnv() { + uiprogress.Stop() + } + + nodeData.nodeID = nodeID + nodeData.nodeInfo = nodeInfo + nodeData.keys = keys + nodeData.bondInfo = bond + nodeData.rewards = reward + + return nodeData, nil +} + +// Structure the data to be displayed +func buildLidoData(node *lidoData) map[string]struct { + data []string + weight int +} { + var nodeOpDetailed, keysDetailed, queueDetailed, bondDetailed, rewardsDetailed string + var currentBond, requiredBond, excessBond, missedBond, rewards decimal.Decimal + rewardAddressLink := fmt.Sprintf(`https://etherscan.io/address/%s`, node.nodeInfo.RewardAddress) + claimRewardsLink := fmt.Sprintf(`https://%s.etherscan.io/address/%s#writeProxyContract#F10`, networkName, contracts.DeployedAddresses(contracts.CSModule)[networkName]) + + detailedDescriptions := map[string]string{ + nodeOpInfo: ` +## Description +- Node Operator ID: Unique identifier for the node operator. +- Reward Address: Address that is the ultimate recipient of the rewards +- Manager Address: Address used to perform routine management operations regarding the CSM Node Operator.`, + + keysInfo: ` +## Description +- Stuck Keys Count: Number of keys stuck in the system. A validator is considered to be "stuck" if it has not been exited timely following an exit signal from the protocol. +- Refunded Keys Count: Number of keys that were refunded. +- Exited Keys Count: Number of keys that have exited. +- Deposited Keys Count: Number of keys currently deposited. +- Depositable Keys Count: Number of keys eligible for deposits.`, + + queueInfo: ` +## Description +- Keys in the deposit queue: Number of the depositable keys that are in the deposit queue.`, + + bondInfo: ` +## Description +- Bond : a security collateral that Node Operators must submit before uploading validator keys into CSM. It covers possible losses caused by inappropriate actions on the Node Operator's side. +- Current Bond: The current amount of bonded ETH. +- Required Bond: The required amount of ETH to maintain. +- Excess Bond: The amount of excess bond over the required amount. +- Missed Bond: The amount of bond that is missing.`, + + rewardsInfo: ` +## Description +- Non-claimed Rewards: The amount of rewards available for claiming.`, + } + + if longDescriptions { + nodeOpDetailed = detailedDescriptions[nodeOpInfo] + keysDetailed = detailedDescriptions[keysInfo] + queueDetailed = detailedDescriptions[queueInfo] + bondDetailed = detailedDescriptions[bondInfo] + rewardsDetailed = detailedDescriptions[rewardsInfo] + currentBond = weiToEth(node.bondInfo.Current) + excessBond = weiToEth(node.bondInfo.Excess) + missedBond = weiToEth(node.bondInfo.Missed) + requiredBond = weiToEth(node.bondInfo.Required) + rewards = weiToEth(node.rewards) + } else { + currentBond = weiToEth(node.bondInfo.Current).Round(1) + excessBond = weiToEth(node.bondInfo.Excess).Round(1) + missedBond = weiToEth(node.bondInfo.Missed).Round(1) + requiredBond = weiToEth(node.bondInfo.Required).Round(1) + rewards = weiToEth(node.rewards).Round(1) + } + + data := map[string]struct { + data []string + weight int + }{ + nodeOpInfo: { + data: []string{ + fmt.Sprintf(`- **Node Operator ID:** %s`, node.nodeID.String()), + fmt.Sprintf(`- **Reward Address:** %s`, node.nodeInfo.RewardAddress.String()), + fmt.Sprintf(`- **Manager Address:** %s`, node.nodeInfo.ManagerAddress.String()), + fmt.Sprintf(`- [Reward Address Link on etherscan](%s)`, rewardAddressLink), + nodeOpDetailed, + }, + weight: 1, + }, + keysInfo: { + data: []string{ + fmt.Sprintf(`- **Stuck Keys Count:** %s`, node.keys.StuckValidatorsCount.String()), + fmt.Sprintf(`- **Refunded Keys Count:** %s`, node.keys.RefundedValidatorsCount.String()), + fmt.Sprintf(`- **Exited Keys Count:** %s`, node.keys.ExitedValidators.String()), + fmt.Sprintf(`- **Deposited Keys Count:** %s`, node.keys.DepositedValidators.String()), + fmt.Sprintf(`- **Depositable Keys Count:** %s`, node.keys.DepositableValidatorsCount.String()), + keysDetailed, + }, + weight: 2, + }, + queueInfo: { + data: []string{ + fmt.Sprintf(`- **Keys in the deposit queue:** %d`, node.nodeInfo.EnqueuedCount), + queueDetailed, + }, + weight: 3, + }, + bondInfo: { + data: []string{ + fmt.Sprintf(`- **Current Bond:** %s ETH`, currentBond.String()), + fmt.Sprintf(`- **Required Bond:** %s ETH`, requiredBond.String()), + fmt.Sprintf(`- **Excess Bond:** %s ETH`, excessBond.String()), + fmt.Sprintf(`- **Missed Bond:** %s ETH`, missedBond.String()), + bondDetailed, + }, + weight: 4, + }, + rewardsInfo: { + data: []string{ + fmt.Sprintf(`- **Non-claimed Rewards:** %s ETH`, rewards.String()), + fmt.Sprintf(`- [Claim your rewards here!](%s)`, claimRewardsLink), + rewardsDetailed, + }, + weight: 5, + }, + } + + return data +} + +// Convert Wei to Ether +func weiToEth(wei *big.Int) decimal.Decimal { + weiToEther := decimal.NewFromBigInt(big.NewInt(1e18), 0) + weiDecimal := decimal.NewFromBigInt(wei, 0) + return weiDecimal.Div(weiToEther) +} + +// Used to disable progress bar when running tests +func isTestEnv() bool { + return flag.Lookup("test.v") != nil +} diff --git a/cli/lidoStatus_test.go b/cli/lidoStatus_test.go new file mode 100644 index 000000000..e65851921 --- /dev/null +++ b/cli/lidoStatus_test.go @@ -0,0 +1,192 @@ +/* +Copyright 2022 Nethermind + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package cli + +import ( + "bytes" + "io" + "math/big" + "strconv" + "testing" + + "github.com/shopspring/decimal" + log "github.com/sirupsen/logrus" +) + +type flags struct { + rewardAddress string + networkName string + longDescriptions bool + nodeIDInt int64 +} + +type lidoStatusCmdTestCase struct { + name string + flags flags + isErr bool +} + +func (f flags) argsList() []string { + s := make([]string, 0) + s = append(s, f.rewardAddress) + if f.networkName != "" { + s = append(s, "--network", f.networkName) + } + if f.longDescriptions { + s = append(s, "--l") + } + if f.nodeIDInt >= 0 { + s = append(s, "--nodeID", strconv.FormatInt(f.nodeIDInt, 10)) + } + + return s +} + +func TestLidoStatusCmd(t *testing.T) { + tcs := []lidoStatusCmdTestCase{ + { + name: "valid lido-status flags with long descriptions, Holesky", + flags: flags{ + rewardAddress: "0xC870Fd7316956C1582A2c8Fd2c42552cCEC70C88", + networkName: "holesky", + longDescriptions: true, + }, + isErr: false, + }, + { + name: "valid lido-status flags, Holesky", + flags: flags{ + rewardAddress: "0x22bA5CaFB5E26E6Fe51f330294209034013A5A4c", + networkName: "holesky", + }, + isErr: false, + }, + { + name: "Invalid: missing address, Holesky", + flags: flags{ + networkName: "holesky", + }, + isErr: true, + }, + { + name: "Invalid: incorrect address, Holesky", + flags: flags{ + rewardAddress: "0xC870Fd", + networkName: "holesky", + }, + isErr: true, + }, + { + name: "Invalid: address missing 0x prefix, Holesky", + flags: flags{ + rewardAddress: "22bA5CaFB5E26E6Fe51f330294209034013A5A4c", + networkName: "holesky", + }, + isErr: true, + }, + { + name: "Valid node ID, Holesky", + flags: flags{ + networkName: "holesky", + nodeIDInt: 1, + }, + isErr: true, + }, + { + name: "Invalid: negative node ID, Holesky", + flags: flags{ + networkName: "holesky", + nodeIDInt: -2, + }, + isErr: true, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + log.SetOutput(io.Discard) + logsOut := new(bytes.Buffer) + tableOut := new(bytes.Buffer) + rootCmd := RootCmd() + rootCmd.SetOut(tableOut) + rootCmd.AddCommand(LidoStatusCmd()) + argsL := append([]string{"lido-status"}, tc.flags.argsList()...) + rootCmd.SetArgs(argsL) + initLogging() + log.SetOutput(logsOut) + rootCmd.SetOutput(io.Discard) + err := rootCmd.Execute() + if tc.isErr && err == nil { + t.Error("sedge lido-status expected to fail") + } else if !tc.isErr && err != nil { + t.Errorf("sedge lido-status failed: %v", err) + } + }) + } +} + +func TestWeiToEth(t *testing.T) { + tests := []struct { + name string + wei *big.Int + expected decimal.Decimal + }{ + { + name: "100 Wei", + wei: big.NewInt(100), + expected: decimal.NewFromFloat(0.0000000000000001), + }, + { + name: "1,000 Wei", + wei: big.NewInt(1000), + expected: decimal.NewFromFloat(0.000000000000001), + }, + { + name: "50,000 Wei", + wei: big.NewInt(50000), + expected: decimal.NewFromFloat(0.00000000000005), + }, + { + name: "0 Wei", + wei: big.NewInt(0), + expected: decimal.NewFromFloat(0), + }, + { + name: "expected 1 ETH", + wei: new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil), + expected: decimal.NewFromFloat(1), + }, + { + name: "expected 1.5 ETH", + wei: new(big.Int).Set(new(big.Int).Mul(big.NewInt(15), new(big.Int).Exp(big.NewInt(10), big.NewInt(17), nil))), + expected: decimal.NewFromFloat(1.5), + }, + { + name: "expected 200 ETH", + wei: new(big.Int).Set(new(big.Int).Mul(big.NewInt(200), new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))), + expected: decimal.NewFromFloat(200), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := weiToEth(tt.wei) + if !result.Equal(tt.expected) { + t.Errorf("weiToEth(%v) = %v; expected %v", tt.wei, result, tt.expected) + } + }) + } +} diff --git a/cli/testdata/down_tests/case_1/sedge-data/.env b/cli/testdata/down_tests/case_1/sedge-data/.env index 7879f0553..7903f2514 100644 --- a/cli/testdata/down_tests/case_1/sedge-data/.env +++ b/cli/testdata/down_tests/case_1/sedge-data/.env @@ -14,7 +14,6 @@ NETHERMIND_ETHSTATSCONFIG_NAME=Nethermind NETHERMIND_ETHSTATSCONFIG_SECRET=secret NETHERMIND_ETHSTATSCONFIG_CONTACT=hello@nethermind.io EC_DATA_DIR=./execution-data -CC_PEER_COUNT=50 CC_LOG_LEVEL=info NETWORK=mainnet EC_NODE=http://localhost:8545 diff --git a/cli/testdata/down_tests/case_1/sedge-data/docker-compose.yml b/cli/testdata/down_tests/case_1/sedge-data/docker-compose.yml index d337595c7..1d73043fd 100644 --- a/cli/testdata/down_tests/case_1/sedge-data/docker-compose.yml +++ b/cli/testdata/down_tests/case_1/sedge-data/docker-compose.yml @@ -61,7 +61,6 @@ services: - --logging=${CC_LOG_LEVEL} - --network=${NETWORK} - --p2p-port=9000 - - --p2p-peer-upper-bound=${CC_PEER_COUNT} - --rest-api-host-allowlist=* - --rest-api-enabled=true - --rest-api-port=4000 diff --git a/cli/testdata/logs_tests/case_1/sedge-data/.env b/cli/testdata/logs_tests/case_1/sedge-data/.env index 7879f0553..7903f2514 100644 --- a/cli/testdata/logs_tests/case_1/sedge-data/.env +++ b/cli/testdata/logs_tests/case_1/sedge-data/.env @@ -14,7 +14,6 @@ NETHERMIND_ETHSTATSCONFIG_NAME=Nethermind NETHERMIND_ETHSTATSCONFIG_SECRET=secret NETHERMIND_ETHSTATSCONFIG_CONTACT=hello@nethermind.io EC_DATA_DIR=./execution-data -CC_PEER_COUNT=50 CC_LOG_LEVEL=info NETWORK=mainnet EC_NODE=http://localhost:8545 diff --git a/cli/testdata/logs_tests/case_1/sedge-data/docker-compose.yml b/cli/testdata/logs_tests/case_1/sedge-data/docker-compose.yml index d337595c7..1d73043fd 100644 --- a/cli/testdata/logs_tests/case_1/sedge-data/docker-compose.yml +++ b/cli/testdata/logs_tests/case_1/sedge-data/docker-compose.yml @@ -61,7 +61,6 @@ services: - --logging=${CC_LOG_LEVEL} - --network=${NETWORK} - --p2p-port=9000 - - --p2p-peer-upper-bound=${CC_PEER_COUNT} - --rest-api-host-allowlist=* - --rest-api-enabled=true - --rest-api-port=4000 diff --git a/cli/testdata/run_tests/no_env/docker-compose.yml b/cli/testdata/run_tests/no_env/docker-compose.yml index 41a203c61..08a694214 100644 --- a/cli/testdata/run_tests/no_env/docker-compose.yml +++ b/cli/testdata/run_tests/no_env/docker-compose.yml @@ -85,7 +85,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/testdata/run_tests/no_services/.env b/cli/testdata/run_tests/no_services/.env index 8b6e44601..7d2b7688a 100644 --- a/cli/testdata/run_tests/no_services/.env +++ b/cli/testdata/run_tests/no_services/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/cli/testdata/run_tests/no_version/.env b/cli/testdata/run_tests/no_version/.env index 8b6e44601..7d2b7688a 100644 --- a/cli/testdata/run_tests/no_version/.env +++ b/cli/testdata/run_tests/no_version/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/cli/testdata/run_tests/no_version/docker-compose.yml b/cli/testdata/run_tests/no_version/docker-compose.yml index a23d4e0d3..01cd34913 100644 --- a/cli/testdata/run_tests/no_version/docker-compose.yml +++ b/cli/testdata/run_tests/no_version/docker-compose.yml @@ -84,7 +84,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cli/testdata/run_tests/valid/.env b/cli/testdata/run_tests/valid/.env index 8b6e44601..7d2b7688a 100644 --- a/cli/testdata/run_tests/valid/.env +++ b/cli/testdata/run_tests/valid/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/cli/testdata/run_tests/valid/docker-compose.yml b/cli/testdata/run_tests/valid/docker-compose.yml index a23d4e0d3..01cd34913 100644 --- a/cli/testdata/run_tests/valid/docker-compose.yml +++ b/cli/testdata/run_tests/valid/docker-compose.yml @@ -84,7 +84,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/cmd/sedge/main.go b/cmd/sedge/main.go index 9d6ab974f..746521228 100644 --- a/cmd/sedge/main.go +++ b/cmd/sedge/main.go @@ -74,6 +74,7 @@ func main() { cli.GenerateCmd(sedgeActions), cli.DependenciesCommand(depsMgr), cli.ShowCmd(cmdRunner, sedgeActions, depsMgr), + cli.LidoStatusCmd(), ) sedgeCmd.SilenceErrors = true sedgeCmd.SilenceUsage = true diff --git a/configs/networks.go b/configs/networks.go index a5a51a889..251b03d9b 100644 --- a/configs/networks.go +++ b/configs/networks.go @@ -18,6 +18,7 @@ package configs import ( "errors" "fmt" + "math/rand" "time" ) @@ -75,5 +76,15 @@ func GetPublicRPCs(network string) ([]string, error) { if !exists { return nil, fmt.Errorf("invalid network") } - return rpcs.PublicRPCs, nil + // Create a copy of the slice to avoid modifying the original + shuffledRPCs := make([]string, len(rpcs.PublicRPCs)) + copy(shuffledRPCs, rpcs.PublicRPCs) + + // Shuffle the slice to randomize the order + rand.Seed(time.Now().UnixNano()) + rand.Shuffle(len(shuffledRPCs), func(i, j int) { + shuffledRPCs[i], shuffledRPCs[j] = shuffledRPCs[j], shuffledRPCs[i] + }) + + return shuffledRPCs, nil } diff --git a/e2e/lidoStatus_test.go b/e2e/lidoStatus_test.go new file mode 100644 index 000000000..a9aaa3534 --- /dev/null +++ b/e2e/lidoStatus_test.go @@ -0,0 +1,146 @@ +package e2e + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestLidoStatus_ValidFlags(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "0x22bA5CaFB5E26E6Fe51f330294209034013A5A4c", "--l", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + assert.NoError(t, runErr, "lido status command should succeed with the given arguments") + }, + ) + // Run test case + e2eTest.run() +} + +func TestLidoStatus_ValidNodeID(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "--nodeID", "1", "--l", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + assert.NoError(t, runErr, "lido status command should succeed with the given arguments") + }, + ) + // Run test case + e2eTest.run() +} + +func TestLidoStatus_InvalidNodeID(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "--nodeID", "-2", "--l", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + // Node ID can't be a negative value + assert.Error(t, runErr, "lido status command should fail") + }, + ) + // Run test case + e2eTest.run() +} + +func TestLidoStatus_InvalidRewardAddress(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "0xccb", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + assert.Error(t, runErr, "lido status command should fail") + }, + ) + // Run test case + e2eTest.run() +} + +func TestLidoStatus_RewardAddressNotFound(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "0xC870Fd7316956C1582A2c8Fd2c42552cCEC70C89", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + assert.Error(t, runErr, "lido status command should fail") + }, + ) + // Run test case + e2eTest.run() +} + +func TestLidoStatus_InvalidZeroRewardAddress(t *testing.T) { + // Test context + var ( + runErr error + ) + // Build test case + e2eTest := newE2ETestCase( + t, + // Arrange + nil, + // Act + func(t *testing.T, binaryPath string, dataDirPath string) { + runErr = runCommand(t, binaryPath, "lido-status", "0x0000000000000000000000000000000000000000", "--network", "holesky") + }, + // Assert + func(t *testing.T, dataDirPath string) { + assert.Error(t, runErr, "lido status command should fail") + }, + ) + // Run test case + e2eTest.run() +} diff --git a/go.mod b/go.mod index 9144927df..700475341 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/alexeyco/simpletable v1.0.0 github.com/antonfisher/nested-logrus-formatter v1.3.1 github.com/cenkalti/backoff/v4 v4.2.0 + github.com/charmbracelet/glamour v0.8.0 github.com/compose-spec/compose-go v1.12.0 github.com/distribution/reference v0.5.0 github.com/docker/docker v24.0.7+incompatible @@ -14,6 +15,7 @@ require ( github.com/golang/mock v1.6.0 github.com/google/go-github/v47 v47.1.0 github.com/google/uuid v1.4.0 + github.com/gosuri/uiprogress v0.0.1 github.com/herumi/bls-eth-go-binary v1.29.1 github.com/jarcoal/httpmock v1.2.0 github.com/joho/godotenv v1.5.1 @@ -23,6 +25,7 @@ require ( github.com/protolambda/zrnt v0.32.2 github.com/protolambda/ztyp v0.2.2 github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 + github.com/shopspring/decimal v1.4.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.6.1 github.com/stretchr/testify v1.9.0 @@ -39,8 +42,13 @@ require ( require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/StackExchange/wmi v1.2.1 // indirect + github.com/alecthomas/chroma/v2 v2.14.0 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/aymerick/douceur v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/charmbracelet/lipgloss v0.12.1 // indirect + github.com/charmbracelet/x/ansi v0.1.4 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect @@ -49,6 +57,7 @@ require ( github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/distribution/distribution/v3 v3.0.0-20230223072852-e5d5810851d1 // indirect + github.com/dlclark/regexp2 v1.11.0 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -59,28 +68,34 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/gorilla/css v1.0.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect + github.com/gosuri/uilive v0.0.4 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kilic/bls12-381 v0.1.0 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-shellwords v1.0.12 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect + github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect github.com/morikuni/aec v1.0.0 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/protolambda/bls12-381-util v0.1.0 // indirect - github.com/rivo/uniseg v0.4.4 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -91,10 +106,12 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + github.com/yuin/goldmark v1.7.4 // indirect + github.com/yuin/goldmark-emoji v1.0.3 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 7ca5a72ba..57b6e9aff 100644 --- a/go.sum +++ b/go.sum @@ -12,10 +12,22 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= +github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= +github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= +github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alexeyco/simpletable v1.0.0 h1:ZQ+LvJ4bmoeHb+dclF64d0LX+7QAi7awsfCrptZrpHk= github.com/alexeyco/simpletable v1.0.0/go.mod h1:VJWVTtGUnW7EKbMRH8cE13SigKGx/1fO2SeeOiGeBkk= github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ= github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= +github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= @@ -30,6 +42,14 @@ github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= +github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= +github.com/charmbracelet/lipgloss v0.12.1 h1:/gmzszl+pedQpjCOH+wFkZr/N90Snz40J/NR7A0zQcs= +github.com/charmbracelet/lipgloss v0.12.1/go.mod h1:V2CiwIuhx9S1S1ZlADfOj9HmxeMAORuz5izHb0zGbB8= +github.com/charmbracelet/x/ansi v0.1.4 h1:IEU3D6+dWwPSgZ6HBH+v6oUuZ/nVawMiWj5831KfiLM= +github.com/charmbracelet/x/ansi v0.1.4/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4 h1:6KzMkQeAF56rggw2NZu1L+TH7j9+DM1/2Kmh7KUxg1I= +github.com/charmbracelet/x/exp/golden v0.0.0-20240715153702-9ba8adf781c4/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= @@ -68,6 +88,8 @@ github.com/distribution/distribution/v3 v3.0.0-20230223072852-e5d5810851d1 h1:Ot github.com/distribution/distribution/v3 v3.0.0-20230223072852-e5d5810851d1/go.mod h1:r5XLH1cp+Wau2jxdptkYsFvvvzPPQTIe8eUuQ0vq30Q= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= @@ -121,12 +143,20 @@ github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3 github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= +github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY= +github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI= +github.com/gosuri/uiprogress v0.0.1 h1:0kpv/XY/qTmFWl/SkaJykZXrBBzwwadmW8fRb7RJSxw= +github.com/gosuri/uiprogress v0.0.1/go.mod h1:C1RTYn4Sc7iEyf6j8ft5dyoZ4212h8G1ol9QQluh5+0= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/herumi/bls-eth-go-binary v1.29.1 h1:XcNSHYTyNjEUVfWDCE2gtG5r95biTwd7MJUJF09LtSE= github.com/herumi/bls-eth-go-binary v1.29.1/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= @@ -168,6 +198,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -176,8 +208,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= @@ -186,6 +218,8 @@ github.com/maxatome/go-testdeep v1.11.0 h1:Tgh5efyCYyJFGUYiT0qxBSIDeXw0F5zSoatlo github.com/maxatome/go-testdeep v1.11.0/go.mod h1:011SgQ6efzZYAen6fDn4BqQ+lUR72ysdyKe7Dyogw70= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= +github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -199,6 +233,10 @@ github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= +github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a h1:2MaM6YC3mGu54x+RKAA6JiFFHlHDY1UbkxqppT7wYOg= +github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -234,8 +272,8 @@ github.com/protolambda/ztyp v0.2.2 h1:rVcL3vBu9W/aV646zF6caLS/dyn9BN8NYiuJzicLNy github.com/protolambda/ztyp v0.2.2/go.mod h1:9bYgKGqg3wJqT9ac1gI2hnVb0STQq7p/1lapqrqY1dU= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= @@ -246,6 +284,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 h1:WCcC4vZDS1tYNxjWlwRJZQy28r8CM github.com/santhosh-tekuri/jsonschema/v5 v5.2.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= @@ -292,12 +332,17 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= +github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark-emoji v1.0.3 h1:aLRkLHOuBR2czCY4R8olwMjID+tENfhyFDMCRhbIQY4= +github.com/yuin/goldmark-emoji v1.0.3/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -309,8 +354,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -337,16 +382,16 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/lido/contracts/contractsAddress.go b/internal/lido/contracts/contractsAddress.go index 0389d57b9..3f4dcddef 100644 --- a/internal/lido/contracts/contractsAddress.go +++ b/internal/lido/contracts/contractsAddress.go @@ -15,7 +15,13 @@ limitations under the License. */ package contracts -import "github.com/NethermindEth/sedge/configs" +import ( + "fmt" + + "github.com/NethermindEth/sedge/configs" +) + +type address = map[string]string const ( // Contract names @@ -25,7 +31,7 @@ const ( MEVBoostRelayAllowedList = "mevboostrelayallowedlist" ) -var deployedAddresses = map[string]map[string]string{ +var deployedAddresses = map[string]address{ CSModule: { configs.NetworkHolesky: "0x4562c3e63c2e586cD1651B958C22F88135aCAd4f", }, @@ -41,6 +47,14 @@ var deployedAddresses = map[string]map[string]string{ }, } -func DeployedAddresses(contractName string) map[string]string { +func DeployedAddresses(contractName string) address { return deployedAddresses[contractName] } + +func ContractAddressByNetwork(contractName, network string) (string, error) { + address, found := deployedAddresses[contractName][network] + if !found { + return "", fmt.Errorf("no contract code at network %s, please double check a smart contract is deployed on given network", network) + } + return address, nil +} diff --git a/internal/lido/contracts/csaccounting/bonds.go b/internal/lido/contracts/csaccounting/bonds.go index 4e5542b4a..44d2db2bb 100644 --- a/internal/lido/contracts/csaccounting/bonds.go +++ b/internal/lido/contracts/csaccounting/bonds.go @@ -21,6 +21,7 @@ import ( "github.com/NethermindEth/sedge/internal/lido/contracts" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" ) // BondInfo : Struct represent bond info of Node Operator @@ -50,14 +51,15 @@ func BondSummary(network string, nodeID *big.Int) (BondInfo, error) { return bondsInfo, fmt.Errorf("node ID value out-of-bounds: can't be negative") } - contract, err := csAccountingContract(network) + contract, client, err := csAccountingContract(network) if err != nil { return bondsInfo, fmt.Errorf("failed to call csAccountingContract: %w", err) } + defer client.Close() result, err := contract.GetBondSummary(nil, nodeID) if err != nil { - return bondsInfo, fmt.Errorf("failed to call GetBondSummary: %w", err) + return bondsInfo, fmt.Errorf("failed to call GetBondSummary contract method: %w", err) } bondsInfo.Current = result.Current bondsInfo.Required = result.Required @@ -79,18 +81,23 @@ func BondSummary(network string, nodeID *big.Int) (BondInfo, error) { return bondsInfo, nil } -func csAccountingContract(network string) (*Csaccounting, error) { +func csAccountingContract(network string) (*Csaccounting, *ethclient.Client, error) { client, err := contracts.ConnectClient(network) if err != nil { - return nil, fmt.Errorf("failed to connect to client: %w", err) + return nil, nil, fmt.Errorf("failed to connect to client: %w", err) } - defer client.Close() contractName := contracts.CSAccounting - address := common.HexToAddress(contracts.DeployedAddresses(contractName)[network]) + + contractAddress, err := contracts.ContractAddressByNetwork(contractName, network) + if err != nil { + return nil, nil, fmt.Errorf("failed to get deployed contract address: %w", err) + } + + address := common.HexToAddress(contractAddress) contract, err := NewCsaccounting(address, client) if err != nil { - return nil, fmt.Errorf("failed to create CSAccounting instance: %w", err) + return nil, nil, fmt.Errorf("failed to create CSAccounting instance: %w", err) } - return contract, nil + return contract, client, nil } diff --git a/internal/lido/contracts/csfeedistributor/rewards.go b/internal/lido/contracts/csfeedistributor/rewards.go index f57476e26..2ddc1f2a7 100644 --- a/internal/lido/contracts/csfeedistributor/rewards.go +++ b/internal/lido/contracts/csfeedistributor/rewards.go @@ -26,6 +26,7 @@ import ( bond "github.com/NethermindEth/sedge/internal/lido/contracts/csaccounting" "github.com/NethermindEth/sedge/internal/utils" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" ) // Tree : struct that reperesents Merkle Tree data @@ -60,17 +61,17 @@ func Rewards(network string, nodeID *big.Int) (*big.Int, error) { treeCID, err := treeCID(network) if err != nil { - return nil, fmt.Errorf("failed to call treeCID: %w", err) + return nil, fmt.Errorf("error getting treeCID: %w", err) } shares, err := cumulativeFeeShares(treeCID, nodeID) if err != nil { - return nil, fmt.Errorf("failed to call cumulativeFeeShares: %w", err) + return nil, fmt.Errorf("error getting Node Operator shares: %w", err) } bondInfo, err := bond.BondSummary(network, nodeID) if err != nil { - return nil, fmt.Errorf("failed to call BondSummary: %w", err) + return nil, fmt.Errorf("error getting Node Operator bond: %w", err) } rewards = new(big.Int).Add(bondInfo.Excess, shares) @@ -81,45 +82,32 @@ func cumulativeFeeShares(treeCID string, nodeID *big.Int) (*big.Int, error) { // Get tree data from IPFS treeData, err := treeData(treeCID) if err != nil { - return nil, fmt.Errorf("failed to call treeData: %v", err) + return nil, fmt.Errorf("error getting tree data: %v", err) } - // Compare nodeOperatorID in tree with nodeId to get shares - // Binary search for the nodeOperatorId - low, high := 0, len(treeData.Values)-1 - for low <= high { - mid := (low + high) / 2 - nodeOperatorId, err := convertTreeValuesToBigInt(treeData.Values[mid].Value[0]) - if err != nil { - return nil, fmt.Errorf("failed to convert nodeOperatorId: %v", err) - } - cmp := nodeOperatorId.Cmp(nodeID) - if cmp == 0 { - // Node operator ID matches, return the shares - shares, err := convertTreeValuesToBigInt(treeData.Values[mid].Value[1]) - if err != nil { - return nil, fmt.Errorf("failed to convert shares: %v", err) - } - return shares, nil - } else if cmp < 0 { - low = mid + 1 - } else { - high = mid - 1 - } + index, err := binarySearchNodeID(nodeID, treeData) + if err != nil { + return nil, fmt.Errorf("failed to find node ID: %v", err) + } + + shares, err := convertTreeValuesToBigInt(treeData.Values[index].Value[1]) + if err != nil { + return nil, fmt.Errorf("failed to convert shares: %v", err) } - return nil, fmt.Errorf("invalid nodeId") + return shares, nil } func treeCID(network string) (string, error) { var treeCIDString string - contract, err := csFeeDistributorContract(network) + contract, client, err := csFeeDistributorContract(network) if err != nil { return treeCIDString, fmt.Errorf("failed to call csFeeDistributorContract: %w", err) } + defer client.Close() treeCIDString, err = contract.TreeCid(nil) if err != nil { - return treeCIDString, fmt.Errorf("failed to call TreeCid: %w", err) + return treeCIDString, fmt.Errorf("failed to call TreeCid contract method: %w", err) } return treeCIDString, nil } @@ -153,18 +141,44 @@ func convertTreeValuesToBigInt(value interface{}) (*big.Int, error) { return bigIntValue, nil } -func csFeeDistributorContract(network string) (*Csfeedistributor, error) { +func binarySearchNodeID(nodeID *big.Int, treeData Tree) (int, error) { + // Compare nodeOperatorID in tree with nodeId to get shares + low, high := 0, len(treeData.Values)-1 + for low <= high { + mid := (low + high) / 2 + nodeOperatorId, err := convertTreeValuesToBigInt(treeData.Values[mid].Value[0]) + if err != nil { + return 0, fmt.Errorf("failed to convert nodeOperatorId: %v", err) + } + cmp := nodeOperatorId.Cmp(nodeID) + if cmp == 0 { + return mid, nil + } else if cmp < 0 { + low = mid + 1 + } else { + high = mid - 1 + } + } + return 0, fmt.Errorf("invalid node ID") +} + +func csFeeDistributorContract(network string) (*Csfeedistributor, *ethclient.Client, error) { client, err := contracts.ConnectClient(network) if err != nil { - return nil, fmt.Errorf("failed to connect to client: %w", err) + return nil, nil, fmt.Errorf("failed to connect to client: %w", err) } - defer client.Close() contractName := contracts.CSFeeDistributor - address := common.HexToAddress(contracts.DeployedAddresses(contractName)[network]) + + contractAddress, err := contracts.ContractAddressByNetwork(contractName, network) + if err != nil { + return nil, nil, fmt.Errorf("failed to get deployed contract address: %w", err) + } + + address := common.HexToAddress(contractAddress) contract, err := NewCsfeedistributor(address, client) if err != nil { - return nil, fmt.Errorf("failed to create CSFeeDistributor instance: %w", err) + return nil, nil, fmt.Errorf("failed to create CSFeeDistributor instance: %w", err) } - return contract, nil + return contract, client, nil } diff --git a/internal/lido/contracts/csfeedistributor/rewards_test.go b/internal/lido/contracts/csfeedistributor/rewards_test.go index b883b24b8..8322e2e42 100644 --- a/internal/lido/contracts/csfeedistributor/rewards_test.go +++ b/internal/lido/contracts/csfeedistributor/rewards_test.go @@ -115,3 +115,84 @@ func TestConvertTreeValuesToBigInt(t *testing.T) { } } } + +func TestBinarySearchNodeID(t *testing.T) { + tcs := []struct { + name string + treeData Tree + nodeID *big.Int + expected int + expectErr bool + }{ + { + name: "Node ID found at index 1", + treeData: Tree{ + Values: []struct { + Value []interface{} `json:"value"` + TreeIndex int `json:"treeIndex"` + }{ + {Value: []interface{}{1.0, 5000.0}, TreeIndex: 0}, + {Value: []interface{}{2.0, 6000.0}, TreeIndex: 1}, + {Value: []interface{}{30.0, 7000.0}, TreeIndex: 2}, + }, + }, + nodeID: big.NewInt(2), + expected: 1, + }, + { + name: "Node ID found at index 0", + treeData: Tree{ + Values: []struct { + Value []interface{} `json:"value"` + TreeIndex int `json:"treeIndex"` + }{ + {Value: []interface{}{100.0, 5000.0}, TreeIndex: 0}, + {Value: []interface{}{200.0, 6000.0}, TreeIndex: 1}, + {Value: []interface{}{330.0, 7000.0}, TreeIndex: 2}, + }, + }, + nodeID: big.NewInt(100), + expected: 0, + }, + { + name: "Node ID not found", + treeData: Tree{ + Values: []struct { + Value []interface{} `json:"value"` + TreeIndex int `json:"treeIndex"` + }{ + {Value: []interface{}{10.0, 5000}, TreeIndex: 0}, + {Value: []interface{}{20.0, 6000}, TreeIndex: 1}, + {Value: []interface{}{30.0, 7000}, TreeIndex: 2}, + }, + }, + nodeID: big.NewInt(400), + expected: 0, + expectErr: true, + }, + { + name: "empty tree", + treeData: Tree{ + Values: []struct { + Value []interface{} `json:"value"` + TreeIndex int `json:"treeIndex"` + }{}, + }, + nodeID: big.NewInt(4), + expected: 0, + expectErr: true, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + index, err := binarySearchNodeID(tc.nodeID, tc.treeData) + if (err != nil) != tc.expectErr { + t.Errorf("expected error: %v, got: %v", tc.expectErr, err) + } + if err == nil && index != tc.expected { + t.Errorf("expected index: %v, got: %v", tc.expected, index) + } + }) + } +} diff --git a/internal/lido/contracts/csmodule/keys.go b/internal/lido/contracts/csmodule/keys.go index 491800065..e51d38fc5 100644 --- a/internal/lido/contracts/csmodule/keys.go +++ b/internal/lido/contracts/csmodule/keys.go @@ -48,14 +48,15 @@ func KeysStatus(network string, nodeID *big.Int) (Keys, error) { if nodeID.Sign() < 0 { return keys, fmt.Errorf("node ID value out-of-bounds: can't be negative") } - contract, err := csModuleContract(network) + contract, client, err := csModuleContract(network) if err != nil { return keys, fmt.Errorf("failed to call csModuleContract: %w", err) } + defer client.Close() nodeOp, err := contract.GetNodeOperatorSummary(nil, nodeID) if err != nil { - return keys, fmt.Errorf("failed to call GetNodeOperator: %w", err) + return keys, fmt.Errorf("failed to call GetNodeOperatorSummary contract method: %w", err) } keys.DepositableValidatorsCount = nodeOp.DepositableValidatorsCount keys.DepositedValidators = nodeOp.TotalDepositedValidators diff --git a/internal/lido/contracts/csmodule/nodeOperator.go b/internal/lido/contracts/csmodule/nodeOperator.go index e92a164b5..0b7010fd1 100644 --- a/internal/lido/contracts/csmodule/nodeOperator.go +++ b/internal/lido/contracts/csmodule/nodeOperator.go @@ -20,7 +20,9 @@ import ( "math/big" "github.com/NethermindEth/sedge/internal/lido/contracts" + "github.com/NethermindEth/sedge/internal/ui" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" ) /* @@ -37,6 +39,10 @@ b. error Error if any */ func NodeID(network string, rewardAddress string) (*big.Int, error) { + err := ui.EthAddressValidator(rewardAddress, false) + if err != nil { + return nil, fmt.Errorf("invalid reward address: %w", err) + } // Convert the reward address to a common.Address and check if it's zero rewardAddr := common.HexToAddress(rewardAddress) if rewardAddr == (common.Address{}) { @@ -45,13 +51,13 @@ func NodeID(network string, rewardAddress string) (*big.Int, error) { nodeOperatorIDs, err := nodeOpIDs(network) if err != nil { - return nil, fmt.Errorf("failed to call NodeOpIDs: %w", err) + return nil, fmt.Errorf("error getting Node Operators ID: %w", err) } for _, nodeID := range nodeOperatorIDs { node, err := NodeOperatorInfo(network, nodeID) if err != nil { - return nil, fmt.Errorf("failed to get NodeOperatorInfo: %w", err) + return nil, fmt.Errorf("error getting Node Operator Information: %w", err) } if node.RewardAddress == rewardAddr { return nodeID, nil @@ -75,65 +81,73 @@ Error if any */ func NodeOperatorInfo(network string, nodeID *big.Int) (NodeOperator, error) { var nodeOperator NodeOperator - contract, err := csModuleContract(network) + contract, client, err := csModuleContract(network) + defer client.Close() if err != nil { return nodeOperator, fmt.Errorf("failed to call csModuleContract: %w", err) } nodeOperator, err = contract.GetNodeOperator(nil, nodeID) if err != nil { - return nodeOperator, fmt.Errorf("failed to call GetNodeOperator: %w", err) + return nodeOperator, fmt.Errorf("failed to call GetNodeOperator contract method: %w", err) } return nodeOperator, nil } func nodeOpIDs(network string) ([]*big.Int, error) { var nodeOperatorIDs []*big.Int - contract, err := csModuleContract(network) + contract, client, err := csModuleContract(network) if err != nil { return nil, fmt.Errorf("failed to call csModuleContract: %w", err) } + defer client.Close() limit, err := nodeOpsCount(network) if err != nil { - return nil, fmt.Errorf("failed to call nodeOpsCount: %w", err) + return nil, fmt.Errorf("error getting total number of Node Operators: %w", err) } offset := big.NewInt(0) nodeOperatorIDs, err = contract.GetNodeOperatorIds(nil, offset, limit) if err != nil { - return nil, fmt.Errorf("failed to call GetNodeOperatorIds: %w", err) + return nil, fmt.Errorf("failed to call GetNodeOperatorIds contract method: %w", err) } return nodeOperatorIDs, nil } func nodeOpsCount(network string) (*big.Int, error) { var nodeOperatorCount *big.Int - contract, err := csModuleContract(network) + contract, client, err := csModuleContract(network) + defer client.Close() if err != nil { return nil, fmt.Errorf("failed to call csModuleContract: %w", err) } nodeOperatorCount, err = contract.GetNodeOperatorsCount(nil) if err != nil { - return nil, fmt.Errorf("failed to call GetNodeOperatorsCount: %w", err) + return nil, fmt.Errorf("failed to call GetNodeOperatorsCount contract method: %w", err) } return nodeOperatorCount, nil } -func csModuleContract(network string) (*Csmodule, error) { +func csModuleContract(network string) (*Csmodule, *ethclient.Client, error) { client, err := contracts.ConnectClient(network) if err != nil { - return nil, fmt.Errorf("failed to connect to client: %w", err) + return nil, nil, fmt.Errorf("failed to connect to client: %w", err) } - defer client.Close() contractName := contracts.CSModule - address := common.HexToAddress(contracts.DeployedAddresses(contractName)[network]) + + contractAddress, err := contracts.ContractAddressByNetwork(contractName, network) + if err != nil { + return nil, nil, fmt.Errorf("failed to get deployed contract address: %w", err) + } + + address := common.HexToAddress(contractAddress) contract, err := NewCsmodule(address, client) if err != nil { - return nil, fmt.Errorf("failed to create CSModule instance: %w", err) + return nil, nil, fmt.Errorf("failed to create CSModule instance: %w", err) } - return contract, nil + return contract, client, nil } diff --git a/internal/lido/contracts/mevboostrelaylist/get_relays.go b/internal/lido/contracts/mevboostrelaylist/get_relays.go index 03405c181..fa6081b3e 100644 --- a/internal/lido/contracts/mevboostrelaylist/get_relays.go +++ b/internal/lido/contracts/mevboostrelaylist/get_relays.go @@ -21,6 +21,7 @@ import ( "github.com/NethermindEth/sedge/internal/lido/contracts" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" ) // Relay : Struct represent data of MEV-Boost Relay @@ -47,13 +48,15 @@ Error if any */ func Relays(network string) ([]Relay, error) { var relays []Relay - contract, err := mevBoostRelayListContract(network) + contract, client, err := mevBoostRelayListContract(network) if err != nil { return relays, fmt.Errorf("failed to call mevBoostRelayListContract: %w", err) } + defer client.Close() + result, err := contract.GetRelays(nil) if err != nil { - return relays, fmt.Errorf("failed to call GetRelays: %w", err) + return relays, fmt.Errorf("failed to call GetRelays contract method: %w", err) } for _, r := range result { @@ -116,17 +119,21 @@ func NetworkSupportedByLidoMevBoost(network string) ([]string, bool) { return nil, supported } -func mevBoostRelayListContract(network string) (*Mevboostrelaylist, error) { +func mevBoostRelayListContract(network string) (*Mevboostrelaylist, *ethclient.Client, error) { client, err := contracts.ConnectClient(network) if err != nil { - return nil, fmt.Errorf("failed to connect to client: %w", err) + return nil, nil, fmt.Errorf("failed to connect to client: %w", err) + } + + contractAddress, err := contracts.ContractAddressByNetwork(contractName, network) + if err != nil { + return nil, nil, fmt.Errorf("failed to get deployed contract address: %w", err) } - defer client.Close() - address := common.HexToAddress(contracts.DeployedAddresses(contractName)[network]) + address := common.HexToAddress(contractAddress) contract, err := NewMevboostrelaylist(address, client) if err != nil { - return nil, fmt.Errorf("failed to create Mevboostrelaylist instance: %w", err) + return nil, nil, fmt.Errorf("failed to create Mevboostrelaylist contract instance: %w", err) } - return contract, nil + return contract, client, nil } diff --git a/internal/ui/tables.go b/internal/ui/tables.go index e607969f1..67b544065 100644 --- a/internal/ui/tables.go +++ b/internal/ui/tables.go @@ -18,8 +18,10 @@ package ui import ( "fmt" "io" + "strings" "github.com/alexeyco/simpletable" + "github.com/charmbracelet/glamour" ) /* @@ -131,6 +133,7 @@ func WriteSimpleTable(w io.Writer, data *SimpleTableData) { n = len(column) } } + m := len(data.Headers) if len(data.Headers) == 0 && !data.Enumerate { @@ -173,8 +176,9 @@ func WriteSimpleTable(w io.Writer, data *SimpleTableData) { } } // Print table - table.SetStyle(simpletable.StyleCompact) - fmt.Fprintln(w, table.String()) + table.SetStyle(simpletable.StyleMarkdown) + renderedTable, _ := glamour.Render(table.String(), "dark") + fmt.Fprint(w, renderedTable) fmt.Fprintln(w) } @@ -216,3 +220,28 @@ func WriteListNetworksTable(w io.Writer, data []string) { Enumerate: true, }) } + +/* +WriteLidoStatusTable : +Prints the Lido Node Operator Information + +params :- +a. w io.Writer +Where the data is to be printed +b. data []string +Node Operator data +c. string +Data Header +returns :- +None +*/ +func WriteLidoStatusTable(w io.Writer, data []string, header string) { + var allData []string + + headerText := fmt.Sprintf(`# %s`, header) + allData = append(allData, headerText) + allData = append(allData, data...) + info := strings.Join(allData, "\n") + renderedInfo, _ := glamour.Render(info, "dark") + fmt.Fprint(w, renderedInfo) +} diff --git a/internal/ui/testdata/table_tests/clients_tables/case_1/output b/internal/ui/testdata/table_tests/clients_tables/case_1/output index 6441c0652..322ef790e 100644 --- a/internal/ui/testdata/table_tests/clients_tables/case_1/output +++ b/internal/ui/testdata/table_tests/clients_tables/case_1/output @@ -1,3 +1,6 @@ - # -=== + +                                                                                  + # + ──────────────────────────────────────────────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/clients_tables/case_2/output b/internal/ui/testdata/table_tests/clients_tables/case_2/output index 6441c0652..322ef790e 100644 --- a/internal/ui/testdata/table_tests/clients_tables/case_2/output +++ b/internal/ui/testdata/table_tests/clients_tables/case_2/output @@ -1,3 +1,6 @@ - # -=== + +                                                                                  + # + ──────────────────────────────────────────────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/clients_tables/case_3/output b/internal/ui/testdata/table_tests/clients_tables/case_3/output index 6441c0652..322ef790e 100644 --- a/internal/ui/testdata/table_tests/clients_tables/case_3/output +++ b/internal/ui/testdata/table_tests/clients_tables/case_3/output @@ -1,3 +1,6 @@ - # -=== + +                                                                                  + # + ──────────────────────────────────────────────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/clients_tables/case_4/output b/internal/ui/testdata/table_tests/clients_tables/case_4/output index 4e3cb572f..b8be3e79d 100644 --- a/internal/ui/testdata/table_tests/clients_tables/case_4/output +++ b/internal/ui/testdata/table_tests/clients_tables/case_4/output @@ -1,5 +1,8 @@ - # A Clients C Clients -=== =========== =========== - 1 a c - 2 b - + +                                                                                  + # │A Clients │C Clients + ─────────────────────┼─────────────────────────────┼──────────────────────────── + 1 │a │c + 2 │b │- + diff --git a/internal/ui/testdata/table_tests/network_tables/case_1/output b/internal/ui/testdata/table_tests/network_tables/case_1/output index 1ee26380b..6a2ae2039 100644 --- a/internal/ui/testdata/table_tests/network_tables/case_1/output +++ b/internal/ui/testdata/table_tests/network_tables/case_1/output @@ -1,3 +1,6 @@ - # Supported Networks -=== ==================== + +                                                                                  + # │Supported Networks + ───────────────────────────────┼──────────────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/network_tables/case_2/output b/internal/ui/testdata/table_tests/network_tables/case_2/output index aade4fcb5..286747297 100644 --- a/internal/ui/testdata/table_tests/network_tables/case_2/output +++ b/internal/ui/testdata/table_tests/network_tables/case_2/output @@ -1,4 +1,7 @@ - # Supported Networks -=== ==================== - 1 A + +                                                                                  + # │Supported Networks + ───────────────────────────────┼──────────────────────────────────────────────── + 1 │A + diff --git a/internal/ui/testdata/table_tests/network_tables/case_3/output b/internal/ui/testdata/table_tests/network_tables/case_3/output index a5010b27d..9acd0a7d8 100644 --- a/internal/ui/testdata/table_tests/network_tables/case_3/output +++ b/internal/ui/testdata/table_tests/network_tables/case_3/output @@ -1,6 +1,9 @@ - # Supported Networks -=== ==================== - 1 A - 2 B - 3 C + +                                                                                  + # │Supported Networks + ───────────────────────────────┼──────────────────────────────────────────────── + 1 │A + 2 │B + 3 │C + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_1/output b/internal/ui/testdata/table_tests/randomized_tables/case_1/output index 5adb1a168..dff75540f 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_1/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_1/output @@ -1,3 +1,6 @@ - # Type of Client Randomized Client -=== ================ =================== + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_2/output b/internal/ui/testdata/table_tests/randomized_tables/case_2/output index 5adb1a168..dff75540f 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_2/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_2/output @@ -1,3 +1,6 @@ - # Type of Client Randomized Client -=== ================ =================== + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_3/output b/internal/ui/testdata/table_tests/randomized_tables/case_3/output index 5adb1a168..dff75540f 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_3/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_3/output @@ -1,3 +1,6 @@ - # Type of Client Randomized Client -=== ================ =================== + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_4/output b/internal/ui/testdata/table_tests/randomized_tables/case_4/output index 5adb1a168..dff75540f 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_4/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_4/output @@ -1,3 +1,6 @@ - # Type of Client Randomized Client -=== ================ =================== + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_5/output b/internal/ui/testdata/table_tests/randomized_tables/case_5/output index 4bca6e8d7..c523c927c 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_5/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_5/output @@ -1,6 +1,9 @@ - # Type of Client Randomized Client -=== ================ =================== - 1 A a - 2 B b - 3 - c + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + 1 │A │a + 2 │B │b + 3 │- │c + diff --git a/internal/ui/testdata/table_tests/randomized_tables/case_6/output b/internal/ui/testdata/table_tests/randomized_tables/case_6/output index c9dc4167b..2f277b313 100644 --- a/internal/ui/testdata/table_tests/randomized_tables/case_6/output +++ b/internal/ui/testdata/table_tests/randomized_tables/case_6/output @@ -1,6 +1,9 @@ - # Type of Client Randomized Client -=== ================ =================== - 1 A a - 2 B b - 3 C - + +                                                                                  + # │Type of Client │Randomized Client + ─────────────────┼─────────────────────────────┼──────────────────────────────── + 1 │A │a + 2 │B │b + 3 │C │- + diff --git a/internal/ui/testdata/table_tests/simple_tables/case_2/output b/internal/ui/testdata/table_tests/simple_tables/case_2/output index 6441c0652..322ef790e 100644 --- a/internal/ui/testdata/table_tests/simple_tables/case_2/output +++ b/internal/ui/testdata/table_tests/simple_tables/case_2/output @@ -1,3 +1,6 @@ - # -=== + +                                                                                  + # + ──────────────────────────────────────────────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/simple_tables/case_3/output b/internal/ui/testdata/table_tests/simple_tables/case_3/output index 975a2e44f..a8e85d8b6 100644 --- a/internal/ui/testdata/table_tests/simple_tables/case_3/output +++ b/internal/ui/testdata/table_tests/simple_tables/case_3/output @@ -1,3 +1,6 @@ - A B -=== === + +                                                                                  + A │B + ────────────────────────────────────────┼─────────────────────────────────────── + diff --git a/internal/ui/testdata/table_tests/simple_tables/case_4/output b/internal/ui/testdata/table_tests/simple_tables/case_4/output index 37c53ea66..57f2b240d 100644 --- a/internal/ui/testdata/table_tests/simple_tables/case_4/output +++ b/internal/ui/testdata/table_tests/simple_tables/case_4/output @@ -1,5 +1,8 @@ - A B -=== === - a - - b - + +                                                                                  + A │B + ────────────────────────────────────────┼─────────────────────────────────────── + a │- + b │- + diff --git a/internal/ui/testdata/table_tests/simple_tables/case_5/output b/internal/ui/testdata/table_tests/simple_tables/case_5/output index 4d8b2f2a1..54677ae4d 100644 --- a/internal/ui/testdata/table_tests/simple_tables/case_5/output +++ b/internal/ui/testdata/table_tests/simple_tables/case_5/output @@ -1,4 +1,7 @@ - A B -=== === - a b + +                                                                                  + A │B + ────────────────────────────────────────┼─────────────────────────────────────── + a │b + diff --git a/internal/utils/testdata/checks_tests/case_1/sedge-data/.env b/internal/utils/testdata/checks_tests/case_1/sedge-data/.env index 7879f0553..7903f2514 100644 --- a/internal/utils/testdata/checks_tests/case_1/sedge-data/.env +++ b/internal/utils/testdata/checks_tests/case_1/sedge-data/.env @@ -14,7 +14,6 @@ NETHERMIND_ETHSTATSCONFIG_NAME=Nethermind NETHERMIND_ETHSTATSCONFIG_SECRET=secret NETHERMIND_ETHSTATSCONFIG_CONTACT=hello@nethermind.io EC_DATA_DIR=./execution-data -CC_PEER_COUNT=50 CC_LOG_LEVEL=info NETWORK=mainnet EC_NODE=http://localhost:8545 diff --git a/internal/utils/testdata/checks_tests/case_1/sedge-data/docker-compose.yml b/internal/utils/testdata/checks_tests/case_1/sedge-data/docker-compose.yml index d337595c7..1d73043fd 100644 --- a/internal/utils/testdata/checks_tests/case_1/sedge-data/docker-compose.yml +++ b/internal/utils/testdata/checks_tests/case_1/sedge-data/docker-compose.yml @@ -61,7 +61,6 @@ services: - --logging=${CC_LOG_LEVEL} - --network=${NETWORK} - --p2p-port=9000 - - --p2p-peer-upper-bound=${CC_PEER_COUNT} - --rest-api-host-allowlist=* - --rest-api-enabled=true - --rest-api-port=4000 diff --git a/internal/utils/testdata/checks_tests/case_2/sedge-data/.env b/internal/utils/testdata/checks_tests/case_2/sedge-data/.env index 7879f0553..7903f2514 100644 --- a/internal/utils/testdata/checks_tests/case_2/sedge-data/.env +++ b/internal/utils/testdata/checks_tests/case_2/sedge-data/.env @@ -14,7 +14,6 @@ NETHERMIND_ETHSTATSCONFIG_NAME=Nethermind NETHERMIND_ETHSTATSCONFIG_SECRET=secret NETHERMIND_ETHSTATSCONFIG_CONTACT=hello@nethermind.io EC_DATA_DIR=./execution-data -CC_PEER_COUNT=50 CC_LOG_LEVEL=info NETWORK=mainnet EC_NODE=http://localhost:8545 diff --git a/internal/utils/testdata/checks_tests/case_2/sedge-data/no-docker-compose.yml b/internal/utils/testdata/checks_tests/case_2/sedge-data/no-docker-compose.yml index d337595c7..1d73043fd 100644 --- a/internal/utils/testdata/checks_tests/case_2/sedge-data/no-docker-compose.yml +++ b/internal/utils/testdata/checks_tests/case_2/sedge-data/no-docker-compose.yml @@ -61,7 +61,6 @@ services: - --logging=${CC_LOG_LEVEL} - --network=${NETWORK} - --p2p-port=9000 - - --p2p-peer-upper-bound=${CC_PEER_COUNT} - --rest-api-host-allowlist=* - --rest-api-enabled=true - --rest-api-port=4000 diff --git a/internal/utils/testdata/validate_compose_tests/no_env/docker-compose.yml b/internal/utils/testdata/validate_compose_tests/no_env/docker-compose.yml index 41a203c61..08a694214 100644 --- a/internal/utils/testdata/validate_compose_tests/no_env/docker-compose.yml +++ b/internal/utils/testdata/validate_compose_tests/no_env/docker-compose.yml @@ -85,7 +85,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/internal/utils/testdata/validate_compose_tests/no_services/.env b/internal/utils/testdata/validate_compose_tests/no_services/.env index 8b6e44601..7d2b7688a 100644 --- a/internal/utils/testdata/validate_compose_tests/no_services/.env +++ b/internal/utils/testdata/validate_compose_tests/no_services/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/internal/utils/testdata/validate_compose_tests/no_version/.env b/internal/utils/testdata/validate_compose_tests/no_version/.env index 8b6e44601..7d2b7688a 100644 --- a/internal/utils/testdata/validate_compose_tests/no_version/.env +++ b/internal/utils/testdata/validate_compose_tests/no_version/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/internal/utils/testdata/validate_compose_tests/no_version/docker-compose.yml b/internal/utils/testdata/validate_compose_tests/no_version/docker-compose.yml index a23d4e0d3..01cd34913 100644 --- a/internal/utils/testdata/validate_compose_tests/no_version/docker-compose.yml +++ b/internal/utils/testdata/validate_compose_tests/no_version/docker-compose.yml @@ -84,7 +84,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/internal/utils/testdata/validate_compose_tests/valid/.env b/internal/utils/testdata/validate_compose_tests/valid/.env index 8b6e44601..7d2b7688a 100644 --- a/internal/utils/testdata/validate_compose_tests/valid/.env +++ b/internal/utils/testdata/validate_compose_tests/valid/.env @@ -10,7 +10,6 @@ EC_DATA_DIR=./execution-data EC_SNAP_SYNC_ENABLED=true EC_JWT_SECRET_PATH=/Users/teno/go/src/github.com/NethermindEth/1Click/sedge-data/jwtsecret # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL=http://execution:8545 EC_AUTH_URL=http://execution:8551 diff --git a/internal/utils/testdata/validate_compose_tests/valid/docker-compose.yml b/internal/utils/testdata/validate_compose_tests/valid/docker-compose.yml index 41a203c61..08a694214 100644 --- a/internal/utils/testdata/validate_compose_tests/valid/docker-compose.yml +++ b/internal/utils/testdata/validate_compose_tests/valid/docker-compose.yml @@ -85,7 +85,6 @@ services: - --http-address=0.0.0.0 - --http-port=4000 - --network=${NETWORK} - - --target-peers=${CC_PEER_COUNT} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret - --eth1 diff --git a/templates/envs/chiado/consensus/lighthouse.tmpl b/templates/envs/chiado/consensus/lighthouse.tmpl index e17651f04..dc86e6eb8 100644 --- a/templates/envs/chiado/consensus/lighthouse.tmpl +++ b/templates/envs/chiado/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/chiado/consensus/lodestar.tmpl b/templates/envs/chiado/consensus/lodestar.tmpl index da3dd980a..a367eac43 100644 --- a/templates/envs/chiado/consensus/lodestar.tmpl +++ b/templates/envs/chiado/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/chiado/consensus/teku.tmpl b/templates/envs/chiado/consensus/teku.tmpl index d7a0560f3..168c9eb00 100644 --- a/templates/envs/chiado/consensus/teku.tmpl +++ b/templates/envs/chiado/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/custom/consensus/lighthouse.tmpl b/templates/envs/custom/consensus/lighthouse.tmpl index c64ce7aa5..822866e9a 100644 --- a/templates/envs/custom/consensus/lighthouse.tmpl +++ b/templates/envs/custom/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/custom/consensus/lodestar.tmpl b/templates/envs/custom/consensus/lodestar.tmpl index f1b971c4e..8275b4d89 100644 --- a/templates/envs/custom/consensus/lodestar.tmpl +++ b/templates/envs/custom/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/custom/consensus/prysm.tmpl b/templates/envs/custom/consensus/prysm.tmpl index 2adfaf32f..8452388c3 100644 --- a/templates/envs/custom/consensus/prysm.tmpl +++ b/templates/envs/custom/consensus/prysm.tmpl @@ -1,7 +1,6 @@ {{/* prysm.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/custom/consensus/teku.tmpl b/templates/envs/custom/consensus/teku.tmpl index 826e352c0..c29ba1997 100644 --- a/templates/envs/custom/consensus/teku.tmpl +++ b/templates/envs/custom/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/gnosis/consensus/lighthouse.tmpl b/templates/envs/gnosis/consensus/lighthouse.tmpl index de9a9116d..396d5c838 100644 --- a/templates/envs/gnosis/consensus/lighthouse.tmpl +++ b/templates/envs/gnosis/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/gnosis/consensus/lodestar.tmpl b/templates/envs/gnosis/consensus/lodestar.tmpl index 260e535de..fd6c0933c 100644 --- a/templates/envs/gnosis/consensus/lodestar.tmpl +++ b/templates/envs/gnosis/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info CC_LODESTAR_PRESET=gnosis EC_API_URL={{.ExecutionApiURL}} diff --git a/templates/envs/gnosis/consensus/teku.tmpl b/templates/envs/gnosis/consensus/teku.tmpl index 3bf338468..86eacfc91 100644 --- a/templates/envs/gnosis/consensus/teku.tmpl +++ b/templates/envs/gnosis/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/holesky/consensus/lighthouse.tmpl b/templates/envs/holesky/consensus/lighthouse.tmpl index de9a9116d..396d5c838 100644 --- a/templates/envs/holesky/consensus/lighthouse.tmpl +++ b/templates/envs/holesky/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/holesky/consensus/lodestar.tmpl b/templates/envs/holesky/consensus/lodestar.tmpl index c78448baf..eb779e30a 100644 --- a/templates/envs/holesky/consensus/lodestar.tmpl +++ b/templates/envs/holesky/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/holesky/consensus/prysm.tmpl b/templates/envs/holesky/consensus/prysm.tmpl index c26d55016..ead180285 100644 --- a/templates/envs/holesky/consensus/prysm.tmpl +++ b/templates/envs/holesky/consensus/prysm.tmpl @@ -1,7 +1,6 @@ {{/* prysm.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/holesky/consensus/teku.tmpl b/templates/envs/holesky/consensus/teku.tmpl index 3bf338468..86eacfc91 100644 --- a/templates/envs/holesky/consensus/teku.tmpl +++ b/templates/envs/holesky/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/mainnet/consensus/lighthouse.tmpl b/templates/envs/mainnet/consensus/lighthouse.tmpl index de9a9116d..396d5c838 100644 --- a/templates/envs/mainnet/consensus/lighthouse.tmpl +++ b/templates/envs/mainnet/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/mainnet/consensus/lodestar.tmpl b/templates/envs/mainnet/consensus/lodestar.tmpl index c78448baf..eb779e30a 100644 --- a/templates/envs/mainnet/consensus/lodestar.tmpl +++ b/templates/envs/mainnet/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/mainnet/consensus/prysm.tmpl b/templates/envs/mainnet/consensus/prysm.tmpl index c26d55016..ead180285 100644 --- a/templates/envs/mainnet/consensus/prysm.tmpl +++ b/templates/envs/mainnet/consensus/prysm.tmpl @@ -1,7 +1,6 @@ {{/* prysm.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/mainnet/consensus/teku.tmpl b/templates/envs/mainnet/consensus/teku.tmpl index 3bf338468..86eacfc91 100644 --- a/templates/envs/mainnet/consensus/teku.tmpl +++ b/templates/envs/mainnet/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/sepolia/consensus/lighthouse.tmpl b/templates/envs/sepolia/consensus/lighthouse.tmpl index de9a9116d..396d5c838 100644 --- a/templates/envs/sepolia/consensus/lighthouse.tmpl +++ b/templates/envs/sepolia/consensus/lighthouse.tmpl @@ -1,7 +1,6 @@ {{/* lighthouse.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/sepolia/consensus/lodestar.tmpl b/templates/envs/sepolia/consensus/lodestar.tmpl index 8a9962503..b9c71ab96 100644 --- a/templates/envs/sepolia/consensus/lodestar.tmpl +++ b/templates/envs/sepolia/consensus/lodestar.tmpl @@ -1,7 +1,6 @@ {{/* lodestar.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/sepolia/consensus/prysm.tmpl b/templates/envs/sepolia/consensus/prysm.tmpl index c26d55016..ead180285 100644 --- a/templates/envs/sepolia/consensus/prysm.tmpl +++ b/templates/envs/sepolia/consensus/prysm.tmpl @@ -1,7 +1,6 @@ {{/* prysm.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/envs/sepolia/consensus/teku.tmpl b/templates/envs/sepolia/consensus/teku.tmpl index 3bf338468..86eacfc91 100644 --- a/templates/envs/sepolia/consensus/teku.tmpl +++ b/templates/envs/sepolia/consensus/teku.tmpl @@ -1,7 +1,6 @@ {{/* teku.tmpl */}} {{ define "consensus" }} # --- Consensus Layer - Beacon Node - configuration --- -CC_PEER_COUNT=50 CC_LOG_LEVEL=info EC_API_URL={{.ExecutionApiURL}} EC_AUTH_URL={{.ExecutionAuthURL}} diff --git a/templates/services/merge/consensus/lighthouse.tmpl b/templates/services/merge/consensus/lighthouse.tmpl index 45e2b8566..0270689da 100644 --- a/templates/services/merge/consensus/lighthouse.tmpl +++ b/templates/services/merge/consensus/lighthouse.tmpl @@ -33,8 +33,7 @@ - --http - --http-address=0.0.0.0 - --http-port={{.ClApiPort}}{{if not .CustomConsensusConfigs}} - - --network={{if .SplittedNetwork}}${CL_NETWORK}{{else}}${NETWORK}{{end}}{{end}} - - --target-peers=${CC_PEER_COUNT}{{if .CCBootnodes}} + - --network={{if .SplittedNetwork}}${CL_NETWORK}{{else}}${NETWORK}{{end}}{{end}}{{if .CCBootnodes}} - --boot-nodes={{.CCBootnodes}}{{end}} - --execution-endpoints=${EC_AUTH_URL} - --execution-jwt=/tmp/jwt/jwtsecret diff --git a/templates/services/merge/consensus/lodestar.tmpl b/templates/services/merge/consensus/lodestar.tmpl index f7ffb511b..0e4121c60 100644 --- a/templates/services/merge/consensus/lodestar.tmpl +++ b/templates/services/merge/consensus/lodestar.tmpl @@ -41,7 +41,6 @@ - --rest.cors=* - --discv5=true{{range $enr := .CCBootnodesList}} - --bootnodes={{$enr}}{{end}} - - --targetPeers=${CC_PEER_COUNT} - --metrics=true - --metrics.port={{.ClMetricsPort}} - --jwt-secret=/tmp/jwt/jwtsecret{{if or .ClCheckpointSyncUrl .CheckpointSyncUrl}} diff --git a/templates/services/merge/consensus/prysm.tmpl b/templates/services/merge/consensus/prysm.tmpl index 3e5970cfc..442944fcd 100644 --- a/templates/services/merge/consensus/prysm.tmpl +++ b/templates/services/merge/consensus/prysm.tmpl @@ -36,7 +36,6 @@ - --grpc-gateway-port={{.ClApiPort}} - --datadir=/var/lib/prysm/ - --verbosity=${CC_LOG_LEVEL} - - --p2p-max-peers=${CC_PEER_COUNT} - --execution-endpoint=${EC_AUTH_URL}{{range $url := .FallbackELUrls}} - --fallback-web3provider={{$url}}{{end}} - --accept-terms-of-use{{with .FeeRecipient}} diff --git a/templates/services/merge/consensus/teku.tmpl b/templates/services/merge/consensus/teku.tmpl index adfdaf20a..d52875553 100644 --- a/templates/services/merge/consensus/teku.tmpl +++ b/templates/services/merge/consensus/teku.tmpl @@ -32,7 +32,6 @@ - --p2p-discovery-bootnodes={{.CCBootnodes}}{{end}} - --p2p-enabled=true - --p2p-port={{.ClDiscoveryPort}} - - --p2p-peer-upper-bound=${CC_PEER_COUNT} - --rest-api-enabled=true - --rest-api-host-allowlist=* - --rest-api-interface=0.0.0.0