-
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
fix(ProtoRev): Parameterizing Pool Type Information #5948
Changes from 22 commits
063602c
e2b628e
c9b13cd
a706848
efa68d2
d25d53e
bde5c73
2f314fa
1ede81d
b0c92f3
1c78485
e50b0aa
64a6891
b8e3f1f
41b6e69
da72dd0
8cedc6e
7ef7106
85c64ca
d9ba32a
954269b
6f984fb
a45d681
a252cc1
6aa732e
33424a3
8e4c0e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,23 +73,62 @@ message RouteStatistics { | |
repeated uint64 route = 3 [ (gogoproto.moretags) = "yaml:\"route\"" ]; | ||
} | ||
|
||
// PoolWeights contains the weights of all of the different pool types. This | ||
// distinction is made and necessary because the execution time ranges | ||
// significantly between the different pool types. Each weight roughly | ||
// corresponds to the amount of time (in ms) it takes to execute a swap on that | ||
// pool type. | ||
message PoolWeights { | ||
// InfoByPoolType contains information pertaining to how expensive (in terms of | ||
// gas and time) it is to execute a swap on a given pool type. This distinction | ||
// is made and necessary because the execution time ranges significantly between | ||
// the different pool types. | ||
message InfoByPoolType { | ||
// The stable pool info | ||
StablePoolInfo stable = 1 [ | ||
(gogoproto.moretags) = "yaml:\"stable\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
// The balancer pool info | ||
BalancerPoolInfo balancer = 2 [ | ||
(gogoproto.moretags) = "yaml:\"balancer\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
// The concentrated pool info | ||
ConcentratedPoolInfo concentrated = 3 [ | ||
(gogoproto.moretags) = "yaml:\"concentrated\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
// The cosmwasm pool info | ||
CosmwasmPoolInfo cosmwasm = 4 [ | ||
(gogoproto.moretags) = "yaml:\"cosmwasm\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// StablePoolInfo contains meta data pertaining to a stableswap pool type. | ||
message StablePoolInfo { | ||
// The weight of a stableswap pool | ||
uint64 stable_weight = 1 [ (gogoproto.moretags) = "yaml:\"stable_weight\"" ]; | ||
uint64 weight = 1 [ (gogoproto.moretags) = "yaml:\"weight\"" ]; | ||
} | ||
|
||
// BalancerPoolInfo contains meta data pertaining to a balancer pool type. | ||
message BalancerPoolInfo { | ||
// The weight of a balancer pool | ||
uint64 balancer_weight = 2 | ||
[ (gogoproto.moretags) = "yaml:\"balancer_weight\"" ]; | ||
uint64 weight = 1 [ (gogoproto.moretags) = "yaml:\"weight\"" ]; | ||
} | ||
|
||
// ConcentratedPoolInfo contains meta data pertaining to a concentrated pool | ||
// type. | ||
message ConcentratedPoolInfo { | ||
// The weight of a concentrated pool | ||
uint64 concentrated_weight = 3 | ||
[ (gogoproto.moretags) = "yaml:\"concentrated_weight\"" ]; | ||
// The weight of a cosmwasm pool | ||
uint64 cosmwasm_weight = 4 | ||
[ (gogoproto.moretags) = "yaml:\"cosmwasm_weight\"" ]; | ||
uint64 weight = 1 [ (gogoproto.moretags) = "yaml:\"weight\"" ]; | ||
// The maximum number of ticks we can move when rebalancing | ||
uint64 max_ticks_crossed = 2 | ||
[ (gogoproto.moretags) = "yaml:\"max_ticks_crossed\"" ]; | ||
} | ||
|
||
// CosmwasmPoolInfo contains meta data pertaining to a cosmwasm pool type. | ||
message CosmwasmPoolInfo { | ||
// The weight of a cosmwasm pool (by contract address) | ||
map<string, uint64> weight_map = 1 [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if using a map is problematic for app hashing. We do no iterations on the map itself in the module. The primary use case is determining the number of pool weight of a given cosmwasm pool (which may vary across applications which is why its mapped to contract addresses). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ValarDragon can you verify the safety of this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had instances where we tried to use maps quite a while ago, I think the decision back then was to try avoid using maps for extra safety, would it be possible to change it so tht we use repeated structs instead here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it. ty for confirming |
||
(gogoproto.moretags) = "yaml:\"weight_map\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// BaseDenom represents a single base denom that the module uses for its | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ func NewCmdQuery() *cobra.Command { | |
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryMaxPoolPointsPerBlockCmd) | ||
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryBaseDenomsCmd) | ||
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryEnabledCmd) | ||
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryPoolWeightsCmd) | ||
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryInfoByPoolTypeCmd) | ||
osmocli.AddQueryCmd(cmd, types.NewQueryClient, NewQueryPoolCmd) | ||
|
||
return cmd | ||
|
@@ -141,12 +141,12 @@ func NewQueryEnabledCmd() (*osmocli.QueryDescriptor, *types.QueryGetProtoRevEnab | |
}, &types.QueryGetProtoRevEnabledRequest{} | ||
} | ||
|
||
// NewQueryPoolWeightsCmd returns the command to query the pool weights of protorev | ||
func NewQueryPoolWeightsCmd() (*osmocli.QueryDescriptor, *types.QueryGetProtoRevPoolWeightsRequest) { | ||
// NewQueryInfoByPoolTypeCmd returns the command to query the pool type info of protorev | ||
func NewQueryInfoByPoolTypeCmd() (*osmocli.QueryDescriptor, *types.QueryGetProtoRevInfoByPoolTypeRequest) { | ||
return &osmocli.QueryDescriptor{ | ||
Use: "pool-weights", | ||
Short: "Query the pool weights used to determine how computationally expensive a route is", | ||
}, &types.QueryGetProtoRevPoolWeightsRequest{} | ||
Use: "info-by-pool-type", | ||
Short: "Query the pool info used to determine how computationally expensive a route is", | ||
Comment on lines
+147
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume there is an input right? I think this should be "info-by-pool-type [pool-type]" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea the input is the json file with all of the correct pool info. This isnt used to update by a single pool type (although once the dependencies on a given pool type grow it might be worth migrating to separate message handlers). I'll update the PR with the json example I used in testing. |
||
}, &types.QueryGetProtoRevInfoByPoolTypeRequest{} | ||
} | ||
|
||
// NewQueryPoolCmd returns the command to query the pool id for a given denom pair stored via the highest liquidity method in ProtoRev | ||
|
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.
If we are renaming the proto field, we should depreciate this field and add a new one
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.
(Or reserve!)
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.
Just to clarify, add a note that this is deprecated and adding a new field?
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.
Added back the previous field with a note that it is being deprecated.