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

Feat: CLI account-locked-duration #1292

Merged
merged 32 commits into from
Apr 27, 2022
Merged

Conversation

CmpHDL
Copy link
Contributor

@CmpHDL CmpHDL commented Apr 19, 2022

Closes: #756

Description

Adds CLI command to query pool lockups with given duration. The jitter issue outlined in #756 no longer applies due to +2 weeks (longest lockup time) passing since v7 has been out.

Example Usage:

Query account locked records with a specific duration.

Example:
$ osmosisd query lockup account-locked-duration <address> <duration>

Usage:
  osmosisd query lockup account-locked-duration <address> <duration> [flags]

For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@CmpHDL CmpHDL changed the title 7.0.2 t756 Feat: CLI account-locked-duration Apr 19, 2022
@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 19, 2022

This was based off of v7.0.2, I can re-base this off of main if needed.

@ValarDragon
Copy link
Member

Please do rebase the change off of main

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2022

Codecov Report

Merging #1292 (77891d4) into main (f56fbe5) will decrease coverage by 0.07%.
The diff coverage is 3.26%.

@@            Coverage Diff             @@
##             main    #1292      +/-   ##
==========================================
- Coverage   19.82%   19.74%   -0.08%     
==========================================
  Files         202      202              
  Lines       27685    27759      +74     
==========================================
- Hits         5489     5482       -7     
- Misses      21175    21256      +81     
  Partials     1021     1021              
Impacted Files Coverage Δ
x/gamm/pool-models/balancer/amm.go 17.58% <ø> (ø)
x/gamm/pool-models/stableswap/amm.go 43.28% <0.00%> (-12.49%) ⬇️
x/gamm/pool-models/stableswap/pool.go 0.00% <0.00%> (ø)
x/lockup/client/cli/query.go 51.99% <0.00%> (-3.00%) ⬇️
x/lockup/keeper/grpc_query.go 50.40% <0.00%> (-4.47%) ⬇️
x/lockup/keeper/store.go 84.95% <0.00%> (-2.32%) ⬇️
x/lockup/keeper/iterator.go 82.92% <33.33%> (-2.08%) ⬇️
x/gamm/client/cli/tx.go 59.50% <100.00%> (-0.69%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a56fe51...77891d4. Read the comment docs.

@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 19, 2022

@ValarDragon I had rebased off main after that comment starting with commit 93fd8c3, were you wanting to remerge main based on new commits since then? Also I refixed the typo that somehow got reversed during the rebase so a rerun of workflows should satisfy the linter.

rpc AccountLockedDuration(AccountLockedDurationRequest)
returns (AccountLockedDurationResponse) {
option (google.api.http).get =
"/osmosis/lockup/v1beta1/account_locked_duration/{owner}";
Copy link
Contributor

Choose a reason for hiding this comment

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

Since AccountLockedDurationRequest defines the query params, is there a point in having {owner} as part of the resource URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate on this? AccountLockedPastTimeDenom, AccountLockedPastTimeNotUnlockingOnlyRequest, and most of the locked RPC commands have the {owner} within the resource URL, I had assumed it was for the address parameter and maintained practice.

Copy link
Member

Choose a reason for hiding this comment

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

@alexanderbez I'm not very familiar with this RPC library - does it make sense for us to create an issue and remove potentially redundant {owner}?

Copy link
Member

@mattverse mattverse Apr 26, 2022

Choose a reason for hiding this comment

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

These urls are mostly used in front end, but we definitely don't need to have them both in the request url and the request itself. However, I don't know if it's worth changing considering the fact that all the urls and queries in the frontend would have to be updated along as well

proto/osmosis/lockup/query.proto Show resolved Hide resolved
proto/osmosis/lockup/query.proto Show resolved Hide resolved
x/lockup/client/cli/query.go Outdated Show resolved Hide resolved
x/lockup/client/cli/query.go Outdated Show resolved Hide resolved
x/lockup/client/cli/query.go Show resolved Hide resolved
x/lockup/keeper/iterator.go Outdated Show resolved Hide resolved
@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 20, 2022

Thanks for this PR!

I might have misunderstood issue #756, but seems to me that the direction this PR points to vs the original issue mentioned in the issue seems different.

How I understood issue #756 was that we can't query total amount of specific denom that's over specific amount of duration, since the query account-locked-longer-duration-denom returns all lockups separately instead of adding up the what's in individual lockups.

This PR, however seems to have the same problem, seems like it's closer to adding a query to query all denoms instead of specific denom over specified time. (I still think this query is superuseful, just wanted to confirm my understanding on the existing issue and the current PR submitted!)

The ticket changed a little due to jitter no longer being an issue and yes I planned todo the same command but for denoms after this one. Rather than do both of them at once I wanted to see the process etc for making a change and what kinds of feedback you would have, and better understand things as a whole, rather than making the same mistakes twice and having to fix them twice in separate PRs.

tl;dr
Once this goes through I will be making the command you're talking about with denom as an additional parameter, this one was easier so decided to give it a go right before its brother which includes denom.

@mattverse mattverse self-assigned this Apr 23, 2022
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.

Seems that there's linting issues in query.go thats making the checks fail.

LGTM once that's been fixed!

@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 25, 2022

Thanks @mattverse Will get this fixed today, oddly enough it doesn't seem to be related to this ticket.

@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 25, 2022

@mattverse Ended up fixing it now, query.go should pass, looks like a cat had walked along mid commit.

CHANGELOG.md Outdated Show resolved Hide resolved
x/lockup/client/cli/query.go Outdated Show resolved Hide resolved
@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 25, 2022

@alexanderbez I made the changes you requested.

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

Please address the remaining minor comments but otherwise LGTM. Great job!

x/lockup/client/cli/query.go Outdated Show resolved Hide resolved
rpc AccountLockedDuration(AccountLockedDurationRequest)
returns (AccountLockedDurationResponse) {
option (google.api.http).get =
"/osmosis/lockup/v1beta1/account_locked_duration/{owner}";
Copy link
Member

Choose a reason for hiding this comment

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

@alexanderbez I'm not very familiar with this RPC library - does it make sense for us to create an issue and remove potentially redundant {owner}?

x/lockup/keeper/iterator.go Outdated Show resolved Hide resolved
@CmpHDL
Copy link
Contributor Author

CmpHDL commented Apr 26, 2022

@p0mvn Requested changes done.

@CmpHDL CmpHDL requested a review from alexanderbez April 26, 2022 12:21
@czarcas7ic czarcas7ic merged commit ad7d5de into osmosis-labs:main Apr 27, 2022
@github-actions github-actions bot mentioned this pull request Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Querying account's LP shares by lockup duration
7 participants