-
Notifications
You must be signed in to change notification settings - Fork 0
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: address all to-do's #19
Conversation
- we now dedup existing exits to avoid working them twice - reference obol api implementation doesn't return 400 if there are already threshold partial exits
return nil, errors.Wrap(err, "ejector exits glob") | ||
} | ||
|
||
ret := map[eth2p0.ValidatorIndex]struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use make
to initialize the map instead
ret := map[eth2p0.ValidatorIndex]struct{}{} | |
ret := make(map[eth2p0.ValidatorIndex]struct{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only difference I see between the two is that make
allocs directly on the heap, while doing it as a literal implies that ret
will eventually move to the heap.
While I see the optimization in the sense of "less stuff that the runtime must do", I don't think it's a big deal considering the execution pattern of this function (called once at startup).
WDYT?
if len(ts.partialExits[exit.PublicKey])+1 > len(lock.Operators) { // we're already at threshold | ||
writeErr(writer, http.StatusBadRequest, "already at threshold for selected validator") | ||
return | ||
if len(ts.partialExits[exit.PublicKey])+1 > len(lock.Operators) { // we're already at threshold, ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this condition imply? in specific, what does len(ts.partialExits[exit.PublicKey])
return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts.partialExits
maps a validator's public key to the list of its partial exits, so len(ts.partialExits[exit.PublicKey])
returns the amount of partial exits already stored.
This if
is equivalent to the question "if we added another partial exit for validator exit.PublicKey
, would its size be greater than the operators amount?".
Consider that we must store at must len(lock.Operators)
partial exits for each operator.
Co-authored-by: Abhishek Kumar <43061995+xenowits@users.noreply.github.com>
category: refactor
ticket: none