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

app: eth2wrap best selector refactoring #2806

Merged
merged 2 commits into from
Jan 22, 2024
Merged

Conversation

pinebit
Copy link
Contributor

@pinebit pinebit commented Jan 19, 2024

A quick refactor of eth2wrap to avoid panic() call, to remove extra loops and to remove ambiguity around address<->index translation.

category: refactor
ticket: none

Copy link

sonarcloud bot commented Jan 19, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (226bdfc) 53.27% compared to head (453ab7f) 53.27%.
Report is 2 commits behind head on main.

Files Patch % Lines
app/eth2wrap/eth2wrap.go 96.15% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2806   +/-   ##
=======================================
  Coverage   53.27%   53.27%           
=======================================
  Files         199      199           
  Lines       27627    27624    -3     
=======================================
  Hits        14717    14717           
+ Misses      11089    11083    -6     
- Partials     1821     1824    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

func (multi) Name() string {
return "eth2wrap.multi"
}

func (m multi) Address() string {
return m.clients[m.selector.Best()].Address()
address, ok := m.selector.BestAddress()
Copy link
Collaborator

Choose a reason for hiding this comment

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

In what case could BestAddress return ok == false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In theory this should never happen, because even after period elapsed, we always add at least one entry to the map. So, this is a safeguard in case somebody changes the logic in Increment and not look into this function.

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Jan 22, 2024
@obol-bulldozer obol-bulldozer bot merged commit 4e16691 into main Jan 22, 2024
14 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/eth2wrap-refactor branch January 22, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass v0.19.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants