-
Notifications
You must be signed in to change notification settings - Fork 608
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 createGauge to accomodate for CL gauges #5383
Conversation
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.
thank you for the PR
just have few questions before ACK :))
proto/osmosis/lockup/lock.proto
Outdated
ByDuration = 0; | ||
ByTime = 1; | ||
ByTime = 0; | ||
ByDuration = 1; |
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.
why was this changed again?
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.
Even if we pass lockuptypes.QueryCondition{}
to the function, it will still get the default value of distrTo.LockQueryType
which is the first value of LockQueryType
(In this case ByDuration
=> thus causing an error in the loop. )
So I just change the index to bypass.
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.
for CL the we are not distributing via locktypes so, what i originally thought was that we could skip distrTo check below;
if distrTo.LockQueryType == lockuptypes.ByDuration {
durationOk := false
for _, duration := range durations {
if duration == distrTo.Duration {
durationOk = true
break
}
}
if !durationOk {
return 0, fmt.Errorf("invalid duration: %d", distrTo.Duration)
}
}
// check if denom this gauge pays out to exists on-chain
if distrTo.Denom != "" && !k.bk.HasSupply(ctx, distrTo.Denom) && !strings.Contains(distrTo.Denom, "osmovaloper") {
return 0, fmt.Errorf("denom does not exist: %s", distrTo.Denom)
}
by passing empty queryCondition. lmk if that makes sense
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 I understand ur idea. But the problem I face is even calling CreateGauge
with empty queryCondition. It is still assigned a value in the function.
Thinking about adding new value to LockQueryType
enum to bypass both ByDuration & ByTime. Lmk what u think about that
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.
i see what about changing the enumType to something like pretty much what you suggested;
enum LockQueryType {
option (gogoproto.goproto_enum_prefix) = false;
UNSPECIFIED = 0;
ByTime = 0;
ByDuration = 1;
}
if this works, hopefully we donot have to make lots of core logic changes and it works with existing queryCondition
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 we r same page 🙌
@@ -55,10 +55,6 @@ func (m MsgCreateGauge) ValidateBasic() error { | |||
return errors.New("distribution period should be 1 epoch for perpetual gauge") | |||
} | |||
|
|||
if lockuptypes.LockQueryType_name[int32(m.DistributeTo.LockQueryType)] != "ByDuration" { |
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.
why was this removed as well?
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.
In CreateGauge for CL pool we don't want to limit just using ByDuration
right? Or lmk if im wrong
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 we add this back and add a clause that if lockTypes are used it has to be "byDuration"?
@@ -220,7 +219,7 @@ func (s *KeeperTestSuite) TestCreateConcentratedLiquidityPoolGauge() { | |||
s.Require().True(gaugeInfo.IsPerpetual) | |||
s.Require().Empty(gaugeInfo.Coins) | |||
s.Require().Equal(s.Ctx.BlockTime(), gaugeInfo.StartTime) | |||
s.Require().Equal(appParams.BaseCoinUnit, gaugeInfo.DistributeTo.Denom) | |||
// s.Require().Equal(appParams.BaseCoinUnit, gaugeInfo.DistributeTo.Denom) |
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.
// s.Require().Equal(appParams.BaseCoinUnit, gaugeInfo.DistributeTo.Denom) | |
s.Require().Equal(appParams.BaseCoinUnit, gaugeInfo.DistributeTo.Denom) |
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.
In CreateGauge
we pass empty queryCondition so I dont think we should check gaugeInfo.DistributeTo.Denom
cause its alway be ""
as I think. If im wrong pls fix me
@@ -8,7 +8,6 @@ import ( | |||
"github.com/stretchr/testify/suite" | |||
|
|||
"github.com/osmosis-labs/osmosis/v16/app/apptesting" | |||
appParams "github.com/osmosis-labs/osmosis/v16/app/params" |
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.
Assuming this was removed accidentally
Hey @stackman27 I updated your last request & got new err about |
hi @hieuvubk thank you so much for all the work you've put into this PR but recently we caught a feature that was lacking with external gauges and decided to work on it in this PR (#5459) while doing so we also fixed this issue. So i believe we can hold this PR on for now and close it when we merge this PR |
|
Closing this as the other PR got merged. Thanks for working on this @hieuvubk |
Closes: #4833
What is the purpose of the change
LockQueryType
enum has an index 0 asByDuration
. So if we passlockuptypes.QueryCondition{}
,distrTo.LockQueryType
will default toByDuration
and enter the loop => I change the indexes for passing the loop.disTo.Denom = ""
when we passlockuptypes.QueryCondition{}
Testing and Verifying
(Please pick one of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)