-
Notifications
You must be signed in to change notification settings - Fork 607
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
refactor: add PokeTokenWeights to Pool interface #1232
Conversation
// | ||
// 3. t > start_time + duration: w(t) = target_pool_weights | ||
switch { | ||
case blockTime.Before(params.StartTime) || params.StartTime.Equal(blockTime): |
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.
reviewer: no logical changes, just switched the existing branching code to be switch
-based instead of if/elses.
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.
should we generally aim to prefer the code base to be switch based instead of if/elses?
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.
Yeah, definitely. A single if/else
is fine and OK. Once you have an if/if else/.../else
block, then it becomes hard to read and a switch
is much cleaner.
@ValarDragon we actually don't have any keeper-based tests for this, so even with this change, we wouldn't catch anything I think? Also, more I think about it, idk how I feel about a |
Agreed with the concern over |
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.
LGTM!
A general question I have would be for none balancer pools, how/what would PokeTokenWeights be implemented?
// | ||
// 3. t > start_time + duration: w(t) = target_pool_weights | ||
switch { | ||
case blockTime.Before(params.StartTime) || params.StartTime.Equal(blockTime): |
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.
should we generally aim to prefer the code base to be switch based instead of if/elses?
Codecov Report
@@ Coverage Diff @@
## main #1232 +/- ##
==========================================
+ Coverage 20.96% 20.98% +0.01%
==========================================
Files 196 196
Lines 25337 25340 +3
==========================================
+ Hits 5312 5317 +5
+ Misses 19066 19065 -1
+ Partials 959 958 -1
Continue to review full report at Codecov.
|
@@ -359,7 +359,7 @@ func TestBalancerPoolPokeTokenWeights(t *testing.T) { | |||
defaultStartTime := time.Unix(1618703511, 0) | |||
defaultStartTimeUnix := defaultStartTime.Unix() | |||
defaultDuration := 100 * time.Second | |||
floatGuaranteedPrecison := float64(GuaranteedWeightPrecision) | |||
floatGuaranteedPrecision := float64(GuaranteedWeightPrecision) |
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.
lol, ty for the fix
Closes: #1213
Description
PokePool
to thePool
interfaceGetPool
->GetPoolAndPoke
GetPools
->GetPoolsAndPoke
For contributor use:
docs/
) or specification (x/<module>/spec/
)Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer