From 877629e99cec70c767607af55f438038d634723b Mon Sep 17 00:00:00 2001 From: D13ce Date: Tue, 28 Mar 2023 10:55:00 +0200 Subject: [PATCH 1/2] (BIDS-1801) Fix look of withdrawal tab on dashboard --- templates/dashboard.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/dashboard.html b/templates/dashboard.html index 3399f5bde9..cf263340c3 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -315,7 +315,10 @@ {{ if .CappellaHasHappened }} {{ end }} From a5adcd8446df34b82227dd0346678fd7faf10b2e Mon Sep 17 00:00:00 2001 From: D13ce Date: Tue, 28 Mar 2023 11:03:32 +0200 Subject: [PATCH 2/2] (BIDS-1801) Add tooltip to next withdrawal amount on dashboard --- handlers/dashboard.go | 20 +++++++++++--------- handlers/validator.go | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/handlers/dashboard.go b/handlers/dashboard.go index c9743ab5c5..89accb9c37 100644 --- a/handlers/dashboard.go +++ b/handlers/dashboard.go @@ -237,14 +237,16 @@ func getNextWithdrawalRow(queryValidators []uint64) ([][]interface{}, error) { continue } for _, v := range validatorsDb { - if v.Index == balanceIndex { - if (balance[0].Balance > 0 && v.WithdrawableEpoch <= epoch) || - (balance[0].EffectiveBalance == utils.Config.Chain.Config.MaxEffectiveBalance && balance[0].Balance > utils.Config.Chain.Config.MaxEffectiveBalance) { - // this validator is withdrawable, check if it is the next one - if nextValidator == nil || v.Index > *stats.LatestValidatorWithdrawalIndex { - nextValidator = v - nextValidator.Balance = balance[0].Balance - } + if v.Index != balanceIndex { + continue + } + + if (balance[0].Balance > 0 && v.WithdrawableEpoch <= epoch) || + (balance[0].EffectiveBalance == utils.Config.Chain.Config.MaxEffectiveBalance && balance[0].Balance > utils.Config.Chain.Config.MaxEffectiveBalance) { + // this validator is withdrawable, check if it is the next one + if nextValidator == nil || v.Index > *stats.LatestValidatorWithdrawalIndex { + nextValidator = v + nextValidator.Balance = balance[0].Balance } } } @@ -286,7 +288,7 @@ func getNextWithdrawalRow(queryValidators []uint64) ([][]interface{}, error) { template.HTML(fmt.Sprintf(`~ %s`, utils.FormatBlockSlot(utils.TimeToSlot(uint64(timeToWithdrawal.Unix()))))), template.HTML(fmt.Sprintf(`~ %s`, utils.FormatTimeFromNow(timeToWithdrawal))), withdrawalCredentialsTemplate, - template.HTML(fmt.Sprintf(`~ %s`, utils.FormatAmount(new(big.Int).Mul(new(big.Int).SetUint64(nextValidator.Balance-utils.Config.Chain.Config.MaxEffectiveBalance), big.NewInt(1e9)), "ETH", 6))), + template.HTML(fmt.Sprintf(` %s`, utils.FormatAmount(new(big.Int).Mul(new(big.Int).SetUint64(nextValidator.Balance-utils.Config.Chain.Config.MaxEffectiveBalance), big.NewInt(1e9)), "ETH", 6))), }) return nextData, nil diff --git a/handlers/validator.go b/handlers/validator.go index 6c2d0b3f5c..1b26822d80 100644 --- a/handlers/validator.go +++ b/handlers/validator.go @@ -471,7 +471,7 @@ func Validator(w http.ResponseWriter, r *http.Request) { template.HTML(fmt.Sprintf(`~ %s`, utils.FormatBlockSlot(utils.TimeToSlot(uint64(timeToWithdrawal.Unix()))))), template.HTML(fmt.Sprintf(`~ %s`, utils.FormatTimeFromNow(timeToWithdrawal))), withdrawalCredentialsTemplate, - template.HTML(fmt.Sprintf(` %s`, utils.FormatAmount(new(big.Int).Mul(new(big.Int).SetUint64(validatorPageData.CurrentBalance-utils.Config.Chain.Config.MaxEffectiveBalance), big.NewInt(1e9)), "ETH", 6))), // RECy + template.HTML(fmt.Sprintf(` %s`, utils.FormatAmount(new(big.Int).Mul(new(big.Int).SetUint64(validatorPageData.CurrentBalance-utils.Config.Chain.Config.MaxEffectiveBalance), big.NewInt(1e9)), "ETH", 6))), }) validatorPageData.NextWithdrawalRow = tableData