Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEDS 1065/apps christmas miracle #1239

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from

Conversation

LuccaBitfly
Copy link
Contributor

@LuccaBitfly LuccaBitfly commented Jan 8, 2025

Adds efficiency, balances and rewards field to validator dashboard group summary.
Rule-of-thumb performance estimates:

  • Balances: adds 500ms - 2.5s per request depending on dashboard size
  • Rewards: data is already there so no changes
  • Efficiency: data is mostly already there so no changes

Copy link

cloudflare-workers-and-pages bot commented Jan 9, 2025

Deploying beaconchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: 53bc77d
Status: ✅  Deploy successful!
Preview URL: https://1cf7c52e.beaconchain.pages.dev
Branch Preview URL: https://beds-1065-apps-christmas-mir.beaconchain.pages.dev

View logs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the changes here don't fit the intended usage for this file please lmk

@LuccaBitfly LuccaBitfly force-pushed the BEDS-1065/apps-christmas-miracle branch from df5ec40 to 53bc77d Compare January 9, 2025 13:15
Copy link
Contributor

@remoterami remoterami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, left a few comments. ptal

Comment on lines -832 to +859
func (d *DataAccessService) internal_getElClAPR(ctx context.Context, dashboardId t.VDBId, groupId int64, hours int) (elIncome decimal.Decimal, elAPR float64, clIncome decimal.Decimal, clAPR float64, err error) {
func (d *DataAccessService) getElClAPR(ctx context.Context, dashboardId t.VDBId, groupId int64, hours int) (elIncome decimal.Decimal, elAPR float64, clIncome decimal.Decimal, clAPR float64, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That function could probably also be moved to vdb_helpers.go, it's used a few times in different locations 🙏

Comment on lines +828 to +831
if totalIdealAttestationRewards > 0 {
attestationEfficiency.Float64 = decimal.NewFromInt(totalAttestationRewards).Div(decimal.NewFromInt(totalIdealAttestationRewards)).InexactFloat64()
attestationEfficiency.Valid = true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was calculated above already, see ret.AttestationEfficiency

Comment on lines +842 to +854
rpOperatorInfo, err := d.getValidatorDashboardRpOperatorInfo(ctx, dashboardId)
if err != nil {
return nil, err
}
validatorMapping, err := d.services.GetCurrentValidatorMapping()
if err != nil {
return nil, err
}
balances, err := d.calculateValidatorDashboardBalance(ctx, rpOperatorInfo, validators, validatorMapping, protocolModes)
if err != nil {
return nil, err
}
ret.Balances = balances
Copy link
Contributor

@remoterami remoterami Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check: This would factor in the protocolModes for the new balances field, but the rest of the function does not yet use the parameter. I'm not 100% certain which other fields would also be affected, but apr might be a candidate.

  • If there are any, I would prefer to not return "mixed" data as that could be confusing. Rather either apply the calculation to all relevant fields, or (temporarily) apply it to none (hardcoding protocolModes.RocketPool to false)
  • If there are none (which might actually be the case, could be that the parameter is just a leftover from when we were briefly planning to add RP stats to the group summaries or something), the comment about it at the top of the method should be removed / clarified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants