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

fix: cl spotprice query #5863

Merged
merged 5 commits into from
Aug 2, 2023
Merged

Conversation

doggystylez
Copy link
Contributor

Closes: #XXX

What is the purpose of the change

fixed inconsistency in spot price query for cl pools - the base and quote denoms are being reversed due to the spot price querier providing them in reverse order:

sp, err := q.K.RouteCalculateSpotPrice(ctx, req.PoolId, req.QuoteAssetDenom, req.BaseAssetDenom)

and edited spot price cli command help text to reflect actual behavior of "denom in, denom out"

note - I also noticed that the path for this query doesn't include the v1beta1 version name

rpc SpotPrice(SpotPriceRequest) returns (SpotPriceResponse) {
option (google.api.http).get =
"/osmosis/poolmanager/pools/{pool_id}/prices";

Testing and Verifying

This change modified the spotprice test to swap the args and can be verified as follows:

  • Manually verified the change by ...
  • query spot price for cl pool at <lcd>/osmosis/poolmanager/pools/1066/prices?base_asset_denom=uosmo&quote_asset_denom=ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

@doggystylez
Copy link
Contributor Author

upon futher investigation, this affects and reverse the twap for cl pools also, making this state breaking

@p0mvn p0mvn mentioned this pull request Jul 19, 2023
@p0mvn p0mvn added the V:state/breaking State machine breaking PR label Jul 19, 2023
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

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

I think we should have it along with the twap fix we need to make (by twap fix, I'm referring to the twap record that this change will cause break. We would either need migration or removal of the existing twap record)

@@ -91,7 +91,7 @@ func GetCmdPool() (*osmocli.QueryDescriptor, *queryproto.PoolRequest) {

func GetCmdSpotPrice() (*osmocli.QueryDescriptor, *queryproto.SpotPriceRequest) {
return &osmocli.QueryDescriptor{
Use: "spot-price <pool-ID> [quote-asset-denom] [base-asset-denom]",
Use: "spot-price <pool-ID> [base-asset-denom] [quote-asset-denom]",
Copy link
Member

Choose a reason for hiding this comment

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

note to other reviewers: This changed due to order of proto query client

Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

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

LGTM once changelog entry is added. We should also create a follow-up issue for migrating/deleting existing records as discussed internally (converged on it being okay to do in follow-up PR).

@czarcas7ic czarcas7ic self-assigned this Aug 1, 2023
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

This looks good, appreciate the PR!

@czarcas7ic czarcas7ic merged commit 7331689 into osmosis-labs:main Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants